From a317028b9e191e359664505de8d0fba89ed10f1b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 21 Apr 2020 17:54:56 +0000 Subject: [PATCH] find connections through plugs --- experiments7/doAlu16.py | 73 +++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/experiments7/doAlu16.py b/experiments7/doAlu16.py index 591e6b7..71d465b 100755 --- a/experiments7/doAlu16.py +++ b/experiments7/doAlu16.py @@ -157,39 +157,14 @@ class ALU16(Module): self.create_pins() - print (dir(self.cell)) - for net in self.cell.getNets(): - print (net.getName()) - print (self.cell.getNet("a(0)")) - print (dir(self.cell.getNet("a(0)"))) - net = self.cell.getNet("a(2)") - print (list(net.getPlugs())) - for plug in net.getPlugs(): - print (plug, dir(plug)) - components = list(plug.getConnexComponents()) - pc = plug.getCell() - print ("plug cell", pc) - mnet = plug.getMasterNet() - print ("mstnet", mnet) - - for inst in self.cell.getInstances(): - for net in self.cell.getNets(): - plug = inst.getPlug(net) - if net.getName() == "a(2)": - print ("net", net, "plug", plug) - #print (list(net.getPlugs())) - continue - icell = inst.getMasterCell() - print (dir(inst)) - print (dir(icell)) - #if len(list(icell.getInstances())) > 0: - #continue # already placed, do not include it - #print (list(icell.getOccurrences())) - for net in icell.getNets(): - print ("inst", icell, "has nets", net.getName()) - plug = inst.getPlug(net) - print ("plug", plug, dir(plug)) + find = self.get_net_connections(['add_o(0)', 'sub_o(0)', 'o(0)'], + ['clk', 'rst']) + 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) @@ -219,6 +194,40 @@ class ALU16(Module): self.save() return result + def get_net_connections(self, find, already_found): + res = set() + search_more = [] + for inst in self.cell.getInstances(): + if (inst.getPlacementStatus() != + Instance.PlacementStatus.UNPLACED): + continue + print ("instance", inst) + for plug in inst.getConnectedPlugs(): + netname = plug.getNet().getName() + if netname in already_found: + continue + if plug.getNet().getName() in find: + print ("plug", plug, plug.getNet().getName()) + for p in plug.getNet().getPlugs(): + c = p.getInstance() + if (c.getPlacementStatus() != + Instance.PlacementStatus.UNPLACED): + continue + print ("notplaced", c) + for pc in c.getConnectedPlugs(): + print ("plug", pc) + pn = pc.getNet().getName() + if pn not in find and pn not in already_found: + search_more.append(pn) + res.add(c) + print() + if search_more: + print("more", search_more) + new_found = find + already_found + #more = self.get_net_connections(search_more, new_found) + #res.update(more) + return res + def scriptMain(editor=None, **kwargs): coriolis_setup() -- 2.30.2