add dummy/fake/ghost PLL blackbox cell
[soclayout.git] / experiments9 / coriolis2 / settings.py
index 8ed5fad0b4fab45e0f11cecc2d746c61907b4e9b..6d111f08eb33896ddfdbd6e59010f2db84ae0f62 100644 (file)
@@ -10,8 +10,9 @@ from   helpers   import overlay, l, u, n
 import symbolic.cmos45  # do not remove
 import os
 
-import LibreSOCMem
+import LibreSOCMem, pll
 LibreSOCMem.setup()
+pll.setup()
 
 if os.environ.has_key('CELLS_TOP'):
     cellsTop = os.environ['CELLS_TOP']
@@ -22,6 +23,39 @@ db = DataBase.getDB()
 af = AllianceFramework.get()
 
 
+def createPLLBlackbox ():
+    global db, af
+    print( '  o  Creating PLL blackboxes for "ls180" design.' )
+    rootlib  = db.getRootLibrary()
+    lib      = rootlib.getLibrary( 'pll' )
+    pllName = 'pll'
+    pll     = lib.getCell( sramName )
+    if not pll:
+        raise ErrorMessage( 1, 'settings.createPLLBlackBox(): '
+                                'PLL Cell "{}" not found.' \
+                               .format(sramName) )
+    sram.setAbstractedSupply( True )
+    blackboxName = 'pll'
+    cell     = Cell.create( lib, blackboxName )
+    instance = Instance.create( cell, 'pll', pll )
+    state    = af.getCatalog().getState( blackboxName, True )
+    state.setCell( cell )
+    state.setLogical( True )
+    state.setInMemory( True )
+    print( '     - {}.'.format(cell) )
+    for masterNet in pll.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 )
+
 def createSramBlackbox ():
     global db, af
     print( '  o  Creating SRAM blackboxes for "ls180" design.' )
@@ -129,6 +163,7 @@ Viewer.Graphics.setStyle('Alliance.Classic [black]')
 # TODO: create a fake one
 with overlay.UpdateSession():
     createSramBlackbox()
+    createPLLBlackbox()
 
 print( '  o  Successfully run "<>/coriolis2/settings.py".' )
 print( '     - CELLS_TOP = "{}"'.format(cellsTop) )