Skip to content

Commit

Permalink
Merge pull request #41 from cedard234/without_OA
Browse files Browse the repository at this point in the history
bugfix: fixed floating metal in do_power_fill API
  • Loading branch information
boblinchuan authored Dec 19, 2024
2 parents 8d3b6fd + 3f0c91f commit f4e98f6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/bag/layout/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -2670,7 +2670,7 @@ def do_power_fill(self, layer_id: int, tr_manager: TrackManager,
vdd_warrs: Optional[Union[WireArray, List[WireArray]]] = None,
vss_warrs: Optional[Union[WireArray, List[WireArray]]] = None, bound_box: Optional[BBox] = None,
x_margin: int = 0, y_margin: int = 0, sup_type: str = 'both', flip: bool = False,
uniform_grid: bool = False) -> Tuple[List[WireArray], List[WireArray]]:
uniform_grid: bool = False, draw_on_edge: bool = True) -> Tuple[List[WireArray], List[WireArray]]:
"""Draw power fill on the given layer. Wrapper around do_multi_power_fill method
that only returns the VDD and VSS wires.
Expand All @@ -2696,6 +2696,8 @@ def do_power_fill(self, layer_id: int, tr_manager: TrackManager,
draw power fill on a common grid instead of dense packing.
flip : bool
true to reverse order of power fill. Default (False) is {VDD, VSS}.
draw_on_edge : bool
true to draw power fill to the edge of the bounding box. false to keep a margin of the preset value of track space width. Default is True.
Returns
-------
Expand All @@ -2719,11 +2721,10 @@ def do_power_fill(self, layer_id: int, tr_manager: TrackManager,
raise RuntimeError('Provided supply type and supply wires do not match.')

# Run the actual power fill using the multi_power_fill function
ret_warrs = self.do_multi_power_fill(layer_id, tr_manager, top_lists, bound_box,
x_margin, y_margin, flip, uniform_grid)
ret_warrs = self.do_multi_power_fill(layer_id, tr_manager, top_lists, bound_box, x_margin, y_margin, flip, uniform_grid, draw_on_edge)

# Reorganize return values
if sup_type.lower() == 'both':
if sup_type.lower() == 'both':
top_vdd, top_vss = (ret_warrs[0], ret_warrs[1]) if not flip else (ret_warrs[1], ret_warrs[0])
elif sup_type.lower() == 'vss':
top_vdd = []
Expand All @@ -2737,7 +2738,7 @@ def do_power_fill(self, layer_id: int, tr_manager: TrackManager,
def do_multi_power_fill(self, layer_id: int, tr_manager: TrackManager,
sup_list: List[Union[WireArray, List[WireArray]]], bound_box: Optional[BBox] = None,
x_margin: int = 0, y_margin: int = 0, flip: bool = False, uniform_grid: bool = False
) -> List[List[WireArray]]:
, draw_on_edge: bool = True) -> List[List[WireArray]]:
"""Draw power fill on the given layer. Accepts as many different supply nets as provided.
Parameters
Expand All @@ -2758,6 +2759,8 @@ def do_multi_power_fill(self, layer_id: int, tr_manager: TrackManager,
draw power fill on a common grid instead of dense packing.
flip : bool
true to reverse order of power fill. Default is False.
draw_on_edge : bool
true to draw power fill to the edge of the bounding box. false to keep a margin of the preset value of track space width. Default is True.
Returns
-------
Expand All @@ -2783,8 +2786,12 @@ def do_multi_power_fill(self, layer_id: int, tr_manager: TrackManager,
cl, cu = bound_box.xl + fill_w2, bound_box.xh - fill_w2
lower, upper = bound_box.yl, bound_box.yh
sep_margin = tr_manager.get_sep(layer_id, ('sup', ''))
tr_bot = self.grid.coord_to_track(layer_id, cl, mode=RoundMode.GREATER_EQ)
tr_top = self.grid.coord_to_track(layer_id, cu, mode=RoundMode.LESS_EQ)
if draw_on_edge:
tr_bot = self.grid.coord_to_track(layer_id, cl, mode=RoundMode.GREATER_EQ)
tr_top = self.grid.coord_to_track(layer_id, cu, mode=RoundMode.LESS_EQ)
else:
tr_bot = self.grid.coord_to_track(layer_id, cl, mode=RoundMode.GREATER) + sep_margin // 2
tr_top = self.grid.coord_to_track(layer_id, cu, mode=RoundMode.LESS) - sep_margin // 2
trs = self.get_available_tracks(layer_id, tid_lo=tr_bot, tid_hi=tr_top, lower=lower, upper=upper,
width=fill_width, sep=fill_space, sep_margin=sep_margin,
uniform_grid=uniform_grid)
Expand Down

0 comments on commit f4e98f6

Please sign in to comment.