pymint.constraints package

Submodules

pymint.constraints.arrayconstraint module

class pymint.constraints.arrayconstraint.ArrayConstraint(components: List[Component], xdim: int = 1, ydim: int = 1, horizontal_spacing: float = 0, vertical_spacing: float = 0)

Bases: LayoutConstraint

Array Constraint represents a 1D / 2D array with fixed spacings in both dimensions

property dim: int

Returns the size of the array

Returns:

size

Return type:

int

property horizontal_spacing: float

Gets the horizontal spacing between the components

Raises:

KeyError – If the horizontal spacing is not set

Returns:

The horizontal spacing

Return type:

float

property vertical_spacing: float

Gets the vertical spacing between the components

Raises:

KeyError – If the vertical spacing is not set

Returns:

The vertical spacing

Return type:

float

property xdim: int

Returns the x size of the array

Returns:

size

Return type:

int

property ydim: int

Returns the y size of the array

Returns:

size

Return type:

int

pymint.constraints.constraint module

pymint.constraints.constraintlistener module

class pymint.constraints.constraintlistener.ConstraintListener(device: MINTDevice)

Bases: mintListener

Listener that is used to catch all the layout constratints from the MINT design

enterFlowStat(ctx: FlowStatContext)
enterHorizontalSpacingParam(ctx: HorizontalSpacingParamContext)
enterLayerBlock(ctx: LayerBlockContext)
enterOrientation(ctx: OrientationContext)
enterPositionConstraintStat(ctx: PositionConstraintStatContext)
enterSetCoordinate(ctx: SetCoordinateContext)
enterSpacingParam(ctx: SpacingParamContext)
enterUfname(ctx: UfnameContext)
enterVerticalSpacingParam(ctx: VerticalSpacingParamContext)
exitBankDeclStat(ctx: BankDeclStatContext)
exitBankStat(ctx: BankStatContext)
exitChannelStat(ctx: ChannelStatContext)
exitFlowStat(ctx: FlowStatContext)
exitGridStat(ctx: GridStatContext)
exitLayerBlock(ctx: LayerBlockContext)
exitNetlist(ctx: NetlistContext)
exitNodeStat(ctx: NodeStatContext)
exitPositionConstraintStat(ctx: PositionConstraintStatContext)
exitSpanStat(ctx: SpanStatContext)

pymint.constraints.lengthconstraint module

class pymint.constraints.lengthconstraint.LengthConstraint(connection: Connection, length: float)

Bases: LayoutConstraint

Layout Constriant that will be used for specifying a fixed length for a connection

property connections: List[Connection]

Returns the component covered by the constraint

Returns:

constrained component

Return type:

Component

property length: float

Returns the length fixed by the constraint

Returns:

length constrained

Return type:

float

pymint.constraints.mirrorconstraint module

class pymint.constraints.mirrorconstraint.DistanceDictionaries(groups_size: int, device: Device, undirected_netlist)

Bases: object

Distance dictionaries are the data structures we are using to solve the mirror grouping problem. This algoithm creates dictionaries based on the distances of each of the components to the source components`that are the original decendentants of the `mirror driving component.

The datastructure essentially looks like this: —– —– | 0 : [source_node] 0: [source_node] 0: [source_node] | | 1 : [node1, node2] 1: [node1, node2] 1: [node1, node2] | | 2 : [node1, node2] 2: [node1, node2] 2: [node1, node2] | | 3 : [node1, node2] , 3: [node1, node2] , 3: [node1, node2] , … | | 4 : [node1, node2] 4: [node1, node2] 4: [node1, node2] | | 5 : [node1, node2] 5: [node1, node2] 5: [node1, node2] | | 6 : [node1, node2] 6: [node1, node2] 6: [node1, node2] | | 7 : [node1, node2] 7: [node1, node2] 7: [node1, node2] | —– —–

Its a list of dictionaries where the keys are the distances to the source. If we trim and prune this entire data structure, we will get the final list of groups that we can export.

find_node_in_group(group_index: int, node: str) Tuple[bool, int]

Returns a tuple of (is_node_in_group, distance) return -1 as distance incase the node is not found

Parameters:
  • group_index (int) – The index of the group to check

  • node (str) – The node to check

Raises:

IndexError – If the group index is out of range

Returns:

A tuple of (is_node_in_group, distance)

Return type:

Tuple[bool, int]

generate_groups() List[List[str]]
is_node_in_group(group_index: int, node: str) bool
load_group_dfs_nodes(group_index, dfs_nodes: List[str]) None

Loads the DFS nodes of a group into the dictionary.

prune_backpaths() None
prune_non_group_nodes() None
prune_non_matching_nodes() None
remove_node_from_group(group_index: int, node: str) None
set_group_node(group_index: int, node: str, distance: int)
set_source(group_index: int, node: str)
trim_dictionaries(limit: int) None

Removes all the dictionarie entries that have a distance greater than or equal to the limit

trim_uneven_distaces() None
class pymint.constraints.mirrorconstraint.MirrorConstraint(source_component: Component, mirror_count=None, mirror_groups: List[List[Component]] = [])

Bases: LayoutConstraint

Layout constraint when two differnt sub-netlists need to have the same layout

add_group(components: List[Component]) None

Adds the passed componets to a new group

Parameters:
  • components (List[Component]) – List of components that need to be in a

  • group (mirror) –

static find_mirror_groups(driving_component: Component, device: Device, mirror_count: int) List[List[Component]]
static generate_constraints(mirror_driving_components: List[Component], mint_device: MINTDevice) None

Generate the mirror constraints for the device

Parameters:
  • mirror_driving_components (List[Component]) – components that are driving the mirror constraint

  • device (MINTDevice) – device to generate the constraint for

property mirror_count: int

Number of mirror groups

Returns:

number of mirror groups

Return type:

int

property mirror_groups: List[List[Component]]

Returns the mirror groups

Returns:

Mirror groups covered by the constraint

Return type:

List[List[Component]]

property mirror_source: Component

Returns the mirror source component

Returns:

mirror source

Return type:

Component

pymint.constraints.orientationconstraint module

class pymint.constraints.orientationconstraint.ComponentOrientation(value)

Bases: Enum

Enum ot represent component’s relative orientation

HORIZONTAL = 0
VERTICAL = 1
class pymint.constraints.orientationconstraint.OrientationConstraint

Bases: LayoutConstraint

Layout constraint that setups relative orientations for a number of components inside a single layer

add_component_orientation_pair(component: Component, orientation: ComponentOrientation) None

Adds a component onto the constraint

Parameters:
  • component (Component) – component covered by the constraint

  • orientation (ComponentOrientation) – orientation to set

property orientation_map: Dict[Component, ComponentOrientation]

Retuns the map of all the components and their corresponding orientation

Returns:

Dict mapping the components and

their orientations

Return type:

Dict[Component, ComponentOrientation]

pymint.constraints.orthogonalconstraint module

class pymint.constraints.orthogonalconstraint.OrthogonalConstraint(components: List[Component])

Bases: LayoutConstraint

Layout constraint used to represent an orthogonal layout requirement for a sub-netlist

static generate_constraints(orthogonal_driving_components: List[Component], device: MINTDevice) None

Generates the orthogonal constraints for the device

Parameters:
  • orthogonal_driving_components (List[Union[MINTComponent, Component]]) – components that are driving the orthogonal constraint

  • device (MINTDevice) – device to generate the constraints for

static traverse_node_component_neighbours(component: Component, mint_device: MINTDevice) List[Component]

Traverses the node networks to find the components covered by the constraint

Parameters:
  • component (Component) – starting component

  • device (MINTDevice) – current device

Returns:

list of components covered by the constraint

Return type:

List[Component]

pymint.constraints.positionconstraint module

class pymint.constraints.positionconstraint.PositionConstraint(component: Component, xpos: float, ypos: float, zpos: float)

Bases: LayoutConstraint

Layout constraint that fixes the location

get_component() Component

Returns the component constrained by the component

Raises:

Exception – if the component is not covered by the constraint

Returns:

returns the component covered by the constraint

Return type:

Component

property xpos: float

Returns the x position of the component

Returns:

x coordinate of the component if set else returns None

Return type:

float

property ypos: float

Returns the y position of the component

Returns:

y coordinate of the component if set else returns None

Return type:

float

property zpos: float

Returns the z position of the component

Returns:

z coordinate of the component if set else returns None

Return type:

float

pymint.constraints.rotationconstraint module

class pymint.constraints.rotationconstraint.RotationConstraint(component: Component, rotation: float)

Bases: LayoutConstraint

Layout constraint that fixed the absolute rotation of the component

property component: Component

Returns the component covered by the constraint

Returns:

constrianed component

Return type:

Component

property rotation: float

Returns the rotation fixed by the rotation

Returns:

rotation value

Return type:

float

Module contents