You are on page 1of 2

ntity ffr is generic (n:integer:=4); Port ( a : in STD_LOGIC_vector((n-1) downto 0 ); b : in STD_LOGIC_vector((n-1) downto 0 ); s : out STD_LOGIC_vector((n-1) downto 0 ); cin : in STD_LOGIC; cout

: out STD_LOGIC); end ffr;

architecture Behavioral of ffr is signal c: std_logic_vector((n) downto 0 ); begin c(0)<=cin; g1: for i in 0 to(n-1)generate s(i)<=a(i)xor b(i)xor c(i); c(i+1)<=(a(i) and b(i)) or (c(i) and b(i)) or (a(i) and c(i)); end generate; cout<=c(n); end Behavioral;

Parallel adder:-

You might also like