L-Edit designs may be simulated using either Spice (analog simulation) or SLS (switch level digital simulation). This document describes the creation of SLS files and the use of the SLS simulator.
This procedure requires the use of a Sun Unix machine. Most of you do not usually use the unix systems and therefore have not had unix accounts or unix passwords. Dave van Leeuwen has set up accounts for you and will help you to set up a unix password if you visit him in room A201c.
Before transfer to another tool we must save our L-Edit library in a portable format (in this case as a GDS II file).
The file should be saved where it can be accessed from your Unix account. Unix accounts live on a server called rockhopper, so if your username is "fjb23" then your unix home directory will be accessible as "\\rockhopper\fjb23".
File -> Export Mask Data -> GDSII... Export GDSII To File: [ \\rockhopper\<username>\<libname>.gds ] Export
Note that where <username> is shown above you should substitute your own username. Similary <libname> is the name of the L-Edit library and <cellname> is the name of the cell within that library that you want to simulate.
First ensure that the eXcursion X server is running on your PC so that you can see graphics generated by unix programs.
Start -> Programs -> eXcursion V7 -> eXcursion Server
Open a Telnet terminal window on the sun machine named hydra.
Start -> Run Run Open: [ telnet hydra ] OK
When asked for username and password remember to give your Unix password rather than your PC password.
Request a listing of your unix directory so that you can check that the GDS II file "<libname>.gds" has been saved correctly.
ls
Run the netlist and simulate script with appropriate arguments
spacesls <libname>.gds <cellname>
If all goes well an editor window will open for you to edit the simulation stimulus file "<cellname>.cmd".
Note that unix machine is case sensitive (hence FRED.GDS is not the same file as fred.gds). If the command fails to work, check the directory listing to see that you have typed the GDS II filename correctly. Also check that <cellname> does exist within the original library.
Set up the stimulus for your simulation
The default stimulus will set the VSS node to logic 0 (low: l*~ ) and the VDD node to logic 1 (high: h*~ ) while all other i/o pins will be undriven (floating: f*~ ). The following shows the default stimulus for a NAND gate with inputs IN_A and IN_B and an output OUT:
# Identify power supply if possible # set VSS = l*~ set VDD = h*~ # Assign other i/o floating # set IN_A = f*~ set OUT = f*~ set IN_B = f*~
Remember that i/o can only be identified if you have placed ports on the correct layer within your design. The power supply is identified merely by name so if you have named your VSS port Ground (rather than VSS) it will not be recognised and will be initially assigned floating.
To run a useful simulation we must drive the inputs with low and high values:
set IN_A = l*4 h*8 l*~ set OUT = f*~ set IN_B = l*8 h*8 l*~
Note that "l*4" indicates that the signal is driven low for 4 time periods. The full sequence for IN_A, "l*4 h*8 l*~ ", takes the signal low for 4 time periods then high for 8 time periods then low for the rest of the simulation. The "*~ " represents the time period forever. Thus "set VDD = h*~ " sets the VDD signal high forever as expected for a power supply.
The output is left floating since we wish to observe it's behaviour rather than control it. On rare occasions you may wish to initialise a value on an output of a latch using a sequence like "set Q = l*1 f*~ ". This is not recomended since it cannot be done once the chip is fabricated. If you need to do this sort of initialisation then your latch should be provided with a reset facility.
The full stimulus describes the set of waveforms shown below. Note that in this sequence we change only one input at a time such that we can easily identify the cause of any change in the output.
Run the simulation
Simply save the modified "<cellname>.cmd" file from the editor and then exit the editor window. This will trigger the rest of the Netlist and Simulate script. If all goes well a new window will be opened showing the resulting waveforms.
Note that the waveforms are truncated at the last change in any signal (in this case at time 16 when In_B falls).
Obtain a hard copy of waveform display
File -> Print Simeye Print Dialog Print Command: [ lpr -P eleccae2_hp4 ] Print
"lpr -P eleccae2_hp4" is the unix print command to send a file to the HP printer in the CAE2 lab.
Exiting from the waveform window will finish the script leaving you at the unix prompt.
Changing the stimulus
If you re-run the script you can change the stimulus to achieve a different simulation. Using the option "-simonly" avoids re-running the netlist stage of the operation:
spacesls -simonly <libname>.gds <cellname>
Regenerating the default stimulus
By default the script uses a previously generated stimulus file as the basis for any new simulation. If you change the ports on your design you may wish to regenerate a new default stimulus file. This can be done using the "-gencmd" option:
spacesls -gencmd <libname>.gds <cellname>
Other stimulus options
-cmd <cmdfilename>
This option allows you to specify an alternative stimulus file that you have prepared prior to invoking the simulation script. By default the chosen stimulus file is not edited before simulation.
For example you may use the same stimulus for a 2 input NAND gate and a 2 input NOR gate (where the inputs and outputs have the same names in both gates):
spacesls MY_LIB.gds MY_NAND2 cp space/MY_LIB.prj/MY_NAND2.cmd GATE2.cmd spacesls -cmd GATE2.cmd MY_LIB.gds MY_NOR2
Note that the unix copy command, "cp", is used to copy the stimulus that you have developed for the "MY_NAND2" gate which is found in the "space/MY_LIB.prj/" subdirectory. The new stimulus file, named "GATE2.cmd", is used in the second simulation.
-cpcmd <cmdfilename>
This option copies a previously created stimulus file to be used as a base stimulus for a new simulation. By default the copied stimulus file is edited before simulation.
For example you may wish to base the stimulus for a half adder gate on the stimulus for the NAND gate (here we cannot use the exact same stimulus file since the half adder has 2 outputs while the NAND gate has only one):
spacesls -cpcmd GATE2.cmd MY_LIB.gds MY_HA
-edit
This option is usually used in conjunction with the -cmd option to indicate that the chosen stimulus file should be edited before simulation.
-noedit
This option indicates that the stimulus file selected does not require editing before simulation. The option might be used to override the default action for the "-cpcmd" option or simply to re-run the previous simulation.
Repetitive Stimuli
It is useful to be able to define signal sequences that repeat. The following specifies two anti-phase clock signals each with a cycle length of 4 time periods. The simulation will include 10 cycles of each clock.
set CK1 = (h*2 l*2)*10 set CK2 = (l*2 h*2)*10
When simulating clocked circuits you should ensure that other inputs don't change at the same time as the clock. This helps us to distinguish changes in outputs caused by the clock and those caused by other inputs. It also helps to avoid set-up and hold violations.
Simulation Duration
By default the simulation will terminate when all signals have finished changing. You can set a shorter duration by using a command such as the following in the stimulus file:
set simperiod = 50
This is necessary if you have set up a an endless sequence of changes on an input such as might result from the following clock specification:
set Clock = l*3 (h*2 l*2)*~
If this clock specification is used without the simperiod setting, it will prevent the simulation from completing.
The SLS simulator documentation is available on-line. Type the following at the unix command prompt:
ghostview /usr/local/pcks/cad/1.0/cacd/doc/slsman.ps
Iain McNally
4-3-2003