VLSI LAB Manual 2014 PDF
VLSI LAB Manual 2014 PDF
VLSI LAB Manual 2014 PDF
: 10ECL77
IA Marks
: 25
: 03
Exam Hours
: 03
: 42
Exam Marks
: 50
PART A
DIGITAL DESIGN
ASIC-DIGITAL DESIGN FLOW
1. Write Verilog Code for the following circuits and their Test Bench for verification, observe
the waveform and synthesis the code with technological library with given Constraints*. Do the
initial timing verification with gate level simulation.
i.
ii.
An inverter
A Buffer
iii.
Transmission Gate
iv.
Basic/universal gates
v.
vi.
vii.
viii.
Page 1
PART - B
ANALOG DESIGN
Analog Design Flow
1. Design an Inverter with given specifications*, completing the design flow mentioned below:
a. Draw the schematic and verify the following
i) DC Analysis
ii) Transient Analysis
b. Draw the Layout and verify the DRC, ERC
c. Check for LVS
d. Extract RC and back annotate the same and verify the Design
e. Verify & Optimize Time, Power and Area to the given constraint***
2. Design the following circuits with given specifications*, completing the design flow
mentioned below:
a. Draw the schematic and verify the following
i) DC Analysis
ii) AC Analysis
iii) Transient Analysis
b. Draw the Layout and verify the DRC, ERC
c. Check for LVS
d. Extract RC and back annotate the same and verify the Design.
i) A Single Stage differential amplifier
ii) Common source and Common Drain amplifier
Page 2
3. Design an op-amp with given specification* using given differential amplifier Common
source and Common Drain amplifier in library** and completing the design flow mentioned
below:
a. Draw the schematic and verify the following
i) DC Analysis
ii). AC Analysis
iii) Transient Analysis
b. Draw the Layout and verify the DRC, ERC
c. Check for LVS
d. Extract RC and back annotate the same and verify the Design.
4. Design a 4 bit R-2R based DAC for the given specification and completing the design flow
mentioned using given op-amp in the library**.
a. Draw the schematic and verify the following
i) DC Analysis
ii) AC Analysis
iii) Transient Analysis
b. Draw the Layout and verify the DRC, ERC
c. Check OF LVS
d. Extract RC and back annotate the same and verify the Design.
5. For the SAR based ADC mentioned in the figure below draw the mixed signal schematic and
verify the functionality by completing ASIC Design FLOW.
Page 3
PART A
DIGITAL DESIGN
Steps to use Xilinx tool:
Start the Xilinx Project Navigator by using the desktop shortcut or by using the
Start
Programs
Xilinx ISE
Project Navigator.
Spartan 3
New project
Page 4
In the create new source window select source type as verilog module give file name
Page 5
click next
next finish
Double click on source file complete the verilog code for inverter
Check syntax, and remove errors if present
Simulate the design using ISE Simulator Highlight inverter.v file in the Sources in
Project window. To run the Behavioral Simulation, Click on the symbol of FPGA device
and then right click Click on new source Click on verilog text fixture Give file name
with _tb
finish
Generate test bench file after initial begin assign value for inputs
behavioral model
Click on simulate
Page 6
INVERTER
1. Write Verilog Code of an inverter circuits and their Test Bench for verification
Objective:
To design an inverter in verilog using xilinx tool and verify it on ISE simulator
Tools : Xilinx ISE simulator .
Symbol and truth table:
Design Description:
NOT gate, for example, will invert the data. NOT gate has 1 input and 1 output. Whatever
the value is at the input, the output will have the opposite value. If the input is a 1, the output is a 0.
If the input is a 0, the output is a 1. B = ~A
Waveform:
Page 7
VERILOG CODE
//Data flow model
module in1(a, b);
input a;
output b;
assign b=~a;
endmodule
// Behavioural model
module in1(a, b);
input a;
output reg b;
always @(a)
begin
b=~a;
end
endmodule
Page 8
Page 9
BUFFER
2. Write Verilog Code of a Buffer circuits and their Test Bench for verification
Objective:
To design a buffer in verilog using xilinx tool and verify it on ISE simulator.
Tools : Xilinx ISE simulator .
Symbol and Truth table:
Design Description:
If we were to connect two inverter gates together so that the output of one fed into the
input of another, the two inversion functions would "cancel" each other out so that there would
be no inversion from input to final output: For this purpose, a special logic gate called a buffer is
manufactured to perform the same function as two inverters. Its symbol is simply a triangle, with
no inverting "bubble" on the output terminal: B = A
Page 10
Waveform:
// VERILOG CODE:
//Data flow model
module buffer(a, b);
input a;
output b;
assign b=a;
endmodule
// Behavioural
module buffer (a, b);
input a;
output reg b;
always @(a)
begin
b=a;
end
endmodule
Page 11
#100;
a = 1; #100;
end
endmodule
Waveform:
Conclusion: Design of a buffer in xilinx tool and is verified according to the truth Table.
Page 12
Transmission Gate
3. Write Verilog Code of a transmission gate circuits and their Test Bench for verification
Objective:
To design a transmission gate in verilog using xilinx tool and verify it on ISE simulator.
Tools : Xilinx ISE simulator .
Circuit Diagram and Truth table:
A(Select)
0
1
1
IN
X
0
1
OUT
X
0
1
Design Description:
Transmission gate is an electronic element. It is a good non-mechanical relay, built
with CMOS technology. It can be used to simplify digital logic circuits or to switch analog
signals, and so is also known as an analog gate, analogue switch or electronic relay depending on
its use. It is made by the parallel combination of an nMOS and a pMOS transistor with the input
at the gate of one transistor being complementary to the input at the gate of the other transistor.
Page 13
//VERILOG CODE
module transmission_gate(A,IN,OUT);
input A,IN;
output OUT;
wire Abar;
assign Abar=~A;
pmos(OUT,Abar,IN);
nmos(OUT,A,IN);
endmodule
Page 14
Waveform:
Conclusion: Design of a transmission gate in xilinx tool and is verified according to the truth
Table.
Page 15
BASIC GATES
4. Write Verilog Code of a Basic gates circuits and their Test Bench for verification.
Objective:
To design a basic gates in verilog using xilinx tool and verify it on ISE simulator.
Tools : Xilinx ISE simulator .
AND GATE:
Page 16
OR GATE:
Page 17
EX-OR GATE:
Design Description:
The output of an XOR gate is equal to 1 if either input (A or B in this case) is equal to
one, but equal to zero if both inputs are equal to zero or if both inputs are equal to 1. This is the
difference between an OR gate and an XOR gate, an OR gates output will equal 1 if both inputs
are equal to 1.
The equation OF an XOR gate is: C = A ^ B
Waveform:
Page 18
NAND GATE:
Design Description:
A variation on the idea of the AND gate is called the NAND gate. The word "NAND" is
a verbal contraction of the words NOT and AND. Essentially, a NAND gate behaves the same as
an AND gate with a NOT (inverter) gate connected to the output terminal. To symbolize this
output signal inversion, the NAND gate symbol has a bubble on the output line. The truth table
for a NAND gate is as one might expect, exactly opposite as that of an AND gate:
As with AND gates, NAND gates are made with more than two inputs. In such cases, the
same general principle applies: the output will be "low" (0) if and only if all inputs are "high"
(1). If any input is "low" (0), the output will go "high" (1).
The equation of an XOR gate is: C = ~(A &B)
Page 19
Waveform:
NOR GATE:
Design Description:
A variation on the idea of the OR gate is called the NOR gate. The word "NOR" is a
verbal contraction of the words NOT and OR. Essentially, a NOR gate behaves the same as an
OR gate with a NOT (inverter) gate connected to the output terminal. To symbolize this output
signal inversion, the NOR gate symbol has a bubble on the output line. The truth table for a NOR
gate is as one might expect, exactly opposite as that of an OR gate:
As with OR gates, NOR gates are made with more than two inputs. In such cases, the
same general principle applies: the output will be "low" (0) if any inputs are "high" (1). If both
the inputs is "low" (0), the output will go "high" (1).
Page 20
Waveform:
VERILOG CODE
//Data flow model
module gat(c,d,a,o,na,no,x);
input c,d ;
output a,o,x,no,na;
assign o=(c|d); //o -> or gate output
assign no=~(c|d);
Page 21
// Inputs
// Outputs
.no(no),
.x(x) );
initial begin
c = 0;
d = 0;#100;
c = 0;
d = 1;#100;
c = 1;
d = 0;#100;
c = 1;
d = 1;#100;
end
endmodule
Waveform:
Conclusion: Design of Basic gates in xilinx tool and is verified according to the truth Table.
Page 22
FLIP FLOPS
5. Write Verilog Code of Flip flops circuits and their Test Bench for verification
Objective:
To design Flip flops in verilog using xilinx tool and verify it on ISE simulator
Tools : Xilinx ISE simulator .
i) D FLIPFLOP
Page 23
// VERILOG CODE
module d_ff( d, clk, q, q_bar);
input d, clk;
output q, q_bar;
reg q;
reg q_bar;
always @ (posedge clk)
begin
q <= d;
q_bar <= !d;
end
endmodule
//Test bench structure
module cc_v;
reg d;
d = 0;
clk = 1; #100;
d = 1;
clk = 1; #100;
d = 1;
clk = 0; #100;
end
endmodule
Page 24
Waveform:
ii) T FLIPFLOP
Page 25
// Inputs
wire q;
// Outputs
wire q_bar;
initial begin
t = 0;clk = 0;
t = 0;clk = 1;
#100;
t = 1;clk = 1; #100
t = 1;clk = 0; #100;
end
endmodule
Waveform:
Page 26
iii) SR FLIPFLOP:
Page 27
// VERILOG CODE
module sr_ff(clk,s,r,q,qb);
input clk,s,r;
output rer q,qb;
always @(clk,s,r)
begin
if(clk==1)
begin
if(s==0 & r==1)
begin
q=0; qb=~q;
end
else if(s==1 & r==0)
begin
q=1; qb=~q;
end
else if(s==0 & r==0)
begin
q=q; qb=~q;
end
else if(s==1 & r==1)
begin
q=1'bz; qb= 1'bz;
end
end
end
endmodule
Page 28
reg r; // Inputs
.q(q),
.qb(qb) );
initial begin
clk = 0; s = 1;
r = 0;
clk = 1; s = 0;
r = 1;
#100;
clk = 1; s = 1;
r = 0;
#100;
clk = 1; s = 0;
r = 0;
#100;
clk = 1; s = 1;
r = 1;
#100;
end
endmodule
Waveform:
Page 29
Page 30
//Verilog code
module jk_ff(clk,j,k,q,qb);
input clk, j, k;
output q,qb;
reg q,qb;
always @(clk,j,k)
begin
if(clk==1)
begin
if(j==0 & k==1)
begin
q=0; qb=~q;
end
else if(j==1 & k==0)
begin
q=1; qb=~q;
end
else if(j==0 & k==0)
begin
q=q; qb=~q;
end
else if(j==1 & k==1)
q=~q; qb=~q;
end
end
endmodule
Page 31
// Inputs
.qb(qb)
);
initial begin
clk = 0; j = 0;
k = 0;
#100;
clk = 1; j = 1;
k = 0;
#100;
clk = 1; j = 0;
k = 1;
#100;
clk = 1; j = 0;
k = 0;
#100;
clk = 1; j = 1;
k = 1;
#100;
end
endmodule
Waveform:
Conclusion: Design of Flipflops(D,T,SR,JK) in xilinx tool and is verified according to the truth
Table.
Page 32
PARALLEL ADDER
6. Write Verilog Code of Parallel adder circuits and their Test Bench for verification
Objective:
To design parallel adder in verilog using xilinx tool and verify it on ISE simulator
Tools : Xilinx ISE simulator .
Page 33
Design Description:
Parallel adders are digital circuits that compute the addition of variable
binary strings of equivalent or different size in parallel.
A number of full adders may be added to the ripple carry adder or ripple carry adders of different
sizes may be cascaded in order to accommodate binary vector strings of larger sizes. For an n-bit
parallel adder, it requires n computational elements (FA).
It is composed of four full adders. The augends bits of x are added to the addend bits of
y respectfully of their binary position Each bit 6 addition creates a sum and a carry out. The carry
out is then transmitted to the carry in of the next higher-order bit. The final result creates a sum
of four bits plus a carry out (c4).
// VERILOG CODE
module padd(x,y, c, sum, cout);
input [3:0] x,y;
input c;
output [3:0] sum;
output cout;
FA stage0(x[0],y[0],c,sum[0],c1);
FA stage1(x[1],y[1],c1, sum[1],c2);
FA stage2(x[2],y[2],c2, sum[2],c3);
FA stage3(x[3],y[3],c3,sum[3],cout);
endmodule
// Function of full Adder
module FA(a,b,cin, s,c0);
input a,b,cin;
output s,c0;
assign s=a^b^cin;
assign c0=(a&b)|(b&cin)|(cin&a);
endmodule
Page 34
padd uut (
.x(x),
.y(y),
.c(c),
.sum(sum),
.cout(cout)
);
initial begin
// Initialize Inputs
x = 4'b0101;
y = 4'b1100;
c = 0;
#100;
x = 4'b0001;
y = 4'b1011;
c = 1;
#100;
x = 4'b1011;
y = 4'b0101;
c = 0;
#100;
end
endmodule
Waveform:
Conclusion: Design of Parallel Adder in xilinx tool and is verified according to the truth Table.
Page 35
SERIAL ADDER
// VERILOG CODE
module fa(a, b, c, sum, carry);
input a;
input b;
input c;
output sum;
output carry;
wire d,e,f;
xor(sum,a,b,c);
and(d,a,b);
and(e,b,c);
and(f,a,c);
or(carry,d,e,f);
endmodule
Page 36
initial begin
#10 a=1b0;b=1b0;c=1b0;
#10 a=1b0;b=1b0;c=1b1;
#10 a=1b0;b=1b1;c=1b0;
#10 a=1b0;b=1b1;c=1b1;
#10 a=1b1;b=1b0;c=1b0;
#10 a=1b1;b=1b0;c=1b1;
#10 a=1b1;b=1b1;c=1b0;
#10 a=1b1;b=1b1;c=1b1;
#10$stop;
end
endmodule
Page 37
COUNTER
7. Write Verilog Code of counter circuits and their Test Bench for verification
Objective:
To design counter in verilog using xilinx tool and verify it on ISE simulator
Tools : Xilinx ISE simulator .
Design Description:
In the 4-bit counter to the right, we are using edge-triggered master-slave
flip-flops similar to those in the Sequential portion of these pages. The output of each flipflop changes state on the falling edge (1-to-0 transition) of the T input.
The count held by this counter is read in the reverse order from the order in which the flip-flops
are triggered. Thus, output D is the high order of the count, while output A is the low order. The
binary count held by the counter is then DCBA, and runs from 0000 (decimal 0) to 1111
(decimal 15). The next clock pulse will cause the counter to try to increment to 10000
(decimal 16). However, that 1 bit is not held by any flip-flop and is therefore lost. As a result,
the counter actually reverts to 0000, and the count begins again
Up Counter:
Verilog code
module upcountermod(clk, clear, q);
input clk;
input clear;
output [3:0] q;
reg [3:0] q;
always@(posedge clear or posedge clk)
begin
if(clear)
q <=4b0000;
else
q <= q+1b1;
end
endmodule
Page 38
TEST BENCH
module upcountert_v;
reg clk;
reg clear;
wire [3:0] q;
upcountermod uut ( .clk(clk), .clear(clear),.q(q));
initial begin
clk = 0;
clear = 0;
#5 clear=1b1;
#5 clear=1b0;
end
always #5 clk=~clk;
initial #200 $stop;
endmodule
Down counter:
//Verilog code
Page 39
initial begin
clk = 0;
clear = 0;
#5 clear=1b1;
#5 clear=1b0;
end
always #5 clk=~clk;
initial #200 $stop;
endmodule
Up-Down Counter
//Verilog code:
module updowncountermod(clk, clear, updown, q);
input clk;
input clear;
input updown;
output [3:0] q;
reg [3:0] q;
always@(posedge clear or posedge clk)
begin
if(clear)
q <=4b0000;
else if(updown)
q <= q+1b1;
else
q <= q-1b1;
end
endmodule
//TEST BENCH
module updowncountert_b;
reg clk;
reg clear;
reg updown;
wire [3:0] q;
updowncountermod uut (.clk(clk),.clear(clear), .updown(updown), .q(q) );
Page 40
initial begin
clk = 0;
clear = 0;
updown = 0;
#5 clear=1b1;
#5 clear=1b0;
#100 updown=1b1;
end
always #5 clk=~clk;
initial #150 $stop;
endmodule
Page 41
Asynchronouscounter
//Verilog code:
module asynchronouscountermod(clk, clear, q);
input clk;
input clear;
output [3:0] q;
reg [3:0] q;
always @(negedge clk or posedge clear)
q[0]<=~q[0];
always @(negedge q[0] or posedge clear)
q[1]<=~q[1];
always @(negedge q[1] or posedge clear)
q[2]<=~q[2];
always @(negedge q[2] or posedge clear)
begin
if(clear)
q <=4b0000;
else
q[3]<=~q[3];
end
endmodule
TEST BENCH
module asynchronouscountert_b;
reg clk;
reg clear;
wire [3:0] q;
asynchronouscountermod uut (.clk(clk),.clear(clear),.q(q) );
initial begin
clk = 0;
clear = 0;
#5 clear=1b1;
#5 clear=1b0;
end
always #5 clk=~clk;
initial #200 $stop;
endmodule
Page 42
Design Description:
A successive approximation ADC is a type of analog-to-digital converter that converts a
continuous analog waveform into a discrete digital representation via a binary search through all
possible quantization levels before finally converging upon a digital output for each conversion
The successive approximation Analog to digital converter circuit typically consists of four chief
subcircuits:
1. A sample and hold circuit to acquire the input voltage (Vin).
2. An analog voltage comparator that compares Vin to the output of the
internal DAC and outputs the result of the comparison to the successive
approximation register (SAR).
Page 43
Page 44
PART B
ANALOG DESIGN
Analog Design Flow using Electric 9.04 - tool
Design the circuits with given specifications*, completing the design flow mentioned below:
a. Draw the schematic and verify the
following i) DC Analysis
ii) Transient Analysis
b. Draw the Layout and verify the DRC, ERC
c. Check for LVS
d. Extract RC and back annotate the same and verify the Design
e. Verify & Optimize Time, Power and Area to the given constraint***
This Lab will introduce you to the Analog VLSI system Lab using Electric -9.04 tool:
Its assumed that Electric (version 8.10 or later) and LTspice have been installed properly on your
computer. With this assumption all layout and simulation work will be done (saved) in C:/Electric
(where the Electric jar file resides). Ensure that you have increased the memory in your JVM as
instructed above.
Page 45
Next go to menu item Window -> Color Schemes -> White Background Colors
Using a white background will be useful in these tutorials so that ink is minimized if they are
printed out
Its often preferable to use a black background colors to ease the stress on your eyes ;-)
Adjust the sizes of the windows to fill the available space as seen below.
Well set Electric up for use in ON Semiconductors C5 process and fabrication through MOSIS.
This process has two layers of polysilicon to make a poly1-poly2 capacitor, 3 layers of metal, and a
hi-res layer to block the implant, and thus decrease in resistance, of poly2 to fabricate higher-value
(than what we would get with poly1) poly2 resistors.
This tutorial uses the MOSIS scalable CMOS (SCMOS) submicron design rules.
While the C5 process is an n-well process well still draw the p-well, which will be ignored during
fabrication, just to make the layouts more portable between processes.
Page 46
Next, the scale (lambda) for the C5 process is 300 nm using the MOSIS Scalable CMOS (mocmos
technology in Electric, see image above) submicron design rules.
To set the scale go to File -> Preferences -> Technology -> Scale and set mocmos scale to 300 nm
as seen below.
Page 47
Press OK to exit.
Go to File -> Save Library As -> Lib_name.jelib
Next lets begin to draw the schematic of a CMOS inverter circuit.
Go to Cell -> New Cell and enter the cell name (inverter) and view (schematic) seen below.
Page 48
Next create a new cell, Cell -> New Cell (or just use Ctrl+N) called inv_20_10 (an inverter with a
PMOS having a width of 20 and an NMOS with a width of 10)
Ensure the schematic view is selected.
Page 49
Repeat the above set of steps for the pMos Node in the cell
Page 50
Next turn the grid on and add the power symbol as seen below.
Page 51
Page 52
Page 53
To go back up in the hierarchy we can use Ctrl+U or Cell -> Up Hierarchy -> Up Hierarchy
Press Ctrl+U now to go back up to the inverter schematic (the only cell using the icon view)
Select this view again and then Ctrl+D to back into the icon view (knowing can use the Explorer to move
between cells too)
Next select and delete the box/text to get the following.
Page 54
Page 55
Next, turn off the grid and then place the icon into this schematic.
This can be done in two ways.
In the Component menu select Cell -> inv_20_10 or
in the Explorer click, and hold, on the cell you want to instantiate and drag it into the drawing area.
Use either method to place the inverter icon as seen below.
Page 56
Double click on the Arcs (or select and use Ctrl+I) to label the wires in and out as seen below.
Also, edit the SPICE text so that the text seen below is used (set to Multi-line text).
Page 57
Closing LTspice results in, again, after selecting the in and out voltages:
Page 58
Now there are three views in the inv_20_10 cell group: schematic, icon, and layout
Add the following Nodes to this cell.
Annotation text was added to help know what to place and where.
Page 59
Move the active areas adjacent to the transistors. Move Annotation text for labeling too.
Page 60
Add a poly1 to metal1 contact on the left and a metal1 Pin on the right as seen below.
Page 61
Select this gnd Export and change its Text size to 5 as seen below.
Remember that using the Crtl+click is useful for cycling through the selections.
Also remember that both gnd and vdd exports must be lowercase to properly NCC with the corresponding
power and ground schematic Nodes.
Page 62
Next, select the metal1 Pin we placed a moment ago (you can only export Nodes, not Arcs, and the Pin is a
Node). Export this Pin as out to match the schematic view.
Again, change the size of the Text to 5 as seen below.
Repeat for vdd and in then DRC, NCC, and Well Check the layout.
There shouldnt be any errors.
Page 63
Page 64
Notice that you can de-select the Easy to Select feature and make the cell hard to select. This is useful
when the layout is complicated.
If a cell or layout is hard to select you can toggle the Special Select cursor (circled on the menu).
Using Pure layers, see menu item under the left Components menu tab, requires the use of Special Select.
Lets connect metal wires to the cell as seen below.
Next edit the properties of the wire Arcs so that they correspond to the names in the inverter_sim{sch}.
Next copy the SPICE code from inverter_sim{sch} into this layout view of the cell.
Change the size of the SPICE code to 3 as seen below.
Page 65
Its tough to see the wire Arc names so change their size to 5 (again Ctrl+click and Shift+click are always
useful) DRC, NCC, and Well Check the cell inverter_sim.
We get errors for both the NCC and the Well Checks.
Page 66
Now the two cells DRC, NCC, and Well Check without errors.
Further, the layout view of this cell can now be simulated using SPICE
Repeat the same procedure for single stage amplifiers and for the operation amplifier with the layout rules.
Page 67