Implementation-of-Full-Adder-and-Full-subtractor-circuit
AIM:
To design a Full Adder and Full Subtractor circuit and verify its truth table in Quartus using Verilog programming.
Equipments Required:
Hardware – PCs, Cyclone II , USB flasher
Software – Quartus prime
Full Adder and Full Subtractor
Full Adder
Full adder is a digital circuit used to calculate the sum of three binary bits. It consists of three inputs and two outputs. Two of the input variables, denoted by A and B, represent the two significant bits to be added. The third input, Cin, represents the carry from the previous lower significant position. Two outputs are necessary because the arithmetic sum of three binary digits ranges in value from 0 to 3, and binary 2 or 3 needs two digits. The two outputs are sum and carry.
Sum =A’B’Cin + A’BCin’ + ABCin + AB’Cin’ = A ⊕ B ⊕ Cin
Carry = AB + ACin + BCin
Figure -1 FULL ADDER
Full Subtractor
A full subtractor is a combinational circuit that performs subtraction involving three bits, namely minuend, subtrahend, and borrow-in . It accepts three inputs: minuend, subtrahend and a borrow bit and it produces two outputs: difference and borrow.
Diff = A ⊕ B ⊕ Bin
Borrow out = A'Bin + A'B + BBin
Truthtable
Procedure
Write the detailed procedure here
Program:
/* Program to design a half subtractor and full subtractor circuit and verify its truth table in quartus using Verilog programming.
Developed by: HAMZA FAROOQUE
RegisterNumber: 212223040054 */
FULL_ADDER
module full_adder(a,b,cin,sum,carry);
input a,b,cin;
output sum,carry;
wire w1,w2,w3,w4;
xor(w1,a,b);
xor(sum,w1,cin);
and(w2,a,b);
and(w3,b,cin);
and(w4,cin,a);
or(carry,w2,w3,w4);
endmodule
FULL_SUBTRACTER
module full_subtracter(a,b,Bin,BO,DIFF);
input a,b,Bin;
output BO,DIFF;
assign DIFF = a ^ b ^ Bin;
assign BO = (a & b) | ((a ^ b) & Bin);
endmodule
RTL Schematic
Full_adder
![full_adder circuit dia](https://private-user-images.githubusercontent.com/147473768/313712557-5371de9d-9d9d-4c53-943c-18efc64b94fc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxNzY0MDQsIm5iZiI6MTcyMjE3NjEwNCwicGF0aCI6Ii8xNDc0NzM3NjgvMzEzNzEyNTU3LTUzNzFkZTlkLTlkOWQtNGM1My05NDNjLTE4ZWZjNjRiOTRmYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyOFQxNDE1MDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kOGQ0YWVlYjg5ZGE0YzA2NTAwMGJiYzg3MjM0MzIyOGQxZjI1OGQwNWRjYTczODhmNTJiZDVjM2U5MTJjMzJmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.5ARFVOWoyGZwDH5zkAyJixbDeHojTQQ_LvAQu43-2-4)
Full_subtracter
![full_subtracter circuit dia](https://private-user-images.githubusercontent.com/147473768/313712624-6d6be52a-5b94-4543-b328-61f9e54a7066.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxNzY0MDQsIm5iZiI6MTcyMjE3NjEwNCwicGF0aCI6Ii8xNDc0NzM3NjgvMzEzNzEyNjI0LTZkNmJlNTJhLTViOTQtNDU0My1iMzI4LTYxZjllNTRhNzA2Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyOFQxNDE1MDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mNTAwYTZmNmMyNDkxN2U0YTg2NGZmODFkY2Y5NGI0ODU1NDM5NDdiODQ0MGE2ZjhjNTI1OWYzNjI2ZmMwYTZiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9._dCtW1HqUcPg3_utAULsRV-gA5-IFGaNw28ccgKWGPA)
Output Timing Waveform
Result:
Thus the Full Adder and Full Subtractor circuits are designed and the truth tables is verified using Quartus software.