Skip to content

Commit

Permalink
More accurate search for obstacle of the H-Tree sub-branches.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpc-lip6 committed Jan 16, 2024
1 parent eda39f4 commit fa2ba40
Showing 1 changed file with 46 additions and 18 deletions.
64 changes: 46 additions & 18 deletions cumulus/src/plugins/block/spares.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from ...Hurricane import Breakpoint, DbU, Box, Transformation, Box, \
Path, Layer, Occurrence, Net, RoutingPad, \
Horizontal, Vertical, Contact, Pin, Plug, \
Instance
Instance, Point
from ...CRL import AllianceFramework, RoutingLayerGauge
from ...helpers import trace, dots, l, u, n
from ...helpers.io import ErrorMessage, WarningMessage, catch
Expand Down Expand Up @@ -276,27 +276,54 @@ def create ( spares ):

@staticmethod
def isUsedArea ( spares, area, rtag, raiseError ):
centerArea = Box( area.getCenter() )
sliceHeight = spares.conf.sliceHeight
centerArea.inflate( 4*sliceHeight, sliceHeight )
trace( 540, '\tQuadTree.isUnderArea(): {} {} of {}\n'.format(rtag,centerArea,spares.conf.cell) )
if rtag[-2:] == 'bl':
vWireArea = Box( area.getXCenter(), area.getYCenter()
, area.getXCenter(), area.getYMax () )
hWireArea = Box( area.getXCenter(), area.getYMax()
, area.getXMax (), area.getYMax() )
elif rtag[-2:] == 'br':
vWireArea = Box( area.getXCenter(), area.getYCenter()
, area.getXCenter(), area.getYMax () )
hWireArea = Box( area.getXCenter(), area.getYMax()
, area.getXMin (), area.getYMax() )
elif rtag[-2:] == 'tl':
vWireArea = Box( area.getXCenter(), area.getYCenter()
, area.getXCenter(), area.getYMin () )
hWireArea = Box( area.getXCenter(), area.getYMin()
, area.getXMax (), area.getYMin() )
elif rtag[-2:] == 'tr':
vWireArea = Box( area.getXCenter(), area.getYCenter()
, area.getXCenter(), area.getYMin () )
hWireArea = Box( area.getXCenter(), area.getYMin()
, area.getXMin (), area.getYMin() )
else:
vWireArea = Box( area.getXCenter(), area.getYCenter() )
hWireArea = vWireArea
vWireArea.inflate( 0, sliceHeight )
hWireArea.inflate( sliceHeight, 0 )
trace( 540, '\tQuadTree.isUsedArea(): {} {} of {}\n'.format(rtag,hWireArea,vWireArea,spares.conf.cell) )
trace( 540, '\t{}\n'.format( spares.conf.cellPnR ))
for occurrence in spares.conf.cellPnR.getTerminalNetlistInstanceOccurrencesUnder( centerArea ):
if not isinstance(occurrence.getEntity(),Instance):
continue
instance = occurrence.getEntity()
masterCell = instance.getMasterCell()
if not masterCell.isTerminalNetlist():
continue
trace( 540, '\t| Overlap {}\n'.format(occurrence.getEntity()) )
if raiseError:
raise Error%essage( 1, [ 'QuadTree.create(): Unable to create QuadTree under area {}' \
.format(area)
, 'Area center is under fixed block {}' .format()
] )
return True
for treeBox in vWireArea, hWireArea:
for occurrence in spares.conf.cellPnR.getTerminalNetlistInstanceOccurrencesUnder( treeBox ):
if not isinstance(occurrence.getEntity(),Instance):
continue
instance = occurrence.getEntity()
masterCell = instance.getMasterCell()
if not masterCell.isTerminalNetlist():
continue
if instance.getName().startswith('spare_'):
continue
trace( 540, '\t| Overlap {}\n'.format(occurrence.getEntity()) )
if raiseError:
raise Error%essage( 1, [ 'QuadTree.create(): Unable to create QuadTree under area {}' \
.format(area)
, 'Area center is under fixed block {}' .format()
] )
return True
sys.stdout.flush()
sys.stderr.flush()
trace( 540, '\t-> Area is clear.\n' )
return False

@staticmethod
Expand All @@ -305,6 +332,7 @@ def _create ( spares, parent, area, tag, raiseError=False ):
if QuadTree.isUsedArea( spares, area, childRtag, raiseError ):
return None
qt = QuadTree( spares, parent, area, childRtag )
trace( 540, '\tQuadTree._create(): {}\n'.format(qt) )
return qt

def __init__ ( self, spares, parent, area, rtag='root' ):
Expand Down

0 comments on commit fa2ba40

Please sign in to comment.