Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - hex notation

 
Thread Tools Search this Thread
Old 12-10-2003, 11:38 AM   #1
Default hex notation


Hi,
I have code like this:

cs_reg <= '1' when Adr = conv_std_logic_vector(21, 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


Andreas H?lscher
  Reply With Quote
Old 12-10-2003, 12:04 PM   #2
Matt North
 
Posts: n/a
Default Re: hex notation
"Andreas H?lscher" <> wrote in message
news: om...
> Hi,
> I have code like this:
>
> cs_reg <= '1' when Adr = conv_std_logic_vector(21, 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




Matt North
  Reply With Quote
Old 12-10-2003, 12:56 PM   #3
Egbert Molenkamp
 
Posts: n/a
Default Re: hex notation

> 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




Egbert Molenkamp
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Asymptotic Notation Tacky Software 0 10-02-2006 02:52 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46