also add createSRAMblocks to freepdk_c4m45
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 28 Apr 2021 16:57:33 +0000 (16:57 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 28 Apr 2021 16:57:33 +0000 (16:57 +0000)
experiments9/freepdk_c4m45/coriolis2/settings.py

index c0ddc5c1995f0f5d5cfcbe3b89b20ec002939205..5a7e6c3b12d143e3026e7e86997a8c5749751e3e 100644 (file)
@@ -1,5 +1,6 @@
 # -*- Mode:Python -*-
 
+from   __future__ import print_function
 import os
 import socket
 import helpers
@@ -12,13 +13,16 @@ 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 )
 
 import Cfg
+from   Hurricane import DataBase, Cell, Instance, Net
 from   CRL     import AllianceFramework, RoutingLayerGauge
+from   helpers   import overlay, l, u, n
 from   helpers import overlay, l, u, n
 from   NDA.node45.freepdk45_c4m import techno, FlexLib, LibreSOCIO
 
@@ -26,6 +30,50 @@ techno.setup()
 FlexLib.setup()
 LibreSOCIO.setup()
 
+
+db = DataBase.getDB()
+af = AllianceFramework.get()
+
+
+def createSramBlackbox ():
+    global db, af
+    print( '  o  Creating SRAM blackboxes for "ls180" design.' )
+    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 = [ 'spblock512w64b8w_0'
+                     , 'spblock512w64b8w_1'
+                     , 'spblock512w64b8w_2'
+                     , 'spblock512w64b8w_3'
+                     ]
+    for blackboxName in blackboxeNames:
+        cell     = Cell.create( lib, blackboxName )
+        instance = Instance.create( cell, 'real_sram', sram )
+        state    = af.getCatalog().getState( blackboxName, True )
+        state.setCell( cell )
+        state.setLogical( True )
+        state.setInMemory( True )
+        print( '     - {}.'.format(cell) )
+        for masterNet in sram.getNets():
+            if not masterNet.isExternal():
+                continue
+            net = Net.create( cell, masterNet.getName() )
+            net.setDirection( masterNet.getDirection() )
+            net.setType( masterNet.getType() )
+            net.setExternal( True )
+            net.setGlobal( masterNet.isGlobal() )
+            if masterNet.isSupply():
+                continue
+            plug = instance.getPlug( masterNet )
+            plug.setNet( net )
+
+
 with overlay.CfgCache(priority=Cfg.Parameter.Priority.UserFile) as cfg:
     cfg.misc.catchCore           = False
     cfg.misc.minTraceLevel       = 12300
@@ -41,6 +89,10 @@ with overlay.CfgCache(priority=Cfg.Parameter.Priority.UserFile) as cfg:
     cfg.anabatic.topRoutingLayer = 'metal6'
     cfg.katana.eventsLimit       = 4000000
     af  = AllianceFramework.get()
-    af.getRoutingGauge('FlexLib').getLayerGauge( 5 ).setType( RoutingLayerGauge.PowerSupply )
+    lg5 = af.getRoutingGauge('FlexLib').getLayerGauge( 5 )
+    lg5.setType( RoutingLayerGauge.PowerSupply )
     env = af.getEnvironment()
     env.setCLOCK( '^sys_clk$|^ck|^jtag_tck$' )
+
+with overlay.UpdateSession():
+    createSramBlackbox()