IPConnect class

IPConnect provides means of connecting ports and interfaces of objects that are subclasses of Wrapper. Since IPConnect is a subclass of Wrapper itself, this means that it also has IO - ports and interfaces, and that multiple IPConnects can have their ports and interfaces connected to each other (or other objects that subclass Wrapper).

../_images/ipconnect.png

Instances of Wrapper objects can be added to an IPConnect using add_component() method:

# create a wrapper for an IP
dma = IPWrapper('DMATop.yaml', ip_name='DMATop', instance_name='DMATop0')
ipc = IPConnect()
ipc.add_component("dma", dma)

Connections between cores can then be made with connect_ports() and connect_interfaces() based on names of the components and names of ports/interfaces:

ipc.connect_ports("comp1_port_name", "comp1_name", "comp2_port_name", "comp2_name")
ipc.connect_interfaces("comp1_interface_name", "comp1_name", "comp2_interface_name", "comp2_name")

Setting ports or interfaces of a module added to IPConnect as external with _set_port() and _set_interface() and allows these ports/interfaces to be connected to other Wrapper instances.

ipc._set_port("comp1_name", "comp1_port_name", "external_port_name")
ipc._set_interface("comp1_name", "comp1_interface_name", "external_interface_name")

This is done automatically in make_connections() method when the design is built based on the data from the YAML design description.

class IPConnect(*args, src_loc_at=0, **kwargs)

Connector for multiple IPs, capable of connecting their interfaces as well as individual ports.

__init__(name: str = 'ip_connector')
_connect_external_ports(internal: WrapperPort, external: WrapperPort)

Makes a pass-through connection - port of an internal module in IPConnect is connected to an external IPConnect port.

Parameters:
internal: WrapperPort

port of an internal module of IPConnect

external: WrapperPort

external IPConnect port

_connect_internal_ports(port1: WrapperPort, port2: WrapperPort)

Connects two ports with matching directionality. Disallowed configurations are: - input to input - output to output - inout to inout All other configurations are allowed.

Parameters:
port1: WrapperPort

1st port to connect

port2: WrapperPort

2nd port to connect

_connect_to_external_port(internal_port: str, internal_comp: str, external_port: str, external: DesignExternalPorts) None

Connect internal port of a component to an external port

Parameters:
internal_port: str

internal port name in internal_component to connect to external_port

internal_comp: str

internal component name

external_port: str

external port name

external: DesignExternalPorts

dictionary in the form of {“in”: list, “out”: list, “inout”: list} containing port names specified as external in each of the three categories. All keys are optional and lack of a category implies an empty list

_set_interface(comp_name: str, iface_name: str, external_iface_name: str) None

Set interface specified by name as an external interface

Parameters:
comp_name: str

name of the component - hierarchy or IP core

iface_name: str

interface name in the component

external_iface_name: str

external name of the interface specified in “external” section

Raises:

ValueError – if such interface doesn’t exist

_set_port(comp_name: str, port_name: str, external_name: str) None

Set port specified by name as an external port

Parameters:
comp_name: str

name of the component - hierarchy or IP core

port_name: str

port name in the component

external_name: str

external name of the port specified in “external” section

Raises:

ValueError – if such port doesn’t exist

add_component(name: str, component: Wrapper) None

Add a new component to this IPConnect, allowing to make connections with it

Parameters:
name: str

name of the component

component: Wrapper

Wrapper object

connect_interfaces(iface1: str, comp1_name: str, iface2: str, comp2_name: str) None

Make connections between all matching ports of the interfaces

Parameters:
iface1: str

name of the 1st interface

comp1_name: str

name of the 1st IP

iface2: str

name of the 2nd interface

comp2_name: str

name of the 2nd IP

Raises:

ValueError – if any of the IPs doesn’t exist

connect_ports(port1_name: str, comp1_name: str, port2_name: str, comp2_name: str) None

Connect ports of IPs previously added to this Connector

Parameters:
port1_name: str

name of the port of the 1st IP

comp1_name: str

name of the 1st IP

port2_name: str

name of the port of the 2nd IP

comp2_name: str

name of the 2nd IP

Raises:

ValueError – if such IP doesn’t exist

get_ports() list

Return a list of external ports of this module

make_connections(ports: DS_PortsT, interfaces: DS_InterfacesT, external: DesignExternalSection) None

Use names of port and names of ips to make connections

Parameters:
ports: DS_PortsT

“ports” section in the YAML design specification

interfaces: DS_InterfacesT

“interfaces” section in the YAML design specification

external: DesignExternalSection

“external” section in the YAML design specification

make_interconnect_connections(interconnects: Dict[str, DesignSectionInterconnect], external: DesignExternalSection)

Connect slaves and masters to their respective interfaces in the interconnect

Parameters:
interconnects: Dict[str, DesignSectionInterconnect]

“interconnects” section in the YAML design specification

external: DesignExternalSection

“external” section in the YAML design specification

set_constant(comp_name: str, comp_port: str, target: int) None

Set a constant value on a port of an IP

Parameters:
comp_name: str

name of the IP or hierarchy

comp_port: str

name of the port of the IP or hierarchy

target: int

int value to be assigned

Raises:

ValueError – if such IP doesn’t exist

validate_inout_connections(inouts: Collection[Tuple[str, str]])

Checks that all inout ports of any IP or hierarchy in the design are explicitly listed in the ‘external’ section.

Parameters:
inouts: Collection[Tuple[str, str]]

external.ports.inout section of the design description YAML


Last update: 2024-11-12