if False:
VIA23 = DataBase.getDB().getTechnology().getLayer( 'VIA23' )
- UpdateSession.open()
+ #UpdateSession.open()
#net = cell.getNet('b(%d)' % 0)
net = cell.getNet('vdd')
build_downtrace(net, VIA23, metal2, -5, -10, -20)
build_downtrace(net, metal2, x, y, y+10)
ab.inflate ( l(30.0) )
cell.setAbutmentBox( ab )
- UpdateSession.close()
+ #UpdateSession.close()
#af.saveCell( cell, CRL.Catalog.State.Views )
#plugins.RSavePlugin.ScriptMain( **kw )
HorizontalAccess = 1
VerticalAccess = 2
- def __init__(self, modelName):
- UpdateSession.open()
+ def __init__(self, modelName, session=True, views=False):
+ if session:
+ UpdateSession.open()
self.fillerCount = 0
self.af = CRL.AllianceFramework.get()
#self.cell = af.createCell(modelName)
- self.cell = af.getCell( modelName, CRL.Catalog.State.Logical )
+ if not views:
+ self.cell = af.getCell( modelName, CRL.Catalog.State.Logical )
+ else:
+ self.cell = af.getCell( modelName, CRL.Catalog.State.Views )
self.createNet('vss', direction=Net.Direction.IN,
isExternal=True, isGlobal=True, type=Net.Type.POWER)
self.createNet('vdd', direction=Net.Direction.IN,
isExternal=True, isGlobal=True, type=Net.Type.GROUND)
self.build()
- UpdateSession.close()
+ if session:
+ UpdateSession.close()
return
def createNet(self, netName, **attributes):
for pin, net in portmap.items():
self.connect(instance, pin, net)
- if transf:
- self.place(instance, transf[0], transf[1], transf[2])
+ if transf:
+ self.place(instance, transf[0], transf[1], transf[2])
return instance
def createAccess(self, termPath, x, y, flags):
return self.getMasterCell(name).getAbutmentBox().getWidth()
def save(self):
- self.af.saveCell(self.cell, CRL.Catalog.State.Physical)
+ plugins.RSavePlugin.ScriptMain( cell=self.cell )
+ #self.af.saveCell(self.cell, CRL.Catalog.State.Views)
def build(self):
print '[ERROR] Model.build() base class method should never be called.'
self.buildPower()
+class AddSubPlace(Ringed):
+
+ def build(self):
+ self.alu_hier_place()
+
+ def alu_hier_place(self, **kw):
+
+ cell = self.cell
+ 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' )
+
+ 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 .'
+ return False
+ kw[ 'cell' ] = cell
+
+ ab = Box( l( 0.0 )
+ , l( 0.0 )
+ , l( 900.0 )
+ , l( 600.0 ) )
+
+ #UpdateSession.open()
+ cell.setAbutmentBox( ab )
+
+ transf = (l(50.0), l(100.0), Transformation.Orientation.ID)
+ subi = self.createInstance("subckt_49_sub", sub, transf=transf)
+ print "sub place", subi
+
+ transf = (l(500.0), l(100.0), Transformation.Orientation.ID)
+ addi = self.createInstance("subckt_48_add", add, transf=transf)
+ 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)
+
+ #af.saveCell( cell, CRL.Catalog.State.Views )
+ #plugins.RSavePlugin.ScriptMain( **kw )
+
+ return 0
+
+
+class AddSubRoute(Ringed):
+
+ def build(self):
+ self.alu_hier_route()
+
+ def alu_hier_route(self, **kw):
+
+ cell = self.cell
+ 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( 900.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.getComponents()
+ print "components", c, dir(c)
+ for child in cell.getInstances():
+ print "child", child
+
+ return success
+
+
+
def ScriptMain(**kw):
#editor = None
#if "editor" in kw and kw["editor"]:
add.save()
sub = Sub('sub')
sub.save()
+ addsub = AddSubPlace('alu_hier')
+ addsub.save()
+ addsub = AddSubRoute('alu_hier', False, True)
+ addsub.save()
#if editor:
# editor.setCell(ringo.getCell())