15EC302J Vlsi Lab Students PDF
15EC302J Vlsi Lab Students PDF
15EC302J Vlsi Lab Students PDF
REGISTER NO :
NAME :
YEAR/SEM/SEC :
1. Course plan
4 Design of Memory-RAM & ROM, Finite State Machine, Barrel Shifter 7,8
5 Switch Level modeling of CMOS gates and Boolean expression 9
6 CMOS Logic gate and Dynamic Circuits using HSPICE 10,11
INDEX
9
Lab Experiment #1
Design of Combinational Logic Circuits
1.1 Objective: To learn the design of combinational logic circuits in Verilog then
simulating and synthesizing using EDA tools
1.List the types of design methodologies for digital design with an example?
2. Give the difference between module and module instance.
3. What are built in gate primitivies?
4. Give the use of net, reg and wire data types.
5. Declare the following variables in Verilog:
a. An 8-bit vector net called a_in.
b. An integer called count.
c. An array called delays. Array contains 20 elements of the type integer.
d. A parameter cache_size equal to 512.
Full adder:
1
Ripple Carry Adder
output s;
output cout;
input x;
input y;
assign s=x^y;
assign cout=x&y;
endmodule
// TEST BENCH
module half_adder_tb_v;
// Inputs
// reg x; regy;
// Outputs
initial begin
// Initialize Inputs
x = 0; y = 0;
// Wait 100 ns for global reset to
finish #100; x=0; y=1;
end
endmodul
e
output sum;
output carry;
input x;
input y;
input cin;
wire w1,w2,w3;
Half_adder h1(w1,w2,x,y);
Half_adder h2(sum,w3,w1,cin);
or g1(carry,w2,w3);
endmodule
// TEST BENCH
module full_adder_tb_v;
// Inputs
// Outputs
end
endmodul
e
output [3:0]S;
output cout;
input [3:0]A;
input [3:0]B;
input cin;
wire c1,c2,c3;
full_adder f1(S[0],c1,A[0],B[0],cin);
full_adder f2(S[1],c2,A[1],B[1],c1);
full_adder f3(S[2],c3,A[2],B[2],c2);
full_adder f4(S[3],cout,A[3],B[3],c3);
endmodule
// TEST BENCH
module ripple_carry_adder_tb_v;
// Inputs
// Outputs
// Initialize Inputs A
= 0; B = 0; cin = 0;
end
endmodule
Waveforms – Problem 1
2 x 1 Multiplexer
0 I0
1 I1
6
4 x 1 Multiplexer
0 0 I0
0 1 I1
1 0 I2 8 x 1 Multiplexer
1 1 I3
Select Signal Output
(Y)
S2 S1 S0
0 0 0 I0
0 0 1 I1
0 1 0 I2
0 1 1 I3
1 0 0 I4
1 0 1 I5
1 1 0 I6
1 1 1 I7
output out;
input A;
input B;
input s;
7
assign out=(s)?A:B;
endmodule
// TEST BENCH
module mux2_1_tb_v;
// Inputs
// Output
s wire out;
initial begin
// Initialize Inputs
A = 0; B = 0; s = 0;
end
endmodul
e
input [3:0]I;
input [1:0]s;
always@(I,s)
begin
case(s)
8
2'b00:out=I[0];
2'b01:out=I[1];
2'b10:out=I[2];
2'b11:out=I[3];
endcase
end
endmodule
// TEST BENCH
module mux4_1_tb_v;
// Inputs
// Output
s wire out;
// Initialize Inputs
end
endmodul
e
2.MUX 8 X 1 USING 4 X 1 MUX AND 2 X 1 MUX
output out;
wire [1:0]w;
endmodule
// TEST BENCH
module mux8_1_tb_v;
// Inputs
// Output
s wire out;
// Initialize
Inputs s = 0; i = 0;
s=3'b100; i=8'b00010000;
#100; s=3'b101; i=8'b00100000;
end
endmodule
Waveforms – Problem 2
2.1 Objective: To learn the design of sequential circuits in Verilog then simulating
and synthesizing using EDA tools
2.2 Software tools Requirement
Equipments:
Computer with Xilinx and Modelsim Software Specifications:
HP Computer P4 Processor – 2.8 GHz, 2GB RAM, 160 GB Hard Disk
Softwares: Synthesis tool: Xilinx ISE.
Simulation tool: ModelSim Simulator
2.3 Prelab Questions
(write pre lab Q & A in an A4 sheet)
output q;
input s;
input r;
input clk;
input clr;
reg q;
initial
q=0;
begin
if(clr==1)
q=0;
else if(s==0&&r==0)
q=q;
else if(s==1&&r==0)
q=s;
else if(s==0&&r==1)
q=0;
else
q=1'bz;
end
endmodul
e
// TEST BENCH
module srfflop_v;
// Inputs
// Output
s wire q;
// Initialize Inputs
s = 0; r = 0; clk = 0; clr = 0;
#100 s=0;r=0;clk=1;clr=0;
#100 s=0;r=1;clk=0;clr=0;
#100 s=0;r=1;clk=1;clr=0;
#100 s=1;r=0;clk=0;clr=0;
#100 s=1;r=0;clk=1;clr=0;
#100 s=1;r=1;clk=0;clr=0;
#100 s=1;r=1;clk=1;clr=0;
end
endmodule
output q;
input clk;
input clr;
input j;
input k;
reg q;
initial
q=0;
always@(negedge clk)
begin
case({j,k})
2'b00: q=q;
2'b01: q=0;
2'b10: q=1;
2'b11: q=~q;
endcase
end
endmodule
// TEST BENCH
module jkff_tb_v;
// Inputs
// Output
s wire q;
// Initialize Inputs
#100; clr=0;
end
always
#50 clk=~clk;
endmodule
output q;
input clk;
input clr;
input t;
reg q;
initial
q=0;
always@(negedge clk)
begin
case({clr,t})
2'b00: q=q;
2'b10: q=0;
2'b01: q=~q;
endcase
end
endmodule
// TEST BENCH
module tffcase_tb_v;
// Inputs
// Output
s wire q;
// Initialize Inputs
clk = 0; clr = 1; t = 0;
end
always
#50 clk=~clk;
endmodule
Waveforms – Problem 1
module ripple_counter_4_bit(q,clk,reset);
input clk,reset;
output[3:0]q;
T_FF tff0(q[0],clk,reset);
T_FF tff1(q[1],q[0],reset);
T_FF tff2(q[2],q[1],reset);
T_FF tff3(q[3],q[2],reset);
endmodule
// TEST BENCH
module ripple_counter_4_bit_tb_v;
// Inputs
// Outputs
wire [3:0] q;
// Instantiate the Unit Under Test (UUT)
ripple_counter_4_bit uut
(.q(q),.clr(clr),.clk(clk));
initial begin
// Initialize Inputs
clr = 1; clk = 1;
#100; clr=0;
end
always
#50 clk=~clk;
endmodule
input clr;
input clk;
input mod;
always@(posedge clk)
begin
case({clr,mod})
2'b11 : q=0;
2'b10 : q=0;
2'b01 : q=q+1;
2'b00 : q=q-1;
endcase
end
endmodule
// TEST BENCH
module updowncntr_tb_v;
// Inputs
// Outputs
wire [3:0] q;
// Initialize Inputs
#1000; mod=0;
end
always
#50 clk=~clk;
endmodule
Waveforms – Problem 2
Write a Verilog HDL Code to implement a SISO and PIPO shift registers.
2.6 Result:
Thus the design of sequential circuits is simulated in Verilog and synthesized using EDA tools.
Lab Experiment #3
Design of VLSI Adder and multiplier
3.1 Objective: To learn the design of combinational logic circuits in Verilog then
simulating and synthesizing using EDA tools
module CLA_4bmod(sum,c_4,a,b,c_0);
input [3:0]a,b;
input c_0;
output [3:0]sum;
output c_4;
wire p0,p1,p2,p3,g0,g1,g2,g3;
wire c1,c2,c3,c4;
assign
p0=a[0]^b[0],
p1=a[1]^b[1],
p2=a[2]^b[2],
p3=a[3]^b[3],
g0=a[0]&b[0],
g1=a[1]&b[1],
g2=a[2]&b[2],
g3=a[3]&b[3];
assign
c1=g0|(p0&c_0),
c2=g1|(p1&g0)|(p1&p0&c_0),
c3=g2|(p2&g1)|(p2&p1&g0)|(p2&p1&p0&c_0),
c4=g3|(p3&g2)|(p3&p2&p1&g1)|(p3&p2&p1&g0)|(p3&p2&p1&p0&c_0);
assign
sum[0]=p0^c_0,
sum[1]=p1^c1,
sum[2]=p2^c2,
sum[3]=p3^c3,
c_4=c4;
endmodule
3.4.2 Design the bruan array multiplier and Wallace tree multiplier.
Logic Diagram – Problem 2
4 bit Multiplier
Verilog Code - Problem 2
module braun_mul(a,b,p);
input [3:0]a,b;
output[7:0]p;
wire[32:1]w;
and g1(p[0],a[0],b[0]);
and g2(w[1],a[1],b[0]);
and g3(w[2],a[2],b[0]);
and g4(w[3],a[3],b[0]);
and g5(w[4],a[0],b[1]);
and g6(w[5],a[1],b[1]);
and g7(w[6],a[2],b[1]);
and g8(w[7],a[3],b[1]);
and g9(w[8],a[0],b[2]);
and g10(w[9],a[1],b[2]);
and g11(w[10],a[2],b[2]);
and g12(w[11],a[3],b[2]);
and g13(w[12],a[0],b[3]);
and g14(w[13],a[1],b[3]);
and g15(w[14],a[2],b[3]);
and g16(w[15],a[3],b[3]);
fadd f1(p[1],w[16],w[1],w[4],1'b0);
fadd f2(w[32],w[17],w[5],w[2],1'b0);
fadd f3(w[31],w[18],w[3],w[6],1'b0);
fadd f4(p[2],w[19],w[8],w[32],w[16]);
fadd f5(w[30],w[20],w[31],w[9],w[17]);
fadd f6(w[29],w[21],w[7],w[10],w[18]);
fadd f7(p[3],w[22],w[30],w[12],w[19]);
fadd f8(w[26],w[23],w[29],w[13],w[20]);
fadd f9(w[25],w[24],w[11],w[14],w[21]);;
fadd f10(p[4],w[27],w[26],1'b0,w[22]);
fadd f11(p[5],w[28],w[25],w[27],w[23]);
fadd f12(p[6],p[7],w[15],w[28],w[24]);
endmodule
full adder:
module fadd(sum,carry,a,b,c);
input a,b,c;
output sum,carry;
assign sum = a^b^c;
assign carry = (a&b)|(b&c)|(c&a);
endmodule
F i r s s
ta
e
g
H A H A
S e c o F A F s
ta
e
g
A F A F A
F i n a a
d
r
e
z7 z6 z5 z4 z3 z2 z1 z0
module wallace_tb_v;
reg [3:0] A; reg [3:0] B;
wire [7:0] prod;
wallace uut (
.A(A),
.B(B),
.prod(prod)
);
initial begin
A = 0; B = 0;
#100 A=4'b1111;B=4'b1010;
#100 A=4'b1001;B=4'b1100;
#100 A=4'b0110;B=4'b1101;
#100 A=4'b0111;B=4'b1110;
#100;
end
endmodule
3.6 Result:
Thus the design of VLSI adders and multipliers is simulated in Verilog and synthesized using
EDA tools.
Lab Experiment #4
Design of FSM
4.1 Objective: To learn the design of FSM for any application in Verilog then simulating and
synthesizing using EDA tools
4.2 Software tools Requirement
Equipments:
Computer with Xilinx and Modelsim Software Specifications:
HP Computer P4 Processor – 2.8 GHz, 2GB RAM, 160 GB Hard Disk
Softwares: Synthesis tool: Xilinx ISE.
Simulation tool: ModelSim Simulator
4.3 Prelab Questions
(write pre lab Q & A in an A4 sheet)
4.4 Problem 1: Implement Sequence Recognizer for detecting three successive 1’s using
Verilog code.
State Diagram
4.4 Verilog Code - Problem 1
module fsm( clk, rst, inp, outp);
input clk, rst, inp;
output outp;
reg [1:0] state;
reg outp;
always @( posedge clk, posedge rst )
begin
if( rst )
state <= 2'b00;
else
begin
case( state )
2'b00:
begin
if( inp ) state <= 2'b01;
else state <= 2'b10;
end
2'b01:
begin
if( inp ) state <= 2'b11;
else state <= 2'b10;
end
2'b10:
begin
if( inp ) state <= 2'b01;
else state <= 2'b11;
end
2'b11:
begin
if( inp ) state <= 2'b01;
else state <= 2'b10;
end
endcase
end
end
always @(posedge clk, posedge rst)
begin
if( rst )
outp <= 0;
else if( state == 2'b11 )
outp <= 1;
else outp <= 0;
end
endmodule
// TEST BENCH
module fsm_tb_v;
reg clk, rst, inp;
wire outp; reg[15:0]
sequence; integer i;
fsm dut( clk, rst, inp, outp);
initial
begin
clk = 0; rst = 1;
sequence = 16'b0101_0111_0111_0010;
#5 rst = 0;
for( i = 0; i <= 15; i = i + 1)
begin
inp = sequence[i];
#2 clk = 1;
#2 clk = 0;
end
test2;
end
task test2;
for( i = 0; i <= 15; i = i + 1)
begin
inp = $random % 2;
#2 clk = 1;
#2 clk = 0;
end
endtask
endmodule
4.4.Waveforms – Problem 1
4.5 Post Lab Question: Write a Verilog code to implement an FSM. (For any application)
4.6 Result: Thus, the design of FSM for any application is simulated in Verilog and
synthesized using EDA tools.
Lab Experiment #5
5.1 Objective: To learn the design of sub-circuit design in Verilog then simulating and
synthesizing using EDA tools
Equipment’s:
1. Write the program for Linear feedback shift register using verilog.
5.6 Result: Thus, the design of 8 Bit Barrel Shifter is simulated in Verilog and synthesized
using EDA tools.
Lab Experiment #6
Design of Digital circuits at the MOS transistor level
6.1 Objective: To learn the design of Digital circuits at the MOS transistor level Using Switch
Level Modeling.
Equipments:
Computer with Xilinx and Modelsim Software Specifications:
HP Computer P4 Processor – 2.8 GHz, 2GB RAM, 160 GB Hard Disk
Softwares: Synthesis tool: Xilinx ISE.
6.4.1: Design inverter logic using verilog switch level modeling and verify the simulation
result using test bench.
Logic Diagram-Problem 1
6.4.2 Design two input CMOS NAND , NOR logic using verilog switch level modeling and
verify the simulation result using testbench.
Logic Diagram-Problem 2
6.4.3: Design 2:1 Mux using CMOS switches and write verilog coding using switch level
modeling and verify the simulation result.
Logic Diagram-Problem 3
1. Define a memory element to store a value and design a level sensitive CMOS latch .
2. Draw the CMOS logic circuit for the following boolean expression
A(D+E)+BC
6.6 Result: Thus, the design of combinational circuit using switch level modeling is
simulated in Verilog and synthesized using EDA tools.
TANNER SPICE
SOFTWARE REQUIRED
LT SPICE
PROCEDURE
1. Open LT Spice
2. Click File – New Schematic
3. Place the component, Edit- component
4. Connect the components, Edit- Draw wire
5. Place the ground, Edit- Place_Gnd
6. Place Label, Edit- Label_Net
7. Simulate the circuit , Simulate _ Run
8. Set the Transient response
9. Click the markers at input node and output node to verify the waveform.
SR FLIPFLOP
LOGIC DIAGRAM
OUTPUT GRAPH
D FLIPFLOP
LOGIC DIAGRAM
OUTPUT GRAPH
Result:
Thus the CMOS flip flops are simulated and outputs are executed using Tanner Spice tool.
Ex.No.8 CMOS LOGIC GATES AND CIRCUITS Date:
AIM
To simulate and execute CMOS logic gates and circuits using Tanner Spice
SOFTWARE REQUIRED
LT SPICE
PROCEDURE
1. Open LT Spice
2. Click File – New Schematic
3. Place the component, Edit- component
4. Connect the components, Edit- Draw wire
5. Place the ground, Edit- Place_Gnd
6. Place Label, Edit- Label_Net
7. Simulate the circuit , Simulate _ Run
8. Set the Transient response
9. Click the markers at input node and output node to verify the waveform.
NAND GATE LOGIC DIAGRAM
OUTPUT GRAPH
NOR GATE
LOGIC DIAGRAM
OUTPUT GRAPH
INVERTER
LOGIC DIAGRAM
OUTPUT GRAPH
Result:
Thus the CMOS logic gates are simulated and outputs are executed using Tanner Spice tool.
Ex.No.9 DYNAMIC CIRCUITS Date:
AIM
To simulate and execute dynamic circuit(NAND Gate) using Tanner Spice
SOFTWARE REQUIRED
LT SPICE
PROCEDURE
1. Open LT Spice
2. Click File – New Schematic
3. Place the component, Edit- component
4. Connect the components, Edit- Draw wire
5. Place the ground, Edit- Place_Gnd
6. Place Label, Edit- Label_Net
7. Simulate the circuit , Simulate _ Run
8. Set the Transient response
9. Click the markers at input node and output node to verify the waveform.
Result:
Thus the dynamic circuit(NAND Gate) is simulated and output is executed using Tanner Spice
tool.