0% found this document useful (0 votes)
30 views23 pages

ADVLSI2

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

ADVLSI2

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

Advance VLSI Assignment

Chapter 1

Carry Skip Adder

Abstract

The Carry-Skip Adder (CSA) is a parallel adder that improves the performance of binary
addition by reducing the delay associated with carry propagation. In this implementation, the
carry skip adder logic is coded using Verilog, which is a hardware description language used
to model digital systems.

The module takes two 4-bit binary inputs, performs bitwise operations, and produces a 4-bit
sum along with a carry-out signal. The key components of this adder include generate and
propagate signals, which enable optimized carry generation and skipping. The carry signals
are calculated step by step, with the carry skipping mechanism ensuring faster computation
for large bit-width inputs.

A testbench is provided to verify the functionality of the adder, simulating different input
combinations to assess the correctness of the sum and carry-out values. This design is
validated using the Xilinx simulation environment to evaluate its performance and behavior.
The adder is efficient in terms of speed and resource usage, making it ideal for use in high-
speed arithmetic circuits such as digital signal processors and cryptographic systems.

Page | 1
Advance VLSI Assignment

Introduction:

The Carry-Skip Adder (CSA) is a type of fast adder used in digital systems for performing
binary addition. In conventional adders, such as ripple-carry adders, the carry signal from
each bit is propagated sequentially to the next bit, which introduces significant delay,
especially as the number of bits increases. The Carry-Skip Adder overcomes this limitation
by allowing certain carry signals to skip over groups of bits when no carry propagation is
needed, improving the overall speed of the addition operation.

The Carry-Skip Adder works by dividing the binary numbers into groups of bits, where each
group has its own generate (g) and propagate (p) signals. If a group generates a carry, it is
propagated immediately; otherwise, the carry skips over the group. This significantly reduces
the time required for carry propagation, making the CSA a preferred choice in high-speed
computing applications.

Verilog is widely used in digital design due to its ability to model both combinational and
sequential circuits efficiently. In this project, the Carry-Skip Adder is implemented in
Verilog, with 4-bit inputs and a 4-bit output. The adder's behavior is thoroughly tested using a
testbench that simulates various input scenarios. The Verilog code for the Carry-Skip Adder
is designed to be modular, allowing for easy scaling to larger bit-width adders while
maintaining high performance.

Page | 2
Advance VLSI Assignment

Objectives:

Extension to Larger Bit-Widths: Although this implementation focuses on a 4-bit adder, the
The primary objective of this project is to design and implement a 4-bit Carry-Skip Adder in
Verilog and validate its functionality through a testbench. The specific goals of the project
are:

1. Design of the Carry-Skip Adder in Verilog: The first goal is to implement the Carry-
Skip Adder in Verilog, ensuring that the generate and propagate signals are correctly
computed and the carry-out signal is appropriately handled.

2. Optimization for Speed: By implementing the carry-skip mechanism, the aim is to


reduce the delay associated with carry propagation in the addition operation,
providing a faster alternative to traditional adders.

3. Testing and Verification: A testbench will be developed to verify the correctness of


the CSA by applying different input combinations and observing the resulting sum
and carry-out. The design should be tested for edge cases such as all bits being 1 or 0,
as well as typical use cases.

4. Performance Evaluation: The performance of the Carry-Skip Adder will be evaluated


using design should be modular enough to be scaled for larger bit-widths without
significant modification, showcasing the scalability of the Carry-Skip Adder design.

5. Use of Xilinx Software for Implementation: The design will be implemented using
Xilinx FPGA tools, which provide a platform for simulating and synthesizing
hardware designs. This will allow for real-world validation of the adder's performance
on FPGA hardware.

Page | 3
Advance VLSI Assignment

Verilog Code:

assign p = a ^ b; // Propagate = a XOR b

assign c1 = g[0]; // c1 = g[0] (carry out from bit 0)


assign c2 = g[1] | (p[1] & c1); // c2 = g[1] or (p[1] and c1)
assign c3 = g[2] | (p[2] & c2); // c3 = g[2] or (p[2] and c2)
assign cout = g[3] | (p[3] & c3); // Final carry out module cskip(a, b, sum, cout);
input [3:0] a;
input [3:0] b; // Carry signals

output [3:0] sum;


output cout;

wire [3:0] g; // Generate signals


wire [3:0] p; // Propagate signals
wire c1, c2, c3; // Carry signals
wire skip; // Skip signal

// Generate and propagate signals


assign g = a & b; // Generate = a AND b

// Final sum calculation


assign sum = p ^ {c3, c2, c1, 1'b0}; // XOR propagate with carry
endmodule

Page | 4
Advance VLSI Assignment

Test bench:

module cskipa_v;

// Inputs
reg [3:0] a;
reg [3:0] b;

// Outputs
wire [3:0] sum;
wire cout;

// Instantiate the Unit Under Test


(UUT) cskip uut (
.a(a),
.b(b),
.sum(sum),
.cout(cout)
);

initial begin

$display("Time\t| a\t| b\t| sum\t| cout");


$monitor("%g\t| %b\t| %b\t| %b\t| %b", $time, a, b, sum, cout);

// Test Case 1 (cout = 1)


a = 4'b0111; // 7
b = 4'b1001; // 9
#10;

Page | 5
Advance VLSI Assignment

// Test Case 2 (cout = 0)


a = 4'b0010; // 2
b = 4'b0011; // 3
#10;

// Test Case 3 (cout = 1)


a = 4'b1100; // 12
b = 4'b0101; // 5
#10;

// Test Case 4 (cout = 0)


a = 4'b0001; // 1
b = 4'b0001; // 1
#10;

end
endmodule

Page | 6
Advance VLSI Assignment

Xilinx Software Overview:

Xilinx is a leading provider of FPGA (Field-Programmable Gate Array) and CPLD (Complex
Programmable Logic Device) solutions. Their software suite, including Vivado and ISE,
provides designers with tools for synthesizing, simulating, and implementing digital systems
on Xilinx hardware platforms. Vivado, the modern toolset, supports high-level design
abstraction with a rich set of features, including RTL (Register Transfer Level) synthesis,
high- level synthesis (HLS), and IP (Intellectual Property) cores.

Vivado is particularly powerful for designing FPGA-based systems, offering a graphical user
interface and a command-line interface for efficient design entry. It also supports Verilog and
VHDL coding, which are widely used for hardware design. Vivado includes features for
simulating and verifying the design using integrated simulation tools, ensuring that the
behavior of the design matches the intended functionality before hardware deployment.

In this project, Xilinx software is used to simulate the Carry-Skip Adder implementation.
Vivado allows for rapid testing and debugging, providing insight into timing issues, signal
propagation, and logic synthesis. With Xilinx software, the design can be synthesized into a
bitstream that can be loaded onto an FPGA for hardware validation. This environment
supports high-performance simulation, providing accurate feedback on timing, logic errors,
and overall system performance.

By using Xilinx tools, designers can optimize their designs for specific FPGA hardware,
taking advantage of parallelism, pipelining, and other techniques to improve speed and
efficiency. The ability to verify designs through simulation and implement them directly on
FPGA hardware makes Xilinx a powerful tool for hardware designers, ensuring that complex
digital systems can be implemented and tested with high precision and reliability.

Page | 7
Advance VLSI Assignment

Result:

Page | 8
Advance VLSI Assignment

Chapter 2

Carry save adder

Abstract

A Carry Save Adder (CSA) is a specialized digital circuit designed for fast addition of three
or more binary numbers. Unlike traditional adders, the CSA avoids carry propagation during
intermediate stages, significantly improving speed. The design splits addition into multiple
stages by computing partial sums and carry bits simultaneously. This project implements a 4-
bit CSA using Verilog HDL and verifies its functionality through simulation in Xilinx
Vivado software. The CSA's efficiency and performance are demonstrated and compared
with conventional adders.

Introduction

Addition of multiple binary numbers is a frequent operation in digital systems, especially in


multipliers and arithmetic units. Traditional adders like Ripple Carry Adders or Carry Look-
Ahead Adders can become inefficient when dealing with more than two operands due to carry
propagation delays. The Carry Save Adder resolves this issue by calculating partial sums and
carries without propagating the carry immediately. The final result is computed by a final
addition stage, making the CSA highly efficient for multi-operand addition.

Objective

The primary objectives of this project are:

1. To design a 4-bit Carry Save Adder using Verilog HDL.

2. To simulate and verify the functionality of the CSA using Xilinx Vivado.

3. To analyze the advantages of the CSA in terms of speed and area efficiency.

Page | 9
Advance VLSI Assignment

4. To demonstrate its suitability for applications like multiplication and multi-


operand addition.

Software Used

The following tools were utilized for the implementation and verification of the CSA:

1. Xilinx Vivado: A versatile FPGA design tool for Verilog coding, simulation,
and synthesis.

2. Verilog HDL: A hardware description language for designing and modeling the
Carry Save Adder.

Page | 10
Advance VLSI Assignment

Verilog Code:

module fulladder
( input a,b,cin,
output sum,carry
);

assign sum = a ^ b ^ cin;


assign carry = (a & b) | (cin & b) | (a & cin);

endmodule
CSA.v
module CSA
( input [3:0] x,y,z,
output [4:0] s,
output cout
);

wire [3:0] c1,s1,c2;

fulladder fa_inst10(x[0],y[0],z[0],s1[0],c1[0]);
fulladder fa_inst11(x[1],y[1],z[1],s1[1],c1[1]);
fulladder fa_inst12(x[2],y[2],z[2],s1[2],c1[2]);
fulladder fa_inst13(x[3],y[3],z[3],s1[3],c1[3]);

Page | 11
Advance VLSI Assignment

fulladder fa_inst20(s1[1],c1[0],1'b0,s[1],c2[1]);
fulladder fa_inst21(s1[2],c1[1],c2[1],s[2],c2[2]);
fulladder fa_inst22(s1[3],c1[2],c2[2],s[3],c2[3]);
fulladder fa_inst23(1'b0,c1[3],c2[3],s[4],cout);

assign s[0] = s1[0];

endmodule

Page | 12
Advance VLSI Assignment

Test Bench:

tb_adder.v

module tb_adder;

reg [3:0] x,y,z;


wire [4:0] s;
wire cout;
integer i,j,k,error;

// Instantiate the Unit Under Test


(UUT) CSA uut (x,y,z,s,cout);

//Stimulus block - all the input combinations are tested here.


//the number of errors are recorded in the signal named "error".
initial begin
// Initialize Inputs
x = 0;
y = 0;
z = 0;
error = 0;
//three for loops to test all input combinations.
for(i=0;i<16;i=i+1) begin
for(j=0;j<16;j=j+1) begin
for(k=0;k<16;k=k+1) begin

Page | 13
Advance VLSI Assignment

x = i;
y = j;
z = k;
#10;
if({cout,s} != (i+j+k))
error <= error + 1;
end
end
end
end

endmodule

Page | 14
Advance VLSI Assignment

Result:

Page | 15
Advance VLSI Assignment

Chapter 3

Carry Select Adder

Abstract

The Carry Select Adder (CSA) is a high-speed adder architecture that reduces the delay
associated with carry propagation in traditional adders. By performing additions for two
possible carry inputs (carry = 0 and carry = 1) simultaneously, the CSA achieves faster
computation. This project involves designing a 4-bit Carry Select Adder using Verilog HDL
and verifying its functionality through simulation in Xilinx Vivado. The implementation
showcases the efficiency of CSA in high-speed arithmetic operations.

Introduction

Addition is a critical operation in digital systems, and the performance of an adder directly
influences the overall speed of a processor or an arithmetic unit. Ripple Carry Adders and
Carry Look-Ahead Adders, while useful, still face delays in certain scenarios. The Carry
Select Adder improves upon these designs by reducing the dependency on carry propagation.
It achieves this by precomputing sums for both possible carry-in values and selecting the
appropriate result based on the actual carry-in, making it highly suitable for high-speed
applications.

Objective:

The primary objectives of this project are:

1. To design a 4-bit Carry Select Adder using Verilog HDL.

2. To simulate and verify its functionality in Xilinx Vivado.

3. To analyze the efficiency of the CSA compared to traditional adders.

4. To demonstrate how parallelism in carry computation reduces delay in arithmetic

Page | 16
Advance VLSI Assignment
circuits.

Software Used

The design, simulation, and verification of the Carry Select Adder were conducted using the
following tools:

1. Xilinx Vivado: A powerful FPGA design suite used for HDL coding, simulation, and
synthesis.

2. Verilog HDL: The hardware description language used for modeling the CSA and its
testbench.

Page | 17
Advance VLSI Assignment

Verilog Code:

fulladder.v

module fulladder
( input a,b,cin,
output sum,carry
);

assign sum = a ^ b ^ cin;


assign carry = (a & b) | (cin & b) | (a & cin);

endmodule

multiplexer2.v

module multiplexer2
( input i0,i1,sel,
output reg bitout
);

always@(i0,i1,sel)
begin
if(sel == 0)
bitout = i0;
else
bitout = i1;
end

Page | 18
Advance VLSI Assignment

endmodule

carry_select_adder
module carry_select_adder
( input [3:0] A,B,
input cin,
output [3:0] S,
output cout
);

wire [3:0] temp0,temp1,carry0,carry1;

//for carry 0
fulladder fa00(A[0],B[0],1'b0,temp0[0],carry0[0]);
fulladder fa01(A[1],B[1],carry0[0],temp0[1],carry0[1]);
fulladder fa02(A[2],B[2],carry0[1],temp0[2],carry0[2]);
fulladder fa03(A[3],B[3],carry0[2],temp0[3],carry0[3]);

//for carry 1
fulladder fa10(A[0],B[0],1'b1,temp1[0],carry1[0]);
fulladder fa11(A[1],B[1],carry1[0],temp1[1],carry1[1]);
fulladder fa12(A[2],B[2],carry1[1],temp1[2],carry1[2]);
fulladder fa13(A[3],B[3],carry1[2],temp1[3],carry1[3]);

//mux for carry


multiplexer2 mux_carry(carry0[3],carry1[3],cin,cout);
//mux's for sum
multiplexer2 mux_sum0(temp0[0],temp1[0],cin,S[0]);

Page | 19
Advance VLSI Assignment

multiplexer2 mux_sum1(temp0[1],temp1[1],cin,S[1]);
multiplexer2 mux_sum2(temp0[2],temp1[2],cin,S[2]);
multiplexer2 mux_sum3(temp0[3],temp1[3],cin,S[3]);

endmodule

TEST BENCH CODE:


module tb_adder;

// Inputs
reg [3:0] A;
reg [3:0] B;
reg cin;
// Outputs
wire [3:0] S;
wire cout;
integer i,j,error;

// Instantiate the Unit Under Test


(UUT) carry_select_adder uut (
.A(A),
.B(B),
.cin(cin),
.S(S),
.cout(cout)
);

//Stimulus block - all the input combinations are tested here.


//the number of errors are recorded in the signal named "error".

Page | 20
Advance VLSI Assignment

initial begin
// Initialize Inputs
A = 0;
B = 0;
error = 0;
//for carry in =0
cin = 0;
for(i=0;i<16;i=i+1) begin
for(j=0;j<16;j=j+1) begin
A =
iB =
j;
#10;
if({cout,S} != (i+j))
error <= error + 1;
end
end
//for carry in =1
cin = 1;
for(i=0;i<16;i=i+1) begin
for(j=0;j<16;j=j+1) begin
A = i;
B = j;
#10;

Page | 21
Advance VLSI Assignment

if({cout,S} != (i+j+1))
error <= error + 1;
end
end
end
endmodule

Result :

Page | 22
Advance VLSI Assignment

Page | 23

You might also like