here is a generic code of a cascade full adder.
the problem is that the result of the fulladder appears with one event delay(I mean that when I change inputs1 & inputs2 the result of the previous inputs appears). I know that if I write the code without a process this delay wouldn't occur but I need to write a generic fulladder and there is no way to write a generic code without a process and a for loop.
so I'm asking if anyone could help me to fix the code so that the output would show the results with no delay!!!
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
entity adders is
generic(
numberOfInputs : Integer := 4
); port(
enable : in std_logic;
cin : in std_logic;
inputs1 : in std_logic_vector(numberOfInputs-1 downto 0);
inputs2 : in std_logic_vector(numberOfInputs-1 downto 0);
outputs : out std_logic_vector(numberOfInputs downto 0)
);
end entity adders;
architecture Generic_Adder of adders is
signal Couts:std_logic_vector(numberOfInputs downto 0);
signal temp1:std_logic_vector(numberOfInputs-1 downto 0);
signal temp2:std_logic_vector(numberOfInputs-1 downto 0);
signal temp3:std_logic_vector(numberOfInputs-1 downto 0);
begin
temp2<=inputs1;
temp3<=inputs2;
couts(0)<= cin;
Sum:process(temp2,temp3,cin,enable,Couts) is
begin
for count in 0 to numberOfInputs-1 loop
temp1(count) <= (temp2(count) xor temp3(count));
outputs(count) <= Couts(count) xor temp1(count);
Couts(count+1) <= (temp2(count) and temp3(count)) or(couts(count) and temp1(count));--cout(count) is the previuos cout becuase the first cout is cin
end loop;
end process;
outputs(numberOfInputs) <= Couts(numberOfInputs);
end Generic_Adder;