0% found this document useful (0 votes)
148 views2 pages

Full Adder Test Bench and VHDL Code

This document contains code for a full adder logic circuit and its test bench. The full adder code defines an entity with inputs a, b, cin and outputs sum, cout. The architecture describes the logic for computing sum and cout. The test bench code applies all possible input combinations to the full adder circuit over time and monitors the outputs.

Uploaded by

AVINASH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views2 pages

Full Adder Test Bench and VHDL Code

This document contains code for a full adder logic circuit and its test bench. The full adder code defines an entity with inputs a, b, cin and outputs sum, cout. The architecture describes the logic for computing sum and cout. The test bench code applies all possible input combinations to the full adder circuit over time and monitors the outputs.

Uploaded by

AVINASH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

********************************************************************************

***********
full_Adder code for rtl simulation
********************************************************************************
***********
entity full_adder is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
cin : in STD_LOGIC;
cout : out STD_LOGIC;
sum : out STD_LOGIC);
end full_adder;
architecture Behavioral of full_adder is
begin
sum <= a xor b xor cin;
cout <= ( a and b) or (b and cin) or (cin and a);
end Behavioral;
********************************************************************************
***********
test bench code for full adder
********************************************************************************
***********
-- Stimulus process
stim_proc: process
begin
wait for 100 ns;
a <= '0';
b <= '0';
cin <= '0';
wait for 100 ns;
a <= '0';
b <= '0';
cin <= '1';
wait for 100 ns;
a <= '0';
b <= '1';
cin <= '0';
wait for 100 ns;
a <= '0';
b <= '1';
cin <= '1';
wait for 100 ns;

a <= '1';
b <= '0';
cin <= '0';
wait for 100 ns;
a <= '1';
b <= '0';
cin <= '1';
wait for 100 ns;
a <= '1';
b <= '1';
cin <= '0';
wait for 100 ns;
a <= '1';
b <= '1';
cin <= '1';
wait for 100 ns;
wait;
end process;

You might also like