Simple Type conversion

G

Gerry

Hi

The following simple code:

variable ulut_index_tmp : unsigned(3 downto 0);

ulut_index_tmp := ulut_alu3(0) & ulut_alu2(0) & ulut_alu1(0) & ulut_alu0(0);

ulut_tmp_dst0(0) := ulut_tmp_lut0(unsigned(ulut_index_tmp(3 downto 0), 4));

So in the variable ulut_index_tmp i concatenate 4 bits, and with this
for bits I wanna look up 1 bit in the 16 bit value ulut_tmp_lut0.
However, when I do it this way, then it tells me:

Type error in variable ulut_index_tmp. Needed type natural.

But when I say natural instead of unsigned it tells me illegal
conversion. Anyone an idea how to convert this so that this works?

Should also be sythesizable

Thanks1
 
M

Mark McDougall

Gerry said:
But when I say natural instead of unsigned it tells me illegal
conversion. Anyone an idea how to convert this so that this works?

Convert to integer instead...

Regards,
 
K

KJ

Gerry said:
ulut_tmp_dst0(0) := ulut_tmp_lut0(unsigned(ulut_index_tmp(3 downto 0),
4));
Corrected versions:
1. ulut_tmp_dst0(0) := ulut_tmp_lut0(to_integer(ulut_index_tmp(3 downto
0)));
2. ulut_tmp_dst0(0) := ulut_tmp_lut0(to_integer(ulut_index_tmp));

Kevin Jennings
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top