convert std_logic_vector to unsigned ???

K

khiltrop

I need to convert a std_logic_vector into an unsigned, and I am surprised
that this seems not to work.

signal a : std_logic_vector ( 5 downto 0 );
signal b : unsigned ( 5 downto 0 );

I tried:

b <= a;
b <= to_unsigned ( a, 6 );
b <= conv_unsigned ( a, 6 );

with used libs (several combinations commented in or out):
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all; --do not use both ???
--use ieee.numeric_bit.all;
use ieee.numeric_std.all;
--use ieee.std_logic_unsigned.all;

all with Xilinx web pack 6.2.03i.
Syntax check claims in different ways, usually ...can not have such
operands in this context.

What am I doing wrong?

Klaus

BTW conversion from unsigned to std_logic_vector works.
 
N

newman5382

How about

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
----
--<snip>
----
signal a : std_logic_vector ( 5 downto 0 );
signal b : unsigned ( 5 downto 0 );

b <= unsigned(a);

-Newman
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top