> 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/ehs/model-in-sps-rt-lab-only/prepare-the-cpu-model.md).

# Prepare the CPU Model

Once the SPS Simulink model defining the electrical circuit to be executed by eHS on the FPGA (the **eHS circuit**) is complete, it can be integrated into the RT-LAB model (the **CPU model**).

## Add the eHS CPU Block to the model

To execute the circuit on the FPGA, the CPU model must include an **OpCtrl** block and the **eHS CPU Block**.

Once added, the **eHS CPU Block** must be configured to interface with the CPU model and/or an external device under test (DUT). This process is described in [Configure the eHS Circuit Interfaces](https://www.opal-rt.com/docs/ehs/model-in-sps-rt-lab-only/configure-the-ehs-circuit-interfaces.md).

For a simpler setup, **it is recommended to start from the example model delivered with your system or from an example model installed with RT-LAB**. These examples already include a correctly configured **OpCtrl** block and **eHS CPU Block** matching the firmware.

Otherwise, add and configure the required blocks manually:

1. Create or open the CPU model in Simulink
2. Open the **Simulink Library Browser**
3. Navigate to **RT-LAB I/O > Opal-RT > Common** and drag the **OpCtrl** block into the main computation subsystem of the model
4. Navigate to **eFPGASIM > External circuit editor workflow** and drag the **eHS CPU Block** into the same model subsystem as the **OpCtrl** block

When the block is added, you will be prompted to select the eHS License Class of the simulator. The license class (e.g. `x128`, `x64`, etc) is determined by the value of the simulator's *EHS\_CORE\_TOKEN* license feature. [Verify the value of *EHS\_CORE\_TOKEN* in the simulator license](https://www.opal-rt.com/docs/rt-lab/licensing-reference/simulator-license) and select the corresponding license class when configuring the block, or select `Auto`.

## Choose and add the eHS firmware

Each system is delivered with one or more prevalidated firmware configurations. For the SPS workflow, these configurations typically consist of `.bin` and `.conf` files provided on the **CD or USB drive** included with the system.

Copy the required firmware files to the same directory as the CPU model before configuring the **OpCtrl** and **eHS CPU** blocks. **Do not rename firmware files**, as their naming convention is critical for correct operation.

Configure the **OpCtrl** block:

* Set **Primary Bitstream Filename** to the desired `.bin` firmware file.
* Set **Board Type** to match the hardware identified by the selected bitstream filename.
* All other parameters can remain at their default values **unless you are working with multiple FPGA systems or external synchronization**.

Users may choose to use a different firmware than the one delivered, provided that it is fully compatible with their system. See [Standard eHS Firmware List](https://www.opal-rt.com/docs/ehs/first-steps/choose-the-ehs-firmware/introduction-to-standard-ehs-firmware.md) for information about available options. The required firmware files for standard firmware are available in the installation directory (e.g., `C:\OPAL-RT\eFPGASIM\vX.X.X\Common\fpgalib\firmwares`).

## Add the SPS circuit model to eHS

1. Double-click the **eHS CPU Block** to open its mask.
2. In the **Circuit** tab, click the browse button (**...**) next to **Circuit File Name** and select the SPS Simulink model that defines the circuit to be executed by the eHS solver.

{% hint style="info" %}
The SPS Simulink model file must be placed in the same directory as the CPU model.
{% 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/ehs/model-in-sps-rt-lab-only/prepare-the-cpu-model.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.
