EDA Solutions logo

Netlisting in S-Edit via Tcl Procedures

Published by Raymond Liu – Latest update: 21/9/2022

Relevant product(s): S-Edit
Operating systems: Windows/Linux RHEL 6 and above
Versions affected: All
Relevant area(s): Usage / Automation
ID: TN042

Summary

S-Edit allows running netlisting procedures in Tcl that would enable greater control over how your device or subcircuit can be netlisted. This guide will explain how to create a Tcl netlister for your devices, supported by examples.

Details

Netlisting directly from Tcl procedures

The attached files contain two examples. In this example, we will look at the Tcl script called “StringNetlister.tcl” in the ‘.scripts/open.design’ folder. This folder is hidden by default. Ensure ‘show hidden files’ is checked in the file explorer settings to view this folder.

Below are details on how this example was created:

  1. Create a Tcl file containing a procedure with a string variable. This procedure will return the string to the caller so it can be appended onto the netlist. Any formatting within the string, including new lines and indents, will get copied directly into the netlist.

    In the example, the procedure is called “netlistString” and returns the string set to “netlistText” (line 13). It shows simulator settings, adding comments to the netlist, creating a subcircuit and getting the file path property. The example also retrieves the value from the property “file_path” (line 4), which the user in S-Edit can edit.
 #This string will be appended to the netlist
    set netlistText "simulator lang=hspice
*****You can add comments here*****
.subckt example_nmos A B VSS VDD nmos
file=$path Example text
.ends"

This string above will be appended to the netlist

  1. Place the script in the directory ‘.script/open.design’ in the design folder. If this folder does not exist, create the folders manually. The design will now load the script automatically when it is opened in S-Edit. In the example, a message is displayed in the command window when the script is loaded successfully (line 17).
  2. Create a symbol and the properties you want to retrieve to export in the netlist. In our example, a symbol called “subcktDevice” is created with a property called “file_path”, which is stored under the “path” variable in the script (line 4).
  3. Create a property called “SPICE.netlistProcedure” in your symbol view. To call the procedure, type the procedure’s name in square brackets in the property field. In the example’s case, it is “[exampleprocedure]”.
  1. Your symbol is now set up to append the string to the netlist of any schematic that it is instanced in. Instance this symbol in a schematic and export the netlist. In the example, “subcktDevice” will append the “netlistText” string (line 7) to the schematic it is instanced in, “subcktSchem”.

Parameterising a device using netlisting procedures

The attached files contain a second example in “ParamDevices.tcl”. This is an applied example showing how to create a parameterised primitive device using netlisting procedures.

  1. Create the netlisting procedure. In the procedure, use the ‘property get’ command to retrieve properties from the device.
    This example creates a string called “deviceStr” and concatenates variables that the user inputs to netlist a primitive device. The properties include the name of the instance, the nets that the pins are attached to, the cell name and the device’s parameters. The example also includes a callback procedure, “wtot_calc”, that calculates the total width of the device.
#Get device parameters
    set paramList {l nf wf wtot}
    foreach param $paramList {
        if {[property get $param -exists]} {
            set deviceStr [join [list $deviceStr $param=[property get $param -evaluate]]]
        }
    }

This code searches for parameters listed in the variable “paramList”

  1. Place the script in the directory ‘.script/open.design’ in the design folder. In the example, a message is displayed in the command window when the script is loaded successfully (line 47).
  2. In your design, create a symbol with the same name as the model you want to parameterise and add the parameters that your procedure tries to get. In the example, the device is called “nmos”. The pins property, “pinList”, has the value “%%” which lists all the device’s ports. Then, call your procedure in the property “SPICE.netlistProcedure”, which is “[paramproc]” in the example. The callback is also added to the properties “nf” and “wf”.
  3. This device is now set up and can be now instanced in schematics. In the example, the “nmos” device is instanced in “nmosSchem” with the name “N1” and net labels were added to the ports.

Testing the netlisting procedure

Below are the exported netlists of the two guided examples. These netlists can also be found in the “ExportedNetlists” folder in the attached files.

Schematic “subcktSchem”:

Schematic “nmosSchem”:

References

Documentation on automatically running Tcl scripts: https://docs.sw.siemens.com/en-US/product/862138555/doc/DC202102053.docs.sedit_user.en_us/html/id6568ea2b-6487-4417-94b6-cfb4462bd56d

Tcl Commands – proc documentation: https://wwwTcl.tk/man/tcl/TclCmd/proc.html

Attachments

The netlisting procedures example is found here: https://we.tl/t-v3yhvaOqum