Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
maxLevel3

FPGA Model Overview

When designing a real-time simulation for an OPAL-RT platform, two Simulink models must be created.

  • The first one, hereafter called the FPGA model, contains the RT-XSG blocks required to build the configuration file to be downloaded in the FPGA of the real-time platform. The sections below describe the blocks used to build this model.

  • The second model, the CPU model, will run on the CPU of the real-time platform and is controlled by the simulation software (RT-LAB or HYPERSIM). This model contains interface blocks (OpCtrl and IO functionality blocks, or OpInput/OpOutput blocks) that allow exchanging information between the CPU model and the FPGA board, through the PCIe bus. These blocks can be interpreted as a bridge between software and hardware.

Example CPU models are provided under RT-LAB software and FPGA models are provided under folder <RTXSG_ROOTFolder>\Examples and can be used as a start point for building your specific FPGA design and corresponding RT-LAB model.  

Inside the FPGA model, besides the logic to be implemented on the FPGA, certain blocks are required to establish communication with the CPU Model and also to interact with the IO cards.

The following figure shows the OP4510 I/O example model, which can be found at C:\OPAL-RT\RTXSG\v3.x.x.x\Examples\OP4510\AIO_DIO_TSDIO_PWMIO_QEIO.Image Removed

...

CPU-FPGA Communication Blocks

...

The block can have up to 64 ports of 33 bits in the Xilinx UFix format (not applicable for OP4200 unless implemented in a future release). Data coming from the DataIN block is updated at the rate of the CPU model simulation time step. The receive mode can be either synchronous or asynchronous.

...

During the generation process (and in the final bitstream file), this Data_IN input is automatically disabled and the blocks connected to it are discarded. The input of the DataIN block then becomes the values sent from the CPU model through the corresponding interface blocks.Example of basic DataIN implementationImage Removed

...

The synchronous mode is associated with the default mode of the DataIn Send block in the CPU model (one data per port per time-step) (that block is for usage with SFunction Driver, see RT-LAB documentation for more information and usage of OPALBOARD instead), there is not time multiplexing on the CPU side. This mode is shown in the figure above for three DataIN ports.DataIN synchronous mode, assuming there 5 FPGA steps in 1 CPU step.pngImage Removed

...

The asynchronous mode is used when there is time multiplexing on the CPU side. It returns up to 250 words to the FPGA model during each CPU time step. The exact time of arrival in the FPGA model is unknown.

...

The block has the capability to show the values to be sent to the FPGA model through its Data_Out output port during an offline simulation. During generation (and in the final bitstream file), this output port is not used.DataOUT basic implementation exampleImage Removed

...

The register mode is used when time multiplexing is not needed. It returns one word to the CPU model at every CPU time step. Only the last data computed on the FPGA is sent to the CPU model.DataOUT register mode explanationImage Removed

...

The FIFO mode is used when time multiplexing is needed. The « buffer » on the FPGA can store up to 250 words. To decide if a sample will be stored or not, the block looks for the MSB (bit 32) connected to that DataOut port.

...

Considering those 3 FPGA steps that occurred in the order displayed, we will receive on the CPU model the results shown below.

DataOUT FIFO mode explanation (FPGA side)Image Removed

...

LoadIN and LoadOUT Blocks

...

One I/O Block must be instantiated in the model for each I/O module of the chassis. The mask parameters are as follows:

Type

Type of signal to be interfaced (either analog or digital)

Direction

The direction of the signal to be interfaced (either input or output)

Interface

This drop-down menu lists all available interfaces available according to the selected Type and Direction parameters and the hardware platform selected in the Hardware Config block. The user chooses the appropriate interface to manage the specific signal.

Characteristics

This is not editable. It shows the interface board characteristics for easy identification of the board that corresponds to the selected interface location

Multiplex input/output signals

This checkbox can be used to concatenate multiple inputs or output signals on the same Simulink R net. This may help the user to build cleaner schematics

Number of channels

This is used to select the number of channels to appear on the block icon. This option is not available when the Multiplex input/output signal option is selected. In this case, the channel number is set to the maximal value allowed by the selected interface board

Show external signal port(s)

This is used to add input or output ports that represent the external world, from the active control card point of view. These ports can be used to connect the signals to a model of the external device connected to the signal conditioning modules. This feature can be very useful for offline simulation of the FPGA model

Once the signal type (analog or digital) and direction (input or output) are selected, the Interface drop-down list allows selecting one of the I/O module installed in chassis, as well as the Default Output Values.

...

Warning

By disabling the strict hardware mismatch in the simulation software, the designer assumes entire responsibility of securing its hardware.


DeviceID (in the bitstream)

Compatible with (in the hardware)

OP5340

OP5340; OP5340-2

OP5340-2

OP5340; OP5340-2

OP5330-1

OP5330-1; OP5330-3

OP5330-3

OP5330-1; OP5330-3

OP5351

OP5351; OP5353; OP5357; OP5358-3; OP5358-5

OP5353

OP5351; OP5353; OP5357; OP5358-3; OP5358-5

OP5357

OP5351; OP5353; OP5357; OP5358-3; OP5358-5

OP5358-3

OP5351; OP5353; OP5357; OP5358-3; OP5358-5

OP5358-5

OP5351; OP5353; OP5357; OP5358-3; OP5358-5

OP5352

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2;  OP5360-3

OP5354

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2; OP5360-3

OP5355

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2;  OP5360-3

OP5356-3

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2; OP5360-3

OP5356-5

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2; OP5360-3

OP5359

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2; OP5360-3

OP5360-1

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2, OP5360-3

OP5360-2

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2; OP5360-3

OP5360-3

OP5352; OP5354; OP5355; OP5356-3; OP5356-5; OP5359; OP5360-1; OP5360-2; OP5360-3

OP5367-1

OP5367-1

OP5367-3

OP5367-3

OP5367-5

OP5367-5; OP5367-6

OP5367-6

OP5367-6; OP5367-5

OP5369

OP5351; OP5353; OP5360-1; OP5360-2; OP5360-3

OP5969-2

OP5969-2; OP5969-1

OP5969-1

OP5969-2; OP5969-1

OP7820

OP7820; OP7822

OP7822

OP7820; OP7822

OP7817-2

OP7817-2; OP7821

OP7821

OP7817-2; OP7821

Analog Output Interface

One Analog Output block is used to access all 16 channels of one Analog Output mezzanine installed on the simulator.

...

When signals are multiplexed (addressed by groups of two), each input of the block represents two channels and must be driven by a UFix33_0 bit word. The MSB (bit 32) is the valid bit. Bits 31 to 16 represent channel x+1 while bits 15 to 0 represent channel x. The valid bit must be set to 1 for the outputs to be active. Each channel must have a format equivalent to the Fix16_11 numeric format.

Image Removed

...

The update rate of the outputs can be selected by the user (down to 1us) through the Convert input of the block. To do so, the user must provide a pulse with the required period (for example 1us). The ModelSync signal can be used also. As of now, only one update rate can be selected for all 16 channels.Analog Out Interface block, implementation exampleImage Removed

...

Analog Input Interface

One Analog Input block is used to access all 16 channels of one Analog Input mezzanine installed on the simulator.

Channels can be accessed individually or by groups of two (Multiplex option selected). The acquisition rate of the inputs can be selected by the user (down to 2.5us) through the Convert input of the block. To do so, the user must provide a pulse with the required frequency (for example 2.5us). As of this writing, only one acquisition rate can be selected for all 16 Analog Input channels.Analog In Interface block, (a) No multiplexing of signal, (b) Multiplex option selectedImage Removed

...

When channels are addressed individually, each output of the block represents one channel and is a Fix16_10 bit word. The MSB (bit 15) is the sign. Four bits (bits 14 to 10) represent the integer value while the remaining 10 bits (bits 9 to 0) represent the fractional part. This logic implies a range of [+31.999, -32] volts.

...

When the Multiplex option is selected (groups of two), each output of the block represents two channels and is a UFix33_0 bit word. The MSB (bit 32) is a valid bit. Bits 31 to 16 represent channel x+1 while bits 15 to 0 represent channel x. Each channel is represented using Fix16_10.Analog In Interface block, implementation exampleImage Removed

...

Digital Output Interface

One Digital Output block is used to access all 32 channels of one Digital Output mezzanine installed on the simulator. Channels can be accessed individually or merged in a single 32-bit word.

The update rate is limited by the hardware conditioning only. At some point, the rising time of the digital output becomes too important compared to the period of the digital signal/PWM. At this point, logic level detection does not occur fast enough for the duty cycle to be properly represented.Image Removed

...

When channels are addressed individually, each input of the block represents one channel and must be driven by a 1-bit word. When grouped in a 32-bit word, bit 0 (LSB) will drive channel 0 while bit 31 (MSB) will drive channel 31. A low voltage level is sent as 0 while a high voltage level is sent as 1. The voltage level itself is set by the user at the hardware level (for example 0 to 5V, 0 to 12V, etc.).Digital Out Interface block, (a) No multiplexing of signals, (b) Multiplex option selectedImage Removed

...

Digital In Interface

One Digital Input block is used to access all 32 channels of one Digital Input mezzanine installed on the simulator. Channels can be accessed individually or retrieved in a single 32-bit word. The update rate is limited by the hardware conditioning only.

...

The Simulation State block returns the various states of the CPU model to the FPGA model. The CPU model states are Stopped, Pause, Execute, Reset and Load. The Simulation State returns one if the state is true/active and returns zero if the state is false/inactive. Each output has a size of 1 bit.SimulationState blockImage Removed

...

Anchor
modelsync
modelsync
ModelSync Tag

...