Clarify unit conversion.
authorJock Tanner <tanner.of.kha@gmail.com>
Thu, 19 Mar 2020 22:03:35 +0000 (22:03 +0000)
committerJock Tanner <tanner.of.kha@gmail.com>
Thu, 19 Mar 2020 22:03:35 +0000 (22:03 +0000)
experiments7/doAlu16.py

index 64beb077b7d68d36f0410438870c600788e3b649..2fae8c629466c845e88fe37cea2d699cabc2a604 100755 (executable)
@@ -34,9 +34,19 @@ def get_layer(name, layer_cache={}):
 
 
 def to_DbU(l):
+    """
+    Convert lambdas to database units. (See Hurricane+Python Manual 3.4.)
+    """
     return DbU.fromLambda(l)
 
 
+def from_DbU(ph):
+    """
+    Convert database units to lambdas. (See Hurricane+Python Manual 3.4.)
+    """
+    return DbU.toLambda(ph)
+
+
 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,
@@ -330,7 +340,7 @@ def alu16(**kwargs):
     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?
+                x=50.0, y=from_DbU(y_north),
                 delta=60.0, repeat=BIT_WIDTH)
     create_pins(cell, 'rst', 'rst.0', Pin.Direction.WEST, layer=METAL2,
                 x=0.0, y=140.0)