Modeling the FPGA functionality in Simulink.
Implement the PI-controlled system with blocks from the HDL library of the AMD Vitis Model Composer.

The following table shows the the blocks used and the specified values of their block properties. The same controller is used in the DemoFPGApipt1 demo model.
HDL Block | Name | Set Block Properties1) |
|---|---|---|
AddSub | AddSub |
|
AddSub1 | Latency: 2 | |
AddSub2 | Basic page:
Output page:
| |
Constant | Kp_const |
|
Ki_const |
| |
CMult | CMult |
|
Mult | Mult | Latency: 6 |
Mult1 | Latency: 6 | |
Register | Register | ‑ |
Press Ctrl + D from time to time to update the diagram. This helps you to detect modeling errors early.
Check if the messages are plausible. Error messages due to open inputs at the AddSub blocks can be ignored, for example.
From the FPGA Interface sublibrary of the FPGA Programming Blockset, add an FPGA_IO_WRITE_BL block to the model.

The FPGA_IO_WRITE_BL block lets you access an I/O channel to output the controlled variable.
Double-click the block to open the block dialog.
The block dialog opens.

Configure the block parameters to access an analog output channel.
Dialog Page | Set Parameter1) |
|---|---|
Unit | I/O type: Analog_Mod_1 |
Select Analog Out - Ch: 17 [Mod: 1] | |
Parameters | Scaling: mV |
Click OK.
The block display changes.

Add an FPGA_IO_READ_BL block to the model.
The FPGA_IO_READ_BL block lets you read the actual value of the controlled system from an analog input channel.
Open the block dialog and configure the parameters to access an analog input channel.
Dialog Page | Set Parameter1) |
|---|---|
Unit page | I/O type: Analog_Mod_1 |
Select Analog In - Ch: 23 [Mod: 1]. | |
Parameters page | Input range: -10V..+10V |
Scaling: mV |
The block display changes.
Add an FPGA_XDATA_READ_BL block to the model and configure the parameters of the block dialog.
Dialog Page | Set Parameter1) |
|---|---|
Unit page | Access type: Register |
Channel name: Set point | |
Parameters page | – |
The FPGA_XDATA_READ_BL block lets you read data values from an application running on the real-time processor.
Connect the added blocks as shown in the following illustration. Terminate the Data New ports of the register and analog input blocks with AMD Terminator blocks.

You modeled the FPGA functionality in Simulink.
To keep the model clear, you can place the controller in a subsystem:
Select all AMD blocks.
Press Ctrl+G to create a subsystem from the selection.
Open the subsystem and rename the inports and outports.
Press Ctrl+S to save the model.

For the next step, refer to Step 3: How to Simulate the FPGA Functionality in Simulink (Offline Simulation).