bag.layout.core
This module defines some core layout classes
Module Contents
Classes
Attributes
- class bag.layout.core.PyLayInstance(parent: bag.layout.template.TemplateBase, master: bag.layout.template.TemplateBase, ref: pybag.core.PyLayInstRef)[source]
-
- property master: bag.layout.template.TemplateBase[source]
The master of this instance.
- Type:
- property transformation: pybag.core.Transform[source]
The instance transformation object.
- Type:
Transform
- property bound_box: pybag.core.BBox[source]
Returns the overall bounding box of this instance.
- Type:
BBox
- get_item_location(row: int = 0, col: int = 0) Tuple[int, int] [source]
Returns the location of the given item in the array.
- get_bound_box_of(row: int = 0, col: int = 0) pybag.core.BBox [source]
Returns the bounding box of an instance in this mosaic.
- transform(xform: pybag.core.Transform) None [source]
Transform the location of this instance.
- Parameters:
xform (Transform) – the transformation to apply to this instance.
- new_master_with(**kwargs: Any) None [source]
Change the master template of this instance.
This method will get the old master template layout parameters, update the parameter values with the given dictionary, then create a new master template with those parameters and associate it with this instance.
- Parameters:
**kwargs (Any) – a dictionary of new parameter values.
- transform_master_object(obj: T, row: int = 0, col: int = 0) T [source]
Transforms the given object in instance master w.r.t. this instance’s Transform object.
- get_port(name: str = '', row: int = 0, col: int = 0) bag.layout.routing.base.Port [source]
Returns the port object of the given instance in the array.
- Parameters:
- Returns:
port – the port object.
- Return type:
- get_primitive_port(name: str, check_fun: Callable[[int], bool], row: int = 0, col: int = 0) bag.layout.routing.base.Port [source]
Returns the port object of the given instance in the array.
- Parameters:
name (str) – the port terminal name. If empty, check if this instance has only one port, then return it.
check_fun (Callable[[int], bool]) – a function that returns true if a layer is considered “private”.
row (int) – the instance row index. Index 0 is the bottom-most row.
col (int) – the instance column index. Index 0 is the left-most column.
- Returns:
port – the port object.
- Return type:
- get_pin(name: str = '', row: int = 0, col: int = 0, layer: int = Port.default_layer) Union[bag.layout.routing.base.WireArray, pybag.core.BBox] [source]
Returns the first pin with the given name.
This is an efficient method if you know this instance has exactly one pin.
- Parameters:
name (str) – the port terminal name. If None or empty, check if this instance has only one port, then return it.
row (int) – the instance row index. Index 0 is the bottom-most row.
col (int) – the instance column index. Index 0 is the left-most column.
layer (int) – the pin layer. If negative, check to see if the given port has only one layer. If so then use that layer.
- Returns:
pin – the first pin associated with the port of given name.
- Return type:
Union[WireArray, BBox]
- port_pins_iter(name: str = '', layer: Union[int, str] = Port.default_layer) Iterable[Union[bag.layout.routing.base.WireArray, pybag.core.BBox]] [source]
Iterate through all pins of all ports with the given name in this instance array.
- Parameters:
- Yields:
pin (Union[WireArray, BBox]) – the pin as WireArray or bounding box.
- get_all_port_pins(name: str = '', layer: Union[int, str] = Port.default_layer) Union[List[bag.layout.routing.base.WireArray], List[pybag.core.BBox]] [source]
Returns a list of all pins of all ports with the given name in this instance array.
This method gathers ports from all instances in this array with the given name, then find all pins of those ports on the given layer, then return as list of WireArrays.
- Parameters:
- Returns:
pin_list – the list of pins as WireArrays or bounding boxes.
- Return type:
Union[List[WireArray], List[BBox]]