Professional Documents
Culture Documents
EXPERIMENT 3
4-bit Full Adder
AKKALA VIKAS
EVD18I004
AIM :
1. Design and implement a 4-bit Full adder using Gate-level,
Dataflow and Behavioral styles of coding.
2. Write a test bench to verify your designs for all the modes of
function.
3. Perform Behavioral simulation, Synthesis, Implementation and
Bit-stream generation for each of the styles.
4. Report the schematics for all three, obtained after RTL analysis,
Synthesis and Implementation.
5. Generate and compare Hardware utilization and Power reports
for the designs. Find which style of coding is more efficient
overall and support your conclusion with a clear comparison table.
Apparatus : Xilinx Vivado
Theory:
● N bit parallel Adder works in different stages
● Each full adder takes the carry-in as input and produces
carry-out and sum bit as output.
● The carry-out produced by a full adder serves as carry-in for
its adjacent most significant full adder.
● When carry-in becomes available to the full adder, it activates
the full adder.
● After full adder becomes activated, it comes into operation
Code:
4 bit Full adder(Behavioural):
`timescale 1ns / 1ps
module fourbitfulladder_b(a,b,c_in,sum,c_out);
input [3:0]a,b;
input c_in;
output reg [3:0]sum;
output reg c_out;
always @ (a or b or c_in)
{c_out,sum}= a + b + c_in;
endmodule
input [3:0]a;
input [3:0]b;
input c_in;
output [3:0]sum;
output c_out;
wire [2:0]w1;
endmodule
input [3:0]a;
input [3:0]b;
input c_in;
output [3:0]sum;
output c_out;
wire [2:0]w1;
endmodule
Testbench:
`timescale 1ns / 1ps
module tb();
reg [3:0]a;
reg [3:0]b;
reg c_in;
wire [3:0]sum_b;
wire c_out_b;
wire [3:0]sum_d;
wire c_out_d;
wire [3:0]sum_s;
wire c_out_s;
integer i,j;
fourbitfulladder_b cut1(a,b,c_in,sum_b,c_out_b);
fourbitfulladder_d cut2(a,b,c_in,sum_d,c_out_d);
fourbitfulladder_s cut3(a,b,c_in,sum_s,c_out_s);
initial
begin
a= 0;b=0;c_in=0;
for(i=0;i <=15;i = i+1)
for(j=0;j <=15;j = j+1)
begin
c_in <=0;
a <= i;
b <= j;
#1;
c_in <=1;
#1;
end
$finish;
end
endmodule
Simulation:
Simulation
Rtl schematic:
Behavioural:
Synthesized schematic
Package and device layout
Structural:
Synthesized schematic
Package and device layout
Dataflow:
Synthesized schematic
Package and device layout
I/0 Ports:
I/o ports
Implementation:
Power report:
Behavioural
Structural
Dataflow
Behavioural modeling
Structural modeling
Dataflow modeling
Bitstream generation:
Bitstream
Observations:
● In this case of a 4 bit full adder we see that the behavioral
model has least number of lines in code and has the best
readability than that of gate level and data flow model
● Simulation Outputs from each style are observed and
compared
● The Register transfer level schematic of the behavioral
model is much smaller in area than of the structural and
dataflow ,the schematic of structural and data flow are
similar
● All the models here have used similar number of Lut’s
● Since there are similar number of hardware entities the
power consumption is also similar in all the three cases
● For this kind of a circuit the three modeling styles are
equally efficient
Conclusions:
We have implemented 4-bit full adder using behavioral ,structural and data
flow modeling styles and observed the simulation results using behavioral
simulation
We have also synthesized,implemented and generated the bitstreams in each
style and observed the power and utilization reports
Applications:
● Adders are used as a part of many large circuits
● Some commonly used adders are ripple carry adder,carry look ahead
adder,carry save adder
● Are used in AlU’s
● Used in Multipliers for addition purpose