An Introduction to Verilog: Transitioning from VHDL Tutorial 1.
Verilog VHDL code Parallel adder
-
Upload
bharti-airtel-ltd -
Category
Engineering
-
view
1.535 -
download
11
Transcript of Verilog VHDL code Parallel adder
![Page 1: Verilog VHDL code Parallel adder](https://reader030.fdocuments.in/reader030/viewer/2022013123/58e7b28e1a28ab65578b4ab5/html5/thumbnails/1.jpg)
EXPERIMENT 5NAME: SHYAMVEER SINGHRoll No: B-54REG No:11205816AIM: Implementation of parallel adder using half adder and full adder.APPARETUS: Xillin 9.2i
THEORY : Parallel adder use to parallel addition of the binary bits using any addition process like half adder or full adder.Addition will start from LSB and till MSB and if there any carry generated than we will store it in a new variable.
TRUTH TABLE:a 1 0 1 1
b 1 1 0 1
sum 1 0 0 0
cin 1 1 1 1
cout 1 VERILOG CODE:
module pashyam(a,b,sum,cout);input [3:0] a,b;output [3:0] sum;output cout;wire c0,c1,c2;halfadd f1(a[0],b[0],sum[0],c0);fa f2(a[1],b[1],c0,sum[1],c1);fa f3(a[2],b[2],c1,sum[2],c2);fa f4(a[3],b[3],c2,sum[3],cout);
![Page 2: Verilog VHDL code Parallel adder](https://reader030.fdocuments.in/reader030/viewer/2022013123/58e7b28e1a28ab65578b4ab5/html5/thumbnails/2.jpg)
endmodulemodule fa(a,b,c,sum,carry);input a,b,c;output sum,carry;assign sum=(a^b^c);assign carry=(a&b)|(b&c)|(c&a);
endmodulemodule halfadd(a,b,sum,carry);input a,b;output sum,carry;assign sum=((~a)&b)|(a&(~b));assign carry=a&b;
endmodule
RTL Simulation:
![Page 3: Verilog VHDL code Parallel adder](https://reader030.fdocuments.in/reader030/viewer/2022013123/58e7b28e1a28ab65578b4ab5/html5/thumbnails/3.jpg)
OUTPUT WAVE FORM:
![Page 4: Verilog VHDL code Parallel adder](https://reader030.fdocuments.in/reader030/viewer/2022013123/58e7b28e1a28ab65578b4ab5/html5/thumbnails/4.jpg)