From 18d2afa4012361898fa8039e548f5fc19ea8a78e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 28 Feb 2020 20:27:29 +0000 Subject: [PATCH] add sub function (class-ish form) --- experiments5/ringoscillator.py | 159 +++++++++++++++++++++++++++++---- 1 file changed, 143 insertions(+), 16 deletions(-) diff --git a/experiments5/ringoscillator.py b/experiments5/ringoscillator.py index 8451eb5..edb5107 100755 --- a/experiments5/ringoscillator.py +++ b/experiments5/ringoscillator.py @@ -239,6 +239,123 @@ def add ( cell, **kw ): #plugins.RSavePlugin.ScriptMain( **kw ) +################### +# sub + +def sub ( cell, **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' ) + metal5 = DataBase.getDB().getTechnology().getLayer( 'metal5' ) + + #cell = af.getCell( 'sub', CRL.Catalog.State.Logical ) + print cell.getNet('a(0)') + + if not cell: + print '[ERROR] Unable to load cell "alu16.vst", aborting .' + return False + kw[ 'cell' ] = cell + + width = 350.0 + height = 405.0 + + ab = Box( l( 0.0 ) + , l( 0.0 ) + , l( width ) + , l( height ) ) + + cellGauge = af.getCellGauge() + spaceMargin = (Cfg.getParamPercentage('etesian.spaceMargin').asPercentage()+5) / 100.0 + aspectRatio = Cfg.getParamPercentage('etesian.aspectRatio').asPercentage() / 100.0 + clocktree.ClockTree.computeAbutmentBox( cell, spaceMargin, aspectRatio, cellGauge ) + ab2 = cell.getAbutmentBox() + print "box", ab, ab.getHeight(), ab.getWidth() + print "calc box", ab2, ab2.getHeight(), ab2.getWidth() + + #height = ab.getHeight() + #width = ab.getWidth() + + #UpdateSession.open() + cell.setAbutmentBox( ab ) + + for i in range(16): + if True: + x = 20.0*i + 10.0 + y = height + Pin.create( cell.getNet('a(%d)' % i) + , 'a(%d).0' % i + , Pin.Direction.NORTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( x ), l( y - 0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + for i in range(16): + if True: + Pin.create( cell.getNet('o(%d)' % i) + , 'o(%d).0' % i + , Pin.Direction.SOUTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( 10.0*i + 100.0 ), l( 0) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + + for i in range(16): + if True: + net = cell.getNet('b(%d)' % i) + x = 20.0*i + 10.0 + 10 + y = height - 0 + #build_downtrace(net, metal3, x, y+11, y) + #continue + Pin.create( net + , 'b(%d).0' % i + , Pin.Direction.NORTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( x ), l( y - 0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + if False: + 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 True: + if editor: editor.setCell( cell ) + + 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 ) + #plugins.RSavePlugin.ScriptMain( **kw ) + #def toDbU(v): return DbU.fromLambda(v) def toDbU(v): return l(v) @@ -487,13 +604,7 @@ class Model (object): print '[ERROR] Model.build() base class method should never be called.' -class Add (Model): - - def build(self): - #self.setAbutmentBox( - #Box(toDbU(0.0), toDbU(0.0), toDbU(1595.0), toDbU(450.0))) - add(self.cell) - self.buildPower() +class Ringed (Model): def addFillers(self): self.addFillersRow(toDbU(1580.0), toDbU(0.0), @@ -695,17 +806,33 @@ class Add (Model): return +class Add(Ringed): + + def build(self): + add(self.cell) + self.buildPower() + + +class Sub(Ringed): + + def build(self): + sub(self.cell) + self.buildPower() + def ScriptMain(**kw): - editor = None - if "editor" in kw and kw["editor"]: - editor = kw["editor"] - - ringo = Add('add') - ringo.save() - if editor: - editor.setCell(ringo.getCell()) - editor.fit() + #editor = None + #if "editor" in kw and kw["editor"]: + # editor = kw["editor"] + + add = Add('add') + add.save() + sub = Sub('sub') + sub.save() + + #if editor: + # editor.setCell(ringo.getCell()) + # editor.fit() return True -- 2.30.2