Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Operator & on VHDL

Im not sure about how this operator works.

For example if i had:

signal vector_a : std_logic_vector(4 downto 0) :=(others => '0');

vector_a <= vector_a(3 downto 0) & '1';

Would the result be "0 0 0 0 1" or "1 0 0 0 0" ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In case of using 3 to 0 instead of 3 downto 0, would the result change?

>Solution :

"&" is the concatenate operator, and concatenates items from left to right.

So in your example, the result in vector_a would be 0 0 0 0 1

Using a different range would make no difference, the result would still be 0 0 0 0 1 when printed left to right. But it would affect the indexed values.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading