> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/configure-ios/analog-digital-and-sfp-ios/s-function-workflow/multi-fpga-model-ios.md).

# Multi-FPGA Model I/Os

When a model includes electrical I/O distributed across multiple FPGAs (e.g. one simulator with one expansion unit), the configuration process is similar to the standard **S-Function Workflow**. The key difference is that **each additional unit** must have its own **OpCtrl** (or **OpLnk**) block. This configuration applies when using one or more I/O expansion units connected via **PCIe**.

{% hint style="danger" %}
The **S-Function Workflow** is **not supported for MuSE** connections. If the hardware is connected via MuSE, refer to the [OPAL-RT Board Workflow / Multi-FPGA Model I/Os](https://www.opal-rt.com/docs/rt-lab/configure-ios/analog-digital-and-sfp-ios/opal-rt-board-workflow/multi-fpga-model-ios.md) documentation.
{% endhint %}

{% stepper %}
{% step %}

### Prepare the model directory

Copy the **bitstream files** (`.bin` and `.conf`) provided with your system to the model folder. In multi-FPGA configurations, each unit may have a different FPGA and/or bitstream files. Ensure that all required files for every unit are copied to the model folder.
{% endstep %}

{% step %}

### Add an OpCtrl block

Add a first **OpCtrl** block within one computation subsystem where signals will be exchanged through I/O modules (**SM\_** or **SS\_**), and configure the following parameters:

* **Board ID** – Each simulator and expansion unit is assigned a unique **chassis index**. The **Board ID** parameter determines which unit the block will control. Set the correct **Board ID** as specified in the **System Description Document**. For detailed instructions on changing the unit **chassis index**, refer to your simulator and/or expansion unit documentation.
* **Primary Bitstream Filename** – Select the correct `.bin` file provided for this unit.
* **Synchronization mode** – If the selected **Board ID** corresponds to the **chassis index** of the real-time simulator, set the **Synchronization Mode** to **Master**. In **Master** mode, the FPGA provides the clock to the CPU and outputs a synchronization pulse through the unit’s TX connector.

  If the selected **Board ID** corresponds to the **chassis index** of an expansion chassis, set the **Synchronization Mode** to **Slave**. In **Slave** mode, the FPGA expects to receive a synchronization pulse from the master.
* **Board Type** – Identify from the bitstream filename provided for this unit.
* **Synchronization type** – Set according to the cable used: Audio or Optical fiber.

All other parameters can remain at their default values.
{% endstep %}

{% step %}

### Add I/O blocks

From *RT-LAB I/O > Opal-RT > Common*, add the required I/O blocks to the subsystem containing the first **OpCtrl** block. These I/O blocks will operate on the unit controlled by this **OpCtrl** block. Configure the following parameters:

* **`DataOut`** / **`DataIn` port numbers** – Configure each block’s **`DataOut`** and **`DataIn`** **port numbers** according to your **System Description Document** or the `.conf` file.

By default, the **Controller Name** parameter in I/O blocks is set to 'OpCtrl', matching the default **Controller Name** in the **OpCtrl** block. This parameter is used to link I/O blocks to specific **OpCtrl** or **OpLnk** blocks when many are present. For this configuration, leave the default value unchanged.
{% endstep %}

{% step %}

### Add a second OpCtrl block

If additional I/O blocks need to be added but will operate on a different unit, a second **OpCtrl** block must be used. Configure the following parameters:

* **Controller Name** – Change the default value, as each **OpCtrl** block must have a unique **Controller Name** (e.g., 'OpCtrl2', 'OpCtrl3', etc.).
* **Board ID** – Set it to match the **chassis index** of the unit to be controlled, as specified in the **System Description Document**.
* **Primary Bitstream Filename** – Select the correct `.bin` file provided for this unit.
* **Synchronization mode** – Set it based on the unit’s role: choose **Master** for the real-time simulator or **Slave** for an expansion chassis.
* **Board Type** – Identify from the bitstream filename provided for this unit.
* **Synchronization type** – Set according to the cable used: Audio or Optical fiber.

All other parameters can remain at their default values.
{% endstep %}

{% step %}

### Add I/O blocks

From *RT-LAB I/O > Opal-RT > Common*, add the required I/O blocks that will operate on the additional unit.

* **Controller Name** – Change it to match the **OpCtrl** block associated with the additional unit (e.g., 'OpCtrl2', 'OpCtrl3', etc.).
* **`DataOut`** / **`DataIn` port numbers** – Configure each block’s **`DataOut`** and **`DataIn`** **port numbers** according to your **System Description Document** or the `.conf` file.
  {% endstep %}

{% step %}

### Repeat steps 4 and 5 for **each additional unit operating I/O**

Each unit must have a dedicated **OpCtrl** block with a unique **Controller Name** (e.g., 'OpCtrl2', 'OpCtrl3', etc.) and all I/O blocks must have their **Controller Name** parameter set to match the corresponding **OpCtrl** block.

If a unit operates I/O distributed across multiple subsystems, each additional subsystem containing I/O must include an **OpLnk** block and be configured as described in this section.
{% endstep %}

{% step %}

### Save, build, load and execute the model

1. Save and run the Simulink model to confirm that everything works as expected.
2. In RT-LAB, build the model.
3. Go to the **Execution** tab and ensure that the **Real-time simulation mode** is set to **Hardware synchronized**.
4. Open the **Assignation** tab and ensure that the **XHP** box is checked (enabled).
5. Load and execute the model in RT-LAB.
   {% endstep %}
   {% endstepper %}

{% hint style="danger" %}
**Physical connections are required for proper operation.** Refer to your **System Description Document** for detailed instructions, and consult your simulator and/or expansion unit documentation.

* Connect a synchronization cable (optical or copper) from the **TX port** of the simulator to the **RX port** of the expansion unit.
* Ensure the expansion unit is powered on before booting the simulator to allow proper detection.
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/configure-ios/analog-digital-and-sfp-ios/s-function-workflow/multi-fpga-model-ios.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
