Documente Academic
Documente Profesional
Documente Cultură
An Introduction to S-Edit
Hadi Esmaeilzadeh hadi@cad.ece.ut.ac.ir
Viewing Modes
S-Edit has two viewing modes, Schematicmode and Symbol mode. When you create an instance of a basic device (such as a transistor) or a larger functional unit (such as an inverter), you use a symbol to represent the smaller device or unit within the larger module. To create or modify the symbol itself, you operate in Symbol mode. When you define the connectivity of modules, you use a schematic. Schematics show the relationship of basic circuit elements, such as transistors, to larger functional units, such as inverters or gates. To create or view a schematic, you operate in Schematic mode. Use View > Symbol Mode and View > Schematic Mode to switch between modes. You can also switch between modes by typing a question mark (?).
Symbol Mode
Symbols consist of drawn shapes, ports, and properties. To create a symbol, create a new module (Module > New) and switch to Symbol mode. Then: Use the Box, Polygon, Line, Circle, and Comment tools to create the modules graphic representation. For more information on these tools Use the Port tools to place ports, the modules points of connection to other design objects Use the Property tool to specify how the module will be described in exported netlists. A modules properties can characterize its physica parameters, such as length, width, and perimeter; its nonphysical parameters, such as device type and comments; and its output strings, which specify the exact form of the SPICE, NetTran, or TPR description and identify lowest level of hierarchy for netlist output.
Schematic Mode
Schematics define the connectivity of primitives and lower-level modules within higher-level modules. Schematics show how smaller functional units or basic devices (such as transistors) are connected to form higher-level units (such as inverters). Schematics consist of five basic elements: Module instances appear as symbols. Module instances have pins, which indicate possible connection points for other objects. For more information on module instances. Wires connect module instances to one another. Ports identify signals connected to the module or its instances. Ports on a modules schematic must correspond in name and type to ports on its symbol. Ports also identify and label nodes in the schematic. Annotation objectsboxes, circles, polygons, lines, and comments document or illustrate a schematic. Labels identify and name nodes in the schematic. Unlike ports, they do not show where signals are connected to the module, nor do they necessarily correspond to ports in the module symbol.
The file spice.sdb is a library containing modules for various SPICE primitives. If it is not already loaded, click on Add Library to obtain a Windows file browser. Navigate to the tspro\library directory and select the file spice.sdb. Click on OK.
In the Symbol Browser dialog, select capacitor from the module list and click on Place. S-Edit will copy the module capacitor in spice.sdb into schemex.sdb. Click on Close to close the Symbol Browser dialog box. The current file and module will be schemex.sdb:Module0. Use Module > Open to examine the module list for schemex.sdb. The list will contain the module capacitor. The letter C next to the modules name means that the module has been changed (or added) since the file was last saved. Use the File > Save As command to save the changes, specifying a drive, directory, and new name for the file (for example, schemex1.sdb).
Creating a Schematic
In this subsection, you will instance modules and connect them by wire to create a schematic. If necessary, switch to Schematic mode. Activate the Module Instance tool , then click with the DRAW button in the Work Area. The resulting dialog box contains a list of available modules. Highlight N_4 and click OK. Select this transistor and drag it to the lower half of the Work Area (using the MOVE-EDIT button). Instance module P_4 in the same way, but position it in the upper half of the Work Area. Both transistors are now visible in the schematic. The four open circles on the ends of the transistors represent pins, at which other schematic objects can be connected to the instances. Drag the two transistors together so that the top pin of the NMOS transistor lies over the bottom pin of the PMOS transistor. The open circles will disappear, indicating that the transistors are connected. The schematic will look like this:
Activate the Wire tool and draw wires to connect the transistors: PMOS gate to NMOS gate, PMOS bulk to PMOS drain, and NMOS bulk to NMOS drain. The Wire tool looks like this: For each wire, click the DRAW mouse button to place the first vertex; move the mouse and click the DRAW button again to place another vertex, and so on; click the END mouse button to place the last vertex and finish the wire. When you have drawn the wires, the schematic will look like this:
There are four types of regular ports. Each has a different appearance for the sake of design readability, but in function they are identical.
Input ports (for input signals) Output ports (for output signals) Other (for any other kind of signal)
Activate the appropriate Port tool and add create the input and output nodes to the schematic. To draw a port, click any mouse button over the desired port location. In the resulting dialog box, name the port and click OK. Position the input port on the left side of the schematic and the output port on the right side.
Activate the Wire tool and connect these ports to the instances. When you have finished, the schematic will look like this.
vertex, and so on; finally, click the END button to place the last vertex. Leave the schematic page (the part of the module viewable in Schematic mode) empty. When you have finished drawing the Ground symbol, it will look like this:
Creating a Symbol
In this subsection, you will create a symbol for the inverter. Switch to Symbol mode. Using lines, an all-angle polygon, and ports, draw the inverter symbol shown above, except for the circle.
Activate the Circle tool. Hold the DRAW button at the circles center, drag the circumference to the desired radius, and release the DRAW button. Use the Port tools to place input and output ports on the symbol. Make sure the names and types of the ports (Input, Output, Bidirectional, or Other) correspond exactly to the ports in Schematic mode. When you have finished drawing the module symbol, it should look like this:
Save your design file if you like. The tutorial directory contains the finished design in the file ringosc.sdb.
In this section, you will examine and manipulate properties, which determine how devices in your design are represented when it is exported to a netlist file. Use the Module > Open command to open module N_4. Switch to Symbol mode (see figure below).
All of the text objects in this symbol are properties. On the right side of the symbol are several transistor parameters: PD, AD, W, L,and so on. When you create a property, you can choose whether to show or hide its name, value, or name and value when the module is instanced. In the originating module, S-Edit will enclose hidden properties or property elements by square brackets, and they will be invisible in instances of the module. Both L and W are without brackets, so they are visible in instances.
Output Properties
Above the symbol is a property named SPICE OUTPUT. An output property defines how instances of this transistor will appear in a SPICE-format file. The value of this property (or any other property) obeys a special syntax. The SPICE OUTPUT string is:
M${Instance} %{D} %{G} %{S} %{B} NMOS W=${W} L=${L} AS=${AS} AD=${AD} PS=${PS} PD=${PD}
The table below shows the output results of the various parts of the SPICE OUTPUT string.
M, NMOS, L=, W=, AS=, AD=, PS=, PD=, [spaces]
The name of the node connected to the pin corresponding to the port named D. In this case, S-Edit writes the name of the node connected to the drain of the transistor instance instead of
%{D} in the output file. Likewise, %{G}, %{S}, and %{B} refer to the nodes connected to the
gate, source, and bulk pins of the transistor, and all take the names of ports on the symbol.
${W}, ${L}, ${AS}, ${AD}, ${PS}, ${PD}
The values of the properties named W, L, AS, and so on. In this case, 22u is substituted for ${W} in the output file, and likewise the assigned values for ${L}, ${AS}, and so on.
${Instance}
A special value called a predefined property. Predefined properties allow internal information (such as the name of the file, module, page, and instance) to be inserted in the output string. Instead of ${Instance}, S-Edit will write the name of the instance in the SPICE file.
Properties in Instances
Properties appear in instances of this module. Use Module > Open to open the module Inv. Switch to Schematic mode. Select the N_4 module instance and use the Edit > Edit Object command to edit the instances properties (see figure below).
The value of a property in its instanced module (the originating module) is its default value. When the
Default switch next to a property is on, the property will take its value from the symbol page of the
instanced module. You can also override the values assigned in the symbol for this instanceif you do, S-Edit will clear the Default check box for you. For this instance, the property named L represents the length of the transistor and the property named W represents the width of the transistor. The default values for these properties are 2u and 22u, respectively. Now, change the width and length for this instance only. If necessary, scroll down until the properties L and W are visible. Change the value of L from 2u to 5u. Change the value of W from 22u to 8u. Click OK. Since L and W are visible, the changed values appear on the schematic. Make a similar change to the PMOS transistor. Change the length and width of the P_4 instance to 5u and 12u, respectively. When you change the values of a property in an instance, the changes affect that instance only. To change the property value for all instances of a module, you must edit the property directly in the instanced, or originating, module. Open the module, switch to Symbol mode, select the property whose value is to be changed, and use the Edit > Edit Object command to change the value. When you have changed the value of a property in the instanced module, the value changes for that property in all instances of that module except those in which the Default switch has been turned off for the property. You can show or hide properties in the symbol for this instance. Select the N_4 module instance and use the Edit > Edit Object command. Scroll down until the SPICE OUTPUT property for this instance is visible. The propertys viewing parameter is set to None, meaning that the property is not visible in the schematic. Click All to show the SPICE OUTPUT propertys name and value. Click OK. The SPICE OUTPUT property now appearswith node names and property values substituted for the %{} and ${} stringsabove the transistor in the schematic.
Only this particular instance shows the SPICE OUTPUT property; other instances of the N_4 module are unaffected.
Exporting a Netlist
In this section, you will export a SPICE-format file describing the ring oscillator circuit. Before you export a SPICE-format file, you must define the primitive devices in your design. Primitive devices are basic circuit elements such as resistors, capacitors, and transistors for which there exist no further subcircuit descriptions in SPICE. You define a primitive device when you create a SPICE OUTPUT property for it. S-Edit treats all modules with SPICE OUTPUT properties as primitives. The library symbols contained in the file spice.sdb already have such output properties, so you do not need to create them. Open the module ringosc. Use the File > Export command. In the resulting dialog box, enter the name of the SPICE file to be exported in the Output file name field. The default value for this field is the name of the module being exported (ringosc). If you plan to simulate the SPICE file with T-Spice, turn on the Suppress .END in SPICE output switch.
When this option is switched off, S-Edit writes an .END command at the end of the SPICE file. Without the .END command, the resulting file can be included in other SPICE files. Click OK to export the file. The finished SPICE file resides in the same directory as schemex.sdb, and looks something like this:
* SPICE written by the Tanner Research schematic editor, S-Edit * Version: 2.00 August 25, 1997 14:52:13 .SUBCKT Inv A Gnd Out Vdd MP_4_1 Out A Vdd Vdd PMOS W=22u L=2u AS=66p AD=66p PS=24u PD=24u MN_4_1 Out A Gnd Gnd NMOS W=22u L=2u AS=66p AD=66p PS=24u PD=24u
.ENDS * Main circuit: ring C1 N7 Gnd 10pF XInv_7 N7 Gnd A Vdd Inv XInv_6 N6 Gnd N7 Vdd Inv XInv_5 N5 Gnd N6 Vdd Inv XInv_4 N4 Gnd N5 Vdd Inv XInv_3 N3 Gnd N4 Vdd Inv XInv_2 N1 Gnd N3 Vdd Inv XInv_1 A Gnd N1 Vdd Inv * End of module with no ports: ring
S-Edit has automatically generated subcircuit calls. The parameter list for the subcircuit Inv contains the parameters Vdd and Gnd. In the main circuit (the ring schematic) these two slots are connected to nodes called Vdd and Gnd. This is how S-Edit passes global nodes through the circuit hierarchy so that all modules can access these nodes. You can now simulate this circuit using T-Spice. A file called ringcmd.sp has been included in the tutorial directory. It contains commands to run a simulation of this circuit and requires the file ringosc.sp (the exported file). To run a simulation using T-Spice, click on the T-Spice button in the Command toolbar:
You can also use the Probe tool to examine the electrical properties of an object, node, or module instance.
Creating Properties
To create properties in a module, you must switch to Symbol mode. You can add, delete, or edit properties at any time, and you can override property values assigned in the original module with properties assigned in the instance. You can also choose to show or hide a propertys name or value. Use the Property tool (F7) to create properties.
Activate the Property tool and click with the DRAW button at the desired point. A dialog box appears.
Name Value
A unique name for each property in a given symbol. A number or alphanumeric string which becomes the default value for the property, passed on to instances of the module. You can override default values by editing individual instances in Schematic mode. The character between the propertys name and value when displayed on the screen. For example, for a property displayed as w=4.0, the separator character is =. The height of the text (in locator units) used to display the property. In Schematic mode, none of the propertys fields (name, separator character, value) are displayed with the instances symbol. In Symbol mode in the original module, the property is displayed in square brackets [ ]. In Schematic mode, only the propertys value is displayed with the instances symbol. In Symbol mode in the original module, the propertys name and separator character are displayed in square brackets [ ]. In Schematic mode, all of the propertys fields (name, separator character, and value) are displayed with the instances symbol. The same holds true in Symbol mode in the original module. Defines Value as an integer. Defines Value as a floating-point number. Defines Value as an alphanumeric character string. The string may contain tokens that are parsed and expanded to take context-specific values
Separator character
Show: Name and Value Value Type: Integer Value Type: Real Value Type: Text
Property Tokens
Property tokens are used to count module instances, to reference ports or other properties, or to format property outputs. S-Edit interprets property tokens in instances (when shown in Schematic mode) or during export to a netlist. S-Edit parses all other text without expansion. The following table lists property tokens and their interpreted form. Token Interpreted form
# ${ property} %{ port} [ tokens ]
An incremented integer that counts the instances of the module. (This token is only interpreted during netlist export.) The value of the named property (as a string) or the indicated predefined property value The braces are required. The name of the node to which the pin associated with the named port is attached. The braces are required. The square brackets enclose optional information. If defined property and port references are enclosed by square brackets, S-Edit interprets them normally. If individual references enclosed by brackets are undefined, S-Edit simply omits all references within the brackets and does not report any errors. Newline (\n) or tab (\t) characters. An escape character. Use the backslash before a reserved character to instruct S-Edit to insert that character instead of interpreting it. The following characters, excluding commas, are reserved: \, #, $, %, {, }, [, ], n, t.
\n \t \
Predefined Properties
Certain property values are predefined by S-Edit. Predefined properties take their values from the current module, not the module being instanced. These values appear in instances when the properties are visible. The syntax of a predefined property value is ${ predefined_property}, where predefined_property is one of the types listed below: Property
Author Org Info File Module Page Instance Created Modified
Information or source
Author field of the Module > Info dialog box Org field of the Module > Info dialog box Info field of the Module > Info dialog box
Current file name (without path) Current module name Current page name Instance name Date and time of the modules creation Date and time of the modules last modification
For example, if token ${Module} is the value of property P belonging to module A, and module A is instanced in module B, then the token expands so that the instance is displayed in Schematic mode with the string P = B. Note that predefined properties take precedence over normal properties. For example, if a module contains a property named File and you reference this property in another propertyusing a token such as ${File}S-Edit will display the value of the predefined property, not the value of the File property you created.
Output Properties
Output properties identify a module as a primitive module, or subcircuit, instanced in a higher-level module. Output properties also specify the netlist representation of a module. There are five types of output properties, corresponding to particular output formats:
SPICE OUTPUT SPICE PARAMETER TPR OUTPUT EDIF PRIMITIVE VHDL PRIMITIVE NETTRAN OUTPUT
An output property must have one of these names, and its value type must always be string. When a module contains an output property appropriate to the format being exported, S-Edit writes an appropriate string to the netlist. Otherwise, S-Edit treats the module as a call to a subcircuit, and the schematic of the module as the subcircuit description. If the modules schematic pages are empty, SEdit writes either an empty subcircuit definition block (in SPICE format) or indicates an error (in NetTran and TPR formats). You can specify output property values in the original module with tokens and normal text, just as you do other properties. When exporting a netlist, S-Edit collects the various output properties from individual module instances and formats their information accordingly. One other important use of the SPICE OUTPUT property is to include SPICE simulation commands in its value. S-Edit will write these commands to the netlist, the T-Spice will simulate the design accordingly. An output property must have one of the following names:
SPICE OUTPUT
The value of this property expands into a string that describes the module as a primitive device in a SPICEformat netlist. If the module does not contain a SPICE OUTPUT property, S-Edit will write an empty subcircuit definition block in a SPICE-format netlist. The value of this property is a list of names of other properties on the same symbol which are to be passed to subcircuits as parameters. Individual output property names must be separated by a space. Property names that contain spaces must be enclosed in double quotes. The value of this property expands into the string that describes either a call to a NetTran macro or a reference to a NetTran macro file. The value of this property is not written to the netlist. Instead, it instructs S-Edit to export the module as a pad or as a regular cell in a TPR-format netlist. S-Edit will consider the module a pad if and only if the value of the TPR OUTPUT property is CP. If the module does not contain a TPR OUTPUT property, S-Edit will not extract it as a primitive of a TPR netlist. This property instructs S-Edit to export the module to an EDIF netlist as a primitive device. S-Edit ignores the property value for netlist output. This property instructs S-Edit to export the module to a VHDL netlist as a primitive device. S-Edit ignores the property value for netlist output.
SPICE PARAMETER
Reference
Tanner EDA, T-Spice Pro User Guide