Professional Documents
Culture Documents
ECE 4263/6263 Principles of VLSI Design: Irsim Tutorial (VER. 1.2)
ECE 4263/6263 Principles of VLSI Design: Irsim Tutorial (VER. 1.2)
ECE 4263/6263 Principles of VLSI Design: Irsim Tutorial (VER. 1.2)
Starting IRSIM
Make sure that you have defined the environment variable to point to the base IRSIM directory. This is
done on the MSU computer system by using the software environment utility “swsetup”. The command
is
swsetup ecad
c5n.prm is a fabrication technology file (provided by the lab TA) and the .irs file is any IRSIM file. The
explicit path to the .prm file is not required if your ECAD environment variables are set correctly.
Alternately, you can make sure the .prm file is in the current directory. For example, if your .irs file is
named demo.irs type:
irsim c5n.prm demo.irs
IRSIM will tell you how many transistors you have and then display the IRSIM prompt shown below.
IRSIM>
A
A
N4
B N2
N3
C B
f = AB + ABC
A B
N1
A B C
The first line is a comment. Any line that begins with the vertical bar ’|’ is a comment. This first line says
that the technology used is scalable cmos. Transistors are specified as follows:
type g s d l w
where type is p for pmos and n for nmos. The g refers to the gate’s node name. Similarly, s refers to
the source’s node name, and d refers to the drain’s node name. This is why you need a labeled circuit
schematic to create a .irs file by hand. It is important that you get the connections correct. The l is the
transistor’s channel length and the w is the transistor’s channel width, both in lambda.
The first transistor specified in the example above is the top-left pmos transistor in the
corresponding schematic. Study the rest of the IRSIM file and the circuit. It is easy to see how the two
match. You can also enter in resistors and capacitors. See the IRSIM manual for the proper format to
create these elements. Considering just transistors, you are now ready to run IRSIM.
Creating IRSIM files from the Mississippi State University Cadence ECAD flow
Except for trivially small gates, IRSIM netlist will be machine generated by the MSU Cadence ECAD
tool suite. To create IRSIM compatible netlist, do the following steps:
1. Create a schematic in the Cadence tools. Be sure to create pins for circuit inputs and outputs. Create
“input/output” pins for the power supplies. IRSIM requires the power supply node and ground node
to be named “Vdd” and “Gnd”, respectively. It is good habit to always name your “digital” supplies
with these abbreviations.
Do NOT use the “bang” (!) suffix on node names. This practice leads to a high probabil-
ity of “floating” supply nodes as your designs become more hierarchical.
! Information
sp2sim will give basic help using the command “sp2sim -h”.
Power supply nodes can be “renamed” to the IRSIM compatible names by
sp2sim -pVddNodeName -gGndNodeName
The steps above can be used to generate HSPICE and IRSIM netlists from layout views.
Running IRSIM
You can enter in commands interactively at the IRSIM prompt or you can run a script from a .cmd file.
The .cmd files contain commands that are exactly what you would type in at the IRSIM prompt.
Here is an example IRSIM session. The IRSIM> prompt precedes commands that were entered
interactively. Text preceded by the vertical bar | is output from IRSIM.
The basic idea of IRSIM is that you tell it which nodes to pull high, which nodes to pull low, which nodes
to tristate, and then you tell IRSIM to run the simulation for a certain period of time. This period of time
is the stepsize. The above command tells IRSIM that the stepsize is 1ns. The default stepsize is 10ns.
irsim> w a abar
The command “w” tells IRSIM to watch the following nodes. So the above command tells it to watch the
nodes a and abar. IRSIM displays the nodes in the reverse order in the above command. Therefore the
output order will be abar a. Enter the watch nodes in any order you like.
irsim> d
“d” displays all the nodes that are being watched. You can also enter in something like “d a abar” which
tells IRSIM to only display nodes a and abar
a=X abar=X
time = 0.0ns
At time zero, the values of the nodes are all undefined. Now let’s set the value of the input a to logical
zero and “step” the simulator. The “s” command tells IRSIM to simulate for a certain period of time
previously defined by the stepsize command. The default value is 10 ns, but we set it to 1ns above.
irsim> l a
irsim> s
abar=1 a=0
time = 1.00ns
IRSIM displays the values of the nodes after each step because of the previous “w” command. The
current time is also displayed. Notice that a equals 0 and abar equals 1, as we would expect. Also, note
that time=1ns. This is the current simulation time now. Now let’s set the value of a to logical one and step
the simulator again.
irsim> h a
irsim> s
abar=0 a=1
time = 2.00ns
h sets the following nodes to a logic high value, and now abar equals 0. Finally, we will “high
impedence” the input a and step the simulator once more.
irsim> x a
irsim> s
abar=0 a=1
time = 3.00ns
Exiting IRSIM
To exit IRSIM, simply type “exit” at the prompt.
irsim> exit
%
IRSIM will close all of its windows and return to the unix prompt.
You can get help on a specific command by typing “help” followed by the command. For example, to get
help on the “h”, “l”, “x”, and “R” commands, type
irsim> help h
h node/vector... -> drive node/vector(s) to 1 (high)
irsim> help l
l node/vector... -> drive node/vector(s) to 0 (low)
irsim> help x
x node/vector... -> make node/vector(s) undriven (non-input)
irsim> help R
R [n] -> simulate for ’n’ cycles (default: longest sequence)
irsim>
Vectors in IRSIM
If you have a long list of inputs, it can be tiresome to keep using the “l” and “h” commands to set the
logic values. The “vector” command lets you group inputs together so that you can set them all quickly.
For example, using our demo.irs circuit in Fig. 1 again, consider the following IRSIM commands
*** IRSIM version 9.5 *** @ Tue Feb 6 16:13:07 2001
Read demo.irs lambda:0.30u format:MIT
13 nodes; transistors: n-channel=8 p-channel=8
parallel txtors:none
irsim> stepsize 10
The vector command creates a vector variable called ins. The ins is three bits consisting of a, b, and c.
The “l” command tells IRSIM to set the vector ins to 000. Therefore, a equals 0, b equals 0, and c
equals 0. The outs vector consists of the negated versions of a, b, and c. Therefore, the outs variable
equals 111. Now let’s set the middle bit of ins to logical one and step the simulator.
irsim> h b
irsim> s
ins=010 outs=101
time = 20.00ns
Now, outs equals 101 as we would expect. Using the “l” and “h” comamand repeatedly is getting old.
Let’s set the ins vector all at once. Use the “set” command to do this.
irsim> set ins 100
irsim> s
ins=100 outs=011
time = 30.00ns
irsim> inputs
h inputs: a
l inputs: c b
u inputs:
irsim>
Finally, the “inputs” command lists all of the driven inputs in IRSIM and shows which are driven high (h)
and which are driven low (l). It also shows which inputs are undefined (u).
The path command shows the critical path for the last transition of a node f. The output shows that an
input node b changed to logic 1 at time = 10 ns. The node bbar then transitioned to logical low at time
= 10.4 ns. Finally, node f went to logical one at 10.05ns. Therefore, it took 0.05 ns to go from low to high
for the given input changes. Let’s try that again with node f going from high to low.
irsim> set ins 111
irsim> s
f=0 c=1 b=1 a=1
time = 30.00ns
irsim> path f
critical path for last transition of f:
a -> 1 @ 20.00ns , node was an input
f -> 0 @ 20.01ns (0.01ns)
irsim>
This time, the logic path that caused the output node f to change stages was shorted. This path delay was
0.01ns.
Sometimes you may want to find the worst case T plh or T phl . The path command helps you find
this number. You do this by setting the circuit to some state and then force inputs to change that will
cause a transition at the output. Some intelligence is required to figure out what the worst state is and
what combination of input changes will cause the slowest output transition.
This tells IRSIM to display the nodes a, b, c, and f in the analyzer window Go ahead and experiment
with the analyzer window. It's pretty easy to use. Here are some of the things that you can do.
This sequence of commands creates a “clock” on the input c. The “c” command instructs IRSIM to step
the clock variable c throught the two state, 0 and 1. The remaining circuit outputs can be simulated with
irsim> h b
irsim> c
ins=011 f=0 c=1 b=1 a=0
time = 4.00ns
irsim> l b
irsim> h a
irsim> c
The “c 2” command tells IRSIM to cycle through the clock vectors states twice instead of just once. Now
redefine the clock vector to cycle through a gray code three times instead of counting in normal binary.
irsim> clock ins 000 001 011 010 110 111 101 100
irsim> c 3
ins=100 f=1 c=0 b=0 a=1
time = 40.00ns
irsim>
Anything that you see in irsim from now on will be into the file called “mylogfile”. When you're done
recording, type
irsim> logfile
This example runs through all many different possible combinations of inputs. The waveforms will be
displayed in an analyzer window. You can run a .cmd file from the command line or within IRSIM. To
run the command file directly upon starting IRSIM, type
% irsim c5n.prm demo.irs -example.cmd
Or from the IRSIM prompt, type (make sure you place a white space between the ampersand and the
filename)
irsim> @ example.cmd
If all nodes are to be viewed with the analyzer window, the IRSIM command is
analyzer pin1, pin2, pin3, pin4, pin5, pin6, pin7, pin8, pin9, pin10, pin11, pin12, pin1b,
pin2b, pin3b, pin4b, pin5b, pin6, pin7b, pin8b, pin9b, pin10b, pin11b, pin12b
IRSIM can create the same expression using its node name expansion operator {start:stop}, where
start is the first number of the expansion sequence, and stop is the last number of the expansion
sequence. For example, the verbose IRSIM command above is equivalent to the shortened IRSIM
command
analyzer pin{1:12}, pin{1:12}b