prga.core.builder.array.array module

class prga.core.builder.array.array.ArrayBuilder(context, module)

Bases: prga.core.builder.array.base.BaseArrayBuilder

Array builder.

Parameters:
  • context (Context) – The context of the builder
  • module (Module) – The module to be built
classmethod _ArrayBuilder__expose_node(pin)
classmethod _connect_cboxout(module, pin, *, create_port=False)
classmethod _equiv_sbox_position(position, from_corner, to_corner=None)
classmethod _expose_node(pin, *, create_port=False)

Recursively expose a hierarchical routing node.

Parameters:pin (Pin) – A (hierarchical) pin of a routing node
Keyword Arguments:
 create_port (bool) – If set to True, a port is create at the parent module of pin
Returns:
Return type:Pin or Port
classmethod _find_segment_drivers(module, node, pos, ordering, corner_idx)

Find the best segment driver.

classmethod _no_channel_for_switchbox(module, position, corner, ori, output=False)
auto_connect(*, is_top=None)

Automatically connect submodules.

Keyword Arguments:
 is_top (bool) – If set to True, the array is treated as if it is the top-level array. This affects if unconnected routing nodes are exposed as ports. If not set, this method checks the context to see if the module being built is the top-level array
Returns:
Return self to support chaining, e.g.,
array = builder.fill().auto_connect().commit()
Return type:ArrayBuilder
fill(sbox_pattern=<prga.core.common.SwitchBoxPattern._wilton object>, *, identifier=None, dont_create=False, dont_update=False, primaries=None, secondaries=None)

Automatically create switch box connections using switch box patterns.

Parameters:

sbox_pattern (SwitchBoxPattern) –

Keyword Arguments:
 
  • identifier (str) – Used to differentiate the switch boxes
  • dont_create (bool) – If set to True, only existing switch box instances are to be filled. No new instances are created
  • dont_update (bool) – If set to True, existing switch box instances are not updated
Returns:

Return self to support chaining, e.g.,

array = builder.fill().auto_connect().commit()

Return type:

ArrayBuilder

classmethod get_hierarchical_root(array, position, corner=None)

Get the hierarchical root instance occupying the given position.

Parameters:
  • position (tuple [int, int ]) – Position of the tile
  • corner (Corner or str) – If specified, get the switch box instance
Returns:

If corner is not specified, return a hierarhical instance of a tile; otherwise a switch box

Return type:

AbstractInstance

classmethod hierarchical_position(instance)
instantiate(model, position, *, name=None, **kwargs)

Instantiate model at the specified position in the array.

Parameters:
  • model (Module) – A tile, an array or a switch box
  • position (tuple [int, int ]) – Root position for the tile/array, or exact position of the switch box
Keyword Arguments:
 
  • name (str) – Name of the instance. By default, "t_ix{x}y{y}" is used for tile/array instances and "sb_ix{x}y{t}{corner}" is used for switch box instances
  • **kwargs – Additional attributes assigned to the instance
Returns:

Return type:

Instance

classmethod new(name, width, height, *, edge=OrientationTuple(north=False, east=False, south=False, west=False), **kwargs)

Create a new array.

Parameters:
  • name (str) – Name of the array
  • width (int) – Width of the array
  • height (int) – Height of the array
Keyword Arguments:
 
  • edge (OrientationTuple [bool ]) – Marks this array to be on the specified edges of the top-level array. This affects segment instantiation.
  • **kwargs – Additional attributes assigned to the array
Returns:

Module

class prga.core.builder.array.array._ArrayInstancesMapping(width, height)

Bases: prga.util.Object, collections.abc.MutableMapping

Helper class for Array.instances property.

Parameters:
  • width (int) – Width of the tile/array
  • height (int) – Height of the tile/array
Supported key types:
tuple [int, int ]: Root position of a tile. If a tile is larger than 1x1, the position of
its bottom-left corner is the root position
tuple [tuple [int, int ], Corner ]: Position of a switch box. The first element
is the position, and the second element is the corner in that position
_ArrayInstancesMapping__validate_position(x, y)
get_root(position, corner=None)
sboxes
tiles