whitespace transform
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 18 Mar 2020 14:46:17 +0000 (14:46 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 18 Mar 2020 14:46:17 +0000 (14:46 +0000)
experiments7/doAlu16.py

index 2fcdd1c9e2451272c1f8defcd23dd14b52566360..64beb077b7d68d36f0410438870c600788e3b649 100755 (executable)
@@ -37,12 +37,11 @@ def to_DbU(l):
     return DbU.fromLambda(l)
 
 
-def create_pins(
-    cell, net, name, direction, status=Pin.PlacementStatus.FIXED, layer=None,
-    x=0.0, y=0.0, width=2.0, height=2.0, repeat=1, delta=0.0, external=True,
-):
-    """
-    Creates a series of pins in a cell.
+def create_pins(cell, net, name, direction,
+                status=Pin.PlacementStatus.FIXED, layer=None,
+                x=0.0, y=0.0, width=2.0, height=2.0,
+                repeat=1, delta=0.0, external=True):
+    """Creates a series of pins in a cell.
 
     :param cell: Hurricane.Cell object to place pins onto, or object name,
     :param net: Hurricane.Net object name or name template, taking a pin
@@ -63,9 +62,7 @@ def create_pins(
       provided.
     """
     if isinstance(cell, basestring):
-        cell = CRL.AllianceFramework.get().getCell(
-            cell, CRL.Catalog.State.Logical
-        )
+        cell = af.getCell(cell, CRL.Catalog.State.Logical)
 
     if layer is None:
         layer = get_layer('METAL3')
@@ -80,17 +77,9 @@ def create_pins(
         iterator = repeat
 
     for i in iterator:
-        pin = Pin.create(
-            cell.getNet(net.format(i)),
-            name.format(i),
-            direction,
-            status,
-            layer,
-            l(x),
-            l(y),
-            l(width),
-            l(height),
-        )
+        pin = Pin.create(cell.getNet(net.format(i)), name.format(i),
+                         direction, status, layer,
+                         l(x), l(y), l(width), l(height))
         if direction in (Pin.Direction.NORTH, Pin.Direction.SOUTH):
             x += delta
         else:
@@ -126,12 +115,10 @@ def coriolisSetup():
 
     cellsTop = '~/alliance-check-toolkit/cells'
     env = af.getEnvironment()
-    env.addSYSTEM_LIBRARY(
-        library=cellsTop + '/nsxlib', mode=CRL.Environment.Prepend
-    )
-    env.addSYSTEM_LIBRARY(
-        library=cellsTop + '/mpxlib', mode=CRL.Environment.Prepend
-    )
+    env.addSYSTEM_LIBRARY(library=cellsTop + '/nsxlib',
+                          mode=CRL.Environment.Prepend)
+    env.addSYSTEM_LIBRARY(library=cellsTop + '/mpxlib',
+                          mode=CRL.Environment.Prepend)
 
     Cfg.getParamBool('misc.catchCore').setBool(False)
     Cfg.getParamBool('misc.info').setBool(False)
@@ -203,18 +190,12 @@ def add(**kwargs):
     UpdateSession.open()
     cell.setAbutmentBox(ab)
 
-    create_pins(
-        cell, 'a({})', 'a({}).0', Pin.Direction.NORTH,
-        x=10.0, y=height, delta=20.0, repeat=BIT_WIDTH,
-    )
-    create_pins(
-        cell, 'o({})', 'o({}).0', Pin.Direction.SOUTH,
-        x=100.0, y=0.0, delta=10.0, repeat=BIT_WIDTH,
-    )
-    create_pins(
-        cell, 'b({})', 'b({}).0', Pin.Direction.NORTH,
-        x=20.0, y=height, delta=20.0, repeat=BIT_WIDTH,
-    )
+    create_pins(cell, 'a({})', 'a({}).0', Pin.Direction.NORTH,
+                x=10.0, y=height, delta=20.0, repeat=BIT_WIDTH)
+    create_pins(cell, 'o({})', 'o({}).0', Pin.Direction.SOUTH,
+                x=100.0, y=0.0, delta=10.0, repeat=BIT_WIDTH)
+    create_pins(cell, 'b({})', 'b({}).0', Pin.Direction.NORTH,
+                x=20.0, y=height, delta=20.0, repeat=BIT_WIDTH)
     UpdateSession.close()
 
     if editor:
@@ -280,18 +261,12 @@ def sub(**kwargs):
     UpdateSession.open()
     cell.setAbutmentBox(ab)
 
-    create_pins(
-        cell, 'a({})',  'a({}).0', Pin.Direction.NORTH,
-        x=10.0, y=height, delta=20.0, repeat=BIT_WIDTH,
-    )
-    create_pins(
-        cell, 'o({})', 'o({}).0', Pin.Direction.SOUTH,
-        x=100.0, y=0.0, delta=10.0, repeat=BIT_WIDTH,
-    )
-    create_pins(
-        cell, 'b({})', 'b({}).0', Pin.Direction.NORTH,
-        x=20.0, y=height, delta=20.0, repeat=BIT_WIDTH,
-    )
+    create_pins(cell, 'a({})',  'a({}).0', Pin.Direction.NORTH,
+                x=10.0, y=height, delta=20.0, repeat=BIT_WIDTH)
+    create_pins(cell, 'o({})', 'o({}).0', Pin.Direction.SOUTH,
+                x=100.0, y=0.0, delta=10.0, repeat=BIT_WIDTH)
+    create_pins(cell, 'b({})', 'b({}).0', Pin.Direction.NORTH,
+                x=20.0, y=height, delta=20.0, repeat=BIT_WIDTH)
 
     UpdateSession.close()
 
@@ -339,39 +314,26 @@ def alu16(**kwargs):
 
     # find adder instance
     add_inst = [x for x in instances if x.getName().endswith('add')][0]
-    add_inst.setTransformation(
-        Transformation(
-            to_DbU(25.0), to_DbU(75.0), Transformation.Orientation.ID
-        )
-    )
+    add_inst.setTransformation(Transformation(to_DbU(25.0), to_DbU(75.0),
+                               Transformation.Orientation.ID))
     add_inst.setPlacementStatus(Instance.PlacementStatus.FIXED)
 
     # find subtractor instance
     sub_inst = [x for x in instances if x.getName().endswith('sub')][0]
-    sub_inst.setTransformation(
-        Transformation(
-            to_DbU(725.0), to_DbU(75.0), Transformation.Orientation.ID
-        )
-    )
+    sub_inst.setTransformation(Transformation(to_DbU(725.0), to_DbU(75.0),
+                               Transformation.Orientation.ID))
     sub_inst.setPlacementStatus(Instance.PlacementStatus.FIXED)
 
     y_north = cell.getAbutmentBox().getYMax()
-    create_pins(
-        cell, 'a({})', 'a({}).0', Pin.Direction.SOUTH,
-        x=50.0, y=0.0, delta=60.0, repeat=BIT_WIDTH,
-    )
-    create_pins(
-        cell, 'b({})', 'b({}).0', Pin.Direction.SOUTH,
-        x=80.0, y=0.0, delta=60.0, repeat=BIT_WIDTH,
-    )
-    create_pins(
-        cell, 'o({})', 'o({}).0', Pin.Direction.NORTH,
-        x=50.0, y=y_north/l(1),  # converting back to lambdas?
-        delta=60.0, repeat=BIT_WIDTH,
-    )
-    create_pins(
-        cell, 'rst', 'rst.0', Pin.Direction.WEST, layer=METAL2, x=0.0, y=140.0,
-    )
+    create_pins(cell, 'a({})', 'a({}).0', Pin.Direction.SOUTH,
+                x=50.0, y=0.0, delta=60.0, repeat=BIT_WIDTH)
+    create_pins(cell, 'b({})', 'b({}).0', Pin.Direction.SOUTH,
+                x=80.0, y=0.0, delta=60.0, repeat=BIT_WIDTH)
+    create_pins(cell, 'o({})', 'o({}).0', Pin.Direction.NORTH,
+                x=50.0, y=y_north/l(1),  # converting back to lambdas?
+                delta=60.0, repeat=BIT_WIDTH)
+    create_pins(cell, 'rst', 'rst.0', Pin.Direction.WEST, layer=METAL2,
+                x=0.0, y=140.0)
     UpdateSession.close()
 
     if editor: