Previous topic

Architecture definition

Next topic

Ports

This Page

Component objects

class soclib.component.Component

A component object corresponding to a fully parameterized soclib module. This is created by a soclib.platform.Macrocell.create() call.

This object holds all the information about the component:

  • model,
  • parameters (instance and template),
  • ports,
  • connections,
  • associated memory segments.

This objects also offers accessors for common extended attributes used by DSX:

  • coprocessor type, processor architecture, or peripheral type, where relevant,
  • component index on the NoC.

Component inherits dsx.ware.WNode and PortOwner.

__init__(name, module, env, **args)

Creates a new component.

Parameters:
  • name (str) – Instance name of component
  • module (str) – Module name in Module Index
  • env (dict) – Environment (Macrocell -specific)
  • args – A key/value mapping of parameter values (either template or instance)
  • Signal-specific API

    When the created module is actually a signal, some accessors are implemented to permit signal’s feature list.

    getSubSignals()

    Subsignal hacky accessor.

    spec_port_max_count(port)

    Maximal connection count to port of given type.

    Parameters:port – A port index name
    Returns:the maximal count
    can_meta_connect()

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

    Returns:True or False
  • Common API

    set_arg(name, val)
    prepare()

    See dsx.ware.WNode.prepare()

  • DSX high-level module parameters API

    getCpuId()

    Retrieves the cpuid (cpu number used to identify a processor from the software). Only relevant for processor components.

    Returns:an integer.
    cpuType()

    Retrieves the CPU type name as defined by the dsx:cpu extension of the metadata file.

    Returns:a cpu type name string
    extension(name)

    Retrieves a metadata extension value

    Parameters:name (str) – Extension class
    Returns:an iterable of strings containing extensions
    register_segments(arch)

    Adds segments associated to this component to the relevant mapping tables found in the passed architecture.

    Parameters:arch (soclib.platform.Macrocell) – Architecture containing the mapping tables to register segments in
    addSegment(name, address, size, cacheable=None, mt=None)

    Adds a segment to the list of segments associated to this component.

    Parameters:
    • name (str) – Name of segment
    • address (int) – Base address of segment
    • size (int) – Size in bytes of segment
    • cacheable (bool) – Whether this segment should be cacheable
    • mt (Component) – a component corresponding to a common:mapping_table soclib module
    Raises :

    ValueError if address or size is invalid.

    getSegments(mt=None)

    Retrieves the segments associated to the given mapping table.

    Parameters:mt (Component) – A Mapping table
    Returns:an iterable of segment objects.
  • Netlist generation specific stuff

    static_configurators()

    Retrieves the static configurators to call on the type.

    This is a mechanism specific to the C++ objects. Sometimes, netlist must contain calls to static functions of the class prior to the objects instantiations. This method retrieves relevant lines for the C++ class corresponding to this module.

    Returns:an iterable of strings containing C++ code.
    configurators()

    Retrieves the configurators to call on the object.

    This is a mechanism specific to the C++ objects. Sometimes, netlist must contain calls to methods of the object after its instantiation. This method retrieves relevant lines for the C++ class corresponding to this module.

    Returns:an iterable of strings containing C++ code.
    typename()
    Returns:the module name in Module Index
    getCxxType()
    Returns:the entity name
    getIncludes()
    Returns:the list of C++ header files involved with this

    component

    instanciationParams()

    Retrieves the instantiation parameter values for the component.

    Returns:an iterable of values.
    instName()

    Retrieves the instance name

    Returns:a name string
    instArgs()

    Retrieves the instantiation parameters as a string suitable for C++ code generation (to put between the () of the constructor.

    Returns:a C++ code substring.
class soclib.component.Signal

A signal object. This actually inherits Component.

setExternal(port_spec, name)

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

Parameters:
isExternal()

Tells whether this signal got exported to the interface.

Returns:True or False
spawnExternalPort()

Spawns the external port declaration component

Returns:an ExternalPort object
externalPort()

Returns the current external port declaration

Returns:an ExternalPort object or None
instName()

Retrieves or compute the instance name for the signal

Returns:an instance name string
__floordiv__(port)

The // operator.

Connects the signal to the given port.

Parameters:port (Port) – a compatible port
Returns:the signal itself (so that you can use the return value for another connection).
connections()

Retrieves the list of connections made to this signal.

Returns:an iterable of Port objects.
portTypes()

Retrieves the different types of ports connected to this signal (not the names nor modules, only the different port types).

Returns:an iterable of names in Module Index.
class soclib.component.ExternalPort

An external port declaration. soclib.platform.Macrocell contains one object of this type for any export signal or port.

__init__(name, module, env, signal, **args)

Creates a new external port declaration.

Parameters:
ports()

See Component.ports()

fullName()

See Component.fullName()

signal()

Accessor for the associated signal

Returns:a Signal object.
isPrimary()

Whether the underlying signal is primary. See Signal.isPrimary().