Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17235 Обсуждение

How to read bits from input in VHDL?

Altera_Forum
Почетный участник II
3 779Просмотр.

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 баллов
4 Ответы
Altera_Forum
Почетный участник II
2 798Просмотр.

you can access any bits in A: 

 

if A(3 downto 0) = B then 

--etc
Altera_Forum
Почетный участник II
2 798Просмотр.

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.
Altera_Forum
Почетный участник II
2 798Просмотр.

assuming A is declared something like: 

A : in std_logic_vector(7 downto 0); 

 

op <= A(3);
Altera_Forum
Почетный участник II
2 798Просмотр.

thank Tricky! this helped so much. :)

Ответить