2010-11-22 08:44:27 -06:00
|
|
|
import sys
|
|
|
|
|
2010-09-02 05:31:55 -05:00
|
|
|
from OPENCHAMS import *
|
|
|
|
|
2010-11-22 08:44:27 -06:00
|
|
|
def printContents(circuit):
|
|
|
|
print circuit.name
|
|
|
|
# circuit parameters
|
|
|
|
print " + parameters"
|
|
|
|
for param in circuit.parameters.getValues():
|
|
|
|
print " | |", param.key, ":", param.value
|
|
|
|
for param in circuit.parameters.getEqValues():
|
|
|
|
print " | |", param.key, ":", param.value
|
|
|
|
# netlist
|
|
|
|
print " + netlist"
|
|
|
|
# instances
|
|
|
|
print " | + instances"
|
|
|
|
for instance in circuit.netlist.getInstances():
|
|
|
|
if isinstance(instance, Device):
|
2011-07-21 04:20:20 -05:00
|
|
|
print " | | +", instance.name, ":", instance.model, instance.order, instance.mosType, instance.sourceBulkConnected
|
2010-11-22 08:44:27 -06:00
|
|
|
else:
|
2011-07-21 04:20:20 -05:00
|
|
|
print " | | +", instance.name, ":", instance.model, instance.order
|
2010-11-22 08:44:27 -06:00
|
|
|
print " | | | + connectors"
|
|
|
|
for conn in instance.getConnectors():
|
|
|
|
print " | | | |", conn.key, ":", conn.value.name
|
|
|
|
if isinstance(instance, Device):
|
|
|
|
print " | | | + transistors"
|
|
|
|
for tr in instance.getTransistors():
|
|
|
|
print " | | | | name:", tr.name, "- gate:", tr.gate, "- source:", tr.source, "- drain:", tr.drain, "- bulk:", tr.bulk
|
|
|
|
# nets
|
|
|
|
print " | + nets"
|
2011-02-15 07:57:39 -06:00
|
|
|
schematicNet = False
|
2010-11-22 08:44:27 -06:00
|
|
|
for net in circuit.netlist.getNets():
|
|
|
|
print " | | +", net.name, ":", net.type, net.external
|
|
|
|
print " | | | + connections"
|
|
|
|
for conn in net.getConnections():
|
|
|
|
print " | | | | %s.%s"%(conn.instanceName, conn.connectorName)
|
2011-02-15 07:57:39 -06:00
|
|
|
if not net.hasNoPorts() or not net.hasNoWires():
|
|
|
|
schematicNet = True
|
2010-11-22 08:44:27 -06:00
|
|
|
# schematic
|
|
|
|
if (circuit.schematic):
|
2011-02-15 07:57:39 -06:00
|
|
|
print " + schematic"
|
2010-11-22 08:44:27 -06:00
|
|
|
for instance in circuit.schematic.getInstances():
|
2011-03-10 04:42:30 -06:00
|
|
|
print " | + instance name:", instance.key, "- x:", instance.value.x, "- y:", instance.value.y, "- orientation:", instance.value.orientation
|
2011-02-15 07:57:39 -06:00
|
|
|
if schematicNet:
|
|
|
|
for net in circuit.netlist.getNets():
|
|
|
|
if net.hasNoPorts() and net.hasNoWires():
|
|
|
|
continue
|
|
|
|
print " | + net name:", net.name
|
|
|
|
for port in net.getPorts():
|
2011-03-10 04:42:30 -06:00
|
|
|
print " | | + port type:", port.type, "- idx:", port.index, "- x:", port.x, "- y:", port.y, "- orientation:", port.orientation
|
2011-02-15 07:57:39 -06:00
|
|
|
for wire in net.getWires():
|
|
|
|
if isinstance(wire.startPoint, InstancePoint):
|
|
|
|
print " | | + wire <" + wire.startPoint.name.getString() + "," + wire.startPoint.plug.getString() +">"
|
|
|
|
elif isinstance(wire.startPoint, PortPoint):
|
|
|
|
print " | | + wire <" + str(wire.startPoint.index) + ">"
|
|
|
|
else:
|
|
|
|
print " - - UNKNOWN START POINT"
|
|
|
|
for point in wire.getIntermediatePoints():
|
|
|
|
print " | | <" + str(point.x) + "," + str(point.y) + ">"
|
|
|
|
if isinstance(wire.endPoint, InstancePoint):
|
|
|
|
print " | | <" + wire.endPoint.name.getString() + "," + wire.endPoint.plug.getString() +">"
|
|
|
|
elif isinstance(wire.endPoint, PortPoint):
|
|
|
|
print " | | <" + str(wire.endPoint.index) + ">"
|
|
|
|
else:
|
|
|
|
print " - - UNKNOWN END POINT"
|
2010-11-22 08:44:27 -06:00
|
|
|
# sizing
|
|
|
|
if (circuit.sizing):
|
|
|
|
print " + sizing"
|
|
|
|
for op in circuit.sizing.getOperators():
|
2011-07-21 04:20:20 -05:00
|
|
|
print " | + instance name:", op.key, "- operator:", op.value.name, "- simulModel:", op.value.simulModel
|
2010-11-22 08:44:27 -06:00
|
|
|
for constraint in op.value.getConstraints():
|
|
|
|
print " | | + param:", constraint.key, "- ref:", constraint.value.ref, "- refParam:", constraint.value.refParam, "- factor:", constraint.value.factor
|
|
|
|
print " | + equations"
|
|
|
|
for eq in circuit.sizing.getEquations():
|
|
|
|
print " | |", eq.key, ":", eq.value
|
|
|
|
# layout
|
|
|
|
if (circuit.layout):
|
|
|
|
print " + layout"
|
|
|
|
for inst in circuit.layout.getInstances():
|
|
|
|
print " | | instance name:", inst.key, "- style:", inst.value
|
|
|
|
|
|
|
|
def usage():
|
|
|
|
print "usage:", sys.argv[0], "[filename]"
|
|
|
|
sys.exit(48)
|
|
|
|
|
|
|
|
def main():
|
|
|
|
if len(sys.argv) == 1:
|
|
|
|
filename = "./inverter.xml"
|
|
|
|
elif len(sys.argv) == 2:
|
|
|
|
filename = sys.argv[1]
|
|
|
|
else:
|
|
|
|
usage()
|
|
|
|
|
|
|
|
circuit = Circuit.readFromFile(filename)
|
|
|
|
printContents(circuit)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|
2010-09-02 05:31:55 -05:00
|
|
|
|