com.sun.electric.tool.io.output
Class Spice

java.lang.Object
  extended by com.sun.electric.tool.io.output.Output
      extended by com.sun.electric.tool.io.output.Topology
          extended by com.sun.electric.tool.io.output.Spice

public class Spice
extends Topology

This is the Simulation Interface tool.


Nested Class Summary
static class Spice.FlatSpiceCodeVisitor
           
 
Nested classes/interfaces inherited from class com.sun.electric.tool.io.output.Topology
Topology.CellAggregateSignal, Topology.CellNetInfo, Topology.CellSignal, Topology.MyCellInfo, Topology.Visitor
 
Nested classes/interfaces inherited from class com.sun.electric.tool.io.output.Output
Output.OutputCellInfo, Output.WriteJELIB
 
Field Summary
static Variable.Key CDL_TEMPLATE_KEY
          key of Variable holding generic CDL templates.
static Variable.Key SPICE_2_TEMPLATE_KEY
          key of Variable holding Spice 2 templates.
static Variable.Key SPICE_3_TEMPLATE_KEY
          key of Variable holding Spice 3 templates.
static Variable.Key SPICE_A_TEMPLATE_KEY
          key of Variable holding Smart Spice templates.
static Variable.Key SPICE_C_TEMPLATE_KEY
          key of Variable holding Smart Spice templates.
static Variable.Key SPICE_CARD_KEY
          key of Variable holding SPICE code.
static Variable.Key SPICE_CODE_FLAT_KEY
          key of Variable holding SPICE flat code.
static Variable.Key SPICE_DECLARATION_KEY
          key of Variable holding SPICE declaration.
static java.lang.String SPICE_EXTENSION_PREFIX
          Prefix for spice extension.
static Variable.Key SPICE_GC_TEMPLATE_KEY
          key of Variable holding GnuCap templates.
static Variable.Key SPICE_H_TEMPLATE_KEY
          key of Variable holding HSpice templates.
static Variable.Key SPICE_MODEL_KEY
          key of Variable holding SPICE model.
static Variable.Key SPICE_NETLIST_FILE_KEY
          key of Variable holding Spice model file.
static java.lang.String SPICE_NOEXTENSION_PREFIX
          Prefix for spice null extension.
static Variable.Key SPICE_P_TEMPLATE_KEY
          key of Variable holding PSpice templates.
static Variable.Key SPICE_SM_TEMPLATE_KEY
          key of Variable holding Smart Spice templates.
static Variable.Key SPICE_TEMPLATE_KEY
          key of Variable holding generic Spice templates.
 
Fields inherited from class com.sun.electric.tool.io.output.Topology
topCell
 
Fields inherited from class com.sun.electric.tool.io.output.Output
dataOutputStream, filePath, printWriter, quiet, stringWriter
 
Method Summary
protected  boolean canParameterizeNames()
          Method to tell whether the topological analysis should mangle cell names that are parameterized.
protected  void done()
          Method called once at the end of netlisting.
protected  void enterCell(HierarchyEnumerator.CellInfo info)
          Method called during hierarchy traversal.
protected  boolean enumerateLayoutView(Cell cell)
          Used to switch from schematic enumeration to layout enumeration
protected  java.lang.String getGlobalName(Global glob)
          Method to return the proper name of a Global signal
protected  java.lang.String getGroundName(Network net)
          Method to return the proper name of Ground
protected  java.util.Set<Variable.Key> getImportantVars(PrimitiveNode pn)
          Method to tell which Variables are important for primitive node in this netlister
protected  java.lang.String getPowerName(Network net)
          Method to return the proper name of Power
protected  java.lang.String getSafeCellName(java.lang.String name)
          Method to adjust a cell name to be safe for Spice output.
static java.lang.String getSafeNetName(java.lang.String name)
          Method to adjust a network name to be safe for Spice output.
protected  java.lang.String getSafeNetName(java.lang.String name, boolean bus)
          Method to adjust a network name to be safe for Spice output.
protected  Netlist.ShortResistors getShortResistors()
          Tell the Hierarchy enumerator how to short resistors
protected  boolean isAggregateNameGapsSupported()
          Abstract method to decide whether aggregate names (busses) can have gaps in their ranges.
protected  boolean isAggregateNamesSupported()
          Method to report that aggregate names (busses) are not used.
protected  boolean isCaseSensitive()
          Abstract method to decide whether netlister is case-sensitive (Verilog) or not (Spice).
protected  boolean isChooseBestExportName()
          Method to report that not to choose best export name among exports connected to signal.
protected  boolean isLibraryNameAlwaysAddedToCellName()
          Method to report that library names are NOT always prepended to cell names.
protected  boolean isNetworksUseExportedNames()
          Method to report that export names do NOT take precedence over arc names when determining the name of the network.
protected  boolean isSeparateInputAndOutput()
          Method to report whether input and output names are separated.
protected  int maxNameLength()
          Method to tell set a limit on the number of characters in a name.
 void multiLinePrint(boolean isComment, java.lang.String str)
          Formatted output to file "stream".
protected  java.lang.String parameterizedName(Nodable no, VarContext context)
          Method to create a parameterized name for node instance "ni".
protected  boolean skipCellAndSubcells(Cell cell)
          If the netlister has requirments not to netlist certain cells and their subcells, override this method.
protected  void start()
          Method called once by the traversal mechanism.
protected  void validateSkippedCell(HierarchyEnumerator.CellInfo info)
          Method called when a cell is skipped.
protected  void writeCellTopology(Cell cell, Topology.CellNetInfo cni, VarContext context, Topology.MyCellInfo info)
          Method called by traversal mechanism to write one level of hierarchy in the Spice netlist.
static void writeSpiceFile(Cell cell, VarContext context, java.lang.String filePath, boolean cdl)
          The main entry point for Spice deck writing.
 
Methods inherited from class com.sun.electric.tool.io.output.Topology
getCellNetInfo, getUniqueCellName, isShortExplicitResistors, isShortResistors, unIndexedName, writeCell, writeCell
 
Methods inherited from class com.sun.electric.tool.io.output.Output
closeBinaryOutputStream, closeStringsOutputStream, closeTextOutputStream, emitCopyright, exportCellCommand, getAreaToPrint, openBinaryOutputStream, openStringsOutputStream, openTextOutputStream, saveJelib, setContinuationString, setOutputWidth, writeCell, writeLibrary, writePanicSnapshot, writeWidthLimited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPICE_TEMPLATE_KEY

public static final Variable.Key SPICE_TEMPLATE_KEY
key of Variable holding generic Spice templates.


SPICE_2_TEMPLATE_KEY

public static final Variable.Key SPICE_2_TEMPLATE_KEY
key of Variable holding Spice 2 templates.


SPICE_3_TEMPLATE_KEY

public static final Variable.Key SPICE_3_TEMPLATE_KEY
key of Variable holding Spice 3 templates.


SPICE_H_TEMPLATE_KEY

public static final Variable.Key SPICE_H_TEMPLATE_KEY
key of Variable holding HSpice templates.


SPICE_P_TEMPLATE_KEY

public static final Variable.Key SPICE_P_TEMPLATE_KEY
key of Variable holding PSpice templates.


SPICE_GC_TEMPLATE_KEY

public static final Variable.Key SPICE_GC_TEMPLATE_KEY
key of Variable holding GnuCap templates.


SPICE_SM_TEMPLATE_KEY

public static final Variable.Key SPICE_SM_TEMPLATE_KEY
key of Variable holding Smart Spice templates.


SPICE_A_TEMPLATE_KEY

public static final Variable.Key SPICE_A_TEMPLATE_KEY
key of Variable holding Smart Spice templates.


SPICE_C_TEMPLATE_KEY

public static final Variable.Key SPICE_C_TEMPLATE_KEY
key of Variable holding Smart Spice templates.


SPICE_NETLIST_FILE_KEY

public static final Variable.Key SPICE_NETLIST_FILE_KEY
key of Variable holding Spice model file.


SPICE_CARD_KEY

public static final Variable.Key SPICE_CARD_KEY
key of Variable holding SPICE code.


SPICE_DECLARATION_KEY

public static final Variable.Key SPICE_DECLARATION_KEY
key of Variable holding SPICE declaration.


SPICE_MODEL_KEY

public static final Variable.Key SPICE_MODEL_KEY
key of Variable holding SPICE model.


SPICE_CODE_FLAT_KEY

public static final Variable.Key SPICE_CODE_FLAT_KEY
key of Variable holding SPICE flat code.


CDL_TEMPLATE_KEY

public static final Variable.Key CDL_TEMPLATE_KEY
key of Variable holding generic CDL templates.


SPICE_EXTENSION_PREFIX

public static final java.lang.String SPICE_EXTENSION_PREFIX
Prefix for spice extension.

See Also:
Constant Field Values

SPICE_NOEXTENSION_PREFIX

public static final java.lang.String SPICE_NOEXTENSION_PREFIX
Prefix for spice null extension.

See Also:
Constant Field Values
Method Detail

writeSpiceFile

public static void writeSpiceFile(Cell cell,
                                  VarContext context,
                                  java.lang.String filePath,
                                  boolean cdl)
The main entry point for Spice deck writing.

Parameters:
cell - the top-level cell to write.
context - the hierarchical context to the cell.
filePath - the disk file to create.
cdl - true if this is CDL output (false for Spice).

start

protected void start()
Method called once by the traversal mechanism. Initializes Spice netlisting and writes headers.

Specified by:
start in class Topology

done

protected void done()
Method called once at the end of netlisting.

Specified by:
done in class Topology

writeCellTopology

protected void writeCellTopology(Cell cell,
                                 Topology.CellNetInfo cni,
                                 VarContext context,
                                 Topology.MyCellInfo info)
Method called by traversal mechanism to write one level of hierarchy in the Spice netlist. This could be the top level or a subcircuit. The bulk of the Spice netlisting happens here.

Specified by:
writeCellTopology in class Topology

parameterizedName

protected java.lang.String parameterizedName(Nodable no,
                                             VarContext context)
Method to create a parameterized name for node instance "ni". If the node is not parameterized, returns zero. If it returns a name, that name must be deallocated when done.

Overrides:
parameterizedName in class Topology

getImportantVars

protected java.util.Set<Variable.Key> getImportantVars(PrimitiveNode pn)
Method to tell which Variables are important for primitive node in this netlister

Parameters:
pn - primitive node to tell
Returns:
a set of important variables or null if all variables may be important

getSafeCellName

protected java.lang.String getSafeCellName(java.lang.String name)
Method to adjust a cell name to be safe for Spice output.

Specified by:
getSafeCellName in class Topology
Parameters:
name - the cell name.
Returns:
the name, adjusted for Spice output.

getPowerName

protected java.lang.String getPowerName(Network net)
Method to return the proper name of Power

Specified by:
getPowerName in class Topology

getGroundName

protected java.lang.String getGroundName(Network net)
Method to return the proper name of Ground

Specified by:
getGroundName in class Topology

getGlobalName

protected java.lang.String getGlobalName(Global glob)
Method to return the proper name of a Global signal

Specified by:
getGlobalName in class Topology

isNetworksUseExportedNames

protected boolean isNetworksUseExportedNames()
Method to report that export names do NOT take precedence over arc names when determining the name of the network.

Specified by:
isNetworksUseExportedNames in class Topology

isLibraryNameAlwaysAddedToCellName

protected boolean isLibraryNameAlwaysAddedToCellName()
Method to report that library names are NOT always prepended to cell names.

Specified by:
isLibraryNameAlwaysAddedToCellName in class Topology

isAggregateNamesSupported

protected boolean isAggregateNamesSupported()
Method to report that aggregate names (busses) are not used.

Specified by:
isAggregateNamesSupported in class Topology

isAggregateNameGapsSupported

protected boolean isAggregateNameGapsSupported()
Abstract method to decide whether aggregate names (busses) can have gaps in their ranges.

Specified by:
isAggregateNameGapsSupported in class Topology

isSeparateInputAndOutput

protected boolean isSeparateInputAndOutput()
Method to report whether input and output names are separated.

Specified by:
isSeparateInputAndOutput in class Topology

isCaseSensitive

protected boolean isCaseSensitive()
Abstract method to decide whether netlister is case-sensitive (Verilog) or not (Spice).

Specified by:
isCaseSensitive in class Topology

getSafeNetName

protected java.lang.String getSafeNetName(java.lang.String name,
                                          boolean bus)
Method to adjust a network name to be safe for Spice output. Spice has a list of legal punctuation characters that it allows.

Specified by:
getSafeNetName in class Topology

enterCell

protected void enterCell(HierarchyEnumerator.CellInfo info)
Method called during hierarchy traversal. Called at the end of the enter cell phase.

Overrides:
enterCell in class Topology

isChooseBestExportName

protected boolean isChooseBestExportName()
Method to report that not to choose best export name among exports connected to signal.

Overrides:
isChooseBestExportName in class Topology

skipCellAndSubcells

protected boolean skipCellAndSubcells(Cell cell)
If the netlister has requirments not to netlist certain cells and their subcells, override this method. If this cell has a spice template, skip it

Overrides:
skipCellAndSubcells in class Topology

validateSkippedCell

protected void validateSkippedCell(HierarchyEnumerator.CellInfo info)
Method called when a cell is skipped. Performs any checking to validate that no error occurs.

Overrides:
validateSkippedCell in class Topology

getShortResistors

protected Netlist.ShortResistors getShortResistors()
Tell the Hierarchy enumerator how to short resistors

Overrides:
getShortResistors in class Topology

canParameterizeNames

protected boolean canParameterizeNames()
Method to tell whether the topological analysis should mangle cell names that are parameterized.

Overrides:
canParameterizeNames in class Topology

maxNameLength

protected int maxNameLength()
Method to tell set a limit on the number of characters in a name.

Overrides:
maxNameLength in class Topology
Returns:
the limit to name size (SPICE limits to 32 character names?????).

enumerateLayoutView

protected boolean enumerateLayoutView(Cell cell)
Description copied from class: Topology
Used to switch from schematic enumeration to layout enumeration

Overrides:
enumerateLayoutView in class Topology

getSafeNetName

public static java.lang.String getSafeNetName(java.lang.String name)
Method to adjust a network name to be safe for Spice output. Spice has a list of legal punctuation characters that it allows.


multiLinePrint

public void multiLinePrint(boolean isComment,
                           java.lang.String str)
Formatted output to file "stream". All spice output is in upper case. The buffer can contain no more than 1024 chars including the newlinelastMoveTo and null characters. Doesn't return anything.