whitespace cleanup
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 11 Apr 2021 20:03:15 +0000 (20:03 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 11 Apr 2021 20:03:15 +0000 (20:03 +0000)
experiments9/freepdk_c4m45/doDesign.py

index cf3c59c2bb163ba0fb4e90ae9c2cad726b78cec8..b39f53f18e496c27c9b4734e0db7ed7b6c8f78fa 100644 (file)
@@ -13,8 +13,9 @@ from   helpers         import trace, l, u, n
 from   helpers.io      import ErrorMessage, WarningMessage
 from   helpers.overlay import UpdateSession
 import plugins
-from   Hurricane  import Breakpoint, DataBase, DbU, Transformation, Point, Box, \
-                         Cell, Instance
+from   Hurricane  import (Breakpoint, DataBase, DbU, Transformation,
+                         Point, Box,
+                         Cell, Instance)
 from   plugins.alpha.block.matrix         import RegisterMatrix
 from   plugins.alpha.macro.macro          import Macro
 from   plugins.alpha.block.iospecs        import IoSpecs
@@ -85,7 +86,9 @@ def doIoPinVector ( ioSpec, bits ):
                      , ioSpec[5].format(bit)
                      , ioSpec[6].format(bit) ))
     else:
-        raise ErrorMessage( 1, [ 'doIoPinVector(): Argument "ioSpec" must have between 5 and 7 fields ({})'.format(len(ioSpec))
+        raise ErrorMessage( 1, [ 'doIoPinVector(): Argument "ioSpec" ' \
+                                 'must have between 5 and 7 ' \
+                                 'fields ({})'.format(len(ioSpec))
                                , '(ioSpec={})'.format(ioSpec)
                                ] )
     return v
@@ -100,11 +103,13 @@ def rgetInstance ( cell, path ):
     if isinstance(path,str):
         path = path.split( '.' )
     elif not isinstance(path,list):
-        raise ErrorMessage( 1, 'rgetInstance(): "path" argument is neither a string or a list ({})"' \
+        raise ErrorMessage( 1, 'rgetInstance(): "path" argument is neither ' \
+                               'a string or a list ({})"' \
                                .format(path) )
     instance = cell.getInstance( path[0] )
     if instance is None:
-        raise ErrorMessage( 1, 'rgetInstance(): no instance "{}" in cell "{}"' \
+        raise ErrorMessage( 1, 'rgetInstance(): no instance "{}" ' \
+                               'in cell "{}"' \
                                .format(path[0],cell.getName()) )
     if len(path) == 1:
         return instance
@@ -202,7 +207,8 @@ def scriptMain (**kw):
         cell, editor = plugins.kwParseMain( **kw )
         cell = af.getCell( 'ls180', CRL.Catalog.State.Logical )
         if cell is None:
-            print( ErrorMessage( 2, 'doDesign.scriptMain(): Unable to load cell "{}".' \
+            print( ErrorMessage( 2, 'doDesign.scriptMain(): Unable to ' \
+                                    ' load cell "{}".' \
                                     .format('ls180') ))
             sys.exit(1)
         if editor: editor.setCell( cell )
@@ -244,8 +250,8 @@ def scriptMain (**kw):
         chipBuilder.doChipFloorplan()
 
         with UpdateSession():
-            # Thoses ids are dependent on Yosys. They need to be adjusted whenever
-            # the design changes.
+            # Thoses ids are dependent on Yosys. They need to be adjusted
+            # whenever the design changes.
             #tiId   = 38695
             tiId   = 38381
             #sramId = 3695
@@ -257,31 +263,36 @@ def scriptMain (**kw):
                         , tiPath+'subckt_{}_sram4k_3.subckt_144_SPBlock_512W64B8W'.format(sramId+3)
                         ]
             sram = DataBase.getDB().getCell( 'SPBlock_512W64B8W' )
-            if not sram:
-                raise ErrorMessage( 1, 'SRAM instance "{}" not found.'.format(sramPaths[i]) )
-            sramAb = sram.getAbutmentBox()
-            coreAb = cell.getAbutmentBox()
-            sliceHeight = chipBuilder.conf.sliceHeight
-            originX = coreAb.getXMin() + 2*chipBuilder.conf.sliceStep
-            for i in range(4):
-                sram = rgetInstance( cell, sramPaths[i] )
-                chipBuilder.placeMacro \
-                    ( sramPaths[i]
-                    , Transformation( originX
-                                    , coreAb.getYMax() - sramAb.getHeight() - 2*sliceHeight
-                                    , Transformation.Orientation.ID )
-                    )
-                originX += sramAb.getWidth () + 3*sliceHeight
+            if sram:
+                sramAb = sram.getAbutmentBox()
+                coreAb = cell.getAbutmentBox()
+                sliceHeight = chipBuilder.conf.sliceHeight
+                originX = coreAb.getXMin() + 2*chipBuilder.conf.sliceStep
+                for i in range(4):
+                    sram = rgetInstance( cell, sramPaths[i] )
+                    y = coreAb.getYMax() - sramAb.getHeight() - 2*sliceHeight
+                    chipBuilder.placeMacro \
+                        ( sramPaths[i]
+                        , Transformation( originX
+                                        , y
+                                        , Transformation.Orientation.ID )
+                        )
+                    originX += sramAb.getWidth () + 3*sliceHeight
+            else:
+                print (ErrorMessage( 1, 'SRAM instance not found.'))
             pll = addPllPlaceHolder( cell )
             pllAb = pll.getAbutmentBox()
-            pll.setTransformation( Transformation( coreAb.getXMax() - pllAb.getWidth()
-                                                 , coreAb.getYMax() - pllAb.getHeight()
-                                                 , Transformation.Orientation.ID ) )
+            t = Transformation( coreAb.getXMax() - pllAb.getWidth()
+                              , coreAb.getYMax() - pllAb.getHeight()
+                              , Transformation.Orientation.ID )
+            pll.setTransformation( t )
             pll.setPlacementStatus( Instance.PlacementStatus.FIXED )
            #ls180Conf.placeArea = Box( coreAb.getXMin()
            #                         , coreAb.getYMin()
-           #                         , coreAb.getXMax() - chipBuilder.conf.sliceStep
-           #                         , coreAb.getYMax() - sramAb.getHeight() - 2*sliceHeight
+           #                         , coreAb.getXMax() - 
+           #                           chipBuilder.conf.sliceStep
+           #                         , coreAb.getYMax() - 
+           #                          sramAb.getHeight() - 2*sliceHeight
            #                         )
            #memPatterns = [ r'^mem_(?P<i>\d+)__(?P<j>[\d+])$'
            #              , r'^mem_1_(?P<i>\d+)__(?P<j>[\d+])$'