Synthesis erron for "bit'val" attribute....plz chek

D

Dunce by face...

hi all i am using this function to convetr integer to bitvector and
Synplify gives error

pack.vhd(25): type bit needs a syn_enum_encoding attribute of
"sequential" @E:"c:\synthesis\one\pack.vhd":25:22:25:29

code is here:- please have a look
-------------------------------------------------------------------
PACKAGE convert is
function int_to_bv(int : in integer) return bit_vector;
END convert;
PACKAGE BODY convert is

function int_to_bv(int : in integer) return bit_vector is
variable temp : integer;
variable result : bit_vector(0 to 8-1);

begin
if int < 0 then
temp := -(int+1);
else
temp := int;
end if;
for index in result'reverse_range loop
result(index) := bit'val(temp rem 2);
temp := temp / 2;
end loop;
if int < 0 then
result := not result;
result(result'left) := '1';
end if;
return result;
end int_to_bv;
end convert;
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top