Instructions for using Spice (Spice3)
Before starting, run the "typescript" command.
This way you will have a log of your work.
Make any changes in another window, and comment what you are doing
with the "echo" command.
- start magic. Load the
circuit to check, and make any changes (e.g. from the
returned homework). Be sure your inputs and outputs are labelled.
Do not use "input" as an input name.
Also label "Vdd!" and "GND!".
- type ":extract" and quit magic.
This step creates a file with a ".ext" extension,
such as "inverter.ext". See the note below if you have problems.*
- type "ext2spice -f spice3 filename"
(e.g. replace filename with "inverter").
This step takes the .ext file and makes it a .spice file.
All of these files are text files, so you can examine them if you like
(using "vi" or "more" or "cat").
- Use the following
.cir
file
Change the file to include your spice file
(about line 4) as needed.
You do not need to understand everything about this file. Most of it
instructs the simulation software how to deal with the n-type and
p-type transistors.
Any line that begins with an asterisk "*" is a comment.
Change the last few lines to correspond to the inputs.
Every input should have a line specifying what it is. You can use
0 or 5 volts DC (like in the GND / Vdd lines), but a PULSE lets you
see more possibilities.
You may also need to alter the "Vin" line to reflect the label
you used.
- run the command "spice3"
The main commands to know are below. Typically, you would type these
in the order given.
- source filename.cir
This loads your file.
- run
To run the simulation.
- plot signal1 signal2 ...
This plots the signals you want (typically inputs and output).
Troubleshooting
If you have problems, here are some things to check.
- Check your connections in magic.
Just because you have two materials overlap does not mean there is
a connection! (except, of course, for poly and p/n-diff).
- Be sure your inputs and outputs are labelled in magic.
- Do not label extra things like "pdiff".
- Use "Vdd!" and "GND!" as labels for the power connections.
- Do not use "input" as an input name.
When in doubt label it "Vinput" or "Vinput1".
- You do not need to add a line to the .cir file for you output.
- Be consistent with your labels.
If you change the label names in magic, but sure to do all of the
other steps.
See the following link for
an example of running Spice3.
* Note: I've seen some strange things happen when the materials used
are incorrect. Specifically, magic does not handle using
pwc and nwc in place of pdc and ndc,
respectively. The "extract" command generated a warning, but the warning
was not specified. Also, the p-mos transistor turned black! If you see
strange behavior like this when you try to "extract" your design,
double-check the materials used.
For More Information:
- http://carmaux.cs.gsu.edu/~mweeks/csc4250
- http://tuttle.merc.iastate.edu/ee333/spice/pspicetutorial/basics/pspicebasics.htm
- http://www.ee.siue.edu/faculty/adgrego/classes/ece326/PSPICEtutorial.pdf
- http://www.ece.arizona.edu/~ece507/
- http://people.msoe.edu/~meier/tutorials/spicehow-to.html