Verified case · OpenHW on ALINX · Episode 05

Performance baseline: CoreMark 105.4 iter/s, CPI 1.56, -O2 vs -Os

Episode 05 moves CVE2 from “it boots” to “it is measurable”: instruction and data RAM are each expanded to 64 KiB, EEMBC CoreMark 2K is ported, and architectural mcycle/minstret provide cycle and retired-instruction counts. The same RTL is turned into two bitstreams, -O2 and -Os, and each is run on the board for CoreMark, CPI and four microbenchmarks.

Verified on board · 2026-11-20 CVE2 / RV32IM 50 MHz CoreMark 2K · 50 iter Episode 05 / 12

Scope first. These numbers are valid only for “CVE2 + 64 KiB BRAM, no cache, no DDR, 50 MHz, GCC 10.2, rv32im”. Do not compare them directly with cores that have I/D caches, DDR or a higher clock. The CoreMark CRC fields match the official run, so this is the standard workload, not a modified loop.

BoardALINX PI-AR035-F1-1Engineering board, not yet in the board selector; link will be added when listed
SiliconAMD Artix-7 · XC7A35TDevice data and sister boards → ProjectOpenHW CVE2 / CV32E20Upstream repository and commit →
CoreMark (-O2)
105.377 iter/s
CoreMark/MHz
2.108 / 1.608
CoreMark (-Os)
80.422 iter/s
-O2 vs -Os
1.310× · +31.0%
CPI
1.561 / 1.625
RAM
64 KiB I + 64 KiB D
BRAM
32 / 50 · 64.0%
Timing
WNS 1.239 / WHS 0.053 ns

1. Board results

Both bitstreams were downloaded over JTAG and captured from the UART. First the -O2 build:

ALINX AR035 CVE2 Performance EP05
VARIANT=O2 CLK=50000000 BUILD=Nov 20 2026 20:42:57
COUNTER_A lo=003864a2 hi=00000000
COUNTER_B lo=00492d89 hi=00000000
BENCH O2 CRC32 cycles=319508 inst=249876 sink=5e4e1995
BENCH O2 MEMCPY cycles=622677 inst=348277 sink=0007b000
BENCH O2 MATMUL16 cycles=56258 inst=31645 sink=08328000
BENCH O2 SIEVE cycles=103785 inst=65835 sink=00000234
BENCH OS CRC32 cycles=331798 inst=258068 sink=5e4e1995
BENCH OS MEMCPY cycles=696534 inst=417940 sink=0007b000
BENCH OS MATMUL16 cycles=61190 inst=36030 sink=08328000
BENCH OS SIEVE cycles=124426 inst=71638 sink=00000234
COREMARK_BEGIN variant=O2 iterations=50
CoreMark Size    : 666
Total ticks      : 23724157
Total time (secs): 0.474
Iterations/Sec   : 105.377
Iterations       : 50
Compiler version : GCC 10.2.0 (riscv-nuclei-elf)
Compiler flags   : -O2 -march=rv32im -mabi=ilp32
Memory location  : STATIC-64K
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0x0158
Correct operation validated. See README.md for run and reporting rules.
COREMARK_SUMMARY variant=O2 cycles_lo=25909314 cycles_hi=0 inst_lo=16589935 inst_hi=0 cpi_milli=1561 score_milli=96490
EP05 DONE variant=O2

The -Os run differs in the key fields:

VARIANT=Os CLK=50000000 BUILD=Nov 20 2026 20:42:58
Total ticks      : 31085723
Total time (secs): 0.621
Iterations/Sec   : 80.422
Compiler flags   : -Os -march=rv32im -mabi=ilp32
COREMARK_SUMMARY variant=Os cycles_lo=33273071 cycles_hi=0 inst_lo=20469510 inst_hi=0 cpi_milli=1625 score_milli=75135
EP05 DONE variant=Os

A second download of the O2 build produced exactly the same Total ticks=23724157, Iterations/Sec=105.377 and the same cycle/instruction counts for all four microbenchmarks. The five CoreMark CRC fields (seedcrc, crclist, crcmatrix, crcstate, crcfinal) are identical in both builds.

2. CoreMark score and optimisation level

Metric-O2-OsDifference
CoreMark iterations5050same
Total ticks (mcycle)23,724,15731,085,723-Os +31.0%
Measured time0.474 s0.621 s-Os +31.0%
CoreMark score105.377 iter/s80.422 iter/sO2 is 1.310× Os
CoreMark/MHz2.1081.608+31.0%
Whole-run CPI1.5611.625-Os +4.1%
.text size20,448 B17,876 B-Os 12.6% smaller
CRC validationall matchall matchCorrect operation validated

The official CoreMark score uses Total ticks and Iterations/Sec. The “whole-run CPI” column also includes CoreMark calibration, setup and reporting, so it is not the same scope as the microbenchmark CPI. Both are kept to avoid presenting one number as the whole story.

3. Microbenchmarks at two optimisation levels

One bench.c exports two symbol sets through BENCH_PREFIX, compiled at -O2 and -Os and linked into the same firmware. A single boot therefore compares both on the same core, same RAM and same temperature, removing run-to-run environment differences.

Workload-O2 cycles-O2 inst-O2 CPI-Os cycles-Os inst-Os CPICycle delta
CRC32 · 4,096 B319,508249,8761.279331,833258,0891.286+3.9%
memcpy · 4,096 B ×16622,677348,2771.788696,569417,9621.667+11.9%
16×16 matmul56,25831,6451.77861,22536,0521.698+8.8%
sieve · 4,096103,78565,8351.576124,46171,6601.737+19.9%

-Os is not uniformly worse in CPI. The -Os memcpy and matmul have lower CPI, but retire 20.0% and 13.9% more instructions, so they still take 11.9% and 8.8% more cycles. Sieve is the worst case: both CPI and instruction count rise, for +19.9% cycles. Code size and execution speed are independent curves; neither CPI alone nor .text size alone tells the story.

4. Counters and CPI method

COUNTER_A lo=003864a2 hi=00000000
COUNTER_B lo=00492d89 hi=00000000
delta = 0x00492d89 - 0x003864a2 = 1,117,927 cycles
delay loop of 100,000 iterations → ~11.18 cycles/iteration (loop overhead included)

These two lines are the boot-time counter check: between A and B firmware only runs delay(100000), and the cycle delta is 1,117,927. That proves mcycle is actually advancing at 50 MHz rather than returning a stuck register.

5. The resource cost of 64 KiB dual RAM

ItemEP04EP05Change
Instruction / data RAM16 KiB + 16 KiB64 KiB + 64 KiB4× each
Slice LUTs4,1034,266+163
Slice Registers3,5593,687+128
Block RAM Tile832+24 (64.0% used)
DSPs1111unchanged
Bonded IOB2525unchanged
WNS / WHS1.285 / 0.052 ns1.239 / 0.053 ns0 failing endpoints

XC7A35T has only 50 BRAM36 tiles. Two 64 KiB 32-bit RAMs consume 32 of them, 64% of the device. This is the largest resource cost of the episode and a constraint for later episodes: moving to DDR3 or larger working sets cannot keep relying on BRAM. Both bitstreams are 2,192,137 B. O2 SHA-256 571e1c2df4a6275755cb39e419b6a97f09004eacb3d335ad53f8b8bb52d73b88; Os SHA-256 689ff3e18f333f47117296ca84164a04b773ace2bf5ab5b918c81fd22d63cc1d.

6. Pitfalls

7. Reproduce

  1. Install Vivado 2025.2, riscv-nuclei-elf-gcc (GCC 10.2), JTAG and a USB UART cable.
  2. Build both firmwares: cd sw && make clean && make; confirm firmware_o2.hex and firmware_os.hex are both 16,384 words.
  3. Build O2: EP05_VARIANT=o2 vivado -mode batch -source build_ep05.tcl; then Os with EP05_VARIANT=os.
  4. Run hw_server on 3122 and download each: EP05_VARIANT=o2 vivado -mode batch -source program_ep05.tcl, then os.
  5. Start serial capture before programming and drain 0.8–1 s, so stale bytes from the previous bitstream are not mistaken for the new log.
cd sw && make clean && make
cd ..
EP05_VARIANT=o2 /media/alinx/nvme4t/Xilinx/2025.2/Vivado/bin/vivado -mode batch -source build_ep05.tcl
EP05_VARIANT=os /media/alinx/nvme4t/Xilinx/2025.2/Vivado/bin/vivado -mode batch -source build_ep05.tcl
EP05_VARIANT=o2 /media/alinx/nvme4t/Xilinx/2025.2/Vivado/bin/vivado -mode batch -source program_ep05.tcl
python3 cap_serial.py 20 /tmp/ep05_o2.bin   # start before programming

8. Project files

These files come directly from the verified project. CoreMark upstream source is included under the EEMBC licence; the canonical repositories are OpenHW and EEMBC.

This episode verifies the CoreMark CRC fields, the two optimisation-level scores, four on-chip microbenchmarks and the 64 KiB BRAM configuration. It does not verify CoreMark with I/D cache or DDR3, other compiler versions, temperature/voltage corners, multi-threaded CoreMark, or a fair cross-core comparison.

9. Related

Subscribe to fpga.love

Daily Briefing · Weekly Digest · Monthly Deep Dive