Documentation Home Page eHS Toolbox Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

How to create FPGA-based Custom Model compatible with Schematic Editor workflow

Introduction

This document describes how to create a FPGA-based Custom Model that will connect to other ioconf compatible features and be included in automatic firmware description file generation. Using the template Custom Model block from eFPGASIM’s XSG library, define input and output signals to easily connect to eHS and the CPU using Schematic Editor.

To get familiar with the Custom Model block, see the related help pages for the Custom Model XSG and CPU blocks:

Requirements

  • eFPGASIM 2.19 and higher

  • RT-XSG 3.7.0 and higher

FPGA-Based custom model

With the introduction of automatic ioconf firmware description file generation in eFPGASIM 2.15 and RT-XSG 3.4.0 it is now possible to automatically create the ioconf file of a given firmware model during the bitstream compilation process. As of eFPGASIM 2.15 and RT-XSG 3.4.0, only official feature blocks were supported but a custom model toolbox block as now been added to eFPGASIM.

When designing FPGA-based models with eFPGASIM and RT-XSG, it is common to want to add custom features to connect to other eFPGASIM features, mainly eHS, but also to send and receive information from the CPU model. In order for that custom model to be usable in Schematic Editor, it needs to:

  • Add a custom block instance to the list of firmware blocks

  • Add External ports to the port definition of the ioconf

  • Add a connection to an eHS FLWS input

  • Add a connection to an eHS output lane

All this is now possible with the addition of the “Custom Model” block in the “Toolbox Custom Model” library

How to use the Custom Model block

Starting from the eHS Gen5 with Machines example firmware model, simply:

  1. Drag and drop the Custom Model block from the library into your model.

    image-20240820-151126.png

  2. For eHS connectivity, connect your custom model to an eHS FLWS input, the eHS low latency output and a new Load In.

    image-20240820-151736.png

  3. For CPU connectivity, connect your custom model to a new Data In and Data Out.

  4. Now that the custom model is imported, open the mask. Inside the mask are editable text fields to specify the names of the signals. Leave them as is or edit them. By default, there are three inputs and outputs connected to eHS and to the CPU. Once the proper signals are set, click the “Open Custom Model Design” button to start editing. If you need any extra inputs or outputs coming from or going to other blocks other blocks then eHS, use the Input/Output Bus checkboxes. These checkboxes add an input and output port to the custom model that can be used to connect with the rest of the firmware model.

  5. Add your custom FPGA-based logic under the block and connect your inputs and outputs. Notice the path, under the “custom” subsystem is exclusively where modifications to the model should be made. This subsystem is opened via the “Open Custom Model Design” button. The signal connected to eHS are expected to be Extended Floats (XFLOAT_8_34). The signals connected to the CPU are expected to be Unsigned Fixed 32 bits (UFIX_32_0).

  6. Once your design is complete, the model is ready for bitstream and ioconf generation. In this example, the signals coming from eHS are multiplied by 2, 3 and 4 and sent back to eHS. The signals coming from the CPU and added by 10, 20 and 30 and sent back to the CPU.

  7. Create a RT-LAB project, add a eHS SE block and a Custom Model block. To use the Custom Model CPU block, make sure the .ioconf associated to the fimware binary file is in the project folder or Matlab path.

  8. Using the generated ioconf file, the Custom Model should now be visible in the Schematic Editor’s external model inputs and outputs!

  9. In the RT-LAB model, select the Custom Model to configure in the mask dropdown.

     

  10. The source in the Schematic Editor model will be multiplied by 2, 3 and 4 and the signals send from the CPU will be added by 10, 20 and 30!

Troubleshooting

If you’re experiencing issues, make sure to check the eFPGASIM with RT-XSG Module quick guide.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323