bag.layout.routing.fill

This module defines classes that provides automatic fill utility on a grid.

Module Contents

Classes

FillInfo

Functions

fill_symmetric_max_density(→ List[Tuple[int, int]])

Fill the given 1-D area with density constraints, using largest blocks possible.

fill_symmetric_min_density(→ List[Tuple[int, int]])

fill_symmetric_min_density_info(→ FillInfo)

Fill the given 1-D area to satisfy minimum density constraint

fill_symmetric_max_density_info(→ FillInfo)

Fill the given 1-D area with density constraints, using largest blocks possible.

fill_symmetric_max_num_info(→ FillInfo)

Fill the given 1-D area as much as possible with given number of fill blocks.

fill_symmetric_const_space(→ List[Tuple[int, int]])

Fill the given 1-D area given maximum space spec alone.

fill_symmetric_helper(→ List[Tuple[int, int]])

Helper method for all fill symmetric methods.

_fill_symmetric_info(→ FillInfo)

Calculate symmetric fill information.

fill_symmetric_interval(→ List[Tuple[int, int]])

Construct interval list from FillInfo object.

class bag.layout.routing.fill.FillInfo[source]
property num_fill: int[source]
property sp_max: int[source]
property blk_min: int[source]
property blk_max: int[source]
tot_area: int[source]
sp_nominal: int[source]
sp_edge: int[source]
sp_mid: int[source]
blk0: int[source]
blk1: int[source]
blkm: int[source]
num_half: int[source]
num_diff_sp: int[source]
num_blk1_half: int[source]
inc_sp: bool[source]
fill_on_edge: bool[source]
cyclic: bool[source]
invert: bool[source]
get_fill_area(scale: int, extend: int) int[source]
meet_area_specs(area_specs: List[Tuple[int, int, int]]) bool[source]
get_area_fom(area_specs: List[Tuple[int, int, int]]) int[source]
bag.layout.routing.fill.fill_symmetric_max_density(area: int, n_min: int, n_max: int, sp_min: int, area_specs: List[Tuple[int, int, int]], sp_max: Optional[int] = None, fill_on_edge: bool = True, cyclic: bool = False) List[Tuple[int, int]][source]

Fill the given 1-D area with density constraints, using largest blocks possible.

Compute fill location such that the given area is filled with the following properties:

  1. the area is as uniform as possible.

  2. the area is symmetric with respect to the center

  3. all fill blocks have lengths between n_min and n_max.

  4. all fill blocks are at least sp_min apart.

Parameters:
  • area (int) – total number of space we need to fill.

  • n_min (int) – minimum length of the fill block. Must be less than or equal to n_max.

  • n_max (int) – maximum length of the fill block.

  • sp_min (int) – minimum space between each fill block.

  • area_specs (List[Tuple[int, int, int]]) – list of area specifications, in (target, scale, extension) format.

  • sp_max (Optional[int]) – if given, make sure space between blocks does not exceed this value. Must be greater than sp_min

  • fill_on_edge (bool) – If True, we put fill blocks on area boundary. Otherwise, we put space block on area boundary.

  • cyclic (bool) – If True, we assume we’re filling in a cyclic area (it wraps around).

Returns:

fill_interval – a list of [start, stop) intervals that needs to be filled.

Return type:

List[Tuple[int, int]]

bag.layout.routing.fill.fill_symmetric_min_density(area: int, n_min: int, n_max: int, sp_min: int, area_specs: List[Tuple[int, int, int]], sp_max: Optional[int] = None, fill_on_edge: bool = True, cyclic: bool = False) List[Tuple[int, int]][source]
bag.layout.routing.fill.fill_symmetric_min_density_info(area: int, n_min: int, n_max: int, sp_min: int, area_specs: List[Tuple[int, int, int]], sp_max: Optional[int] = None, fill_on_edge: bool = True, cyclic: bool = False) FillInfo[source]

Fill the given 1-D area to satisfy minimum density constraint

Compute fill location such that the given area is filled with the following properties:

  1. the area is as uniform as possible.

  2. the area is symmetric with respect to the center

  3. all fill blocks have lengths between n_min and n_max.

  4. all fill blocks are at least sp_min apart.

Parameters:
  • area (int) – total number of space we need to fill.

  • n_min (int) – minimum length of the fill block. Must be less than or equal to n_max.

  • n_max (int) – maximum length of the fill block.

  • sp_min (int) – minimum space between each fill block.

  • area_specs (List[Tuple[int, int, int]]) – list of area specifications, in (target, scale, extension) format.

  • sp_max (Optional[int]) – if given, make sure space between blocks does not exceed this value. Must be greater than sp_min

  • fill_on_edge (bool) – If True, we put fill blocks on area boundary. Otherwise, we put space block on area boundary.

  • cyclic (bool) – If True, we assume we’re filling in a cyclic area (it wraps around).

Returns:

info – the fill information object.

Return type:

FillInfo

bag.layout.routing.fill.fill_symmetric_max_density_info(area: int, n_min: int, n_max: int, sp_min: int, area_specs: List[Tuple[int, int, int]], sp_max: Optional[int] = None, fill_on_edge: bool = True, cyclic: bool = False) FillInfo[source]

Fill the given 1-D area with density constraints, using largest blocks possible.

Compute fill location such that the given area is filled with the following properties:

  1. the area is as uniform as possible.

  2. the area is symmetric with respect to the center

  3. all fill blocks have lengths between n_min and n_max.

  4. all fill blocks are at least sp_min apart.

  5. we do the best to meet area specs by using the largest blocks possible.

Parameters:
  • area (int) – total number of space we need to fill.

  • n_min (int) – minimum length of the fill block. Must be less than or equal to n_max.

  • n_max (int) – maximum length of the fill block.

  • sp_min (int) – minimum space between each fill block.

  • area_specs (List[Tuple[int, int, int]]) – list of area specifications, in (target, scale, extension) format.

  • sp_max (Optional[int]) – if given, make sure space between blocks does not exceed this value. Must be greater than sp_min

  • fill_on_edge (bool) – If True, we put fill blocks on area boundary. Otherwise, we put space block on area boundary.

  • cyclic (bool) – If True, we assume we’re filling in a cyclic area (it wraps around).

Returns:

info – the fill information object.

Return type:

FillInfo

exception bag.layout.routing.fill.MaxSpaceTooStrictError[source]

Bases: ValueError

Inappropriate argument value (of correct type).

exception bag.layout.routing.fill.InsufficientAreaError[source]

Bases: ValueError

Inappropriate argument value (of correct type).

exception bag.layout.routing.fill.FillTooSmallError[source]

Bases: ValueError

Inappropriate argument value (of correct type).

exception bag.layout.routing.fill.NoFillAbutEdgeError[source]

Bases: ValueError

Inappropriate argument value (of correct type).

exception bag.layout.routing.fill.NoFillChoiceError[source]

Bases: ValueError

Inappropriate argument value (of correct type).

exception bag.layout.routing.fill.EmptyRegionError[source]

Bases: ValueError

Inappropriate argument value (of correct type).

bag.layout.routing.fill.fill_symmetric_max_num_info(tot_area: int, nfill: int, n_min: int, n_max: int, sp_min: int, fill_on_edge: bool = True, cyclic: bool = False) FillInfo[source]

Fill the given 1-D area as much as possible with given number of fill blocks.

Compute fill location such that the given area is filled with the following properties:

  1. the area is as uniform as possible.

  2. the area is symmetric with respect to the center

  3. the area is filled as much as possible with exactly nfill blocks, with lengths between n_min and n_max.

  4. all fill blocks are at least sp_min apart.

Parameters:
  • tot_area (int) – total number of space we need to fill.

  • nfill (int) – number of fill blocks to draw.

  • n_min (int) – minimum length of the fill block. Must be less than or equal to n_max.

  • n_max (int) – maximum length of the fill block.

  • sp_min (int) – minimum space between each fill block.

  • fill_on_edge (bool) – If True, we put fill blocks on area boundary. Otherwise, we put space block on area boundary.

  • cyclic (bool) – If True, we assume we’re filling in a cyclic area (it wraps around).

Returns:

info – the fill information object.

Return type:

FillInfo

bag.layout.routing.fill.fill_symmetric_const_space(area: int, sp_max: int, n_min: int, n_max: int) List[Tuple[int, int]][source]

Fill the given 1-D area given maximum space spec alone.

The method draws the minimum number of fill blocks needed to satisfy maximum spacing spec. The given area is filled with the following properties:

  1. all spaces are as close to the given space as possible (differ by at most 1), without exceeding it.

  2. the filled area is as uniform as possible.

  3. the filled area is symmetric about the center.

  4. fill is drawn as much as possible given the above constraints.

fill is drawn such that space blocks abuts both area boundaries.

Parameters:
  • area (int) – the 1-D area to fill.

  • sp_max (int) – the maximum space.

  • n_min (int) – minimum fill length.

  • n_max (int) – maximum fill length

Returns:

fill_intv – list of fill intervals.

Return type:

List[Tuple[int, int]]

bag.layout.routing.fill.fill_symmetric_helper(tot_area: int, num_blk_tot: int, sp: int, inc_sp: bool = True, invert: bool = False, fill_on_edge: bool = True, cyclic: bool = False) List[Tuple[int, int]][source]

Helper method for all fill symmetric methods.

This method fills an area with given number of fill blocks such that the space between blocks is equal to the given space. Other fill_symmetric methods basically transpose the constraints into this problem, with the proper options.

The solution has the following properties:

  1. it is symmetric about the center.

  2. it is as uniform as possible.

  3. it uses at most 3 consecutive values of fill lengths.

  4. it uses at most 2 consecutive values of space lengths. If inc_sp is True, we use sp and sp + 1. If inc_sp is False, we use sp - 1 and sp. In addition, at most two space blocks have length different than sp.

Here are all the scenarios that affect the number of different fill/space lengths:

  1. All spaces will be equal to sp under the following condition: i. cyclic is False, and num_blk_tot is odd. ii. cyclic is True, fill_on_edge is True, and num_blk_tot is even. iii. cyclic is True, fill_on_edge is False, sp is even, and num_blk_tot is odd.

    In particular, this means if you must have the same space between fill blocks, you can change num_blk_tot by 1.

  2. The only case where at most 2 space blocks have length different than sp is when cyclic is True, fill_on_edge is False, sp is odd, and num_blk_tot is even.

3. In all other cases, at most 1 space block have legnth different than sp. 4, The only case where at most 3 fill lengths are used is when cyclic is True,

fill_on_edge is True, and num_blk_tot is even,

Parameters:
  • tot_area (int) – the fill area length.

  • num_blk_tot (int) – total number of fill blocks to use.

  • sp (int) – space between blocks. We will try our best to keep this spacing constant.

  • inc_sp (bool) – If True, then we use sp + 1 if necessary. Otherwise, we use sp - 1 if necessary.

  • invert (bool) – If True, we return space intervals instead of fill intervals.

  • fill_on_edge (bool) – If True, we put fill blocks on area boundary. Otherwise, we put space block on area boundary.

  • cyclic (bool) – If True, we assume we’re filling in a cyclic area (it wraps around).

Returns:

ans – list of fill or space intervals.

Return type:

List[(int, int)]

bag.layout.routing.fill._fill_symmetric_info(tot_area: int, num_blk_tot: int, sp: int, inc_sp: bool = True, fill_on_edge: bool = True, cyclic: bool = False) FillInfo[source]

Calculate symmetric fill information.

This method computes fill information without generating fill interval list. This makes it fast to explore various fill settings. See fill_symmetric_helper() to see a description of the fill algorithm.

Parameters:
  • tot_area (int) – the fill area length.

  • num_blk_tot (int) – total number of fill blocks to use.

  • sp (int) – space between blocks. We will try our best to keep this spacing constant.

  • inc_sp (bool) – If True, then we use sp + 1 if necessary. Otherwise, we use sp - 1 if necessary.

  • fill_on_edge (bool) – If True, we put fill blocks on area boundary. Otherwise, we put space block on area boundary.

  • cyclic (bool) – If True, we assume we’re filling in a cyclic area (it wraps around).

Returns:

info – the fill information object.

Return type:

FillInfo

bag.layout.routing.fill.fill_symmetric_interval(info: FillInfo, d0: int = 0, d1: int = 0, scale: int = 1) List[Tuple[int, int]][source]

Construct interval list from FillInfo object.

Parameters:
  • info (FillInfo) – the Fillinfo object.

  • d0 (int) – offset of the starting coordinate.

  • d1 (int) – offset of the stopping coordinate.

  • scale (int) – the scale factor.