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

Status
Not open for further replies.

Mirzaaur

Member level 2
Joined
Aug 5, 2005
Messages
50
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,286
Activity points
1,690
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;



best regards,
mirza
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…