Forum Discussion
Altera_Forum
Honored Contributor
9 years agoThat sounds like a crazy idea. Why are you converting a 6 bit bus into a 12 bit bus (2 bits is required to cover 1 and -1) AND the original 6 bit data. Im guessing you're trying to find the number of 1s compared to number of 0s?
anyway you can easily do it.
type int_array_t is array(5 downto 0) of integer range -1 to 1;
signal my_ar : int_array_t;
...
for i in my_ar'range loop
if input(i) = '0' then
my_ar(i) = -1;
elsif input(i) = '1' then
my_ar(i) = 1;
else --cover illegal states in simulation
my_ar(i) = 0;
end if;
end loop;