DFPort¶
DFPorts are used to declare the points of ingress into and egress out of a DFBlock for different types of signals. The declaration of a DFPort instantiates a DFInterconnect, the reference of which is attached to the root node of the DFProject.
Ports can be connected to each other within a hierarchy level (i.e. parent-to-child, child-to-parent, or child-to-child) where the child is within the immediate children of the parent. A DFConnection is used to describe the link between two DFPorts, or between a DFConstantTie and a DFPort - the connection is attached to the DFBlock within its connections array.
As with every tag, DFPort inherits from DFBase, so has support for all of the core attributes (id, description, and attributes).
{
"id": "my_block[my_port]",
"description": "Human readable description of the port",
"attributes": { },
"name": "my_port",
"type": "axi4",
"count": 1,
"direction": "IN",
"block": "my_root.my_block"
}
| Property | Usage |
|---|---|
| name | Name of the port, this automatically generates an ID of the form <BLOCK>[<PORT>]. |
| type | Type of the port, must refer to a DFInterconnect. |
| count | How many signals should this port carry - each can be connected individually. |
| direction | Is the port nominally IN, OUT, or INOUT. The DFInterconnect's role may reverse the data direction for some components. |
| block | Hierarchical path to the parent block. |
Note
On the DFBlock page there is some discussion about the idea of “principal” ports, which allows ports like clock and reset to be nominated so that they can be easily identified by later stages of processing.
Python API¶
-
class
designformat.port.DFPort(name='', type=None, count=0, direction=None, block=None, description=None)¶ DesignFormat representation of a port (input, output or inout)
-
__init__(name='', type=None, count=0, direction=None, block=None, description=None)¶ Constructor for a port object.
- Parameters
name – Name of the port
type – Interface type, which refers to a DFInterconnect
count – Number of signals carried by the port
direction – Whether an input or output
block – Reference to the parent DFBlock
description – Human-readable description of the port
-
addConnection(conn)¶ Add a new connection to this port, either to another port or a DFConstantTie
- Parameters
conn – The connection
-
chaseConnection(index=0, path=None)¶ Chase a connection from the port to it’s ultimate destination, note that this function returns a tuple containing the port and the signal index.
- Parameters
index – The signal index within the port to chase from
path – The current path chased up to this point (used by recursive calls)
-
check()¶ Sanity check that the direction is allowed
-
dumpObject(project)¶ Dump out this node so that it can be reloaded
- Parameters
project – Project definition used to calculate references
-
findConnectionPath(remote_port, local_index=0, remote_index=0, path=None)¶ Try to find a connection pathway between this port and a remote port, this procedure can use both basic connectivity information and the address map to try and find interconnections. A flood search is used, with the shortest path being preferred.
- Parameters
remote_port – The remote port we are trying to reach
local_index – The index of the signal within this port
remote_index – The index of the signal within the remote port
path – Used to track the path construction during recursion
-
getDriverPorts()¶ Return a list of ports that are driving this port
-
getInboundConnections()¶ Return just the inbound connections (where we are being driven)
-
getInterconnectType()¶ Returns the DFInterconnect that this connection represents
-
getOutboundConnections()¶ Return just the outbound connections (where we are the driver)
-
getReceiverPorts()¶ Return a list of ports that are driven by this port
-
getRelativeAddress(remote_port, local_index=0, remote_index=0)¶ Calculate the relative address to access a remote port via basic connectivity and any address maps. This leverages the findConnectionPath function to first identify a viable path, then works through the path to identify the base address of the port.
- Parameters
remote_port – The port to resolve
local_index – Outbound signal index to start from
remote_index – Inbound signal index of the target
-
hierarchicalPath()¶ Returns a complete hierarchical path from the DFProject’s root node all the way down to this port.
-
loadObject(obj, root)¶ Reload this node from passed in object.
- Parameters
obj – Description of this node
root – Root object in the tree
-
resolveAddress(address, index=0)¶ If this port is an initiator in an address map, resolve an address as if part of a transaction initiated through this port.
- Parameters
address – The address to resolve
index – The index of the signal within the port initiating the transaction (default: 0)
-
Javascript API¶
-
class
DFPort(name, type, count, direction, block, description)¶ DesignFormat representation of a port (input, output or inout)
Constructor for a port object.
- Arguments
name (string) – Name of the port
type (string) – Interface type, which refers to a DFInterconnect
count (integer) – Number of signals carried by the port
direction (string) – Whether an input or output
block (DFBlock) – Reference to the parent DFBlock
description (string) – Human-readable description of the port
-
DFPort.addConnection(conn)¶ Add a new connection to this port, either to another port or a DFConstantTie
- Arguments
conn (DFConnection) – The connection
-
DFPort.chaseConnection(index, path)¶ Chase a connection from the port to it’s ultimate destination, note that this function returns a tuple containing the port and the signal index.
- Arguments
index (integer) – The signal index within the port to chase from
path (list) – The current path chased up to this point (used by recursive calls)
-
DFPort.check()¶ Sanity check that the direction is allowed
-
DFPort.dumpObject(project)¶ Dump out this node so that it can be reloaded
- Arguments
project (DFProject) – Project definition used to calculate references
-
DFPort.findConnectionPath(remote_port, local_index, remote_index, path)¶ Try to find a connection pathway between this port and a remote port, this procedure can use both basic connectivity information and the address map to try and find interconnections. A flood search is used, with the shortest path being preferred.
- Arguments
remote_port (DFPort) – The remote port we are trying to reach
local_index (integer) – The index of the signal within this port
remote_index (integer) – The index of the signal within the remote port
path (list) – Used to track the path construction during recursion
-
DFPort.getDriverPorts()¶ Return a list of ports that are driving this port
-
DFPort.getInboundConnections()¶ Return just the inbound connections (where we are being driven)
-
DFPort.getInterconnectType()¶ Returns the DFInterconnect that this connection represents
-
DFPort.getOutboundConnections()¶ Return just the outbound connections (where we are the driver)
-
DFPort.getReceiverPorts()¶ Return a list of ports that are driven by this port
-
DFPort.getRelativeAddress(remote_port, local_index, remote_index)¶ Calculate the relative address to access a remote port via basic connectivity and any address maps. This leverages the findConnectionPath function to first identify a viable path, then works through the path to identify the base address of the port.
- Arguments
remote_port (DFPort) – The port to resolve
local_index (integer) – Outbound signal index to start from
remote_index (integer) – Inbound signal index of the target
-
DFPort.hierarchicalPath()¶ Returns a complete hierarchical path from the DFProject’s root node all the way down to this port.
-
DFPort.loadObject(obj, root, types)¶ Reload this node from passed in object.
- Arguments
obj (object) – Description of this node
root (DFBase) – Root object in the tree
types (object) – Map from class name to class definition
-
DFPort.resolveAddress(address, index)¶ If this port is an initiator in an address map, resolve an address as if part of a transaction initiated through this port.
- Arguments
address (integer) – The address to resolve
index (integer) – The index of the signal within the port initiating the transaction (default: 0)