-- add4pg.vhdl entity and architecture -- for 4 bits of a propegate-generate, pg, adder library IEEE; use IEEE.std_logic_1164.all; entity add4pg is port(a : in std_logic_vector(3 downto 0); b : in std_logic_vector(3 downto 0); cin : in std_logic; sum : out std_logic_vector(3 downto 0); p : out std_logic; g : out std_logic ); end entity add4pg ; architecture circuits of add4pg is signal c : std_logic_vector(2 downto 0); begin -- circuits of add4pg sum(0) <= a(0) xor b(0) xor cin after 2 ps; c(0) <= (a(0) and b(0)) or (a(0) and cin) or (b(0) and cin) after 2 ps; sum(1) <= a(1) xor b(1) xor c(0) after 2 ps; c(1) <= (a(1) and b(1)) or (a(1) and a(0) and b(0)) or (a(1) and a(0) and cin) or (a(1) and b(0) and cin) or (b(1) and a(0) and b(0)) or (b(1) and a(0) and cin) or (b(1) and b(0) and cin) after 2 ps; sum(2) <= a(2) xor b(2) xor c(1) after 2 ps; c(2) <= (a(2) and b(2)) or (a(2) and c(1)) or (b(2) and c(1)) after 2 ps; sum(3) <= a(3) xor b(3) xor c(2) after 2 ps; p <= (a(0) or b(0)) and (a(1) or b(1)) and (a(2) or b(2)) and (a(3) or b(3)) after 2 ps; g <= (a(3) and b(3)) or ((a(3) or b(3)) and ((a(2) and b(2)) or ((a(2) or b(2)) and ((a(1) and b(1)) or ((a(1) or b(1)) and ((a(0) and b(0)))))))) after 2 ps; end architecture circuits; -- of add4pg