Forum Discussion
Altera_Forum
Honored Contributor
12 years agoto add an input of 33 bits in an integrator but output 32 bits follow this code:
signal sum : std_logic_vector(32 downto 0) := (others => '0');
process(clk,reset_n)
begin
if reset_n = '0' then
sum <= (others => '0');
elsif clk'event and clk = '1' then
sum <= std_logic_vector(signed(din) + signed(sum));
end if;
end process ;
dout <= sum(31 downto 0); bit index 31 is assumed dead apparently due to zero insertions so becomes sign bit.