HPS Cache Coherent Accelerator FreeRTOS System Example Design
Introduction¶
This system example design demonstrates a hardware accelerator in the FPGA fabric that communicates with the HPS over a cache-coherent FPGA2HPS AXI interface, performing bulk read/modify/write operations on HPS SDRAM. The example includes a FreeRTOS application that is in charge of configure the hardware in the design and coordinate the data transfer.
Overview¶
This example illustrates the implementation of a System Verilog hardware accelerator (CCA - Cache Coherent Accelerator) in the FPGA fabric that is capable of process data coming from the HPS SDRAM and sending it back to SDRAM keeping cache coherency. The example makes use of FPGA2HPS bridge to implement the cache coherency and the LWHPS2FPGA bridge for the configuration of the FPGA fabric components.
Note: The term accelerator is used to refer that the data processing is off-loaded from the software running in the HPS into the hardware in the FPGA fabric. This is done to speed up the data processing or to allow HPS to preform some other tasks.
Some of the most important features of this example design are listed next:
- Quartus design is based on the Baseline System Example Design for Agilex® 5 FPGA E-Series 065A using HPS Boot first mode booting from an Arm® Cortex®-A55 core processor.
- The Cache Coherent Accelerator (CCA) core that performs pipelined read/modify/write operations on HPS DRAM over the F2H coherent bridge. This includes a custom CSR block for the accelerator control and status, accessible from the HPS. The CCA component is implemented in System Verilog and the source code is available as part of the example design.
- F2H AXI bridge configured for cache-coherent access via SMMU.
- A couple of Modular Scatter-Gather DMA (MSGDMA) components are included in the Quartus design to implement read and write channels in prefetcher mode for bulk data movement between FPGA fabric and HPS memory. The MSGDMA components generate interrupts to signal to HPS about data transfer completion.
- The design includes an On-Chip Memory for DMA descriptor storage and local scratch buffering.
- This example includes a FreeRTOS application running in the HPS that performs the 2nd Phase Fabric configuration, SMMU and GIC configuration. This application makes use of the LWHPS2FPGA bridge to configure the design in the fabric and coordinate the data movement. The HPS software is composed by:
- ARM Trusted Firmware used as bootloader for the FreeRTOS application that includes the FSBL (BL2) and SSBL(BL31).
- FreeRTOS BSP for Agilex® 5 SOC that includes support functions to configure the HPS hardware, configure the FPGA fabric and memory cacheability configuration.
- FreeRTOS application support libraries used to exercise the different data flows supported including a CCA driver.
- FreeRTOS application that includes the main program used to exercise the data transfer and also performs a self-check of the data movement. The application can be configured to also execute a data transfer benchmark and a cache coherency verification.
The HPS software, the initial bitstream and the 2nd Phase fabric design are integrated into a .jic image that is loaded into the QSPI device in the development kit.
The complete CCA System Example Design is located at the following path: https://github.com/altera-fpga/agilex5-ed-hps-fpga-bridges/tree/QPDS26.3_REL_BASELINE_PR/dk-a5e065ab32aea-enablement/cache_coh_accel/
Cache Coherent Accelerator (CCA) Example Quartus Design¶
The Quartus design in this system example design allows data transfer from one region of the SDRAM to another region passing through the Cache Coherent Accelerator component that could be used to process the data if needed. The data transfer is performed by MSGDMA IPs, one for reading from the SDRAM and other for writing to the SDRAM. The Read MSGDMA reads the data from SDRAM and sends it to the CCA. The Write MSGDMA reads the data from CCA and writes back to the SDRAM. The MSGDMA components gets the source/destination addresses and data size to be transferred from descriptors that are stored in a On-Chip memory in the fabric. The HPS is in charge of create these descriptors. These descriptors are read sequentially by the MSGDMAs components and when all of them have been processed and the data transfer finishes, these trigger an interrupt to the HPS, so this can continue with the application flow.
The most important components that integrates the Quartus design are described next:
- HPS IP: The HPS controls the application execution flow and also controls all data transaction functionalities, including DMA operations, EMIF data transfer. In this design, the System MMU Ports setting in the FPGA2HPS bridge is enabled so that F2H transactions go through the SMMU for cache-coherent transactions. All other parameters are the same as the HPS IP in the baseline-a55 Quartus design (including Enabling FPGA-to-HPS interrupts).
- Modular Scatter-Gather DMA (MSGDMA) IP and AvMM-to-AXI4 Bridge: The Quartus design uses 2 MSGDMA IPs components. One for reading from SDRAM (referred as Read MSGDMA) and other for writing to SDRAM (referred as Write MSGDMA). These components are configured in prefetcher mode to facilitate bulk data movement between FPGA fabric and HPS DRAM over the F2H bridge. The prefetcher reads linked descriptor lists stored in the on-chip memory, enabling chained multi-block transfers without software intervention between data blocks. One AvMM-to-AXI4 Bridge block combines the AvMM write channel of the Write MSGDMA and the AvMM read channel of the Read MSGDMA into one single AXI channel interfacing the fabric-to-HPS bridge. As the source port (write) of the Read MSGDMA component is connected to the CCA component, the write address in the descriptors for this component is not used. Similarly, as the sink port (read) of the Write MSGDMA is connected to the CCA component, the read address in the descriptors for this component is not used.
- On-Chip Memory II IP: This is used for MSGDMA descriptor storage and also serves as a local scratch buffer during transfer setup. It is configured as dual-port RAM, being accessible from both the HPS subsystem (via LWHPS2FPGA Bridge) and the MSGDMA's prefetchers. The size of the memory is 4 KB with a data size of 32 bits. The first 2KB region is used for descriptors of the Read MSGDMA and the second 2 KB region is used for descriptors of the Write MSGDMA.
- Cache Coherent Accelerator (CCA) Core: The CCA core (
src/cca_accel_core.sv) implements a pipelined read/modify/write engine that fetches data from HPS SDRAM, processes it in the FPGA fabric, and writes the processed data back over the F2H coherent AXI bridge. A custom CSR block (src/cca_accel_csr.sv) exposes control and status registers for software configuration and step-by-step execution tracking. The CCA supports PROCESS_DATA mode and PASS_THROUGH mode. In the PROCESS_DATA the input data is bit-wise inverted. In PASS_THROUGH mode the data is not modified at all.
A block diagram of the Quartus design for this example is shown next:
The configuration interface in the AVMM component has a base address relative to the LWH2F bridge (address 0x20000000). The following table shows the starting address of the CSRs for each component. The table also shows the address from the HPS perspective.
| Component | AVMM Base Address | Physical address from HPS |
|---|---|---|
| OCM | 0x00200000 | 0x20200000¹ |
| Write MSGDMA Pre-Fetcher CSR | 0x00204000 | 0x20204000 |
| Read MSGDMA Pre-Fetcher CSR | 0x00204020 | 0x20204020 |
| Write MSGDMA CSR | 0x00204040 | 0x20204040 |
| Read MSGDMA CSR | 0x00204060 | 0x20204060 |
| CCA Accel | 0x00400000 | 0x20400000 |
¹ This address is the same that MSGDMA uses to access the descriptors from OCM.
Cache Coherent Accelerator (CCA) Example HPS Software¶
The HPS Software exercises the data transfer from a SDRAM location to another passing through the CCA component to perform some data processing (if configured to do it). The example performs the following operations:
- The main application consist of reading a set of data from a source location in the SDRAM using the Read MSGDMA, which then sends the data to the CCA component to do some processing and the sending back to a destination location in the SDRAM using the Write MSGDMA. The Read and Write operations from the SDRAM through the MSGDMA components, is controlled by descriptors stored in the OCM. The software verifies that the data recovered at the destination SDRAM location matches the expected result from the CCA processing.
- The benchmark task also performs data transfer from one SDRAM location to another passing through the CCA for processing the data, repeating this flow several times with different number of sets of data and different sizes and capturing transfer data throughput metrics. This task can be executed or not based on build time configuration.
- The coherency test task performs an initial verification of read/write access to source and destination memory regions configured as cacheable or not cacheable, checking that data writes reaches the SDRAM or stay in cache. Later this task performs a cache coherency test by transferring some data from a source memory region configured as cacheable, in which the data to transfer is only available in cache memory, to a destination location and verifying that source data in cache is visible in the destination location. In this task, the CCA is configured in PASS THROUGH mode so data is not being processing. This task can be executed or not based on build time configuration.
HPS FreeRTOS Software
The HPS FreeRTOS application software relies on the Arm Trusted Firmware as the bootloader and to provide the SVC services needed to configure the FPGA fabric. The TF-A BL2 is included as part of the Bitstream. The TF-A BL31 and the FreeRTOS software (acting as BL33) are packed into a FIP file. There is a .rbf that is integrated by the a 32-bit word followed by the 2nd phase core.rbf file. This 32-bit word corresponds to the size of the core.rbf. The Bitstream, the .rbf and the FIP are packed into a .jic file as shown in the following diagram. The .jic must be stored in the QSPI device to boot from this. The layout of the .jic is shown next:
The following sections briefly describe the most relevant software components in the application.
-
Cache Coherent Accelerator Driver. This driver is in charge of configure the MSGDMAs and OCM components to perform the data transfer. For this, it uses the cca_transfer_submit() function which receives a parameter a list of jobs with the information about the source and destination address in SDRAM for the data transfer and also the number of byte that wants to be transfer. This information is used to create the descriptors that are stored in the OCM. The descriptor includes a the next_desc_ptr field with the address in the OCM for the next descriptor. If this field has the value of 0, it means that this is the last descripto. When all the descriptors has been executed, an interrupt is triggered by the MSGDMAs and the corresponding rd_prefetch_isr() or wr_prefetch_isr() handler is executed in which is check if read and write transfers has completed, and if this is the case a semaphore is released. The cca_transfer_wait() function is used to wait for the release of this semaphore and normally is expected to be used after cca_transfer_submit() has been called. The 4 KB OCM keeps the descriptors of the Read MSGDMA (0-2KB) and the Write MSGDMA (2KB - 4KB). The cca_transfer_submit() function also receives as parameter the operation mode of the CCA, which can be PASS_THROUGH (CCA_CMD_PASS_THROUGH) mode or PROCEES_DATA mode (CCA_CMD_PROCESS_DATA). The source code of the driver is located at: cca_driver.c.
The following figure describes the data flow that occurs when the cca_transfer_submit() function is executed.
-
Main application: The main() function is the entry point of the application. This starts with HPS hardware configuration that includes the GIC initialization, the SMMU enable and the serial console initialization. After that, this function creates the run() task, which includes the CCA demonstration. If the ENABLE_BENCH_TASK definition exist, it also creates the bench_task ( the benchmark task) and if the ENABLE_COHERENCY_TEST definition exist, it will create the coherency_test task. The bench_task and coherency_test task are executed, but gets blocked waiting for the finishing of the main run() task. The run() task starts with the 2nd phase configuration bitstream, reading this from the QSPI device and then initializes the CCA component and performs the CCA demo that consist on moving some data from some SDRAM addresses to other locations:
1) Creates an array of pointers for the source (src) and destination dst locations in SDRAM with size of 3 elements each one. For each of the 3 src/dst pointers, the task dynamically allocates 4 KB of memory, with 4KB allignment, and initializes the pointers with these addresses. The first locations src regions (128 bytes) are initialized with a 0xAxxxxxxx pattern.
2) For each one of the src/dst pair buffers, the task creates a job object (from cca_job_t ) providing the source address, destination address and size (128 bytes).
3) Request the data transfer from src to dst, calling the cca_transfer_submit() with the list of jobs and number of jobs, indicating also the PROCESS_DATA CCA operation mode.
4) Waits until the transfer completes using cca_transfer_wait().
5) Checks that the data in dst directory matches the inverted pattern written in src buffer.
6) Proceeds to unblock the bench_task and coherency_test so these can continue the execution.The source code of the main application is located at main.c.
-
Bench task: This task performs a CCA throughput benchmark exercising the data transfer from a source memory location to other passing through the CCA. This task is executed only if the ENABLE_BENCH_TASK definition is visible from the main.c file. The entry point of this task is the bench_run() function. This task defines a set of groups in which are defined several data transfers instructions. These instructions define a a certain number of jobs and a size of data to transfer. For each one of the groups, and each one of the data transfers defined on them, the bench_run_config() function is called. This one, converts the data transfer information into jobs that later become the input of the cca_transfer_submit() function which performs the data transfer and also allocates memory for the src/dst buffers with the size provided in the group information. The data transfers defined in each group is performed several times (defined by BENCH_ITERATIONS). In each iteration, the task measures the time that it takes to perform the data transfer using an internal timer (cntfrq) and also keeps tracking of the number of bytes transferred. For each one of the items defined in a group, the function calculates the average CCA throughput in Mbit/s. In this task the CCA also operates in PROCESS_DATA mode.
The following table describes the jobs groups defined:
Group # Jobs Size of the Job (KB) Total Data Transfer (KB) 0 1 32 32 2 32 64 4 32 128 8 32 256 16 32 512 32 32 1024 1 8 4 32 8 16 128 8 32 256 8 64 512 8 96 768 The source code of the Bench task is located at bench_task.c.
-
Coherency_test task: This task verifies the cache coherency during the data transfer from a buffer located at memory region configured as cacheable and data written is in CPU's cache (region considered as dirty) to a another memory region. The entry point of this task is the coherency_test_run() function and This task is executed only if the ENABLE_COHERENCY_TEST definition is visible from the main.c. Once that the coherency_test_run() function starts, it waits until the main application finishes it's execution. At this point the run_coherency_test() function is executed, and this is the one that coordinates the cache coherency check. Initially, this function allocates the src and dst buffers with a size and alignment of 2 MB (size of L3 shared cache). Using these 2 buffers the task performs the following an initial verification that includes the following steps:
-
Flush the cache region for src buffer sending the content of this to SDRAM
-
Configure the memory region for src buffer as non-cacheable and write the PATTERN_3 in to this buffer. Verify that the src buffer in SDRAM has the PATTERN_3.
-
Configure the memory region for src buffer as cacheable and write the PATTERN_A in to this buffer. This time the write is kept only in the cache and not in the SDRAM.
-
Configure again the memory region for src buffer as non-cacheable and read the content. It should see the PATTERN_3.
-
Configure again the memory region for src buffer as cacheable and read the content. It should see the PATTERN_A.
-
Repeat these steps for dst buffer.
The cache coherency test starts at this point having the memory region for src and dst buffers configured as cacheable. The cache region for src buffer has the PATTERN_A while the same region in SDRAM has the PATTERN_3. The task creates a job to request the transfer of src buffer to dst buffer and calls cca_transfer_submit() function setting the CCA in PASS_THROUGH mode. The task then waits for the data transfer completion with the cca_transfer_wait() function and after this the task verifies that the content of dst buffer corresponds to the PATTERN_A that is in the CPUs cache. The reason behind this, is that the READ MSGDMA, snoops the CPU's cache line for src and fetches the PATTERN_A. This confirms that the cache coherency is verified. The data in the SDRAM for dst buffer contains the PATTERN_A while the cache region for this buffer gets invalidated.
The source code of the Coherency_test task is located at coherency_test.c.
-
Prerequisites¶
The following are required to be able to fully exercise this System Example Design:
-
Altera® Agilex™ 5 FPGA E-Series 065A Premium Development Kit, ordering code DK-A5E065AB32AEA. Refer to board documentation for more information.
- HPS Enablement Expansion Board. Included with the development kit.
- Mini USB Cable. Included with the development kit.
- Micro USB Cable. Included with the development kit.
- Ethernet Cable. Included with the development kit.
- Micro SD card and USB card writer. Included with the development kit.
-
Host PC with:
- 64 GB of RAM. Less will be fine for only exercising the binaries, and not rebuilding the System Example Design.
- 10 GB of free disk space for FreeRTOS builds
- Linux OS installed. Ubuntu 22.04LTS was used to create this page, other versions and distributions may work too
- Serial terminal (for example GtkTerm or Minicom on Linux and TeraTerm or PuTTY on Windows)
- Altera® Quartus® Prime Pro Edition Version 26.3
- Local Ethernet network, with DHCP server
- Internet connection. For downloading the files, especially when rebuilding the System Example Design.
For more information about the development kit setup, please refer to the corresponding Baseline System Example Design user guide.
Component Versions¶
Altera® Quartus® Prime Pro Edition Version 26.3 and the following software component versions integrate the 26.3 release.
| Component | Location | Branch | Commit ID/Tag |
|---|---|---|---|
| Agilex 5 System Example Design | https://github.com/altera-fpga/agilex5-ed-hps-fpga-bridges | main | QPDS26.3_REL_BASELINE_PR |
| Arm Trusted Firmware (TF-A) | https://github.com/altera-fpga/arm-trusted-firmware | socfpga_v2.15.0 | QPDS26.3_REL_BASELINE_PR |
| FreeRTOS | https://github.com/altera-fpga/freertos-socfpga | main | QPDS26.3_REL_BASELINE_PR |
Note: The combination of the component versions indicated in the table above has been validated through the use cases described in this page and it is strongly recommended to use these versions together. If you decided to use any component with different version than the indicated, there is not warranty that this will work.
Rebuild FreeRTOS Binaries¶
This section guides you to build the binaries for the Cache Coherent Accelerator example.
Setup Environment¶
1. Create the top folder to store all the build artifacts:
sudo rm -rf agilex5_065a_freeRTOS_cca
mkdir agilex5_065a_freeRTOS_cca
cd agilex5_065a_freeRTOS_cca
export TOP_FOLDER=`pwd`
Enable Quartus tools to be called from command line:
Build Hardware Design¶
cd $TOP_FOLDER
rm -rf dk-a5e065ab32aea-enablement-cache_coh_accel && mkdir dk-a5e065ab32aea-enablement-cache_coh_accel && cd dk-a5e065ab32aea-enablement-cache_coh_accel
wget https://github.com/altera-fpga/agilex5-ed-hps-fpga-bridges/releases/download/QPDS26.3_REL_BASELINE_PR/dk-a5e065ab32aea-enablement-cache_coh_accel.zip
unzip dk-a5e065ab32aea-enablement-cache_coh_accel.zip
rm -f dk-a5e065ab32aea-enablement-cache_coh_accel.zip
make cache_coh_accel-build
The following SOF file is created:
$TOP_FOLDER/dk-a5e065ab32aea-enablement-cache_coh_accel/output_files/cache_coh_accel.sof
Build Binaries for CCA Applications¶
You can build the final .jic binaries for each of the supported applications following the steps below. The build.sh script allows you to build the binaries for the FreeRTOS applications. This script uses the .sof file created before to create the 2nd phase fabric design .rbf and integrates this into the fip file.
cd $TOP_FOLDER/dk-a5e065ab32aea-enablement-cache_coh_accel/software/freertos/cca_user_app/
# Build main app + benchmark task (default)
./build.sh
mv cca_user_app.hps.jic cca_user_app.hps_bench.jic
# Build main app + coherency_test task
sed -i 's/#define ENABLE_BENCH_TASK.*/#define ENABLE_BENCH_TASK 0/g' main.c
sed -i 's/#define ENABLE_COHERENCY_TEST.*/#define ENABLE_COHERENCY_TEST 1/g' main.c
./build.sh
mv cca_user_app.hps.jic cca_user_app.hps_coherence.jic
The following applications are created:
$TOP_FOLDER/dk-a5e065ab32aea-enablement-cache_coh_accel/software/freertos/cca_user_app/cca_user_app.hps_bench.jic- Main application + Benchmark task$TOP_FOLDER/dk-a5e065ab32aea-enablement-cache_coh_accel/software/freertos/cca_user_app/ cca_user_app.hps_coherence.jic- Main application + Coherency_test task
The following directory shows some other binaries that are created during the build:
$TOP_FOLDER/dk-a5e065ab32aea-enablement-cache_coh_accel/software/freertos/cca_user_app/build/fpga_binaries/
NOTE: Alternatively to the build method described above, you can fully build the System Example Design binaries (including Quartus project and HPS binaries) in a single step using the following command from the $TOP_FOLDER/dk-a5e065ab32aea-enablement-cache_coh_accel/ directory:
cd $TOP_FOLDER/dk-a5e065ab32aea-enablement-cache_coh_accel
make software-freertos_app_qspi-install-sw
Please refer to the application README for more detail about building the application and any configurable parameters that could be modified.
Exercise Built Binaries¶
This section presents how to use the built binaries created from Rebuild FreeRTOS Binaries section in this System Example Design for the DK-A5E065AB32AEA development kit.
Configure Board¶
1. Leave all jumpers and switches in their default configuration.
2. Install the appropriate HPS Daughtercard.
3. Connect mini USB cable from vertical connector on HPS Daughtercard to host PC. This is used for the HPS serial console.
4. Connect micro USB cable from development board to host PC. This is used by the tools for JTAG communication.
Configure Serial Console¶
All the scenarios included in this release require a serial connection. This section presents how to configure the serial connection.
1. Install a serial terminal emulator application on your host PC:
- For Windows: TeraTerm or PuTTY are available
- For Linux: GtkTerm or Minicom are available
2. Power down your board if powered up. This is important, as once powered up, with the micro USB JTAG cable connected, a couple more USB serial ports will enumerate, and you may choose the wrong port.
3. Connect mini-USB cable from the vertical mini-USB connector on the HPS Board to the host PC
4. On the host PC, an USB serial port will enumerate. On Windows machines it will be something like COM4, while on Linux machines it will be something like /dev/tty/USB0.
5. Configure your serial terminal emulator to use the following settings:
- Serial port: as mentioned above
- Baud rate: 115,200
- Data bits: 8
- Stop bits: 1
- CRC: disabled
- Hardware flow control: disabled
6. Connect your terminal emulator
Program the Application JIC File¶
1. Power down board
2. Set MSEL dipswitch SW27 to JTAG: OFF-OFF-OFF-OFF
3. Power up the board
4. Write the JIC file to QSPI:
For main application + Benchmark task
For main Main application + Coherency_test taskjtagconfig --setparam 1 JtagClock 16M
quartus_pgm -c 1 -m jtag -o "pvi;cca_user_app.hps_coherence.jic"
Exercise Main Application + Benchmark Task¶
Once the QSPI has been programmed with the cca_user_app.hps_bench.jic file, you need perform the following steps to launch the application.
1. Power down board
2. Set MSEL dipswitch SW27 to ASX4 (QSPI): OFF-ON-ON-OFF
3. Power up the board
4. Observe in the Serial console the output that the application displays. Here you can see that TF-A starts booting after the power cycle, and later this launches the FreeRTOS application. The log shows that the 2nd Phase fabric design configuration and then the main CCA application followed by the benchmark task.
NOTICE: DDR: Reset type is 'Power-On'
NOTICE: IOSSM: Calibration success status check...
NOTICE: IOSSM: All EMIF instances within the IO96 have calibrated successfully!
NOTICE: DDR: Calibration success
NOTICE: DDR: ECC is enabled
NOTICE: IOSSM: Memory initialized successfully on IO96B
NOTICE: ###DDR:init success###
NOTICE: DFI interface selected successfully to SDEMMC
NOTICE: SOCFPGA: QSPI boot
NOTICE: BL2: v2.14.0(release):
NOTICE: BL2: Built : 15:13:52, Nov 10 2026
NOTICE: BL2: Booting BL31
NOTICE: SOCFPGA: Boot Core = 0
NOTICE: SOCFPGA: CPU ID = 0
NOTICE: SOCFPGA: Setting CLUSTERECTRL_EL1
NOTICE: BL31: v2.14.0(release):
NOTICE: BL31: Built : 15:13:52, Nov 10 2026
========================================
CCA FreeRTOS App - Interrupt Mode
Cache Coherent Accelerator Example Usage
3-job chained transfer
========================================
[1/5] Loading FPGA bitstream from QSPI flash...
Bitstream size: 1769472 bytes
Bitstream data send successfully
Bitstream loaded successfully.
[2/5] Initialising CCA driver...
Driver ready.
[3/5] Allocating 3 jobs x 128 bytes...
[4/5] Submitting 3-job chain...
Job 0 src=0x82749000 dst=0x8274b000
Sending:
[00-03] 0xa0000000 0xa0000001 0xa0000002 0xa0000003
[04-07] 0xa0000004 0xa0000005 0xa0000006 0xa0000007
[08-11] 0xa0000008 0xa0000009 0xa000000a 0xa000000b
[12-15] 0xa000000c 0xa000000d 0xa000000e 0xa000000f
[16-19] 0xa0000010 0xa0000011 0xa0000012 0xa0000013
[20-23] 0xa0000014 0xa0000015 0xa0000016 0xa0000017
[24-27] 0xa0000018 0xa0000019 0xa000001a 0xa000001b
[28-31] 0xa000001c 0xa000001d 0xa000001e 0xa000001f
Job 1 src=0x8274d000 dst=0x8274f000
Sending:
[00-03] 0xa1000000 0xa1000001 0xa1000002 0xa1000003
[04-07] 0xa1000004 0xa1000005 0xa1000006 0xa1000007
[08-11] 0xa1000008 0xa1000009 0xa100000a 0xa100000b
[12-15] 0xa100000c 0xa100000d 0xa100000e 0xa100000f
[16-19] 0xa1000010 0xa1000011 0xa1000012 0xa1000013
[20-23] 0xa1000014 0xa1000015 0xa1000016 0xa1000017
[24-27] 0xa1000018 0xa1000019 0xa100001a 0xa100001b
[28-31] 0xa100001c 0xa100001d 0xa100001e 0xa100001f
Job 2 src=0x82751000 dst=0x82753000
Sending:
[00-03] 0xa2000000 0xa2000001 0xa2000002 0xa2000003
[04-07] 0xa2000004 0xa2000005 0xa2000006 0xa2000007
[08-11] 0xa2000008 0xa2000009 0xa200000a 0xa200000b
[12-15] 0xa200000c 0xa200000d 0xa200000e 0xa200000f
[16-19] 0xa2000010 0xa2000011 0xa2000012 0xa2000013
[20-23] 0xa2000014 0xa2000015 0xa2000016 0xa2000017
[24-27] 0xa2000018 0xa2000019 0xa200001a 0xa200001b
[28-31] 0xa200001c 0xa200001d 0xa200001e 0xa200001f
Transfer running...
Transfer complete.
[5/5] Verifying 3 job results...
Job 0 received:
[00-03] 0x5fffffff 0x5ffffffe 0x5ffffffd 0x5ffffffc
[04-07] 0x5ffffffb 0x5ffffffa 0x5ffffff9 0x5ffffff8
[08-11] 0x5ffffff7 0x5ffffff6 0x5ffffff5 0x5ffffff4
[12-15] 0x5ffffff3 0x5ffffff2 0x5ffffff1 0x5ffffff0
[16-19] 0x5fffffef 0x5fffffee 0x5fffffed 0x5fffffec
[20-23] 0x5fffffeb 0x5fffffea 0x5fffffe9 0x5fffffe8
[24-27] 0x5fffffe7 0x5fffffe6 0x5fffffe5 0x5fffffe4
[28-31] 0x5fffffe3 0x5fffffe2 0x5fffffe1 0x5fffffe0
Job 0: PASS
Job 1 received:
[00-03] 0x5effffff 0x5efffffe 0x5efffffd 0x5efffffc
[04-07] 0x5efffffb 0x5efffffa 0x5efffff9 0x5efffff8
[08-11] 0x5efffff7 0x5efffff6 0x5efffff5 0x5efffff4
[12-15] 0x5efffff3 0x5efffff2 0x5efffff1 0x5efffff0
[16-19] 0x5effffef 0x5effffee 0x5effffed 0x5effffec
[20-23] 0x5effffeb 0x5effffea 0x5effffe9 0x5effffe8
[24-27] 0x5effffe7 0x5effffe6 0x5effffe5 0x5effffe4
[28-31] 0x5effffe3 0x5effffe2 0x5effffe1 0x5effffe0
Job 1: PASS
Job 2 received:
[00-03] 0x5dffffff 0x5dfffffe 0x5dfffffd 0x5dfffffc
[04-07] 0x5dfffffb 0x5dfffffa 0x5dfffff9 0x5dfffff8
[08-11] 0x5dfffff7 0x5dfffff6 0x5dfffff5 0x5dfffff4
[12-15] 0x5dfffff3 0x5dfffff2 0x5dfffff1 0x5dfffff0
[16-19] 0x5dffffef 0x5dffffee 0x5dffffed 0x5dffffec
[20-23] 0x5dffffeb 0x5dffffea 0x5dffffe9 0x5dffffe8
[24-27] 0x5dffffe7 0x5dffffe6 0x5dffffe5 0x5dffffe4
[28-31] 0x5dffffe3 0x5dffffe2 0x5dffffe1 0x5dffffe0
Job 2: PASS
========================================
Overall result: PASSED
========================================
========================================
CCA Throughput Benchmark - FreeRTOS
========================================
Benchmark 1: job_size=32 KB, n_jobs = 1 to 32
jobs= 1 job= 32 KiB xfer= 32 KiB avg= 0.034 ms 1916.02 MB/s 15328.1 Mbit/s
jobs= 2 job= 32 KiB xfer= 64 KiB avg= 0.033 ms 3897.04 MB/s 31176.3 Mbit/s
jobs= 4 job= 32 KiB xfer= 128 KiB avg= 0.064 ms 4048.16 MB/s 32385.3 Mbit/s
jobs= 8 job= 32 KiB xfer= 256 KiB avg= 0.118 ms 4416.67 MB/s 35333.3 Mbit/s
jobs=16 job= 32 KiB xfer= 512 KiB avg= 0.220 ms 4747.12 MB/s 37977.0 Mbit/s
jobs=32 job= 32 KiB xfer=1024 KiB avg= 0.451 ms 4648.88 MB/s 37191.0 Mbit/s
Benchmark 2: n_jobs=8, job_size = 4 to 96 KB
jobs= 8 job= 4 KiB xfer= 32 KiB avg= 0.046 ms 1417.33 MB/s 11338.7 Mbit/s
jobs= 8 job= 16 KiB xfer= 128 KiB avg= 0.080 ms 3240.85 MB/s 25926.8 Mbit/s
jobs= 8 job= 32 KiB xfer= 256 KiB avg= 0.118 ms 4415.09 MB/s 35320.7 Mbit/s
jobs= 8 job= 64 KiB xfer= 512 KiB avg= 0.186 ms 5619.39 MB/s 44955.1 Mbit/s
jobs= 8 job= 96 KiB xfer= 768 KiB avg= 0.273 ms 5759.71 MB/s 46077.6 Mbit/s
========================================
Benchmark complete.
========================================
Exercise Main Application + Coherency_test Task¶
Once the QSPI has been programmed with the cca_user_app.hps_coherence.jic file, you need perform the following steps to launch the application.
1. Power down board
2. Set MSEL dipswitch SW27 to ASX4 (QSPI): OFF-ON-ON-OFF
3. Power up the board
4. Observe in the Serial console the output that the application displays. Here you can see that TF-A starts booting after the power cycle, and later this launches the FreeRTOS application. The log shows that the 2nd Phase fabric design configuration and then the main CCA application and followed by the Coherency_test task.
NOTICE: DDR: Reset type is 'Power-On'
NOTICE: IOSSM: Calibration success status check...
NOTICE: IOSSM: All EMIF instances within the IO96 have calibrated successfully!
NOTICE: DDR: Calibration success
NOTICE: DDR: ECC is enabled
NOTICE: IOSSM: Memory initialized successfully on IO96B
NOTICE: ###DDR:init success###
NOTICE: DFI interface selected successfully to SDEMMC
NOTICE: SOCFPGA: QSPI boot
NOTICE: BL2: v2.14.0(release):
NOTICE: BL2: Built : 15:13:52, Nov 10 2026
NOTICE: BL2: Booting BL31
NOTICE: SOCFPGA: Boot Core = 0
NOTICE: SOCFPGA: CPU ID = 0
NOTICE: SOCFPGA: Setting CLUSTERECTRL_EL1
NOTICE: BL31: v2.14.0(release):
NOTICE: BL31: Built : 15:13:52, Nov 10 2026
========================================
CCA FreeRTOS App - Interrupt Mode
Cache Coherent Accelerator Example Usage
3-job chained transfer
========================================
[1/5] Loading FPGA bitstream from QSPI flash...
Bitstream size: 1769472 bytes
Bitstream data send successfully
Bitstream loaded successfully.
[2/5] Initialising CCA driver...
Driver ready.
[3/5] Allocating 3 jobs x 128 bytes...
[4/5] Submitting 3-job chain...
Job 0 src=0x82749000 dst=0x8274b000
Sending:
[00-03] 0xa0000000 0xa0000001 0xa0000002 0xa0000003
[04-07] 0xa0000004 0xa0000005 0xa0000006 0xa0000007
[08-11] 0xa0000008 0xa0000009 0xa000000a 0xa000000b
[12-15] 0xa000000c 0xa000000d 0xa000000e 0xa000000f
[16-19] 0xa0000010 0xa0000011 0xa0000012 0xa0000013
[20-23] 0xa0000014 0xa0000015 0xa0000016 0xa0000017
[24-27] 0xa0000018 0xa0000019 0xa000001a 0xa000001b
[28-31] 0xa000001c 0xa000001d 0xa000001e 0xa000001f
Job 1 src=0x8274d000 dst=0x8274f000
Sending:
[00-03] 0xa1000000 0xa1000001 0xa1000002 0xa1000003
[04-07] 0xa1000004 0xa1000005 0xa1000006 0xa1000007
[08-11] 0xa1000008 0xa1000009 0xa100000a 0xa100000b
[12-15] 0xa100000c 0xa100000d 0xa100000e 0xa100000f
[16-19] 0xa1000010 0xa1000011 0xa1000012 0xa1000013
[20-23] 0xa1000014 0xa1000015 0xa1000016 0xa1000017
[24-27] 0xa1000018 0xa1000019 0xa100001a 0xa100001b
[28-31] 0xa100001c 0xa100001d 0xa100001e 0xa100001f
Job 2 src=0x82751000 dst=0x82753000
Sending:
[00-03] 0xa2000000 0xa2000001 0xa2000002 0xa2000003
[04-07] 0xa2000004 0xa2000005 0xa2000006 0xa2000007
[08-11] 0xa2000008 0xa2000009 0xa200000a 0xa200000b
[12-15] 0xa200000c 0xa200000d 0xa200000e 0xa200000f
[16-19] 0xa2000010 0xa2000011 0xa2000012 0xa2000013
[20-23] 0xa2000014 0xa2000015 0xa2000016 0xa2000017
[24-27] 0xa2000018 0xa2000019 0xa200001a 0xa200001b
[28-31] 0xa200001c 0xa200001d 0xa200001e 0xa200001f
Transfer running...
Transfer complete.
[5/5] Verifying 3 job results...
Job 0 received:
[00-03] 0x5fffffff 0x5ffffffe 0x5ffffffd 0x5ffffffc
[04-07] 0x5ffffffb 0x5ffffffa 0x5ffffff9 0x5ffffff8
[08-11] 0x5ffffff7 0x5ffffff6 0x5ffffff5 0x5ffffff4
[12-15] 0x5ffffff3 0x5ffffff2 0x5ffffff1 0x5ffffff0
[16-19] 0x5fffffef 0x5fffffee 0x5fffffed 0x5fffffec
[20-23] 0x5fffffeb 0x5fffffea 0x5fffffe9 0x5fffffe8
[24-27] 0x5fffffe7 0x5fffffe6 0x5fffffe5 0x5fffffe4
[28-31] 0x5fffffe3 0x5fffffe2 0x5fffffe1 0x5fffffe0
Job 0: PASS
Job 1 received:
[00-03] 0x5effffff 0x5efffffe 0x5efffffd 0x5efffffc
[04-07] 0x5efffffb 0x5efffffa 0x5efffff9 0x5efffff8
[08-11] 0x5efffff7 0x5efffff6 0x5efffff5 0x5efffff4
[12-15] 0x5efffff3 0x5efffff2 0x5efffff1 0x5efffff0
[16-19] 0x5effffef 0x5effffee 0x5effffed 0x5effffec
[20-23] 0x5effffeb 0x5effffea 0x5effffe9 0x5effffe8
[24-27] 0x5effffe7 0x5effffe6 0x5effffe5 0x5effffe4
[28-31] 0x5effffe3 0x5effffe2 0x5effffe1 0x5effffe0
Job 1: PASS
Job 2 received:
[00-03] 0x5dffffff 0x5dfffffe 0x5dfffffd 0x5dfffffc
[04-07] 0x5dfffffb 0x5dfffffa 0x5dfffff9 0x5dfffff8
[08-11] 0x5dfffff7 0x5dfffff6 0x5dfffff5 0x5dfffff4
[12-15] 0x5dfffff3 0x5dfffff2 0x5dfffff1 0x5dfffff0
[16-19] 0x5dffffef 0x5dffffee 0x5dffffed 0x5dffffec
[20-23] 0x5dffffeb 0x5dffffea 0x5dffffe9 0x5dffffe8
[24-27] 0x5dffffe7 0x5dffffe6 0x5dffffe5 0x5dffffe4
[28-31] 0x5dffffe3 0x5dffffe2 0x5dffffe1 0x5dffffe0
Job 2: PASS
========================================
Overall result: PASSED
========================================
========================================
CCA Cache Coherency Verification
========================================
Verifying pre-transfer setup state...
setup: Source DRAM has PATTERN_3 (0x3333xxxx)
setup: Source DRAM still has PATTERN_3 after cache write
setup: Source cache has PATTERN_A (0xAAAAxxxx)
setup: Destination DRAM has PATTERN_5 (0x5555xxxx)
setup: Destination DRAM still has PATTERN_5 after cache write
setup: Destination cache has PATTERN_C (0xCCCCxxxx)
Pre-transfer state confirmed:
src cache (expect PATTERN_A = 0xAAAAxxxx):
[00-03] 0xaaaa0000 0xaaaa0001 0xaaaa0002 0xaaaa0003
[04-07] 0xaaaa0004 0xaaaa0005 0xaaaa0006 0xaaaa0007
dst cache (expect PATTERN_C = 0xCCCCxxxx):
[00-03] 0xcccc0000 0xcccc0001 0xcccc0002 0xcccc0003
[04-07] 0xcccc0004 0xcccc0005 0xcccc0006 0xcccc0007
Submitting coherent DMA transfer (src -> dst)...
dst after transfer (expect PATTERN_A = 0xAAAAxxxx):
[00-03] 0xaaaa0000 0xaaaa0001 0xaaaa0002 0xaaaa0003
[04-07] 0xaaaa0004 0xaaaa0005 0xaaaa0006 0xaaaa0007
========================================
Cache coherency: PASSED
========================================
Notices & Disclaimers¶
Altera® Corporation technologies may require enabled hardware, software or service activation. No product or component can be absolutely secure. Performance varies by use, configuration and other factors. Your costs and results may vary. You may not use or facilitate the use of this document in connection with any infringement or other legal analysis concerning Altera or Intel products described herein. You agree to grant Altera Corporation a non-exclusive, royalty-free license to any patent claim thereafter drafted which includes subject matter disclosed herein. No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document, with the sole exception that you may publish an unmodified copy. You may create software implementations based on this document and in compliance with the foregoing that are intended to execute on the Altera or Intel product(s) referenced in this document. No rights are granted to create modifications or derivatives of this document. The products described may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Altera disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade. You are responsible for safety of the overall system, including compliance with applicable safety-related requirements or standards. © Altera Corporation. Altera, the Altera logo, and other Altera marks are trademarks of Altera Corporation. Other names and brands may be claimed as the property of others.
OpenCL* and the OpenCL* logo are trademarks of Apple Inc. used by permission of the Khronos Group™.