automatically located the joining cells between add and sub
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 21 Apr 2020 21:05:18 +0000 (21:05 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 21 Apr 2020 21:05:18 +0000 (21:05 +0000)
experiments7/doAlu16.py

index 66f4043647d3a84e21c34591fbe580dc866f41a9..1b8248fe3c877c75b59cf23a6edee2481897af6d 100755 (executable)
@@ -11,6 +11,9 @@ from Hurricane import Breakpoint
 from Hurricane import Instance
 from coriolis2.settings import af
 from utils import Module, SessionManager, Config
+import Etesian
+import helpers
+from helpers.overlay import UpdateSession
 
 import symbolic.cmos  # do not remove
 
@@ -90,6 +93,52 @@ class ALU16(Module):
                     x += inst.getAbutmentBox().getWidth()
 
     def place(self):
+        """ALU16.place(), manual placement overload."""
+        datapath_insts = []
+        add, sub = self.submodules
+        #print (sub.ab, dir(list(sub.cell.getInstances())[0]))
+        #print (list(sub.cell.getInstances())[0].getAbutmentBox())
+        subx = widths[BIT_WIDTH] - 40 #self.from_dbu(sub.ab.getXMax())
+        addx = self.from_dbu(add.ab.getWidth()) + 5
+
+        for i in range(BIT_WIDTH):
+            dp = [['nmx2', None],
+                  ['no2', None],
+                  ['sff1', None]]
+
+            # XXX here is the computed abutment box which we want to
+            # place the auto-located cells into, using *auto* place
+            # *not* manual place.
+            y = 40.0 + i * 50
+            y1 = y + 50
+            ab = Box(self.to_dbu(addx), self.to_dbu(y),
+                     self.to_dbu(subx), self.to_dbu(y1))
+            print ("ab", addx, subx, ab, self.from_dbu(ab.getWidth()),
+                                         self.from_dbu(ab.getHeight()))
+
+            # automatically locate all non-placed cells connected to
+            # o(0)....o(15)
+            find = self.get_net_connections(['o(%d)' % i],
+                                        ['clk', 'rst', 'op'])
+            for inst in find:
+                print (inst, inst.getName(), dir(inst))
+                print ("place", ab, inst, dir(inst))
+                for column in dp:
+                    if inst.getName().find(column[0]) != -1:
+                        column[1] = inst
+                # XXX TODO: want to auto-place the instances
+                #with SessionManager():
+                    #cell.setAbutmentBox(ab)
+                    #etesian = Etesian.EtesianEngine.create(cell)
+                    #etesian.place()
+            datapath_insts.append(dp)
+
+        # place to right of add
+        add, sub = self.submodules
+        add_wid = self.from_dbu(add.ab.getWidth())
+        self.place_datapath(datapath_insts, add_wid, 40.0, 1)
+
+    def _old_place(self):
         """ALU16.place(), manual placement overload."""
         datapath_insts = []
         for i in range(BIT_WIDTH):
@@ -157,13 +206,14 @@ class ALU16(Module):
 
             self.create_pins()
 
-        find = self.get_net_connections(['o(15)'],
-                                        ['clk', 'rst', 'op'])
-        print (find)
-        sys.exit(0)
-        find = self.get_net_connections(['o_next(0)'],
-                                        ['clk', 'vss', 'vdd', 'rst'])
-        print (find)
+        if False:
+            find = self.get_net_connections(['o(15)'],
+                                            ['clk', 'rst', 'op'])
+            print (find)
+            sys.exit(0)
+            find = self.get_net_connections(['o_next(0)'],
+                                            ['clk', 'vss', 'vdd', 'rst'])
+            print (find)
 
         if self.editor:
             self.editor.setCell(self.cell)