def doLayout ( self ): #print 'HorizontalRail[%s] @%d' % (self.order,DbU.toLambda(self.axis)) railVias = [ self.side.corner0(self.order) , self.side.corner1(self.order) ] for via in list(self.vias.values()): if via[1].getNet() != via[2].getNet(): continue via[1].doLayout() #print ' Connect:', via[2], via[1].getVia( via[2].getLayer() ) Vertical.create( via[1].getVia( via[2].getLayer() ) , via[2] , via[2].getLayer() , via[2].getX() , via[2].getWidth() ) railVias.append( via[1].getVia( self.side.getVLayer()) ) railVias.sort( key=methodcaller('getY') ) for i in range(1,len(railVias)): Horizontal.create( railVias[i-1] , railVias[i] , self.side.getHLayer() , self.axis , self.side.hRailWidth ) return
def _routePads(self): for i in range(len(self._corona._powerRails)): if self._type == chip.South: Horizontal.create(self._corona._corners[chip.SouthWest][i], self._corona._corners[chip.SouthEast][i], self._corona._powerRails[i][1], self.getAxis(i), self._corona._powerRails[i][3]) elif self._type == chip.North: Horizontal.create(self._corona._corners[chip.NorthWest][i], self._corona._corners[chip.NorthEast][i], self._corona._powerRails[i][1], self.getAxis(i), self._corona._powerRails[i][3]) elif self._type == chip.East: Vertical.create(self._corona._corners[chip.SouthEast][i], self._corona._corners[chip.NorthEast][i], self._corona._powerRails[i][1], self.getAxis(i), self._corona._powerRails[i][3]) elif self._type == chip.West: Vertical.create(self._corona._corners[chip.SouthWest][i], self._corona._corners[chip.NorthWest][i], self._corona._powerRails[i][1], self.getAxis(i), self._corona._powerRails[i][3]) return
def _rpAccess ( self, rp, flags ): trace( 550, ',+', '\t_rpAccess() %s\n' % str(rp) ) if flags & GaugeConf.DeepDepth: hdepth = self._horizontalDeepDepth vdepth = self._verticalDeepDepth else: hdepth = self._horizontalDepth vdepth = self._verticalDepth hpitch = self._routingGauge.getLayerGauge(hdepth).getPitch() hoffset = self._routingGauge.getLayerGauge(hdepth).getOffset() contact1 = Contact.create( rp, self._routingGauge.getContactLayer(0), 0, 0 ) midSliceY = contact1.getY() - (contact1.getY() % self._cellGauge.getSliceHeight()) \ + self._cellGauge.getSliceHeight() / 2 midTrackY = midSliceY - ((midSliceY - hoffset) % hpitch) dy = midSliceY - contact1.getY() if flags & GaugeConf.OffsetBottom1: dy += hpitch if flags & GaugeConf.OffsetTop1: dy -= hpitch contact1.setDy( dy ) trace( 550, contact1 ) if flags & GaugeConf.HAccess: stopDepth = hdepth else: stopDepth = vdepth for depth in range(1,stopDepth): xoffset = 0 if flags & GaugeConf.OffsetRight1 and depth == 1: xoffset = self._routingGauge.getLayerGauge(depth+1).getPitch() contact2 = Contact.create( rp.getNet() , self._routingGauge.getContactLayer(depth) , contact1.getX() + xoffset , contact1.getY() , self._routingGauge.getLayerGauge(depth).getViaWidth() , self._routingGauge.getLayerGauge(depth).getViaWidth() ) trace( 550, contact2 ) if self._routingGauge.getLayerGauge(depth).getDirection() == RoutingLayerGauge.Horizontal: segment = Horizontal.create( contact1 , contact2 , self._routingGauge.getRoutingLayer(depth) , contact1.getY() , self._routingGauge.getLayerGauge(depth).getWireWidth() ) trace( 550, segment ) else: segment = Vertical.create( contact1 , contact2 , self._routingGauge.getRoutingLayer(depth) , contact1.getX() , self._routingGauge.getLayerGauge(depth).getWireWidth() ) trace( 550, segment ) contact1 = contact2 trace( 550, '-' ) return contact1
def doLayout ( self ): #print 'VerticalRail[%s] @%d' % (self.order,DbU.toLambda(self.axis)) railVias = [ self.side.corner0(self.order) , self.side.corner1(self.order) ] for via in list(self.vias.values()): if via[1].getNet() != via[2].getNet(): continue via[1].doLayout() Horizontal.create( via[1].getVia( via[2].getLayer() ) , via[2] , via[2].getLayer() , via[2].getY() , via[2].getHeight() ) railVias.append( via[1].getVia(self.side.getVLayer()) ) railVias.sort( key=methodcaller('getY') ) for i in range(1,len(railVias)): Vertical.create( railVias[i-1] , railVias[i] , self.side.getVLayer() , self.axis , self.side.vRailWidth ) #routingGauge = CRL.AllianceFramework.get().getRoutingGauge() #for depth in range(self.side.verticalDepth-2,self.vias.values()[0][1]._bottomDepth,-2): # blockageLayer = routingGauge.getRoutingLayer(depth).getBlockageLayer() # pitch = routingGauge.getLayerPitch(depth) # # for i in range(1,len(railVias)): # Vertical.create( self.side.blockageNet # , blockageLayer # , self.axis # , self.side.vRailWidth + 2*pitch # , railVias[i-1].getBoundingBox().getYMax() + pitch # , railVias[i ].getBoundingBox().getYMin() - pitch # ) return
def _createHorizontal ( self, source, target, y, flags ): if flags & GaugeConf.DeepDepth: depth = self._horizontalDeepDepth else: depth = self._horizontalDepth layer = self._routingGauge.getRoutingLayer(depth) if flags & GaugeConf.UseContactWidth: width = source.getBoundingBox(layer.getBasicLayer()).getHeight() else: width = self._routingGauge.getLayerGauge(depth).getWireWidth() if flags & GaugeConf.ExpandWidth: width += DbU.fromLambda( 1.0 ) segment = Horizontal.create( source, target, layer, y, width ) trace( 550, segment ) return segment
def addBlockages ( self, sideXMin, sideXMax ): spans = IntervalSet() for rail in self._rails: for via in list(rail.vias.values()): if via[1].getNet() != via[2].getNet(): continue spans.merge( via[1]._y - via[1]._height/2, via[1]._y + via[1]._height/2 ) routingGauge = CRL.AllianceFramework.get().getRoutingGauge() for depth in range(list(self.getInnerRail(0).vias.values())[0][1].bottomDepth ,list(self.getInnerRail(0).vias.values())[0][1].topDepth ): blockageLayer = routingGauge.getRoutingLayer(depth).getBlockageLayer() pitch = routingGauge.getLayerPitch(depth) for chunk in spans.chunks: Horizontal.create( self.blockageNet , blockageLayer , (chunk.getVMax()+chunk.getVMin())/2 , chunk.getVMax() - chunk.getVMin() + pitch*2 , sideXMin , sideXMax ) return
def px2mpx(editor, pxCell): global framework if pxCell == None: raise ErrorMessage( 3, 'px2mpx.px2mpx(): Mandatory pxCell argument is None.') mpxCell = None print '\nProcessing', pxCell UpdateSession.open() try: if pxCell.getName() != 'padreal': mpxCellName = pxCell.getName()[:-2] + 'mpx' else: mpxCellName = pxCell.getName() + '_mpx' mpxCell = framework.createCell(mpxCellName) if editor: editor.setCell(mpxCell) Left = 0x0001 Right = 0x0002 Middle = 0x0000 AllSpan = Left | Right ab = pxCell.getAbutmentBox() mpxCell.setAbutmentBox( Box(ab.getXMin() * 2, ab.getYMin() * 2, ab.getXMax() * 2, ab.getYMax() * 2)) for instance in pxCell.getInstances(): masterCell = instance.getMasterCell() if masterCell.getName() == 'padreal': masterCell = framework.getCell('padreal_mpx', CRL.Catalog.State.Physical) originTransf = instance.getTransformation() mpxInstance = Instance.create( mpxCell, instance.getName(), masterCell, Transformation(originTransf.getTx() * 2, originTransf.getTy() * 2, originTransf.getOrientation())) mpxInstance.setPlacementStatus(Instance.PlacementStatus.PLACED) for net in pxCell.getNets(): mpxNet = Net.create(mpxCell, net.getName()) if net.isExternal(): mpxNet.setExternal(True) if net.isGlobal(): mpxNet.setGlobal(True) mpxNet.setType(net.getType()) mpxNet.setDirection(net.getDirection()) for component in net.getComponents(): layer = component.getLayer() dupComponent = None print ' Processing', component if isinstance(component, Contact): dupComponent = Contact.create(mpxNet, layer, component.getX() * 2, component.getY() * 2, component.getWidth() * 2, component.getHeight() * 2) elif isinstance(component, Horizontal): dL, dW, mW = getDeltas(layer) dLLeft = dL dLRight = dL skipComponent = False bb = component.getBoundingBox() if component.getSourceX() > component.getTargetX(): component.invert() if isinstance(layer, RegularLayer): if layer.getBasicLayer().getMaterial().getCode( ) == BasicLayer.Material.blockage: print ' Blockage BB:%s vs. AB:%s' % (bb, ab) if layer.getName()[-1] == '2' or layer.getName( )[-1] == '4': state = 0 if bb.getXMin() <= ab.getXMin(): state |= Left if bb.getXMax() >= ab.getXMax(): state |= Right if not (state & Left): print ' Shrink left.' dLLeft = dL - DbU.fromLambda(1.5) if not (state & Right): print ' Shrink right.' dLRight = dL - DbU.fromLambda(1.5) if layer.getName( )[-1] == '4' and state == AllSpan: print ' Skipping component.' skipComponent = True width = mW if component.getWidth() > mW: width = component.getWidth() * 2 + dW #print DbU.toLambda(bb.getWidth()), DbU.toLambda( dLLeft-dLRight) if bb.getWidth() * 2 > abs(dLLeft + dLRight) and not skipComponent: dupComponent = Horizontal.create( mpxNet, layer, component.getY() * 2, width, component.getDxSource() * 2 - dLLeft, component.getDxTarget() * 2 + dLRight) print ' Copy:', dupComponent else: print ' Horizontal component too small *or* skipped, not converted' elif isinstance(component, Vertical): dL, dW, mW = getDeltas(component.getLayer()) dLTop = dL dLBottom = dL dX = 0 skipComponent = False if component.getSourceY() > component.getTargetY(): component.invert() if isinstance(layer, RegularLayer): if layer.getBasicLayer().getMaterial().getCode( ) == BasicLayer.Material.blockage: if layer.getName()[-1] == '3' or layer.getName( )[-1] == '5': state = 0 bb = component.getBoundingBox() if bb.getXMin() <= ab.getXMin(): state |= Left if bb.getXMax() >= ab.getXMax(): state |= Right if state == Left: dX = DbU.fromLambda(-2.0) dW += DbU.fromLambda(-2.0) elif state == Right: dX = DbU.fromLambda(2.0) dW += DbU.fromLambda(-2.0) elif state == 0: dX = 0 dW += DbU.fromLambda(-4.0) if layer.getName()[-1] == '5': if state == AllSpan: print ' Skipping component.' skipComponent = True else: dLTop = DbU.fromLambda( 120.0 ) - component.getDyTarget() * 2 if dW < component.getWidth() and not skipComponent: width = mW if component.getWidth() > mW: width = component.getWidth() * 2 + dW dupComponent = Vertical.create( mpxNet, layer, component.getX() * 2 + dX, width, component.getDySource() * 2 - dLBottom, component.getDyTarget() * 2 + dLTop) else: print ' Vertical component too small *or* skipped, not converted' else: print '[WARNING] Unchanged component:', component if dupComponent and NetExternalComponents.isExternal( component): NetExternalComponents.setExternal(dupComponent) if editor: editor.fit() except ErrorMessage, e: print e errorCode = e.code