Hardaddsoft
Hardaddsoft
EX.NO:1
DATE:23/11/2022
Aim:
To design an adder circuit which adds length of any bits using minimal components
using Behavioural Modelling.
Design:
For a 2 bit-adder
Let A = A1A0 be the first two bits number
A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Carry(Cout) = AC+BC+AB
BLOCK DIAGRAM:
Each Full adder contains:
PIN DIAGRAMS
EX – OR GATE – IC 7486
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity adder is
port(a,b:in std_logic_vector(1 downto 0);
sum:out std_logic_vector(1 downto 0);
carry:out std_logic);
end adder;
architecture Behavioral of adder is
begin
sum(0)<=a(0) xor b(0);
sum(1)<=a(1) XOR b(1) XOR (a(0) and b(0));
carry<=((a(0) and b(0))and(a(1) XOR b(1)))or(a(1) and b(1));
end Behavioral;
OUTPUT:
Result:
Thus to program to design a 2-bit adder circuit is executed and the output is verified.