From: Luke Kenneth Casson Leighton Date: Thu, 27 Feb 2020 22:27:45 +0000 (+0000) Subject: place and route alu_hier, not quite working yet X-Git-Tag: partial-core-ls180-gdsii~191 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=320522e355b9ee9bebfc44304e21d611e95c9a98;p=soclayout.git place and route alu_hier, not quite working yet --- diff --git a/experiments5/doAlu16.py b/experiments5/doAlu16.py index 8b3580e..e90a8e9 100755 --- a/experiments5/doAlu16.py +++ b/experiments5/doAlu16.py @@ -368,7 +368,49 @@ def sub ( **kw ): #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']: @@ -379,11 +421,8 @@ def alu_hier(**kw): 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 .' @@ -392,80 +431,137 @@ def alu_hier(**kw): 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