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

Reply

VHDL - HEX to STD_LOGIC_VECTOR

 
Thread Tools Search this Thread
Old 05-09-2005, 03:25 PM   #1
Default HEX to STD_LOGIC_VECTOR


Hi,

I am trying to simulate the following in Modelsim:


use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;

signal t_wraddress : std_logic_vector(14 downto 0);

begin
....

-- Instead of writing t_wraddress <= ("00010" & "0000100010");
-- or t_wraddress <= "000100000100010";
-- I want
-- some shorter expressions like

t_wraddress(14 downto 10) <= to_stdlogicvector(x"02");
t_wraddress(9 downto 0) <= to_stdlogicvector(x"22");


But I get the warning:
# Ambiguous parameter type to function 'to_stdlogicvector'.
# Expression is illegal VHDL-1993 but legal VHDL-1987.

So how can I change that ?

I tried to find some answers in different posts but...

Thank you for your help.

Rgds
André



ALuPin@web.de
  Reply With Quote
Old 05-09-2005, 09:54 PM   #2
Niv
 
Posts: n/a
Default Re: HEX to STD_LOGIC_VECTOR
-- Instead of writing t_wraddress <= ("00010" & "0000100010");
-- or t_wraddress <= "000100000100010";
-- I want
-- some shorter expressions like

t_wraddress(14 downto 10) <= to_stdlogicvector(x"02");
t_wraddress(9 downto 0) <= to_stdlogicvector(x"22");

X"AB03" is a legal 16 bit std_logic_vector.
You're trying to assign X"22", an 8 bit vector to a 10 bit vector.
You shouldn't need the conversion function.

Try something like t_wradress(9 downto 0) <= "00" & X"22"; -- If you want
10 bit assignment

Regards, Niv.




Niv
  Reply With Quote
Old 06-06-2005, 03:11 AM   #3
Son Tran
 
Posts: n/a
Default Re: HEX to STD_LOGIC_VECTOR
Try this. It should work.
Split your address into two parts: 3-bit part + 12-bit part
In 12-bit part you can easily assign a hex number, keep binary the rest.

Then
t_wraddress <= "000100000100010";

is the same as

t_wraddress <= "000" & x"822";

Good luck
stt


<> wrote in message
news: oups.com...
Hi,

I am trying to simulate the following in Modelsim:


use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;

signal t_wraddress : std_logic_vector(14 downto 0);

begin
....

-- Instead of writing t_wraddress <= ("00010" & "0000100010");
-- or t_wraddress <= "000100000100010";
-- I want
-- some shorter expressions like

t_wraddress(14 downto 10) <= to_stdlogicvector(x"02");
t_wraddress(9 downto 0) <= to_stdlogicvector(x"22");


But I get the warning:
# Ambiguous parameter type to function 'to_stdlogicvector'.
# Expression is illegal VHDL-1993 but legal VHDL-1987.

So how can I change that ?

I tried to find some answers in different posts but...

Thank you for your help.

Rgds
André




Son Tran
  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




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