Tuesday, 27 August 2013

vhdl program for full adder using behavioral modelling

---------------------------------------------------------------------------------------------------
--
-- Title       : full_adder
-- Design      : full_adder
-- Author      : rajashekar
-- Company     : kits
--
---------------------------------------------------------------------------------------------------
--
-- File        : full_adder.vhd
-- Generated   : Tue Jun 18 16:48:04 2013
-- From        : interface description file
-- By          : Itf2Vhdl ver. 1.20
--
---------------------------------------------------------------------------------------------------
--                                                                                     y
-- Description :
--
---------------------------------------------------------------------------------------------------

--{{ Section below this comment is automatically maintained
--   and may be overwritten
--{entity {and1} architecture {and1}}

library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity full_adder is
     port(
         a   : in STD_LOGIC;
         b   : in STD_LOGIC;
         cin : in STD_LOGIC    ;
         sum : out STD_LOGIC;
         cout: out STD_LOGIC
         );
end full_adder;

--}} End of automatically maintained section

architecture full_adder_beh of full_adder is
begin
    process(a,b,cin)
    begin
        if(a='0')then
        elsif(b='0' and cin='0')then   
            sum<='0';cout<='0';
        elsif((b='0' and c='1') or (b='1' and c='0'))then
            sum<='1';cout<='0';
        elsif(b='1' and c='1')then
            sum<='0';cout<='1';
        end if;
       
           
            if(a='1')then
        elsif(b='0' and cin='0')then   
            sum<='1';cout<='0';
        elsif((b='0' and c='1') or (b='1' and c='0'))then
            sum<='0';cout<='1';
        elsif(b='1' and c<='1')then
            sum<='0';cout<='1';
           
        end if;
       
        end process;
       
           
           

    -- enter your statements here --      
   

end full_adder_beh;

No comments:

Post a Comment