Common and Type 0 templates List of capability templates
PCIe Modeling Library  /  DML template reference  / 

Bridge and Type 1 templates

pcie_bridge

To be used by devices bridging PCIe to/from e.g. host memory. Inherits pcie_translator. Defines a port object downstream_port and a connect host_memory to which upstream Mem transactions are forwarded, by default. Defines a port message, to which Msg transactions are forwarded, by default. The message port inherits the message_port template. Other transaction types are terminated, by default.

pcie_port

Inherits pcie_device and pcie_translator. Defines a connect upstream_target and a port object downstream_port. Defines a port upstream_message_router which routes upstream messages either to itself or forwards them further upstream or reroutes them downstream. Defines a port upstream_message which handles upstream transactions of type Msg directed at this PCIe port.

pcie_downstream_port

To be used by Downstream Switch Ports. Inherits pcie_port and pcie_hotplug_port.

pcie_root_port

To be used by Root Ports. Inherits pcie_downstream_port.

pcie_upstream_port

To be used by Upstream Switch Ports. Inherits pcie_port.

message_port

Implements transaction interface where it receives and dispatches transactions of type Msg to instances (on the same level) of the handling_messages template. Unhandled messages will be terminated with error or silently dropped depending on type of Msg.

message_translator

Implements transaction_translator interface where it receives translator requests of type Msg from downstream. Forwards messages depending on pcie_msg_route atom. Messages to be routed upstream are forwarded to parameter default_target, messages to be routed downstream are forwarded to downstream_port and messages targeting this PCIe port are forwarded to parameter local_target for local handling of the message.

handling_messages

Should be implemented by (DML) objects that wants to handle PCIe messages dispatched by the message_port template. When a message is received on a message_port instance, it will iterate over instances of this template (in an undefined order) and call the message method. Note that downstream messages have stub-methods in the pcie_config.message group and are not handled by instancing this template.

Methods

message(transaction_t *t, uint64 addr, pcie_message_type_t type) -> (pcie_error_t)

Called by the message_port template when a PCIe message is received. Must return PCIE_Error_Not_Set if the message is not handled. Returning anything else means that the message was handled by this method call.

handling_prs_messages

Stub methods for an RC receiving and sending PRS messages. Inherits handling_messages

page_response

Sends a Page Response message to addr via mt. The caller is responsible for setting the Device ID, Response Code and PRGI fields of addr (which corresponds to DW3 and DW4 in the TLP header).

page_request_received

Stub method, called when a Page Request message is received. Should return true if the message was handled correctly or false if the message could not be handled. The default implementation logs an unimpl message and returns false.

pcie_translator

Default PCIe translator, implementing transaction_translator. Redirects transactions based on the pcie_type atom. Transactions are forwarded according to parameters msg, mem, io and cfg in the group txl_target. By default, all parameters point to the parameter def which defaults to NULL, i.e. transactions are terminated.

ats_upstream_translator

Stub template for handling ATS transactions. Inherits pcie_translator. Defines the ports ats_untranslated, ats_translated and ats_request to which Memory transactions are forwarded according to the pcie_at atom. All other transactions are handled according to the default behavior of pcie_translator. The port ats_request implements transaction with the method issue which by default logs an unimpl message and returns PCIE_Error_Completer_Abort. The two other ports implement transaction_translator and forward all transactions to host_memory.map_target, by default.

ats_invalidate

Sends an ATS invalidation message via mt to an endpoint to invalidate a translated address. The caller is responsible for setting the fields of 'translated_addr'.

type_1_bank

Inherits physical_config_bank and adds Type 1 specific registers. Automatically handles mapping of the downstream_target, according to the secondary/subordinate and base/limit registers. Handles broadcasting of downstream messages to downstream_target.

type_1_base_address

Implements the common functionality of Type 1 base address groups such as io, memory and prefetchable. Handles mapping of the relevant downstream ranges into the upstream target address spaces. Inherits abstract_base_address.

downstream_port

Can be applied to a connect to automatically create a pcie-downstream-port object with map targets for cfg, msg, mem and io. The interface pcie_port_control and transaction are connected to the downstream port of the automatically created object.

pcie_hotplug_port

This template should only be applied to a Downstream Port of PCI Express Switch or a Root Port of PCI Express Root Complex.

When instantiating this template, an implementation of the pcie_hotplug_events interface will be added to the device. When a method of this interface is invoked, it will check if the device has a PCI Express Capability Structure that has support for the incoming Hot-Plug event. If it does, it will trigger a Hot-Plug event.

This template also adds handling of the Hot-Plug PCIe message types defined in this library.

Can be applied to objects that inherit the pcie_downstream_port or the pcie_root_port template. Applying this template will implement the pcie_link_training interface. Implementing this interface will allow the object to initiate link training by the trigger method being invoked.

The template will also set the link_training_target in the link group of the PCI Express Capability Structure in the device.

Parameters:

Common and Type 0 templates List of capability templates