Previous topic

Component objects

Next topic

Coprocessors

This Page

Ports

class soclib.component.PortVarArray

An array-like proxy for variable port arrays.

__init__(owner, base_name, spec, env, auto, callback, p_ref)

Creates a variable port array

Parameters:
  • owner – Owning Component
  • base_name (str) – Base common name of ports
  • spec (str) – Module Index name of ports to create
  • env (dict) – Environment (Macrocell -specific)
  • auto – auto-connection constraints
  • callback – a callable called for each new port creation
  • p_ref – second argument to pass to callable.

Calls callback(port, p_ref) for each new port.

new()

Creates a new port and returns its reference.

Returns:a Port object
__getitem__(no)

Retrieves an already existing port in signal

Parameters:no (int) – Number of port to retrieve
Returns:a Port object
__len__()

Retrieves the current length of the port array.

class soclib.component.PortOwner

Base class for objects containing ports. This can either be Components, or hierarchical Port objects.

__init__(spec, env, is_top_port, **args)

Creates a new port owner

Parameters:
connectedSignals()

Retrieve a set of the signals connected to this port owner

Returns:a set of Signal objects
ports()

Gets the contained ports

Returns:a set of Port objects
getPort(name)

Retrieve a port by its name

Parameters:name (str) – Port name
Returns:a Port object
Raises :ValueError if not found
autoConn(sigmap)

Auto-Connects the ports that should auto-connect to the relevant signals passed in.

Parameters:sigmap (dict) – A mapping of names to signals
class soclib.component.Port

A port.

Ports are attached to Components, but sometimes, Ports are contained in Ports (hierarchical ports).

Port inherits PortOwner.

__init__(name, number, owner, spec, env, auto)

Creates a new port.

Parameters:
  • name (str) – Name of port
  • number (int or None) – Number of port in an array, or None if irrelevant
  • owner – Owning Component
  • spec (an object implementing SpecializationInterface) – specialization of port to create
  • env (dict) – Environment (Macrocell -specific)
  • auto – auto-connection constraints
get_spec()

Retrieves the specialization of the port.

Returns:an object implementing SpecializationInterface
getCxxType()
Returns:the entity name
setExternal(obj, name)

Exports the port to the boundary of the architecture. This permits to build hierarchical netlists.

Parameters:
externalInfo()

Retrieves the setExternal() information as a tuple.

Returns:(obj, name) tuple.
isExternal()

Tells whether this signal got exported to the interface.

Returns:True or False
name

Port name

getPeer()

Retrieves the port connected to the other end of the associated signal.

Returns:a Port object
Raises :AssertionError if corresponding signal is not connected exactly twice.
owner()

Retrieves the module owning this port

Returns:a Component object
isInArray()

Tells whether this port is in a port array

Returns:True or False
number()

Retrieves the port number of this port in an array.

Only valid for a port that is in a port array.

Returns:an integer
baseName()

Retrieves the base name of the port. This correspond to the port name without the array index.

Returns:a name string
autoConn(sigmap)

Auto-Connects the ports that should auto-connect to the relevant signals passed in.

Parameters:sigmap (dict) – A mapping of names to signals
__floordiv__(other)

The // operator.

Connects the port to another port through a specially spawned signal.

Parameters:other (Port) – a compatible port
Returns:the spawned signal (so that you can use the return value for another connection).
fullName()
Returns:complete name of the port prefixed by the owner

component name.

can_meta_connect()

Whether this Signal’s implementation has a () operator defined that can connect all subsignals at once.

Returns:True or False
setSignal(sig)

Assigns passed signal to this port

Parameters:sig (Signal) – a signal
Raises :AssertionError if port already has a signal assigned
connected()

Tells whether the port is already connected to a signal

Returns:True or False
signal()

Retrieves the signal corresponding to the port. If there is no signal currently assigned, create one.

Returns:a Signal object