This repository contains resources to implement off-chip trace of the hard RISC-V cores of a PolarFire® SoC with Lauterbach tools.
Trace can be exported using parallel trace (4, 8, or 16 data lines) with a PowerTrace 2/3 with an AutoFocus-II preprocessor. Alternatively, serial trace can be used with a PowerTrace Serial. Suggested serial configurations are one lane at 10 Gbit/s or two lanes at 5 GBit/s. Each configuration is as fast as a 16-bit parallel trace.
Off-chip trace on this platform requires a component in the FPGA that receives trace data from the SMB (System Memory Buffer) component in the MSS and forwards it to the off-chip trace port.
The SMB is normally used for on-chip trace and uses internal RAM or SDRAM as a trace buffer.
However, in this application, the data is written to a small 4-KiB address range implemented by the axi_to_pti
or axi_to_aurora
IP included in this repository.
We support the following adaptions and evaluation boards:
-
PolarFire® SoC Video Kit via FMC connector using one of the following adapters:
- Lauterbach LA-2785; This adapter allows parallel trace or serial trace.
- Xilinx/AMD FMC XM105 card; This adapter only allows parallel trace.
For 16-bit parallel trace, these adapters are pin compatible, so the same FPGA design can support both cards. For the converter's pin map, refer to
script_support/videokit/io_videokit_fmc.pdc
in this repository. -
PolarFire® SoC FPGA Icicle Kit via RPi connector using Lauterbach LA-3884; For the converter's pin map, refer to
script_support/icicle/io_icicle_rpi.pdc
in this repository.
Of course, trace is also possible with other boards, but for these, the user will need to create their own FPGA design.
Lauterbach hardware/software requirements:
- PowerDebug X50/PRO/II
- parallel trace: PowerTrace 2/3 with AutoFocus-II preprocessor
- serial trace: PowerTrace Serial or PowerTrace Serial 2
- IDC20A cable
- Debug and trace licenses for RISC-V
- TRACE R.2025.02 or a later release
Instructions:
- Use the scripts
lb_cmm/00_program_videokit_16.cmm
,lb_cmm/01_program_videokit_1lane.cmm
,lb_cmm/02_program_videokit_2lane.cmm
orlb_cmm/03_program_icicle_16.cmm
to program the FPGA. This takes a few minutes, but only needs to be done once. - If you use the icicle demo, set J46 to supply the trace reference voltage to the preprocessor.
- Use the script
lb_cmm/10_run_sieve_demo_16.cmm
(parallel trace) orlb_cmm/11_run_sieve_demo_1lane.cmm
/lb_cmm/12_run_sieve_demo_2lane.cmm
(serial trace) to debug and trace a simple sieve demo.
The following instructions will generate a minimal FPGA project with just the MSS (microprocessor subsystem), trace and SDRAM connection. The scripts require exactly Libero 2024.2.
- Start Libero.
- Invoke Project→Execute Script…
- Select either
generate_icicle_project.tcl
, orgenerate_videokit_project.tcl
orgenerate_videokit_project_aurora.tcl
, depending on the desired evaluation board and trace type. For parallel trace, you can specify the number of trace data bits<n>
(4, 8, 16) as an argument. The default is 16 bits. For serial trace, you can specify1lane
or2lane
as an argument to choose the desired setup. The default is1lane
. - Click Run.
This generates the new project as
trace_icicle_<n>
ortrace_videokit_<n>
in the same directory as the tcl scripts. Note that all the settings from thescript_support/
directory as well as all the HDL files from thehdl_src/
directory are copied/imported into the project. Changing them after running the script will have no effect. Re-running the script will erase and regenerate thetrace_icicle_<n>
/trace_videokit_<n>
directory, so all modifications will be lost. - Double-click “Place and Route” in the “Design Flow” tab. This will run the complete implementation of the design.
- Double-click “Export Bitstream” in the “Design Flow” tab. Select the STAPL format. Click OK. This generates a bitstream (.stp file) suitable for programming with TRACE32.
The example projects include a testbench that can be used to do a pre-synthesis integration test of the complete trace path. To run the testbench:
- Open one of the example projects with Libero.
- In the “Design Flow” tab, double-click on “Create Design→Verify Pre-Synthesized Design→Simulate”.
QuestaSim or Modelsim should open and automatically compile and simulate the project.
The signal oDone
should switch to '1'
near the end of the simulation run.
This indicates that all pseudo-random data that was written by the simulated MSS component passed through the axi_to_pti
or axi_to_aurora
component and was decoded and verified successfully by the testbench.
The following instructions describe how to add off-chip trace to an existing design. Use these instructions if you want to use something other than the supported evaluation boards or if your application uses other IP inside the FPGA.
Some familiarity with Libero and FPGA design in general is required to follow these steps. It is recommended to also generate and study one of the example designs (see previous section).
These instructions were tested with Libero 2024.2, but should work with future releases as well.
- Open the project you wish to modify.
- Invoke Project→Execute Script…
- Select
axi_to_pti.tcl
and click Run. - Instantiate the
axi_to_pti
HDL+ component in your design and set thegOutBits
parameters to the desired trace port size. - Connect the
oTraceClk
andoTraceData
outputs to FPGA pins. These will also need matching I/O constraints matching the board schematic. - Connect the AXI interface to either the
FIC_0_AXI4_INITIATOR
orFIC_1_AXI4_INITIATOR
interfaces of the MSS. You will need a CoreAXI4Interconnect component between the MSS and theaxi_to_pti_wrapper
instance. The converter IP only needs a 4-KiB address range and only needs write access. Check the example designs for more details. - The base address where the MSS can write to the converter IP needs to be configured in TRACE32 using the
SYStem.CONFIG USOCSMB.BufferBase
command.
The following instructions describe how to add off-chip trace to an existing design. Use these instructions if you want to use something other than the supported evaluation boards or if your application uses other IP inside the FPGA.
Some familiarity with Libero and FPGA design in general is required to follow these steps. It is recommended to also generate and study one of the example designs (see previous section).
These instructions were tested with Libero 2024.2, but should work with future releases as well.
-
Open the project you wish to modify.
-
Invoke Project→Execute Script…
-
Select
axi_to_aurora.tcl
and click Run. -
Instantiate the
axi_to_aurora_1lane
oraxi_to_aurora_2lane
HDL+ component in your design. -
If not already in your design, Instantiate a Transceiver Interface (
PF_XCVR_ERM
) and supporting clocking infrastructure (Transmit PLL and Transceiver Reference clock). For the serial trace to work properly ensure to- set Transmit PLL into Integer Mode and
- set
PF_XCVR_ERM
to have either- 1 TX lane configured with 8b10b encoding and 32 bit TX PCS-Fabric Interface width or
- 2 TX lanes configured with 8b10b encoding and 16 bit TX PCS-Fabric Interface width.
All other parameters (datarate, frequency, clock source) are highly specific to the used board, clocking sources, and the rest of the project. Refer to the videokit example project for details.
-
Connect the AXI interface to either the
FIC_0_AXI4_INITIATOR
orFIC_1_AXI4_INITIATOR
interfaces of the MSS. You will need a CoreAXI4Interconnect component between the MSS and theaxi_to_pti_wrapper
instance. The converter IP only needs a 4-KiB address range and only needs write access. Check the example designs for more details. -
The base address where the MSS can write to the converter IP needs to be configured in TRACE32 using the
SYStem.CONFIG USOCSMB.BufferBase
command.