create function which pre-creates the blackbox cells
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 28 Apr 2021 17:29:01 +0000 (17:29 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 28 Apr 2021 17:29:01 +0000 (17:29 +0000)
use it to create createPLLBlackbox, not called yet

experiments9/tsmc_c018/coriolis2/settings.py

index 80211c385ded0c201499ae5948ff1dbfccb361d2..70993c75dcf9b1a35a5d9f9c626857dd6a8ab1cf 100644 (file)
@@ -13,7 +13,8 @@ if not NdaDirectory:
     if hostname.startswith('lepka'):
         NdaDirectory = '/dsk/l1/jpc/crypted/soc/techno'
         if not os.path.isdir(NdaDirectory):
-            print( '[ERROR] You forgot to mount the NDA encrypted directory, stupid!' )
+            print( '[ERROR] You forgot to mount the NDA '
+                   'encrypted directory, stupid!' )
     else:
         NdaDirectory = '/users/soft/techno/techno'
 helpers.setNdaTopDir( NdaDirectory )
@@ -22,7 +23,8 @@ import Cfg
 from   Hurricane import DataBase, Cell, Instance, Net
 from   CRL       import AllianceFramework
 from   helpers   import overlay, l, u, n
-from   NDA.node180.tsmc_c018 import techno, FlexLib, LibreSOCIO, LibreSOCMem, pll
+from   NDA.node180.tsmc_c018 import (techno, FlexLib,
+                                     LibreSOCIO, LibreSOCMem, pll)
 
 techno.setup()
 FlexLib.setup()
@@ -35,28 +37,26 @@ db = DataBase.getDB()
 af = AllianceFramework.get()
 
 
-def createSramBlackbox ():
+def createBlackbox (name, libname, cellName, blackboxNames, real_name):
     global db, af
-    print( '  o  Creating SRAM blackboxes for "ls180" design.' )
+    print( '  o  Creating %s blackboxes for "ls180" design.' % name)
     rootlib  = db.getRootLibrary()
-    lib      = rootlib.getLibrary( 'LibreSOCMem' )
-    sramName = 'spblock_512w64b8w'
-    sram     = lib.getCell( sramName )
-    if not sram:
-        raise ErrorMessage( 1, 'settings.createSramBlocks(): SRAM Cell "{}" not found.' \
-                               .format(sramName) )
-    sram.setAbstractedSupply( True )
-    blackboxeNames = [ 'spblock_512w64b8w' # go back to only one blackbox
-                     ]
-    for blackboxName in blackboxeNames:
+    lib      = rootlib.getLibrary( libname )
+    libcell     = lib.getCell( cellName )
+    if not libcell:
+        raise ErrorMessage( 1, 'settings.createSramBlocks(): '
+                               '%s SRAM Cell "%s" not found.' % \
+                               (name, cellName) )
+    libcell.setAbstractedSupply( True )
+    for blackboxName in blackboxNames:
         cell     = Cell.create( lib, blackboxName )
-        instance = Instance.create( cell, 'real_sram', sram )
+        instance = Instance.create( cell, real_name, libcell )
         state    = af.getCatalog().getState( blackboxName, True )
         state.setCell( cell )
         state.setLogical( True )
         state.setInMemory( True )
         print( '     - {}.'.format(cell) )
-        for masterNet in sram.getNets():
+        for masterNet in libcell.getNets():
             if not masterNet.isExternal():
                 continue
             net = Net.create( cell, masterNet.getName() )
@@ -70,6 +70,26 @@ def createSramBlackbox ():
             plug.setNet( net )
 
 
+#TODO, JP, check this, it's cut/paste and guessing
+def createPLLBlackbox ():
+    createBlackbox(name='PLL',
+                   libname='pll',
+                   cellName='pll',
+                   blackboxeNames = [ 'pll'
+                                     ],
+                   real_name='real_pll') # probably
+
+
+def createSramBlackbox ():
+    createBlackbox(name='SRAM',
+                   libname='LibreSOCMem',
+                   cellName='spblock_512w64b8w',
+                   # go back to only one blackbox
+                   blackboxeNames = [ 'spblock_512w64b8w'
+                                     ],
+                   real_name='real_sram')
+
+
 with overlay.CfgCache(priority=Cfg.Parameter.Priority.UserFile) as cfg:
     cfg.misc.catchCore           = False
     cfg.misc.minTraceLevel       = 12300
@@ -88,3 +108,4 @@ with overlay.CfgCache(priority=Cfg.Parameter.Priority.UserFile) as cfg:
 
 with overlay.UpdateSession():
     createSramBlackbox()
+    # createPLLBlackbox ()