Ext2spice
ext2spice - convert from .ext format to .spice format
ext2spice [d defs] [-mnNost] [-c cmin] [-w delataW] [-l nodeLenBarfLimit] extfile
If you get negative perimeters or areas, you probably did not set the extract style correctly in magic. If your version of magic has an extract style such as ext2spice=0.6, you should use that style when extracting (in this case for a 1.2 micron process). See below for a description of what's in the special extract style.
ext2spice reads a file in .ext format and creates a new file in .spice format. The output consists of a list of subcircuits, containing capacitors and transistors. Each .ext file is transformed into a spice subcircuit. The transistor specifications include areas and perimeters of source and drain regions (AS AD PS and PD spice parameters). In order to obtain accurate areas and perimeters, the user may have to alter the extract section of the magic technology file (see below). If your version of magic already supports ext2spice, it will have extract styles with names like ext2spice=1.0 or ext2spice=0.6 (to be used for 2um scmos and 1.2um scmos, respectively). To see a list of the extract styles available in magic, type "extract style". To set the extract style for the 2um process, type "extract style ext2spice=1.0". It might be a good idea to put this in your .magic file.
Any node name ending in the character '!' is assumed to be universal. Thus, ext2spice will electrically connect the node 'Vdd!' in one cell to the node 'Vdd!' in all other cells, whether or not they are physically connected. Identically named nodes that do not end in '!' will only be shorted together if they are present in the same instance of the same cell.
The user can control what identification number ext2spice gives to any particular transistor. The program looks to see if the gate argument is of the form Mx[xx..] where x's are integers. If that is the case, then in the .spice file, the fet will be identified by Mx[xx..]. In order to get magic to place a gate argument in the .ext file, a label must be placed within the channel region of the fet, and the label must end with the character '^'. For example, the label 'M12^' would cause the attached transistor to be identified as 'M12'. A transistor whose identification number is not specified will be issued one by ext2spice.
The user can also specify which terminal of the transistor is the source, and which one is the drain. In this case, at least one terminal attribute must be S or D. Both terminals may be labeled, but one is sufficient. In order for magic to place terminal attributes in the .ext file, the label S$ or D$ must be placed on the junction between the channel and the diffusion.
When merging parallel transistors (see -m below) it is sufficient to label only one of the transistors in order to specify the identification number and source-drain orientation of the merged transistor. However, both Mx and S or D labels should be placed on the same transistor. S or D labels on transistors other than the one(s) with Mx labels may be lost during the merging process.
The possible options are:
m Merge parallel transistors (if they have the same gate length) into an equivalent, wider transistor.
n Print all of the node names with their node numbers at the end of each subckt definition.
N Print all of the node names with their node numbers into a separate .names file. (-n and -N are mutually exclusive).
o Print nodes one per line in subcircuits. May make it easier to read.
t Use a top-down strategy to create node names. Generally, this will result in the shortest nodenames.
s Use the string (alphanumeric) nodenames generated by magic instead of using node numbers. This option overrides node numbers defined in the "defs" file. However, if the name is something like 54_435_27# (an unlabeled node in magic), ext2spice will just generate an integer number as the node name. Warning: this can cause errors if you labeled your nodes with integer names!
c cmin Do not output capacitors that are less than cmin femptoFarads. Default cmin is 1.0 femptoFarads.
l nodeLenBarfLimit
If you use this option, any node name longer than nodeLenBarfLimit characters will instead be renamed to an integer. Set this value to 16 to make hspice happy. Spice3 does not need this option. This option is only usefull with the s option.
.w deltaW
Subtract deltaW microns from the width of every transistor. This is applied before merging parallel transistors, so deltaW will be subtracted from every finger of fingered transistors.
.d defs is a definitions file. Within the defs file, the user may place the following commands, on separate lines:
The path command: path directorypath
Tells ext2spice in which directories to look for .ext files. ext2spice will look through each directory in the listed order, until it finds the .ext file. Directory names MUST BE SEPARATED BY BLANK CHARACTERS. Eg: path . ~burstein/magic ~burstein/magic/comp ~burstein/magic/opamp
The set command: set nodename number
causes the node with the label nodename to have the nodenumber "number" in the spice file. For example:
set GND! 0
set input 7
would set the node with the label 'GND!' to 0, and the node with the label 'input' to 7. In cmos, there are two special nodes, defined in the magic technology file which represent the bulk (substrate) connection of the transistors. (NMOS and PMOS are commonly used names). Generally, the user should SET THESE NODES TO THE SAME NODE as GND and Vdd.
The def command: def exttrans spicetrans flavor
specifies spice model name and flavor (n or p) for a fet. For example:
def pfet PMOS p
def nfet NMOS n
would cause the transistors identified as 'pfet' in the .ext file to have model name 'PMOS' is the .spice file. Likewise, 'nfet' transistors get the 'NMOS' model name. (These actually are the defaults.) The user must specify the actual model. It is necessary to specify the flavor so the program knows which type of diffusion to include in the source and drain area and perimeter calculations.
Two other commands - nrclass and prclass - tell ext2spice which resistance classes (as specified by the magic technology file) correspond to layers which contain pdiffusion and ndiffusion. (They are called resistance classes because magic thinks it is extracting areas and perimeters to calculate resistance. Instead, ext2spice uses it as part of the spice transistor description.) These commands have the form:
parea k
narea k
where k is an integer specifying the first or second or third ... resistance class. The default for narea is 1; for parea, 2.
Thus, if you use the defaults, the resist section of the extract section of the magic technology file should start with:
resist ndiff,ndc/active xxxxxx
resist pdiff,pdc/active xxxxxx
where xxxxxx is some resistance value (which is irrelevant to ext2spice since it ignores resistance).
Since spice will be modeling the gate capacitance and the source and drain area and perimeter capacitances, it would be redundant to include them as lumped capacitances . Therefore, it is best to set the ndc, ndiff, ntrans, pdc, pdiff, and ptrans area and perimeter capacitances to 0 in the magic technology file.
Diffusion areas that overlap between cells might not be measured correctly.
Ring shaped transistors might not extract correctly.
When a node is renamed to an integer, ext2spice does not check to see if there was a node labeled in magic with the same integer, so the nodes may be erroneously merged. For now, don't label nodes in magic with integers.
Report bugs to burstein@zabriskie.berkeley.edu