Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17235 Discussions

How to read bits from input in VHDL?

Altera_Forum
Honored Contributor II
3,777 Views

Hi guys.. 

Can anyone tell me how to read bits from a signal? Let's say I have 16 bits input signal and it's called signal A. How do I read the first 4 bits of the input signal and compare it with signal B which is also 4 bits? Is this possible?  

Thanks.
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
2,796 Views

you can access any bits in A: 

 

if A(3 downto 0) = B then 

--etc
0 Kudos
Altera_Forum
Honored Contributor II
2,796 Views

Thanks Tricky. It worked. =) 

But how about if I want to read only 1 bit? Say, there's 01010101 and I want to read the 4th bit. 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
2,796 Views

assuming A is declared something like: 

A : in std_logic_vector(7 downto 0); 

 

op <= A(3);
0 Kudos
Altera_Forum
Honored Contributor II
2,796 Views

thank Tricky! this helped so much. :)

0 Kudos
Reply