Simple Type conversion

G

Gerry

Guest
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
 
Gerry wrote:

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,

--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266
 
"Gerry" <Gerry@hotmail.com> wrote in message news:foa1e7$ur4$1@aioe.org...
Hi

snip
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
 

Welcome to EDABoard.com

Sponsor

Back
Top