FA Wave
FA Wave
FA Wave
Ans.
VHDL CODE
library ieee;
use ieee.std_logic_1164.all;
entity FA is
port(a,b,cin:in std_logic;
sum,carry: out std_logic);
end FA;
architecture FA_SM of FA is
component xor3
port(a1,b1,c1:in std_logic;
o1:out std_logic);
end component;
component and2
port(a2,b2:in std_logic;
o2:out std_logic);
end component;
component or3
port(a3,b3,c3:in std_logic;
o3:out std_logic);
end component;
signal t1,t2,t3:std_logic;
begin
U1:xor3 port map(a,b,cin,sum);
U2:and2 port map(a,b,t1);
U3:and2 port map(b,cin,t2);
U4:and2 port map(a,cin,t3);
U5:or3 port map(t1,t2,t3,carry);
end FA_SM;
--Here 3- input XOR gate, 2-input AND gate and 3-input OR gate are used as a
component.
--COMPONENT USED:
-------------
--xor3
-------------
library ieee;
use ieee.std_logic_1164.all;
entity xor3 is
port(a1,b1,c1:in std_logic;
o1:out std_logic);
end xor3;
entity and2 is
port(a2,b2:in std_logic;
o2:out std_logic);
end and2;
-------------------------
-- or3
--------------------------
library ieee;
use ieee.std_logic_1164.all;
entity or3 is
port(a3,b3,c3:in std_logic;
o3:out std_logic);
end or3;
WAVE FORM
Try Yourself:
Que:1 Write the code for Full Adder Using Half Adder as a component.
Que:2 Write the the code for Full Adder for given structure.