Intel® Simics® Simulator for Intel® FPGAs: Agilex™ 5 Virtual Platform User Guide

ID 786901
Date 11/16/2024
Public
Document Table of Contents

2.1.3.9. Exercising Peripheral Subsystem in FPGA Fabric Design

led_pio Component From Intel® Simics® CLI Exercise

The Intel® Simics® model of the led_pio component allows to emulate having connected a set of up to 32 LEDs in the virtual platform. This component uses its DATA register to control the state of each one of the LEDs (one bit per LED) and also to read back the current state.

The following table shows some of the methods which you can set and read the state of the LEDs from an Intel® Simics® CLI command. The first and second rows show how this can be done by directly accessing the DATA register with the write-device-reg and read-device-register commands. The third and fourth row shows how the DATA register is accessed through the physical offset in which the DATA register is located (at 0x10080 offset under the lwhps2fpga bridge mapping offset):

Table 12.  CLI Commands to Read the LED State
Task Command
Write through register write-device-reg system.board.fpga.soc_inst.periph_subsys.led_pio.bank.regs.DATA <led_state>
Read through register read-device-reg system.board.fpga.soc_inst.periph_subsys.led_pio.bank.regs.DATA
Write by offset set 0x20010080 <led_state> 4
Read by offset get 0x20010080 4

Interrupt Triggering in Peripheral Subsystem from Intel® Simics® CLI

The button_pio and dipsw_pio components in the peripheral subsystem are provided with the capability to trigger interrupts to the HPS. These components use the INTERRUPTMASK register to enable the interrupt triggering and to clear the interrupt. Since these components handle GPIO inputs, you can control the signals' state through the port.input_io[].iface.signal interface from the Intel® Simics® CLI. One single input is supported in each component, and the interrupt is triggered on the rising edge of the signal.

The following table shows the commands used to handle the interrupts triggering:

Table 13.  Commands to Handle Interrupts
Task Command
Enabling interrupt write-device-reg system.board.fpga.soc_inst.periph_subsys.button_pio.bank.regs.INTERRUPTMASK 1
write-device-reg system.board.fpga.soc_inst.periph_subsys.dipsw_pio.bank.regs.INTERRUPTMASK 1
   
Triggering interrupt by asserting input signal and observing the state of the signal @conf.system.board.fpga.soc_inst.periph_subsys.button_pio.port.input_io[0].iface.signal.signal_raise()
@conf.system.board.fpga.soc_inst.periph_subsys.dipsw_pio.port.input_io[0].iface.signal.signal_raise()
   
Observing the state of the input signal read-device-reg system.board.fpga.soc_inst.periph_subsys.button_pio.bank.regs.DATA
read-device-reg system.board.fpga.soc_inst.periph_subsys.dipsw_pio.bank.regs.DATA
   
Clearing and disabling the interrupt write-device-reg system.board.fpga.soc_inst.periph_subsys.button_pio.bank.regs.INTERRUPTMASK 0
write-device-reg system.board.fpga.soc_inst.periph_subsys.dipsw_pio.bank.regs.INTERRUPTMASK 0
Note:

To observe the Intel® Simics® CLI message indicating the interrupt triggering, increase the log level in the HPS GIC device using:

log-level object = system.board.fpga.soc_inst.hps_subsys.agilex_hps.gic level = 4