hex notation

A

Andreas H?lscher

Hi,
I have code like this:

cs_reg <= '1' when Adr = conv_std_logic_vector(21,8) else '0';

To get my code more readable I want to use hexadecimal numbers for the
address. I tried to replace the 21 with 0x15, 15h, x"15" but nothing
works.

Any hint?

Thanks,
Andreas
 
M

Matt North

Andreas H?lscher said:
Hi,
I have code like this:

cs_reg <= '1' when Adr = conv_std_logic_vector(21,8) else '0';

To get my code more readable I want to use hexadecimal numbers for the
address. I tried to replace the 21 with 0x15, 15h, x"15" but nothing
works.

Any hint?

Thanks,
Andreas

X"15" does work but the target type has to be of bit_vector.

------------------------------------
signal Adr: bit_vector(7 downto 0);

cs_reg<='1' when Adr=X"15" else '0';
------------------------------------

The conversion function to_bitvector is found in the package std_logic_1164
and converts type std_logic_vector and std_ulogic_vector.

Matt
 
E

Egbert Molenkamp

X"15" does work but the target type has to be of bit_vector.

------------------------------------
signal Adr: bit_vector(7 downto 0);

cs_reg<='1' when Adr=X"15" else '0';
------------------------------------
In VHDL'87 "Adr" should be a bit_vector.
Since VHDL-1993 this is replaced such that it is only required that an
element of the vector at least contains the character literals '0' and '1'.
So bit_vector is still valid, but also std_logic_vector, std_ulogic_vector,
unsigned,...

Egbert Molenkamp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top