From 1585db071b68c5d5604b298afc77366d0c0baac6 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 28 Feb 2020 21:03:48 +0000 Subject: [PATCH] add alu_hier place/route, partially works --- experiments5/doAlu16.py | 2 +- experiments5/ringoscillator.py | 184 +++++++++++++++++++++++++++++++-- 2 files changed, 176 insertions(+), 10 deletions(-) diff --git a/experiments5/doAlu16.py b/experiments5/doAlu16.py index 177967c..fa37bd8 100755 --- a/experiments5/doAlu16.py +++ b/experiments5/doAlu16.py @@ -105,7 +105,7 @@ Cfg.getParamBool ( 'misc.bug' ).setBool ( False ) Cfg.getParamBool ( 'misc.logMode' ).setBool ( True ) Cfg.getParamBool ( 'misc.verboseLevel1' ).setBool ( True ) Cfg.getParamBool ( 'misc.verboseLevel2' ).setBool ( True ) -Cfg.getParamInt ( 'misc.minTraceLevel' ).setInt ( 159 ) +#Cfg.getParamInt ( 'misc.minTraceLevel' ).setInt ( 159 ) #Cfg.getParamInt ( 'misc.maxTraceLevel' ).setInt ( 160 ) Cfg.getParamEnumerate ( 'etesian.effort' ).setInt ( 2 ) Cfg.getParamPercentage( 'etesian.spaceMargin' ).setPercentage( 20.0 ) diff --git a/experiments5/ringoscillator.py b/experiments5/ringoscillator.py index edb5107..2550aa0 100755 --- a/experiments5/ringoscillator.py +++ b/experiments5/ringoscillator.py @@ -218,7 +218,7 @@ def add ( cell, **kw ): 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) @@ -233,7 +233,7 @@ def add ( cell, **kw ): 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 ) @@ -373,19 +373,24 @@ class Model (object): 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): @@ -447,8 +452,8 @@ class Model (object): 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): @@ -598,7 +603,8 @@ class Model (object): 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.' @@ -820,6 +826,162 @@ class Sub(Ringed): 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"]: @@ -829,6 +991,10 @@ def ScriptMain(**kw): 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()) -- 2.30.2