Experiment:2: ABC C S
Experiment:2: ABC C S
AIM:- Write an HDL code for full adder circuit and implement on FPGA/CPLD chip.
EDA Tool:- Project Navigator 6.1i, Modelsim SE 5.5c, Xilinx CPLD –XC9572fpc84
THEORY:-
A digital system consists of two types of circuits namely
1) Combinational logic circuit
2) Sequential logic circuit
In a combinational circuit, the output at any time depends only on the input values at that
time.In a sequential circuit, the output at anytime depends on the present input values as
well as the past output values.
A full adder is a combinational circuit which performs the arithmetic sum of three input
bits and produces 2 outputs sum and carry. From the truth table one can understand that
binary variable s gives the value of LSB of sum and Cout gives the output carry.
Inputs Outputs
A B Cin Cout S
0 0 0 0 0
1 0 0 0 1
0 1 0 0 1
1 1 0 1 0
0 0 1 0 1
1 0 1 1 0
0 1 1 1 0
1 1 1 1 1
VHDL CODE:-
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity fullader is
Port ( a : in std_logic;
b : in std_logic;
c : in std_logic;
s : out std_logic;
cr : out std_logic);
end fullader;
begin
process ( a,b,c)
begin
s<= a xor b xor c ;
cr <= (a and b ) or ( b and c) or (c and a);
end process ;
end behavioral;
RESULT:- The truth table for full adder is verified on simulator and HDL code being
implemented on CPLD successfully.