VHDL Digital Full ADDER Logic Using NAND Gate Program
VHDL Digital Full ADDER Logic Using NAND Gate Program
VHDL program for Full Adder behavioral design in Xilinx integrated software environment-------------------------------------------------------------------------------- Company:Techno Global - Balurghat
-- Engineer:Mr. Jitaditya Mondal
-- Create Date:20:36:38 03/28/12
-- Design Name:Full Adder Design
-- Module Name:FullAdder1 - Behavioral
-- Project Name:VHDL Program for "Full Adder" in XILINX Integrated Software Environment
-- Target Device:XC2S15
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
----------------------------------------------------------------------------------- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
-------------------------------------------------------------------------------entity FullAdder1 is
Port ( X : in std_logic;
Y : in std_logic;
CIN : in std_logic;
SUM : out std_logic;
CARRY : out std_logic);
end FullAdder1;
architecture Behavioral of FullAdder1 is
begin
Process (X,Y,CIN)
begin
SUM <= X XOR Y XOR CIN;
CARRY<=(X AND Y) OR (X AND CIN) OR (Y AND CIN);
end process;
end Behavioral;
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
------------------------------------------------------------------------------------ Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
---------------------------------------------------------------------------------entity FullAdder2 is
Port ( X : in std_logic;
Y : in std_logic;
CIN : in std_logic;
SUM : out std_logic;
CARRY : out std_logic);
end FullAdder2;
architecture Structure of FullAdder2 is
component NAND2
Port ( L : in std_logic;
M : in std_logic;
N : out std_logic);
end component;
signal T1, T2, T3, T4, T5, T6, T7: std_logic;
begin
N1 : NAND2 Port map(X,Y,T1);
N2 : NAND2 Port map(X,T1,T2);
N3 : NAND2 Port map(Y,T1,T3);
N4 : NAND2 Port map(T2,T3,T4);
N5 : NAND2 Port map(T4,T5,T6);
N6 : NAND2 Port map(T4,T5,T6);
N7 : NAND2 Port map(T6,T7,T7);
N8 : NAND2 Port map(T6,T7,SUM);
N9 : NAND2 Port map(T1,T5,CARRY);
end Structure;
-- Project Name:VHDL Program for "Half Adder" in XILINX Integrated Software Environment
-- Target Device:XC2S15
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
------------------------------------------------------------------------------------ Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
---------------------------------------------------------------------------------entity HalfAdder2 is
Port ( X : in std_logic;
Y : in std_logic;
SUM : out std_logic;
CARRY: out std_logic);
end HalfAdder2;
architecture HalfAdder2_arch of HalfAdder2 is
begin
process(X,Y)
begin
if(X/=Y) then
SUM<='1';
else
SUM<='0';
end if;
end process;
process(X,Y)
begin
if((X='1') and (Y='1')) then
CARRY<='1';
else
CARRY<='0';
end if;
end process;
end HalfAdder2_arch;
--compile the above vhdl codes then compile the below vhdl code
--Fulladder using half adders
library ieee;
use ieee.std_logic_1164.all;
use work.all;
entity fa is
port(a,b,cin:in bit;
sum,cout:out bit);
end fa;
architecture struct_fa of fa is
component ha
port(a,b:in bit;
sum,carry:out bit);
end component;
component or2
port(a,b:in bit;
y:out bit);
end component;
signal x,y,z:bit;
begin
ha1: ha port map (a,b,x,y);
ha2: ha port map (x,cin,sum,z);
or1: or2 port map (z,y,cout);
end struct_fa
VHDL program for Half Substructure architectural design in Xilinx integrated software environment-------------------------------------------------------------------------------- Company:Techno Global - Balurghat
-- Engineer:Mr. Jitaditya Mondal
-- Create Date:20:36:38 03/28/12
-- Design Name: Half Substructure Design
-- Module Name: HalfSub1 - Architectural
-- Project Name:VHDL Program for " Half Substructure " in XILINX Integrated Software Environment
-- Target Device:XC2S15
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
------------------------------------------------------------------------------------ Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
---------------------------------------------------------------------------------entity HalfSub1 is
Port ( X : in std_logic;
Y : in std_logic;
SUB : out std_logic;
BORROW : out std_logic);
end HalfSub1;
architecture HalfSub1_arch of HalfSub1 is
begin
process(X,Y)
begin
if(X=Y) then
SUB<='0';
end if;
if((X='1') and (Y='0')) then
SUB<='1';
else
BORROW<='1';
end if;
end process;
end HalfSub1_arch;
OUT0 <= R OR T OR V OR X OR Z;
OUT1 <= S OR T OR W OR X;
OUT2 <= U OR V OR W OR X;
OUT3 <= Y OR Z;
end process;
end Behavioral;
Posted by Jitditya Mondal at 05:31
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
----------------------------------------------------------------------------------- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
-------------------------------------------------------------------------------entity DFLIPFLOP3 is
Port ( DATAIN : in std_logic;
CLOCK : in std_logic;
DATAOUT : out std_logic);
end DFLIPFLOP3;
architecture Behavioral of DFLIPFLOP3 is
begin
process (DATAIN, CLOCK)
begin
if (CLOCK = '1' and CLOCK'event) then
DATAOUT <= DATAIN;
end if;
end process;
end Behavioral;
VHDL program for D Flip Flop With Clock and Reset Design Behavioral design in Xilinx integrated
software environment--------------------------------------------------------------------------------- Company:Techno Global - Balurghat
-- Engineer:Mr. Jitaditya Mondal
-- Create Date: 19:08:41 04/01/12
-- Design Name: D FlipFlop with Clock and Reset Design
-- Module Name: DFLIPFLOP4 - Behavioral
-- Project Name:VHDL Program for "D FlipFlop with Clock and Reset Design" in XILINX Integrated Software
Environment
-- Target Device:XC2S15
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
----------------------------------------------------------------------------------- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
--------------------------------------------------------------------------------
entity DFLIPFLOP4 is
Port ( D : in std_logic;
CLOCK : in std_logic;
RESET : in std_logic;
Q : out std_logic);
end DFLIPFLOP4;
architecture Behavioral of DFLIPFLOP4 is
begin
process (CLOCK)
begin
if (CLOCK'event and CLOCK='1')then
if RESET ='0' then
Q <= '0';
else
Q <= D;
end if;
end if;
end process;
end Behavioral;
VHDL program for T Flip Flop Design Behavioral design in Xilinx integrated software environment--------------------------------------------------------------------------------- Company:Techno Global - Balurghat
-- Engineer:Mr. Jitaditya Mondal
-- Create Date: 12:00:24 04/02/12
-- Design Name: T FlipFlop Design
-- Module Name: TFF2 - Behavioral
-- Project Name:VHDL Program for "T FlipFlop Design" in XILINX Integrated Software Environment
-- Target Device:XC2S15
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
----------------------------------------------------------------------------------- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
-------------------------------------------------------------------------------entity TFF2 is
Port ( T : in std_logic;
CLOCK : in std_logic;
Q : inout std_logic;
QN : out std_logic);
end TFF2;
architecture Behavioral of TFF2 is
begin
process(CLOCK)
begin
if (CLOCK = '0' and CLOCK'event) then
Q <= (T AND (NOT Q)) OR ((NOT T) AND Q) after 10ns;
end if;
QN <= NOT Q;
end process;
end Behavioral;
Q <= NOT Q;
QN <= NOT QN;
end if;
end if;
end process;
end Behavioral;
VHDL program for JK Flip Flop Design Behavioral design in Xilinx integrated software environment--------------------------------------------------------------------------------- Company:Techno Global - Balurghat
-- Engineer:Mr. Jitaditya Mondal
-- Create Date: 19:08:41 04/01/12
-- Design Name: JK FlipFlop Design
-- Module Name: JKFF2 - Behavioral
-- Project Name:VHDL Program for "JK FlipFlop Design" in XILINX Integrated Software Environment
-- Target Device:XC2S15
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
----------------------------------------------------------------------------------- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
-------------------------------------------------------------------------------entity JKFF2 is
Port ( SN : in std_logic;
RN : in std_logic;
J : in std_logic;
K : in std_logic;
CLK : in std_logic;
Q : inout std_logic;
QN : out std_logic);
end JKFF2;
architecture Behavioral of JKFF2 is
begin
process(SN,RN,CLK)
begin
if RN='0' then
Q <= '0';
elsif SN='0' then
Q <= '1';
elsif CLK='0' and CLK'event then
case (input) is
when"11" =>
state <= not state;
when"10" =>
state <= '1';
when"01" =>
state <= '0';
when others =>
null;
end case;
end if;
end process;
end Behavioral;
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
------------------------------------------------------------------------------------ Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
--------------------------------------------------------------------------------entity XOR2 is
Port ( X : in std_logic;
Y : in std_logic;
F : out std_logic);
end XOR2;
architecture XOR2_arch of XOR2 is
begin
process(X,Y)
begin
if(X/=Y) then
F<='1';
else
F<='0';
end if;
end process;
end XOR2_arch;
-- Project Name:VHDL Program for "Universal Logic Gates" in XILINX Integrated Software Environment
-- Target Device:XC2S15
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
------------------------------------------------------------------------------------ Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
---------------------------------------------------------------------------------entity XNOR2 is
Port ( X : in std_logic;
Y : in std_logic;
F : out std_logic);
end XNOR2;
architecture XNOR2_arch of XNOR2 is
begin
process(X,Y)
begin
if(X/=Y) then
F<='0';
else
F<='1';
end if;
end process;
end XNOR2_arch;
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
------------------------------------------------------------------------------------ Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
---------------------------------------------------------------------------------entity NOR2 is
Port ( X : in std_logic;
Y : in std_logic;
F : out std_logic);
end NOR2;
architecture NOR2_arch of NOR2 is
begin
process(X,Y)
begin
if((X='0') and (Y='0')) then
F<='1';
else
F<='0';
end if;
end process;
end NOR2_arch;
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
------------------------------------------------------------------------------------ Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
---------------------------------------------------------------------------------entity NAND2 is
Port ( X : in std_logic;
Y : in std_logic;
F : out std_logic);
end NAND2;
architecture NAND2_arch of NAND2 is
begin
process(X,Y)
begin
if((X='1') and (Y='1')) then
F<='0';
else
F<='1';
end if;
end process;
end NAND2_arch;
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
----------------------------------------------------------------------------------- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
-------------------------------------------------------------------------------entity OR2 is
Port ( X : in std_logic;
Y : in std_logic;
F : out std_logic);
end OR2;
architecture OR2_arch of OR2 is
begin
process(X,Y)
begin
if((X='0') and (Y='0')) then
F<='0';
else
F<='1';
end if;
end process;
end OR2_arch;
-- Tool versions:XST(VHDL/Verilog)
-- Revision 0.01 - File Created
-- Additional Comments:
-------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---------------------------------------------------------------------------------- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
------------------------------------------------------------------------------entity AND2 is
Port ( X : in std_logic;
Y : in std_logic;
F : out std_logic);
end AND2;
architecture AND2_arch of AND2 is
begin
process(X,Y)
begin
if((X='1') and (Y='1')) then
F<='1';
else
F<='0';
end if;
end process;
end AND2_arch;