Interrupt Configuration

Simulink® Real-Time™ software schedules the real-time application using either the internal timer of the Speedgoat target machine (default) or an interrupt from an I/O board. You can use your Speedgoat FPGA board to generate an interrupt, which allows you to:

  • Schedule execution of the real-time application based on this interrupt (synchronous execution). For this method, you must generate the interrupt periodically.

  • Execute a designated subsystem in your real-time application (asynchronous execution).

To use FPGA-based interrupts, set up and configure the FPGA domain and Simulink Real-Time domain models.

FPGA Domain Model

In the FPGA domain subsystem, create the interrupt source for the real-time application in one of the following ways.

SourceDescription

Internal

A clock you create using Simulink blocks to create input signals. This clock is a binary pulse train of zeros and ones (transition from 0 to 1 and from 1 to 0). The clock generates an interrupt on a rising edge. The following is an example of an internally generated interrupt source from Simulink blocks. Connect the internally generated interrupt source to an outport labeled INT.

External

A clock signal that comes from a device outside the Speedgoat target machine. You use a digital input pin to connect to this signal. The following is an example of an externally generated interrupt source that comes from TTL channel 8. Delay this source by one FPGA clock cycle and connect to an outport labeled INT.

In both cases, wire the interrupt source to an outport in the FPGA subsystem. Assign the outport as Interrupt from FPGA in the HDL Coder™ HDL Workflow Advisor task 1.2 Set Target Interface.

You are now ready to set up interrupt support in the Simulink Real-Time domain model.

Simulink Real-Time Domain Model

Configure the model Simulink Real-Time domain model to set up interrupt support:

  1. Open the Simulink Real-Time domain model.

  2. In the Simulink editor, on the Real-Time tab, click Hardware Settings.

  3. Navigate to node Simulink Real-Time Options, under node Code Generation.

  4. From the Real-time interrupt source list, select one of the following:

    • Auto (PCI only)

    • The IRQ assigned to your FPGA board

  5. From the I/O board generating the interrupt parameter, select your FPGA board, for example, Speedgoat_IO331.

  6. Add the Simulink Real-Time interface subsystem to the model.

  7. Build and download the real-time application to the Speedgoat target machine.

  8. When you start the real-time application, simulation updates occur when the application receives an interrupt from the FPGA I/O board.

Related Topics