Do some cleanup.
authorJock Tanner <tanner.of.kha@gmail.com>
Fri, 20 Mar 2020 09:32:13 +0000 (09:32 +0000)
committerJock Tanner <tanner.of.kha@gmail.com>
Fri, 20 Mar 2020 09:32:13 +0000 (09:32 +0000)
experiments7/doAlu16.py

index 2fae8c629466c845e88fe37cea2d699cabc2a604..9ac210b863d213fdf1c3e7298035fd8e528bfaa0 100755 (executable)
@@ -9,12 +9,11 @@ import Cfg
 import Etesian
 import Katana
 import clocktree.ClockTree
-from chip import Configuration
 from Hurricane import (
-    DbU, DataBase, UpdateSession, Box, Transformation, Instance,
-    Contact, Vertical, Pad, Pin, NetExternalComponents,
+    DbU, DataBase, UpdateSession, Box, Transformation, Instance,  Pad, Pin,
+    NetExternalComponents,
 )
-from helpers import l, showPythonTrace
+from helpers import l
 from plugins import RSavePlugin
 
 import symbolic.cmos  # do not remove
@@ -103,7 +102,13 @@ def create_pins(cell, net, name, direction,
     return x, y
 
 
-def placeAndRoute(cell):
+def place_and_route(cell):
+    """
+    Places and routes.
+
+    :param cell: Hurricane.Cell object to operate on,
+    :return: True on success, False otherwise.
+    """
     etesian = Etesian.EtesianEngine.create(cell)
     etesian.place()
 
@@ -120,7 +125,7 @@ def placeAndRoute(cell):
     return success
 
 
-def coriolisSetup():
+def coriolis_setup():
     Cfg.Configuration.pushDefaultPriority(Cfg.Parameter.Priority.UserFile)
 
     cellsTop = '~/alliance-check-toolkit/cells'
@@ -157,8 +162,7 @@ def coriolisSetup():
     Cfg.Configuration.popDefaultPriority()
 
 
-def add(**kwargs):
-    editor = kwargs.get('editor', None)
+def add(editor=None, **kwargs):
 
     db = DataBase.getDB()
     print(db, dir(db))
@@ -211,7 +215,7 @@ def add(**kwargs):
     if editor:
         editor.setCell(cell)
 
-    placeAndRoute(cell)
+    place_and_route(cell)
 
     UpdateSession.open()
 
@@ -225,11 +229,10 @@ def add(**kwargs):
     Pad.create(last_net, BLOCKAGE4, ab)
     UpdateSession.close()
 
-    RSavePlugin.ScriptMain(**kwargs)
+    RSavePlugin.ScriptMain(editor=editor, **kwargs)
 
 
-def sub(**kwargs):
-    editor = kwargs.get('editor', None)
+def sub(editor=None, **kwargs):
 
     db = DataBase.getDB()
     print(db, dir(db))
@@ -283,7 +286,7 @@ def sub(**kwargs):
     if editor:
         editor.setCell(cell)
 
-    placeAndRoute(cell)
+    place_and_route(cell)
 
     UpdateSession.open()
 
@@ -296,11 +299,10 @@ def sub(**kwargs):
     Pad.create(last_net, BLOCKAGE4, ab)
     UpdateSession.close()
 
-    RSavePlugin.ScriptMain(**kwargs)
+    RSavePlugin.ScriptMain(editor=editor, **kwargs)
 
 
-def alu16(**kwargs):
-    editor = kwargs.get('editor', None)
+def alu16(editor=None, **kwargs):
 
     db = DataBase.getDB()
     print(db, dir(db))
@@ -366,16 +368,16 @@ def alu16(**kwargs):
     # it connects *to add and sub and the outside world as well*
     cell.setAbutmentBox(ab)
 
-    result = placeAndRoute(cell)
+    result = place_and_route(cell)
 
     af.saveCell(cell, CRL.Catalog.State.Views)
-    RSavePlugin.ScriptMain(**kwargs)
+    RSavePlugin.ScriptMain(editor=editor, **kwargs)
 
     return result
 
 
 def ScriptMain(**kwargs):
-    coriolisSetup()
+    coriolis_setup()
     add(**kwargs)
     sub(**kwargs)
     return alu16(**kwargs)