def __init__(self, topTree, sourceBuffer, area, prefix, flags): self.topTree = topTree self.childs = [] self.blLeafs = [] self.brLeafs = [] self.tlLeafs = [] self.trLeafs = [] self.flags = flags self.sourceBuffer = sourceBuffer self.area = area self.prefix = prefix self.blBuffer = Instance.create(self.topTree.cell, 'ck_htree' + self.prefix + '_bl_ins', self.topTree.bufferCell) self.brBuffer = Instance.create(self.topTree.cell, 'ck_htree' + self.prefix + '_br_ins', self.topTree.bufferCell) self.tlBuffer = Instance.create(self.topTree.cell, 'ck_htree' + self.prefix + '_tl_ins', self.topTree.bufferCell) self.trBuffer = Instance.create(self.topTree.cell, 'ck_htree' + self.prefix + '_tr_ins', self.topTree.bufferCell) self.ckNet = getPlugByName(self.sourceBuffer, self.topTree.bufferOut).getNet() getPlugByName(self.blBuffer, self.topTree.bufferIn).setNet(self.ckNet) getPlugByName(self.brBuffer, self.topTree.bufferIn).setNet(self.ckNet) getPlugByName(self.tlBuffer, self.topTree.bufferIn).setNet(self.ckNet) getPlugByName(self.trBuffer, self.topTree.bufferIn).setNet(self.ckNet) self.topTree._createChildNet(self.blBuffer, 'ck_htree' + self.prefix + '_bl') self.topTree._createChildNet(self.brBuffer, 'ck_htree' + self.prefix + '_br') self.topTree._createChildNet(self.tlBuffer, 'ck_htree' + self.prefix + '_tl') self.topTree._createChildNet(self.trBuffer, 'ck_htree' + self.prefix + '_tr') halfWidth = self.area.getHalfWidth() halfHeight = self.area.getHalfHeight() if halfWidth >= self.topTree.minSide and halfHeight >= self.topTree.minSide: # Recursive call. self.childs.append( HTreeNode(self.topTree, self.blBuffer, self.blArea(), self.prefix + '_bl', 0)) self.childs.append( HTreeNode(self.topTree, self.brBuffer, self.brArea(), self.prefix + '_br', 0)) self.childs.append( HTreeNode(self.topTree, self.tlBuffer, self.tlArea(), self.prefix + '_tl', 0)) self.childs.append( HTreeNode(self.topTree, self.trBuffer, self.trArea(), self.prefix + '_tr', 0)) return
def addLeaf(self, point, plugOccurrence): if self.childs: if self.blArea().contains(point): self.childs[0].addLeaf(point, plugOccurrence) elif self.brArea().contains(point): self.childs[1].addLeaf(point, plugOccurrence) elif self.tlArea().contains(point): self.childs[2].addLeaf(point, plugOccurrence) else: self.childs[3].addLeaf(point, plugOccurrence) return leafBuffer = None if self.blArea().contains(point): self.blLeafs.append(plugOccurrence) leafBuffer = self.blBuffer elif self.brArea().contains(point): self.brLeafs.append(plugOccurrence) leafBuffer = self.brBuffer elif self.tlArea().contains(point): self.tlLeafs.append(plugOccurrence) leafBuffer = self.tlBuffer else: self.trLeafs.append(plugOccurrence) leafBuffer = self.trBuffer leafCk = getPlugByName(leafBuffer, self.topTree.bufferOut).getNet() deepPlug = self.topTree.addDeepPlug(leafCk, plugOccurrence.getPath()) if deepPlug: leafCk = deepPlug.getMasterNet() plugOccurrence.getEntity().setNet(leafCk) return
def connectLeaf(self): trace(550, '\tConnecting leafs.\n') UpdateSession.open() leafsByBuffer = {} hyperMasterClock = HyperNet.create(Occurrence(self.masterClock)) for plugOccurrence in hyperMasterClock.getLeafPlugOccurrences(): trace(550, '\tAdding leaf <%s>.\n' % plugOccurrence) position = plugOccurrence.getBoundingBox().getCenter() self.addLeaf(position, plugOccurrence) self.childs[0].connectLeafs() sys.stdout.flush() getPlugByName(self.topBuffer, self.bufferIn).setNet(self.masterClock) UpdateSession.close() return
def _createChildNet(self, ibuffer, tag): childNet = Net.create(self.cell, tag) childNet.setType(Net.Type.CLOCK) getPlugByName(ibuffer, self.bufferOut).setNet(childNet) return