Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
nanoLambda
…giving you the squeeze of nanometer design technology VirtuosoFab
MEMsim
PROthumb
PROtutor
45nm Size Comparison
A nail = 20 million nm
A human hair = 90,000nm
Ragweed pollen = 20,000nm
Bacteria = 2,000nm
Intel 45nm transistor = 45nm
Rhinovirus = 20nm
Silicon atom = 0.24nm
CONTENTS
PART – A
DIGITAL DESIGN
PART – B
ANALOG DESIGN
[Specifications to GDS-II]
Overview
The focus of this course is the CAD based VLSI design flow. The entire VLSI
design industry makes use of this design flow in some or the other. Proficiency and
Over this course, exposure to various stages of a typical, state of the art Cadence
VLSI tool be provided by various experiments designed to bring out the key aspects of
each important module in the Cadence tool including the synthesis , place and route,
layout, LVS, simulation.
Students will learn how to manage the files with the Library Manager, understand
the basics of the Schematics Editor, and simulate a simple circuit using the Analog
Design Environment (ADE). Understand the differences between using ideal and real
circuit elements.
Course Objectives
Course Outcomes
After studying this course the students would gain enough knowledge,
Breadth options
This subject potentially can be taken as a breadth subject component for ASIC
Design, System on Chip Design, Testing and verification in VLSI, Low Power VLSI.
Directory Structure
Before starting the flow, follow the below library structure. This is not mandatory but will
help in separating design files, library files, log files and command files generated by tools.
root
Cadence_tool
s
cadence_datab
ase
Design Directory
Experiment Directory
Below figure (fig 1) is an example for the directory structure created for a counter design.
Fig 1
Save your design (RTL files) inside the RTL directory and keep both RTL as well as test
bench inside the RTL directory. Libraries and Constraint files (SDC files) are kept in respective
directories. RTL and Synthesis directories are used to run simulation and synthesis so that all
log files, command files and other tool generated files won’t get mixed up.
Verification
IES (Incisive Enterprise Simulator) is the tool used for verification. Navigate to Simulation
directory where you have kept your RTL and test bench (rtl directory). Invoke the tool by typing
‘nclaunch -new -64’ in the terminal. Below figure (fig 2) shows how to invoke C shell, source
cshrc and invoke Incisive tool to simulate an inverter design.
1. NCLaunch window will appear, and in the NCLaunch window, select ‘Multiple Step’
option
3. Click on ‘Create cds.lib File’ option and a ‘Create a cds.lib file’ window will open. Click
‘Save’ option.
6. In the NCLaunch window, we will be able to see the design as well as the test bench
that we kept inside the rtl directory.Click ‘OK’.
Elaboration
8. The next step is elaboration, open the ‘worklib’ directory on the right side of the window
and we can see the design objects created inside. Select the testbench module and
select the ‘launch elaborator’ (ncelab) key.
10. ‘Launch simulator’ will open ‘Design Browser’ and ‘console’ windows. ‘Console –
SimVision’ window can be used to perform simulation in command mode and hence can
be minimized while using ‘Design Browser –SimVision’window to run simulation in GUI
mode. Select send to waveform window.
Synthesis
The tool used for synthesis (converting RTL to gate level netlist) is RTL Compiler (RC).
Running Synthesis
Change the directory from rtl to synthesis and write a script file for synthesis(rc_script.tcl). Below
is an example of a script file for synthesis
The necessary inputs to perform synthesis are RTL, standard cell library and constraints.
Fig: Synthesis
Department of Electronics & Communication, K.I.T, Tiptur 11
VLSI LAB VII Semester
• Synthesize –to_mapped
This command will perform synthesis by combining the generic, mapped and
incremental synthesis .
Note: - In help_ug folder in desktop, you can see a script file ‘rc_script.tcl’ inside the
synthesis directory. Please open the script file for further understanding.
Figure Synthesis previous page shows script file
Using SDC, we define clock period, pulse width, rise and fall time, uncertainty and also
input and output delays for different signals. Below is the constraints file used in counter
design.
This command will define clock with period 10ns and 50% duty cycle and signal is high
in the first half.
• ‘Set_clock_transition –rise/fall’ command defines the transition delay for clock.
• ‘Set_clock_uncertainty’ command will set the uncertainty due to (clock skew and
jitter).
• ‘Set_input/output_delay’ command will specify the input and output delay used
for timing slack calculations.
Keep the constraints file inside the Synthesis directory.
Once the script file to run synthesis and the constraints file are ready, we can initiate
synthesis.
Use the below command to invoke RTL compiler along with the script file.
rc -f <script file name with path>
‘rc’ is the command to invoke RTL Compiler and ‘-f’ option is used to passes the script
to RC at the time of launching the tool. RC will execute each commands mentioned
inside the script file one by one.
Note: - If the script file is in the current working directory (synthesis directory), we need
not have to provide the path for the script.
E.g. - In case of the inverter design, the command will be ‘rc –f rc_script.tcl’
While performing synthesis, always check the RC terminal whether the tool is reporting
any error. Figure below depicts the procedure to perform synthesis in RC terminal.
Aim: To compile and to simulate the Verilog code for an inverter, and then to synthesize
the same for the given constraints.
Logic symbol:
Verilog Code:
// Inverter Design
module inverter(a,b);
input a;
output b;
assign b=~a;
A B
endmodule 0 1
1 0
Testbench:
module inverter_test;
reg a;
wire b;
inverter inverter1(a,b);
initial
begin
a=0; #10
a=1;#10
$stop;
end
endmodule
Waveform:
Aim: To compile and to simulate the Verilog code for a buffer, and then to synthesize
the same for the given constraints.
Logic symbol:
Verilog Code:
// Buffer Design A B
module buffer(a,b); 0 0
1 1
input a;
output b;
assign b=a;
endmodule
Test Bench:
module buffer_test;
reg a;
wire b;
buffer buffer1(a,b);
initial
begin
a=1;#10;
a=0;#10;
$stop;
end
endmodule
Waveform:
Verilog Code:
// Tg Design
module tg(s,in,out);
input s,in; output out;
reg out;
always @ (s or in)
begin
if (s)
out<= in;
else S In Out
out <=1'bZ; 1 0 0
end 1 1 1
0 0 Z
endmodule 0 1 Z
Test Bench:
module tg_t;
reg s, in;
wire out;
tg tg1 (s, in, out);
initial
begin
s=0; in=0; #100;
s=0; in=1; #100;
s=1; in=0; #100;
s=1; in=1; #100;$stop;
end
endmodule
Waveform:
Aim: To compile and to simulate the Verilog code for the basic logic gates, and then to
synthesize those designs for the given constraints.
Logic symbol:
Verilog Code:
assign or_gate=(a|b);
assign and_gate=(a & b);
assign nand_gate=~(a & b);
assign nor_gate=~(a|b);
assign xor_gate=(a^b);
endmodule
Test Bench
module gates_test;
reg a,b;
wire and_gate,or_gate,nand_gate,nor_gate,xor_gate;
gates gates1(a,b,and_gate,or_gate,nand_gate,nor_gate,xor_gate);
initial begin
a=0;b=0;
#10;
a=0;b=1;
#10;
a=1;b=0;
#10;
endmodule
Waveform:
Aim: To compile and to simulate the Verilog code for the common flip-flops, and then to
synthesize those designs for the given constraints.
Design Files: The main design modules and the respective test bench modules are given as
follows, in the order of – D, SR, T, JK and MS (The full forms for the names are: Data, Set
Reset, Toggle, Jack Kilby and Master Slave). The compiler directives are not used in these
modules, as the primitives are not used in the design modules, and the timing is specified in the
test bench modules.
a) D FLIP-FLOP
D Q
RESET D Q Q_BAR
D 1 X 0 1
CLK
0 0 0 1
FLIP-FLOP 0 1 1 0
RST QBAR
Verilog Code:
module dff(d,clk,q,q_bar,rst);
input clk,d,rst;
output q,q_bar;
reg q;
always @(posedge clk)
begin
if(rst==1)
q<=0;
else
q<=d;
end
assign q_bar=~q;
endmodule
Test Bench:
module dff_test;
reg d,clk,rst;
wire q,q_bar;
dff dff1(d,clk,q,q_bar,rst);
initial
begin
clk=1;rst=1;
d=0;
#100;rst=0;d=0;
#100;d=1;
#1000 $stop;
end
always #25 clk=~clk;
endmodule
b) SR FLIP-FLOP
Verilog Code:
module srff(clk,s,r,q,q_bar);
input clk,s,r;
output q,q_bar;
reg q,q_bar;
Testbench:
module srff_test;
reg clk,s,r;
wire q,q_bar;
srff srff1(clk,s,r,q,q_bar);
initial
begin
clk=1;
s=0;r=1; #100;
s=1;r=0; #100;
s=0;r=0; #100;
s=1;r=1;
#1000 $stop;
end
always
#25 clk=~clk;
endmodule
Waveform:
c) T FLIP-FLOP
Logic symbol:
T
T Q
On positive edge of the CLK
FLIP-FLOP T Q Q_BAR
CLK Q_BAR
0 Previous state
1 Toggle
Verilog Code:
module tff(clk,T,q,q_bar,rst);
input clk,T,rst;
output q,q_bar;
reg q;
always@(posedge clk)
if(T)
begin
q<=~q;
end
else
begin
q<=1'b0;
end
assign q_bar=~q;
endmodule
Testbench:
module tff_test;
reg clk,T;
wire q,q_bar;
tff tff1(clk,T,q,q_bar);
initial
begin
clk=1;
T=0;
#100 T=1;
#100;T=0;
#100 T=1;
#1000 $stop;
end
always #25 clk=~clk;
endmodule
d) JK FLIP-FLOP
Logic symbol:
On positive edge of the CLK
J Q
CLK J K Q Q_BAR
J-K
K Q_BAR
0 0 Previous state
FLIP-FLOP
0 1 0 1
1 0 1 0
1 1 Toggle
Verilog Code:
module jkff(clk,j,k,q,q_bar);
input clk,j,k;
output q,q_bar;
reg q=0;
reg q_bar;
always@(posedge clk)
begin
if(j==0 & k==0)
begin
q<=q;q_bar<=~q;
end
if(j==0 & k==1)
begin
q<=0;q_bar<=1;
end
if(j==1 & k==0)
Testbench:
module jkff_test;
reg clk,j,k;
wire q,q_bar;
jkff jkff1(clk,j,k,q,q_bar);
initial
begin
clk=1;
j=0;k=1; #50;
j=0;k=0; #50;
j=1;k=0; #50;
j=1;k=1;
#400 $stop;
end
Waveform:
Verilog Code:
always @(clk)
begin
if (!clk)
begin
m_q <=d;
end
if (clk)
begin
s_q <= m_q;
s_qbar <= ~ m_q;
end
end
endmodule
Master Input Slave Output
Testbench:
module ms_dff_test;
reg clk,d;
wire s_q, s_qbar;
initial
begin
clk = 1'b0;
d = 1'b0; #50
d = 1'b1;#50
d = 1'b0; #1000
$stop;
end
Aim: To compile and to simulate the Verilog code for the serial and parallel adders, and then to
synthesize those designs for the given constraints.
a) SERIAL ADDER
• Design a 4-bit serial adder. Addition will start with a control signal ‘Enable’, the 2
numbers would come serially to the adder. Output has to be given on register.
Logic symbol:
Verilog Code:
module serial_adder(clk,rst,en,x,y,D);
input clk,rst,en;
input x,y;
output [3:0]D;
reg [3:0]D;
reg carry;
always @(posedge rst or posedge clk)
begin
if(rst)
begin
D<=4'b0;
carry<=1'b0;
end
else if(en)
begin
D[0]<=D[1];
D[1]<=D[2];
D[2]<=D[3];
{carry,D[3]}<=x+y+carry;
end
end
endmodule
module serial_adder_test;
reg clk,rst,en,x,y;
wire [3:0]D;
serial_adder serial_adder1(clk,rst,en,x,y,D);
initial
begin
x=0;
y=0;
clk=1;rst=1;en=0;#50;
rst=0;en=1;
x=1;
y=1;#50;
x=0;
y=0;#50;
x=0;
y=1;#50;
x=1;
y=0;#1000
$stop;
end
always #25 clk=~clk;
endmodule
Waveform:
Logic symbol:
Verilog Code:
module parallel_adder(a,b,cin,result);
input [3:0]a,b;
input cin;
output [4:0] result;
assign result =a+b+cin;
endmodule
Testbench:
module parallel_adder_test;
reg [3:0]a,b;
reg cin;
wire [4:0] result;
parallel_adder parallel_adder1(a,b,cin, result);
initial
begin
a=4'b0000;
b=4'b0000;
cin=0;
#100;
a=4'b0010;
b=4'b0001;
#100;
a=4'b0010;
b=4'b0010;
#1000 $stop;
end
endmodule
Waveform:
Aim: To write a Verilog code for Synchronous Counter and Synthesize and verify the
code with gate level simulation.
a) SYNCHRONOUS COUNTER
Logic symbol:
Verilog Code:
//4-bit Synchronous counter
module counter(clk,rst,q);
input clk,rst;
output reg [3:0] q;
always@(posedge clk or negedge rst)
begin
if(!rst)
q<=0;
else
q<=q+1;
end
endmodule
Testbench:
module counter_test;
reg clk, rst;
wire [3:0] q;
counter counter1(clk,rst, q);
initial
begin
clk=0;rst=1;#50;
rst=0;#50;
rst=1;#1000 $stop;
end
always #25 clk=~clk;
endmodule
b) ASYNCHRONOUS COUNTER
Logic symbol:
Verilog Code:
// Asynchronous 4-bit Counter
module async_count(clk,rst,q);
input clk,rst;
output [3:0]q;
reg q0,q1,q2,q3;
always @(posedge clk or posedge rst)
begin
if(rst)
q0<=0;
else
q0<=~q0;
end
Testbench:
module async_count_test;
reg clk, rst;
wire [3:0]q;
async_count async_count1(clk,rst,q);
initial
begin
clk=0;rst=1;#50;
rst=0;#1000
$stop;
end
always #25 clk=~clk;
endmodule
Waveform:
Aim: To compile and to simulate the Verilog code for the successive approximation
register.
Specifications:
Design a 4-bit SAR logic for 4-bit ADC, use start of conversion & end of
conversion signals.
Logic symbol:
Verilog Code:
module SAR_Counter(
input clk,
input rst,
input comparator_in,
input SOC,
output EOC,
output [3:0] Q
);
reg[3:0] q_temp; // DAC o/p register
reg [2:0] q_cntr; // cycle counter
reg en,EOC_temp;
// Enable Control
always@(posedge clk or posedge rst)
begin
if (rst)
en <= 1'b0;
else if (EOC_temp)
en <= 1'b0;
else if (SOC)
en <= 1'b1;
end
// Cycle Counter
always@(posedge clk or posedge rst)
begin
// SAR logic
always@(posedge clk or posedge rst)
begin
if (rst)
q_temp <= 4'b1000;
else if (en)
begin
case (q_cntr)
3'b001 :
begin
if(comparator_in) // Check MSB bit
q_temp[3] <= q_temp[3];
else
q_temp[3] <= 1'b0;
end
3'b010 : begin
q_temp[2] <= 1'b1; // Set 2nd MSB bit
end
3'b011 : begin
if(comparator_in) // Check 2nd MSB bit
q_temp[2] <= q_temp[2];
else
q_temp[2] <= 1'b0;
end
3'b100 : begin
q_temp[1] <= 1'b1; // Set 3rd MSB bit
end
3'b101 : begin
if(comparator_in) // Check 3rd MSB bit
q_temp[1] <= q_temp[1];
else
q_temp[1] <= 1'b0;
end
3'b110 : begin
q_temp[0] <= 1'b1; // Set LSB bit
end
3'b111 : begin
if(comparator_in) // Check LSB bit
q_temp[0] <= q_temp[0];
else
q_temp[0] <= 1'b0;
end
default: begin
Testbench:
module SAR_t;
reg clk = 1'b0;
reg rst = 1'b0;
reg comparator_in = 1'b0;
reg SOC = 1'b0;
wire EOC;
wire [3:0] Q;
initial begin
#50;
rst = 1'b1; #50;
rst = 1'b0;comparator_in = 1'b1;
#50; SOC = 1'b1;
#50; SOC = 1'b0;
#800;comparator_in = 1'b0;
#1000 $stop;
end
always #25 clk=~clk;
endmodule
Waveform: