#af.saveCell( cell, CRL.Catalog.State.Views )
plugins.RSavePlugin.ScriptMain( **kw )
-def alu_hier(**kw):
+def connect ( instanceRef, pin, netRef ):
+ instance = instanceRef
+
+ if isinstance(netRef,str):
+ net = self.getNet( netRef )
+ else:
+ net = netRef
+
+ masterNet = instance.getMasterCell().getNet(pin)
+ if not masterNet:
+ print '[ERR] Master cell "%s" of instance "%s" no connector named "%s".' \
+ % (instance.getMasterCell().getName(), instance.getName(), pin)
+
+ instance.getPlug( instance.getMasterCell().getNet(pin) ).setNet( net )
+
+def place ( instanceRef, x, y, orient ):
+ print "place", instanceRef, x, y, orient
+ instance = instanceRef
+ instance.setTransformation ( Transformation( x, y, orient ) )
+ instance.setPlacementStatus( Instance.PlacementStatus.PLACED )
+
+def createInstance ( cell, instanceName, modelRef, portmap={}, transf=None ):
+ instance = cell.getInstance( instanceName )
+ if instance:
+ print "found instace", instance
+ return instance
+ if isinstance(modelRef,str):
+ model = af.getCell( modelRef, Catalog.State.Views )
+ else:
+ model = modelRef
+ instance = Instance.create( self.cell, instanceName, model )
+ for pin, net in portmap.items():
+ connect( instance, pin, net )
+
+ print "create transf", transf
+ if transf:
+ place( instance, transf[0], transf[1], transf[2] )
+ return instance
+
+################# SNX
+#
+
+def alu_hier_place(**kw):
editor = None
if kw.has_key('editor') and kw['editor']:
metal2 = DataBase.getDB().getTechnology().getLayer( 'metal2' )
metal3 = DataBase.getDB().getTechnology().getLayer( 'metal3' )
- ################# SNX
- #
-
- cell = af.getCell( 'add', CRL.Catalog.State.Views )
- cell = af.getCell( 'sub', CRL.Catalog.State.Views )
+ add = af.getCell( 'add', CRL.Catalog.State.Views )
+ sub = af.getCell( 'sub', CRL.Catalog.State.Views )
cell = af.getCell( 'alu_hier', CRL.Catalog.State.Logical )
if not cell:
print '[ERROR] Unable to load cell "snx.vst", aborting .'
ab = Box( l( 0.0 )
, l( 0.0 )
- , l( 3100.0 )
- , l( 4100.0 ) )
+ , l( 1200.0 )
+ , l( 600.0 ) )
UpdateSession.open()
cell.setAbutmentBox( ab )
- for i in range(16):
- Pin.create( cell.getNet('a(%d)' % i)
- , 'a(%d).0' % i
- , Pin.Direction.SOUTH
- , Pin.PlacementStatus.FIXED
- , metal3
- , l( 100.0*i + 50.0 ) , l( 0.0 ) # Position.
- , l( 2.0 ) , l( 2.0 ) # Size.
- )
- Pin.create( cell.getNet('b(%d)' % i)
- , 'b(%d).0' % i
- , Pin.Direction.SOUTH
- , Pin.PlacementStatus.FIXED
- , metal3
- , l( 100.0*i + 50.0 ) , l( 0.0 ) # Position.
- , l( 2.0 ) , l( 2.0 ) # Size.
- )
- Pin.create( cell.getNet('o(%d)' % i)
- , 'o(%d).0' % i
- , Pin.Direction.NORTH
- , Pin.PlacementStatus.FIXED
- , metal3
- , l( 100.0*i + 25.0 ) , l( 0.0 ) # Position.
- , l( 2.0 ) , l( 2.0 ) # Size.
- )
+ transf = (l(20.0), l(100.0), Transformation.Orientation.ID)
+ subi = createInstance(cell, "subckt_49_sub", sub)
+ place( subi, transf[0], transf[1], transf[2] )
+ print "sub place", subi
- Pin.create( cell.getNet('rst')
- , 'p_reset.0'
- , Pin.Direction.WEST
- , Pin.PlacementStatus.FIXED
- , metal2
- , l( 0.0 )
- , l( 140.0 )
- , l( 2.0 )
- , l( 2.0 )
- )
+ transf = (l(520.0), l(100.0), Transformation.Orientation.ID)
+ addi = createInstance(cell, "subckt_48_add", add)
+ place( addi, transf[0], transf[1], transf[2] )
+ print "add place", addi
+
+ if False:
+ for i in range(16):
+ Pin.create( cell.getNet('a(%d)' % i)
+ , 'a(%d).0' % i
+ , Pin.Direction.SOUTH
+ , Pin.PlacementStatus.FIXED
+ , metal3
+ , l( 100.0*i + 50.0 ) , l( 0.0 ) # Position.
+ , l( 2.0 ) , l( 2.0 ) # Size.
+ )
+ Pin.create( cell.getNet('b(%d)' % i)
+ , 'b(%d).0' % i
+ , Pin.Direction.SOUTH
+ , Pin.PlacementStatus.FIXED
+ , metal3
+ , l( 100.0*i + 50.0 ) , l( 0.0 ) # Position.
+ , l( 2.0 ) , l( 2.0 ) # Size.
+ )
+ Pin.create( cell.getNet('o(%d)' % i)
+ , 'o(%d).0' % i
+ , Pin.Direction.NORTH
+ , Pin.PlacementStatus.FIXED
+ , metal3
+ , l( 100.0*i + 25.0 ) , l( 0.0 ) # Position.
+ , l( 2.0 ) , l( 2.0 ) # Size.
+ )
+
+ Pin.create( cell.getNet('rst')
+ , 'p_reset.0'
+ , Pin.Direction.WEST
+ , Pin.PlacementStatus.FIXED
+ , metal2
+ , l( 0.0 )
+ , l( 140.0 )
+ , l( 2.0 )
+ , l( 2.0 )
+ )
UpdateSession.close()
if editor: editor.setCell( cell )
print "editor", editor, dir(editor)
- etesian = Etesian.EtesianEngine.create(cell)
- etesian.place()
-
- katana = Katana.KatanaEngine.create(cell)
- katana.digitalInit ()
- #katana.runNegociatePreRouted()
- print dir(katana)
- katana.runGlobalRouter (0)
- katana.loadGlobalRouting ( Anabatic.EngineLoadGrByNet )
- katana.layerAssign ( Anabatic.EngineNoNetLayerAssign )
- katana.runNegociate ( Katana.Flags.NoFlags )
- katana.finalizeLayout ()
- print dir(katana)
- success = katana.getSuccessState()
- katana.destroy()
-
- #af.saveCell( cell, CRL.Catalog.State.Views )
+ #af.saveCell( cell, CRL.Catalog.State.Views )
plugins.RSavePlugin.ScriptMain( **kw )
+ return 0
+
+################# SNX
+#
+
+def alu_hier_route(**kw):
+
+ editor = None
+ if kw.has_key('editor') and kw['editor']:
+ editor = kw['editor']
+
+ db = DataBase.getDB()
+ print db, dir(db)
+ metal2 = DataBase.getDB().getTechnology().getLayer( 'metal2' )
+ metal3 = DataBase.getDB().getTechnology().getLayer( 'metal3' )
+
+ cell = af.getCell( 'alu_hier', CRL.Catalog.State.Logical )
+ if not cell:
+ print '[ERROR] Unable to load cell "snx.vst", aborting .'
+ return False
+ kw[ 'cell' ] = cell
+
+ ab = Box( l( 0.0 )
+ , l( 0.0 )
+ , l( 1200.0 )
+ , l( 600.0 ) )
+
+ cell.setAbutmentBox( ab )
+
+ if editor: editor.setCell( cell )
+
+ print "editor", editor, dir(editor)
+
+ if True:
+ etesian = Etesian.EtesianEngine.create(cell)
+ #etesian.place()
+
+ katana = Katana.KatanaEngine.create(cell)
+ katana.digitalInit ()
+ katana.runNegociatePreRouted()
+ print dir(katana)
+ katana.runGlobalRouter (0)
+ katana.loadGlobalRouting ( Anabatic.EngineLoadGrByNet )
+ katana.layerAssign ( Anabatic.EngineNoNetLayerAssign )
+ katana.runNegociate ( Katana.Flags.NoFlags )
+ katana.finalizeLayout ()
+ print dir(katana)
+ success = katana.getSuccessState()
+ katana.destroy()
+ else:
+ success = 0
+
+ #af.saveCell( cell, CRL.Catalog.State.Views )
+ plugins.RSavePlugin.ScriptMain( **kw )
+
+ print "cell", cell, dir(cell)
+ c = cell.getComponentsUnder(0)
+ print "components", c, dir(c)
+ c = cell.getSlaveInstances()
+ print "components", c, dir(c)
+
return success
if __name__ == '__main__':
- success = add()
- success = sub()
- #success = alu_hier()
+ #success = add()
+ #success = sub()
+ success = alu_hier_place()
+ success = alu_hier_route()
shellSuccess = 0
if not success: shellSuccess = 1