xbase.layout.wires

Module Contents

Classes

WireLookup

WireData

WireGraph

WireGraphBuilder

WireSpecs

Functions

_parse_cdba_name(→ Tuple[str, Sequence[int]])

_is_wire_info(→ bool)

_wire_list_iter(→ Iterable[List[Any], ...)

Iterates over wire lists in the given wire graph.

_get_shared_set(→ Set[Tuple[str, int]])

class xbase.layout.wires.WireLookup(data: Dict[Tuple[str, int], Tuple[bag.util.math.HalfInt, int]], ranges: Optional[Dict[str, List[int]]] = None)[source]
classmethod from_dict(table: Mapping[Tuple[str, int], Tuple[float, int]]) WireLookup[source]
__hash__() int[source]

Return hash(self).

__eq__(other: Any) bool[source]

Return self==value.

__bool__() bool[source]
get_track_info(wire_name: str, wire_idx: int) Tuple[bag.util.math.HalfInt, int][source]
get_num_wires(wire_name: str) int[source]
get_wire_range(wire_name: str) Tuple[int, int][source]
to_dict() Mapping[Tuple[str, int], Tuple[float, int]][source]
get_wire_margin_info(grid: bag.layout.routing.grid.RoutingGrid, layer: int, yl: int, yh: int, top_edge: bool, shared: Sequence[str]) Tuple[int, List[Tuple[str, int]]][source]
get_move(tr_idx: bag.util.math.HalfInt, shared: Sequence[str]) WireLookup[source]
get_move_shared(tr_idx: bag.util.math.HalfInt, shared: Sequence[str]) WireLookup[source]
class xbase.layout.wires.WireData[source]
wire_grps: bag.util.immutable.ImmutableList[Tuple[bag.util.immutable.ImmutableList[Tuple[str, str, str]], xbase.layout.enum.Alignment]][source]
shared_wires: bag.util.immutable.ImmutableList[str][source]
classmethod make_wire_data(wire_data: Any, alignment: xbase.layout.enum.Alignment, ptype_default: str) WireData[source]

Construct WireData from given data structure.

wire_data format:

WireData = Optional[Union[WireGraph, {data=WireGraph, align=Alignment, shared=List[str]}]] WireGraph = Union[WireGroup, List[WireGroup]] WireGroup = Union[WireList, {wires=WireList, align=Alignment}] WireList = List[Wire] Wire = Union[name, (name, placement_type), (name, placement_type, wire_type)]

Parameters:
  • wire_data (Any) – the wire graph specification data structure.

  • alignment (Alignment) – default alignment.

  • ptype_default (str) – default placement type.

Returns:

wire_data – the wire graph specification dataclass.

Return type:

WireData

class xbase.layout.wires.WireGraph(graph: networkx.DiGraph, align_specs: List[Tuple[List[Tuple[str, int]], xbase.layout.enum.Alignment]], has_center: bool)[source]
property graph: networkx.DiGraph[source]
property has_center: bool[source]
property upper: int[source]
property lower: int[source]
property sinks: List[Tuple[bag.util.math.HalfInt, str]][source]
__bool__() bool[source]
classmethod make_wire_graph(layer: int, tr_manager: bag.layout.routing.base.TrackManager, wire_data: WireData) WireGraph[source]
get_wire_lookup() WireLookup[source]
get_placement_bounds(layer: int, grid: bag.layout.routing.grid.RoutingGrid, inc_shared: bool = True) Dict[str, List[Tuple[bag.util.math.HalfInt, int]]][source]
get_shared_conn_y(layer: int, grid: bag.layout.routing.grid.RoutingGrid, top_edge: bool) int[source]
set_upper(layer: int, tr_manager: bag.layout.routing.base.TrackManager, val: int) None[source]
place_compact(layer: int, tr_manager: bag.layout.routing.base.TrackManager, lower: int = 0, bot_mirror: bool = False, top_mirror: bool = False, shift: Union[int, bag.util.math.HalfInt] = 0, pcons: Optional[Callable[[str, int, bag.util.math.HalfInt], bag.util.math.HalfInt]] = None, prev_wg: Optional[WireGraph] = None, ytop_conn: Optional[int] = None) None[source]

Place wires in this WireGraph, trying to be as compact as possible.

Algorithm:

  1. First, go through all wires in sorted order, and compute placement. For source wires, use the following algorithm:

    1. If it is shared, place at boundary.

    2. Otherwise, if bot_mirror is True, place it so that it will be DRC clean with itself.

    3. Finally, if prev_wg is given, make sure it is DRC clean from all the sink wires in prev_wg.

  2. After step 1, if we have more than 1 source wires (say A and B), we could still fail DRC rules, because we only made sure A next to A is clean and B next to B is clean, but we’re not guaranteed A next to B is clean. We check for and fix this violation (NOTE: not implemented yet).

  3. Then, we go through all the sink wires, and compute the upper coordinate of this WireGraph as follows:

    1. If the sink wire is shared, record the middle coordinate.

    2. Otherwise, if top_mirror is True, set the upper coordinate so that this wire will be DRC clean to all other non-shared wires.

    3. Finally, make sure upper coordinate is greater than or equal to the upper edge of this wire.

  4. Finally, we find all shared sink wires, and update so they lie on the boundary.

Parameters:
  • layer (int) – wire layer ID.

  • tr_manager (TrackManager) – the TrackManager object.

  • lower (int) – the lower coordinate.

  • bot_mirror (bool) – True if the bottom edge should satisfy mirror placement constraint.

  • top_mirror (bool) – True if the top edge should satisfy mirror placement constraint.

  • shift (Union[int, Halfint]) – shift all wires track index by this amount.

  • pcons (Optional[Callable[[str, int, HalfInt], HalfInt]]) – An optional function used to compute track location based on placement constraint.

  • prev_wg (Optional[WireGraph]) – The WireGraph object just below this one.

  • ytop_conn (Optional[int]) – top Y coordinate of the bottom vertical wire.

align_wires(layer: int, tr_manager: bag.layout.routing.base.TrackManager, lower: int, upper: int, top_pcons: Optional[Callable[[str, int, bag.util.math.HalfInt], bag.util.math.HalfInt]] = None) None[source]
_move(layer: int, tr_manager: bag.layout.routing.base.TrackManager, lower: int, upper, wire: Tuple[str, int], top_pcons: Optional[Callable[[str, int, bag.util.math.HalfInt], bag.util.math.HalfInt]], harden: bool, up: bool) None[source]
class xbase.layout.wires.WireGraphBuilder[source]
register_wires(winfo_list: Sequence[Tuple[str, str, str]], alignment: xbase.layout.enum.Alignment) None[source]

Adds the given list of wires to the WireGraph.

Parameters:
  • winfo_list (Sequence[Tuple[str, str, str]]) – list of wires, described by WireList above.

  • alignment (Alignment) – alignment of the given wires.

register_shared_wire(wire_name: str) None[source]
get_graph(layer: int, tr_manager: bag.layout.routing.base.TrackManager) WireGraph[source]
_is_even_symmetric(wlist: List[Tuple[str, int]]) bool[source]
class xbase.layout.wires.WireSpecs[source]
min_size: Tuple[int, int][source]
blk_size: Tuple[int, int][source]
graph_list: List[Tuple[int, WireGraph]][source]
place_wires(tr_manager: bag.layout.routing.base.TrackManager, w: int, h: int) Dict[int, WireLookup][source]
classmethod make_wire_specs(conn_layer: int, top_layer: int, tr_manager: bag.layout.routing.base.TrackManager, wire_specs: Mapping[int, Any], min_size: Tuple[int, int] = (1, 1), blk_pitch: Tuple[int, int] = (1, 1), align_default: xbase.layout.enum.Alignment = Alignment.LOWER_COMPACT, ptype_default: str = '') WireSpecs[source]

Read wire specifications from a dictionary.

WireSpec dictionary format:

WireSpec = Dict[int, WireData] WireData = Union[WireGraph, {data=WireGraph, align=Alignment, shared=List[str]}] WireGraph = Union[WireGroup, List[WireGroup]] WireGroup = Union[WireList, {wires=WireList, align=Alignment}] WireList = List[Wire] Wire = Union[name, (name, placement_type), (name, placement_type, wire_type)]

keys of WireSpec is delta layer from conn_layer, so key of 1 is the same as conn_layer + 1.

Parameters:
  • conn_layer (int) – the connection layer ID.

  • top_layer (int) – the top layer, used to compute block quantization.

  • tr_manager (TrackManager) – the TrackManager instance.

  • wire_specs (Mapping[int, Any]) – the wire specification dictionary to parse.

  • min_size (Tuple[int, int]) – minimum width/height.

  • blk_pitch (Tuple[int, int]) – width/height quantization on top of routing grid quantization.

  • align_default (Alignment) – default alignment enum.

  • ptype_default (str) – default placement type.

Returns:

wire_specs – the wire specification dataclass.

Return type:

WireSpecs

xbase.layout.wires._parse_cdba_name(name: str) Tuple[str, Sequence[int]][source]
xbase.layout.wires._is_wire_info(obj: Any) bool[source]
xbase.layout.wires._wire_list_iter(wgraph: Any, align_default: xbase.layout.enum.Alignment) Iterable[List[Any], xbase.layout.enum.Alignment][source]

Iterates over wire lists in the given wire graph.

wgraph format:

WireGraph = Union[WireGroup, List[WireGroup]] WireGroup = Union[WireList, {wires=WireList, align=Alignment}] WireList = List[Wire] Wire = Union[name, (name, placement_type), (name, placement_type, wire_type)]

Parameters:
  • wgraph (Any) – the wire graph data structure.

  • align_default (Alignment) – default alignment enum.

Yields:
  • wire_list (List[any]) – a list of wires inside the wire graph.

  • align (Alignment) – alignment of this list of wires.

xbase.layout.wires._get_shared_set(shared: Sequence[str]) Set[Tuple[str, int]][source]