Simulating the FPGA functionality with simulated I/O functionality to detect modeling errors at an early stage.
Open the CN subsystem of the DemoFPGApipt1 demo and select the First Order Lag 1 subsystem.
The First Order Lag 1 subsystem represents the device to be controlled. For instructions on opening the demo model, refer to Step 2: How to Open the Demo Model.
Copy the First Order 1 subsystem to your FPGA model and press Ctrl + I to flip the block.

Open the dialog of the Analog Out block.
On the Parameters page, select Enable simulation port and click OK.
The Sim Data simulation port is added to the block.

Repeat steps 3 and 4 with the Register In and Analog In blocks.
Complete the model as shown in the following illustration.

Steps to complete the model:
Rename the First Order Lag 1 subsystem to Simulated Device.
Add two Simulink Constant blocks:
Set the constant value parameter of one block to 1.
Rename this block to gain.
Set the constant value parameter of the other block to 0.001.
Rename this block to time constant.
Add a Simulink Signal Generator Simulink block to the model with the following settings:
Waveform parameter: square
Amplitude: 1000
The analog I/O blocks are scaled to millivolt, so the amplitude is set to 1,000 mV = 1 V.
Frequency: 100
Units: Hertz
Add a Simulink Constant block to connect the Sim Trigger Input port of the Analog In block to a defined value.
The triggering of the analog input is set to free-running so that the Sim Trigger Input port has no influence on the analog-to-digital conversion.
Connect the ports.
In the SIMULATION pane of Simulink, set the Stop Time for a Simulink simulation to 0.01.

Press Ctrl+S to save the model.
Add Simulink Scope blocks to the signals you want to check and press Ctrl + T to start the simulation.
You added sinks and sources to the interfaces of the FPGA to simulate the FPGA functionality. This lets you validate the FPGA functionality and eliminate errors in an early stage.
