fpga.love
中文 App
Home / Projects / CVE2 EP02 case
Reproduction · OpenHW on ALINX · Episode 03

CVE2 Board-Control Core: Replacing MicroBlaze While Keeping the Factory ACM Protocol

Episode 01 lit the LED, Episode 02 exercised traps and interrupts. Episode 03 puts CVE2 in charge of the board-control plane: LEDs, KEYs, QSPI Flash, I²C EEPROM, the TF card and a 500 ms watchdog, while keeping the factory ACM:* serial protocol unchanged. On-board log: FLASH / EEPROM / SD all ok.

Verified on board · 2026-11-20 CVE2 / RV32IM 50 MHz Vivado 2025.2 Episode 03 / 12

This episode replaces the control core, not the whole factory test. The factory project used a MicroBlaze to run the ACM protocol; EP03 implements the same command surface with CVE2 plus plain RTL peripherals. DDR3, ETH1, MIPI, ADC and HDMI_IN are not integrated here, and ACM:Auto honestly returns wait for them instead of pretending they are covered.

BOARDALINX PI-AR035-F1-1Engineering board, not yet in the board selector; link will be added when listed
CHIPAMD Artix-7 · XC7A35TSee chip specs and related boards → PROJECTOpenHW CVE2 / CV32E20Upstream repository and commit →
Board
ALINX PI-AR035-F1-1
Control plane
8 Auto items + GPIO + WDT
Serial protocol
ACM:* / ACS:* · 115200 8N1
Flash
GD25Q128E · C8 40 18
Watchdog
500 ms @ 50 MHz
Bitstream
2,192,137 B

1. Results

After programming the bitstream over JTAG, the complete boot log is shown below. ACM:Test=WDT then triggers a watchdog reset, the board prints BOOT CAUSE=WDT, and each ACM:Auto item is queried:

ALINX AR035 CVE2 Board Control EP03
BOOT CAUSE=WDT
CFG=000003c7
FLASH ID=00c84018 OK
EEPROM DATA=000000b2 ACK
SD R1=00000001 OK
LED TEST=PASS
KEY1=0 KEY2=0
READY

ACS:Auto=FLASH,result=ok
ACS:Auto=EEPROM,result=ok
ACS:Auto=SD,result=ok

CFG=000003c7 is debug telemetry: bit0 cfg_ready=1, bit1 EOS=1, bit2 MISO=1; the upper 16 bits count SCLK rising edges for this probe (0x3c7 >> 3 = 120 edges), proving that the STARTUPE2 CCLK really reaches the Flash.

2. Test matrix

CategoryTestExpectedMeasuredResult
FlashQSPI JEDEC ID 9FC8 40 1800c84018ok
EEPROMI²C 7-bit address 0x50, read address 0ACK + 1 byte0xB2 ACKok
TF cardSPI CMD0, R1 response0x01 idle0x01ok
LEDLED1–LED8 walkVisible walkLED TEST=PASSpass
KEYRead KEY1/KEY2Released = 0KEY1=0 KEY2=0readable
WatchdogArm, then stop kickingReset after 500 msBOOT CAUSE=WDTpass
DDR3 / ETH1 / MIPI / ADC / HDMI_INACM:AutoNot covered hereresult=waithonest

KEY verification only covers the released state. Pressing a key and the 20 ms debounce counter are left for a later episode.

3. Control-core structure

50 MHz oscillatorY18
→
CVE2 coreRV32IM / OBI
→
16 KiB instruction RAM0x0000_0000
16 KiB data RAM0x0000_0000
→
UART0x1000_0000 / L5
WDT0x3000_0000
GPIO / LED / KEY0x4000_0000–0x4002_0000

GPIO outputs drive the off-chip devices directly; inputs are synchronized through two flip-flops before reaching the CPU. The Flash SCLK does not come from a normal pin: it uses STARTUPE2's USRCCLKO, so CCLK can continue as the QSPI clock after configuration.

AddressPeripheralNotes
0x1000_0000UART+0 TX, +4 status, +8 RX; 16-byte RX FIFO
0x3000_0000WDT+0 arm/disarm, +4 kick, +8 cause, +C status
0x4000_0000LED8 bits, logic 1 = on
0x4001_0000KEY[1:0] currently pressed, [3:2] sticky seen
0x4002_0000GPIO+0 output, +4 input
0x4003_0000DBGcfg_ready / EOS / MISO / SCLK count

4. ACM protocol mapping

The protocol text matches the factory firmware; CVE2 only replaces the execution side. The host tool does not need to change its command format:

CommandCVE2 behaviorResponse
ACM:SupportLists 8 Auto items, KEY1/2, LED1–8, Test=LED/WDTACS:Support,...
ACM:AutoRuns FLASH/EEPROM/SD; others return waitACS:Auto=NAME,result=ok/wait/err
ACM:Auto=FLASHReads JEDEC ID and compares with C8 40 18result=ok
ACM:Auto=EEPROMI²C read at address 0, requires ACKresult=ok
ACM:Auto=SDSPI CMD0, R1=0x01result=ok
ACM:GpioInReads KEY1/KEY2 and sticky seenstatus=on/off
ACM:GpioOut=LEDn,set=on/offWrites the LED registerACS:GpioOut=ok
ACM:Test=WDTArms the watchdog, then spins until resetBOOT CAUSE=WDT after reset

5. Utilization and timing

ItemValueUtilization
Slice LUTs3,41316.41%
Slice Registers2,6776.44%
Block RAM Tile816.00%
DSPs1112.22%
Bonded IOB2510.00%
WNS / WHS1.617 ns / 0.039 nsTNS / THS = 0, 0 failing endpoints

WHS is re-signoff with set_clock_uncertainty -hold 0.100. The earlier 0.150 constraint reported a false -0.002 ns violation; the routed checkpoint has positive physical margin at 0.100 with 0 failing endpoints. Bitstream: top_cve2_ep03.bit, 2,192,137 bytes, SHA-256 aca201c01d74591e6226124473d45cce9473ef7d2872a8ea1f8539fe1edec5b7.

Compared with EP02, this design adds 118 LUTs, 123 FFs and 21 IOBs, mainly from the bit-banged QSPI/I²C/SD GPIO, the WDT and debug telemetry. BRAM and DSP counts are unchanged.

6. Pitfalls

7. Reproduction

  1. Install Vivado 2025.2 and riscv-nuclei-elf-gcc (GCC 10.2).
  2. Build firmware: cd sw && make clean && make, confirm firmware.hex is updated.
  3. Confirm top_cve2_ep03.sv's INIT_FILE points to EP03's sw/firmware.hex.
  4. Synthesize and implement: vivado -mode batch -source build_ep03.tcl.
  5. Start the 2025.2 hw_server on 3122 and program: vivado -mode batch -source program_ep03.tcl.
  6. Serial: stty -F /dev/ttyUSB1 115200 cs8 -cstopb -parenb raw -echo; timeout 20 cat /dev/ttyUSB1.
cd sw && make clean && make
cd ..
/media/alinx/nvme4t/Xilinx/2025.2/Vivado/bin/vivado -mode batch -source build_ep03.tcl
/media/alinx/nvme4t/Xilinx/2025.2/Vivado/bin/vivado -mode batch -source program_ep03.tcl
stty -F /dev/ttyUSB1 115200 cs8 -cstopb -parenb raw -echo
timeout 20 cat /dev/ttyUSB1

8. Project files

The files below come directly from the verified project and can be downloaded for inspection. The complete upstream CVE2 source is in the OpenHW repository.

This episode verifies the board-control plane: Flash ID, EEPROM ACK, TF card CMD0, LED walk, WDT reset and KEY readability. Not verified: KEY press/debounce, SD block reads/writes, Flash erase/program, DDR3/ETH1/MIPI/ADC/HDMI_IN, or a command-by-command performance comparison against MicroBlaze and the factory firmware.

9. Related

Subscribe to fpga.love

Daily Briefing · Weekly Digest · Monthly Deep Dive