Product guide of the imperix firmware IP

This page documents the imperix firmware IP for AMD/Xilinx Vivado, which is required to program the FPGA of imperix controllers. This IP encapsulates the imperix proprietary FPGA logic and offers various interfaces allowing users to add their own custom logic around it.

The document details the different signals provided by this IP, along with their associated timings. Separate documentation exists for specific interfaces, as listed in the table below:


InterfaceFeature/objectiveProduct note
ADCRetrieving ADC conversion results as soon as they are available.PN126
SBIOExchanging data between the user code running in the CPU and the FPGA.PN128
SB-PWMDriving the PWM output chain, comprised of a dead-time generation system and the hardware protection mechanisms.PN127
USRAccessing physical 3V3 I/O pins.PN179
GTAccessing Gigabit Transceivers (GT), enabling support of protocols such as Aurora on SFP ports.PN118
BSCANUsing ILAs to observe FPGA signals in real-time for debugging purposes.PN129
imperix firmware IP

Architecture overview

Because FPGA development operates at the hardware level, a thorough understanding of the underlying system architecture and real-time execution behavior is essential for successfully integrating custom logic into the FPA of an imperix controller.

  • The article PN253 presents the architecture of imperix controllers, explains their main data paths, and introduces the key subsystems. Fundamental information regarding how the controllers manage control-relevant clocks and timing is also provided.
  • The article PN261 explains how imperix controllers operate and details the typical sequence of acquisition → processing → modulation through the user-programmable CPU. Information is also provided about the core operating states and the related enabling/disabling of PWM outputs.

Imperix actively supports two controller generations, both based on AMD Xilinx System-on-Chips (SoCs):

While the specifics (number of CPUs, clock speeds, FPGA resources, etc.) vary between the generations, the operating principles and control workflow are identical. The global architecture is also similar, as shown below:

Architecture of imperix controllers (elements common to Gen. 3 and Gen. 4)

The core modules contained within the imperix firmware IP are:

  • The data acquisition module (documented in PN126) pilots the ADC chips and makes the analog input measurement available to both the CPU user app and the user-programmable FPGA area.
  • The pulse-width modulation (documented in PN127) contains the pre-implemented PWM modulators (CB, SV, DO, SS, PP). It allows driving the PWM outputs from a custom modulator using the SB-PWM path.
  • The CLK module manages the main clock CLK0 (configured via the CONFIG block) and the optional CLK1, CLK2 and CLK3 (configured via CLK block).
  • The DMA is responsible for transferring the data between the FPGA and the CPU read/write buffers. The read and write phases are detailed in the next section.

Execution timing & signals

The following figures illustrate the key phases involved along the CPU control path. These are detailed in PN261, and summarized below:

  • Acquisition: covers the physical Analog-to-Digital conversion and data retrieval to the FPGA fabric.
  • Read: represents the data transfer from the FPGA to the CPU read buffer.
  • CPU task: contains the execution of the main control task (user-defined control algorithms).
  • Write: represents the data transfer from the CPU write buffer to the FPGA.

Interestingly, a second data path exists, associated with the FPGA task, that permits control algorithms to be fully executed on the FPGA, as in the control example presented in TN147.

Phases of the CPU and FPGA control paths

On the PL side (FPGA), the imperix firmware IP provides several signals to monitor and synchronize logic during the execution of these phases.

Timing signals related to the CPU control path
Port nameClk domainDescription
sampling_pulseclk_250_mhzIndicates the ADC sampling instant and the start of the acquisition phase. Corresponds to the rising edge of the sampling clock SCLK.
adc_done_pulse clk_250_mhzIndicates that the acquisition phase is finished and new ADC values are available at the ADC interface.
adc_done_cpu_pulse clk_250_mhzWhen the sampling rate differs from the CPU rate, this signal is a decimated version of adc_done_pulse. It is set when the CPU control path stages are scheduled to execute. The following section describes this scenario in more detail.
reading clk_250_mhzIndicates that the system is in the read phase, in which data flagged as real-time (SBI registers, ADC, GPI, etc.) are sent to the CPU read buffer.
data_valid_pulse clk_250_mhzAsserted at the end of the write phase, notifying that new data were written (SBO registers, PWM duty-cycles, GPO, etc.).

Handling different execution rates

FPGA-based control algorithms are often desired to execute at a higher rate than the CPU. In such cases, a postscaler can be configured in the CONFIG block to reduce the CPU rate relative to the sampling frequency. Then, the adc_done_cpu_pulse acts as the decimated version of adc_done_pulse. It is asserted when the CPU control path stages are scheduled to run.

Execution timing with postscaler = 4

Differences between Gen. 3 and Gen. 4 devices

For FPGA development, the B-Box 4 offers several key enhancements over its predecessors, such as access to analog measurements in floating-point format, faster transceivers, and expanded FPGA resources. The table below summarizes the key differences between the two generations.

ComponentGen 3Gen 4
FPGAKintex 7 125KKintex US+ 504K
LogicLUTs: 78600
Registers: 157200
LUTs: 230400
Registers: 460800
Logic used by imperix IP*min:
LUTs: 25482 (32.4%)
Registers: 46374 (29.5%)

max:
LUTs: 39143 (49.8%)
Registers: 67203 (42.7%)
min:
LUTs 70733 (30.7%)
Registers 108749 (23.6%)

max:
LUTs: 94233 (40.9%)
Registers: 140636 (30.5%)
Usable logic left*max:
LUTs: 53118 (67.6%)
Registers: 110826 (70.5%)

min:
LUTs: 39457 (50.2%)
Registers: 89997 (57.3%)
max:
LUTs: 159667 (69.3%)
Registers: 352051 (76.4%)

min:
LUTs: 136167 (59.1%)
Registers: 320164 (60.5%)
Gigabit Transceivers available from the sandbox3x GTX (3x SFP connectors)
Up to 6.6 Gbps
4x GTH (1x QSFP connector)
Up to 16.3 Gbps
Bidirectional direct FPGA I/Os (USR)36x36x
PWM outputs32x48x
ADC interface16x (int16)24x (int16, or float)
RS485/RS422 2x
Acquisition delay2 μs (B-Box RCP 3.0)
500 ns (B-Box Micro, B-Board, TPI8032)
 200 ns / 368 ns**

* The logic used by the imperix IP depends on the enabled features, as explained in the Disabling Features to Save FPGA Resources section.

** When channels A12-A23 are used.

Interface description of the firmware IP

ADC interface

The ADC interface returns the raw 16-bit signed integer result from the ADC chips. Practical guidance for retrieving data from ADCs is provided in PN126.

Format: 16-bit signed integer (two’s complement, range: -32768 to +32767)
Port NameDirectionWidthClk domainDescription
ADC_reg_XXOutput16bitsclk_250_mhzADC 16-bit result in 2’s complement format.
XX = channel
adc_done_pulseOutput1 bitclk_250_mhzIndicates that new ADC samples are available.
adc_done_cpu_pulseOutput1 bitclk_250_mhzDecimated version of adc_done_pulse when a postscaler is used. Set when the CPU control path stages are scheduled to run.
Description of signals related to the ADC interface

ADC_FLOAT interface

Available exclusively on the B-Box 4, this interface provides access to the true physical values, in single-precision floating-point format, as they are available at the end of the ADC signal chain. The rescaling from the raw 16-bit ADC value is configured by setting the sensor sensitivity and offset from the ADC block.

Format: 32-bit IEEE 754 single-precision floating-point
Port NameDirectionWidthClk domainDescription
ADC_FLOAT_reg_XXOutput32bitsclk_250_mhzADC floating-point result post rescaling.
XX = channel
adc_done_float_pulseOutput1 bitclk_250_mhzIndicates that new ADC_FLOAT samples are available.
adc_done_cpu_float_pulseOutput1 bitclk_250_mhzDecimated version of adc_done_float_pulse when a postscaler is used. Set when the CPU task is scheduled.
Description of signals related to the ADC_FLOAT interface

SBIO interface

The SBIO_BUS (SandBox IO Bus) is a 16-bit memory-mapped bus allowing the CPU to address up to 1024 registers in the FPGA. This bus is dedicated to user-configured data exchanges between the CPU and the FPGA. Its Simulink/PLECS counterparts are the SBI/SBO blocks. Specific documentation is provided in PN128.

Port NameDirectionWidthClk domainDescription
SBIO_BUS_sb_addrOutput10 bitsclk_250_mhzAddress of the accessed register
SBIO_BUS_sb_weOutput1 bitclk_250_mhzWrite enable
SBIO_BUS_sb_wdataOutput16 bitsclk_250_mhzWrite data
SBIO_BUS_sb_rdataInput16 bitsclk_250_mhzRead data
Description of the SBIO interface signals

The bus performs read operations by setting the requested address on sb_addr and expects the corresponding data on sb_rdata exactly four cycles later.

Read operation

A write occurs on each rising edge of clk when sb_we is asserted. The target location is given by sb_addr and the value written is sb_wdata.

Write operation

The two additional signals listed below are provided to help synchronize custom logic with the SBIO bus operations:

SignalDirectionWidthClk domainDescription
readingOutput1 bitclk_250_mhzAsserted high while data (ADC, SBI, GPI) are being read by the CPU.
data_valid_pulseOutput1 bitclk_250_mhzSingle-cycle pulse indicating that all SBO registers have been written for the current CPU control task.

SB-PWM interface

The SB-PWM (SandBox-PWM) interface allows PWM outputs to be driven from custom FPGA logic while still benefiting from the controller’s hardware protections. Additionally, when using the SB-PWM interface, users also benefit from existing dead-time generation and enable/disable mechanisms similar to driving PWMs from the SB-PWM block (or similar). This interface is further documented in PN127.

Port NameDirectionWidthClk domainDescription
sb_pwmInput48 bits (Gen 4)
32 bits (Gen 3)
clk_250_mhzPWM signals driven from sandbox logic.

CLOCK interfaces

The CLOCK interface provides access to the four user-configurable time clock generators. More information about these resources is provided in PN253. Typical timing configurations are also presented in PN259. On the practical side:

  • The main clock CLOCK_0 must be configured via the CONFIG block
  • The auxiliary clocks, CLOCK_1, CLOCK_2 and CLOCK_3 must be configured via the CLK blocks.
Port NameDirectionWidthClk domainDescription
CLOCK_N_periodOutput16 bitsclk_250_mhzPeriod of the clock in ticks.
CLOCK_N_prescalerOutput16 bitsclk_250_mhzIndicates the CLOCK_N_timer ticking rate.
1 tick = 4 ns * CLOCK_prescaler.
CLOCK_N_timerOutput16 bitsclk_250_mhzTimer counting from 0 to CLOCK_period-1 at the ticking rate set by the CLOCK_N_prescaler.
CLOCK_N_clk_enOutput1 bitclk_250_mhzClock enable pulse indicating when CLOCK_N_timer is updated.
CLOCK interfaces signal description, with N going from 0 to 3

Interestingly, the prescaler extends the achievable frequency range beyond what the 16-bit period timer counter alone can provide. With CLOCK_N_prescaler = 1, the minimum achievable frequency is approximately 3.8 kHz (250 MHz / 65535). For lower frequencies, the CLOCK_N_prescaler automatically increases, and the firmware tries to closely match the requested frequencies.

Example:

  • A frequency of 20 kHz results in CLOCK_prescaler = 1 and CLOCK_period = 12500 ticks.
  • A frequency of 2 kHz results in CLOCK_prescaler = 2 and CLOCK_period = 62500 ticks.

When prescaler = 1:

  • clk_en is asserted every clk_250_mhz cycle
  • CLOCK_0_timerincrements on every clock edge
CLOCK_0 with prescaler = 1

When prescaler > 1:

  • clk_en is asserted once every X cycles (where X = prescaler value)
  • CLOCK_0_timer increments only when clk_en is high
CLOCK_0 with prescaler = 2

GT interfaces

The Gigabit Transceiver (GT) interface provides access to high-speed serial transceivers connected to the SFP+, respectively QSFP+ sockets. This enables custom point-to-point communication with external devices such as other controllers, custom hardware etc.

PN118 is an example setting up loopback communication using Xilinx/AMD Aurora as a communication protocol. Additional examples with third-party hardware-in-the-loop (HIL) simulators (OPAL-RT, Plexim and RTDS) are provided on the page SFP communication with third-party devices.

FeatureGen 4Gen 3
Available transceivers4x GTH (1x QSFP connector, lanes 4–7)3x GTX (3x SFP connectors)
Maximum line rate16.3 Gbps6.6 Gbps

Accessing GTH transceivers on Gen 4 controller

On Gen 4, lanes can be exposed to the sandbox from the Configuration tab in the imperix firmware IP configuration. Each enabled lane exposes the following signals:

Port NameDirectionDescription
GT_USER_TX_N_txpOutputTransmit positive (differential)
GT_USER_TX_N_txnOutputTransmit negative (differential)
GT_USER_RX_N_rxpInputReceive positive (differential)
GT_USER_RX_N_rxnInputReceive negative (differential)
gt_refclkOutput250 MHz reference clock (shared across all lanes)
GT interface on Gen 4, where N is the lane number (4, 5, 6, or 7)

Accessing GTX transceivers on Gen 3 controller

On Gen 3, the SFP ports are used by default for RealSync inter-device communication. Using a port from the sandbox requires disabling RealSync on that specific link, which removes the inter-device communication capability on that port. Lanes can be exposed to the sandbox from the Configuration tab in the imperix firmware IP configuration. Each enabled lane exposes the following signals:

Port NameDirectionDescription
txp_NOutputTransmit positive (differential)
txn_NOutputTransmit negative (differential)
rxp_NInputReceive positive (differential)
rxn_NInputReceive negative (differential)
Transceiver ports on Gen 3, where N is the lane number. 0 = SFP 0 (UP), 1 = SFP 1 (DOWN 0), 2 = SFP 2 (DOWN 1))

Serial port interfaces

The serial port interfaces are exclusive to the B-Box 4 and are typically used by the pre-implemented SSIBiSS-C and EnDat2.2 FPGA drivers. The imperix IP allows bypassing these built-in drivers by providing direct access to RS485/RS422 transceiver signals from the sandbox, as illustrated below.

The serial ports (A and/or B) can be made available from the sandbox from the Configuration tab in the imperix firmware IP configuration. Each enabled serial port exposes the following signals:

Port NameDirectionDescription
SERIAL_X_rxInputReceive data from external device
SERIAL_X_txOutputTransmit data to external device
SERIAL_X_clkOutputClock signal for synchronous protocols
SERIAL_X_enOutputTransceiver enable (active high)
Serial interface, where X is the port identifier (A or B).

BSCAN Interface to observe internal signals using ILA

The BSCAN (Boundary Scan) interface exposes the FPGA’s debug scan chain to the sandbox and enables the use of Integrated Logic Analyzers (ILAs) and other Xilinx debug cores. When combined with the Xilinx Virtual Cable (XVC) protocol, this allows remote debugging of internal FPGA signals directly from Vivado’s Hardware Manager over Ethernet.

For detailed instructions on adding ILAs to your design and connecting to them via XVC, refer to PN129.

Digital I/Os drivers

The sandbox exposes various digital I/O signals. Some ports are available for user logic, while others are reserved for internal system operation and must not be modified. For detailed pin locations and electrical specifications, refer to the relevant datasheet:

The USR pins

The USR pins are 36 user-configurable 3.3V I/Os routed directly to the FPGA, without any resistors or level shifters on the PCB traces. These pins are typically used for interfacing external peripherals (e.g., SPI ADC) but can, in fact, be leveraged for a very broad range of applications, thanks to their bidirectionality and high bandwidth.

More information about accessing USR pins is provided in PN179.

Port NameDirectionDescription
USR[35:0]TristateThese pins are used by the motor interface and the programmable inverter. When none of these devices are in use, the USR pins can freely be accessed from the sandbox.

Private Ports

These ports are required for internal communication with controller components and are reserved for imperix use. Modifying these connections may cause undefined behavior and must be absolutely avoided.

Port NameDirectionDescription
private_inInputInternal system signals. Width varies by generation.
private_outOutputInternal system signals. Width varies by generation.
DDRDDR memory interface
FIXED_IOFixed I/O interface to PS

Gen 4 ports

Port NameDirectionDescription
din[23:0]InputGeneral-purpose or fault feedback inputs (GPI/FLT)
dout[47:0]OutputGeneral-purpose outputs or PWM outputs (GPO/PWM)

Gen 3 ports

Port NameDirectionClock DomainDescription
flt[15:0]Inputclk_250_mhzFault inputs
gpi[15:0]Inputclk_250_mhzGeneral-purpose inputs
gpo[15:0]Outputclk_250_mhzGeneral-purpose outputs
pwm[31:0]Outputclk_250_mhzPWM output signals
BBOX[51:0]TristateN/AInternal B-Box RCP pins. Can be repurposed on B-Board PRO with custom PCB design (see PN201).

Disabling features to save FPGA resources

The imperix firmware IP includes several optional features that can be disabled to free up FPGA resources for custom sandbox logic. Access the resource-saving options from the Saving FPGA resources tab in the imperix firmware IP configuration.

Disabling a feature removes it entirely from the FPGA design. If the corresponding functionality is used in the CPU model, an error will be raised in Cockpit. Additionally, unused modulators can be removed to save logic resources. Notably, the CB-PWM logic can be disabled in groups of 8 lanes.

FeatureGen 4Gen 3
CB-PWM lanes 0–7
CB-PWM lanes 8–15
CB-PWM lanes 16–23
CB-PWM lanes 24–31
CB-PWM lanes 32–39
CB-PWM lanes 40–47
SS-PWM logic
PP-PWM logic

Resource Savings

FeatureGen 4Gen 3
CB-PWM (per 8 lanes)~2100 LUTs (0.9%)
~2800 Registers (0.6%)
~1600 LUTs (2.03%)
~2000 Registers (1.27%)
SS-PWM~6250 LUTs (2.71%)
~5500 Registers (11.93%)
~2700 LUTs (3.43%)
~3300 Registers (2.1%)
PP-PWM~4400 LUTs (1.9%)
~9200 Registers (2%)
~4400 LUTs (5.6%)
~9150 Registers (5.82%)