wiki:AdderVbe
-- Additionneur 4 bits avec report entrant et sortant

ENTITY  adder4 IS
  PORT (
    x           : IN  BIT_VECTOR(3 DOWNTO 0);
    y           : IN  BIT_VECTOR(3 DOWNTO 0);
    q           : OUT BIT_VECTOR(3 DOWNTO 0);
    cin         : IN  BIT;
    cout        : OUT BIT;
    vdd         : IN  BIT;
    vss         : IN  BIT
    );
END  adder4;

ARCHITECTURE vbe OF adder4 IS

  SIGNAL carry : BIT_VECTOR(4 DOWNTO 0) ;

BEGIN

carry(0) <= cin;
carry(4 DOWNTO 1) <=  ( x(3 DOWNTO 0)    AND y(3 DOWNTO 0) )    OR
                      ( x(3 DOWNTO 0)    AND carry(3 DOWNTO 0) ) OR
                      ( carry(3 DOWNTO 0) AND y(3 DOWNTO 0) )  ;
q(3 DOWNTO 0)     <= x(3 DOWNTO 0)  XOR 
                     y (3 DOWNTO 0) XOR 
                     carry(3 DOWNTO 0) ;
cout    <= carry(4);

END;
Last modified 18 years ago Last modified on Apr 8, 2007, 1:28:42 PM