addPortMap method
- InterfacePortReference interfacePort,
- PortReference port, {
- bool connect = true,
Creates a mapping between an interface port and a module port.
This establishes a connection between interfacePort
(which must belong
to this interface) and port
(which must belong to this module).
If connect
is true
, the port mapping is immediately activated. If
false
, the mapping is deferred until the interface is connected to
another interface.
Throws an exception if the interfacePort
doesn't belong to this
interface or if a mapping for the port
already exists.
Implementation
PortMap addPortMap(InterfacePortReference interfacePort, PortReference port,
{bool connect = true}) {
if (interfacePort.interfaceReference != this) {
throw RohdBridgeException('$interfacePort is not part of this interface '
'$name in module $module');
}
final portMap = PortMap(port: port, interfacePort: interfacePort);
if (_portMaps.contains(portMap)) {
throw RohdBridgeException('Port map for $port already exists in $name');
}
if (connect) {
portMap.connect();
}
_portMaps.add(portMap);
return portMap;
}