Running 32-bit Linux on FPGAs with RISC-V Out-of-Order Core

linux-litex-naxriscv32

We have successfully created gatewares for SoC of NaxRiscv, a RISC-V Out-of-Order core, for Digilent FPGA boards and run 32-bit Linux.

Click here for NaxRiscv related articles.

LiteX-NaxRiscv

NaxRiscv is an out-of-order execution superscalar RISC-V core. NaxRiscv is integrated into LiteX, an SoC builder.

As introduced in the previous article, NaxRiscv supports 32-bit and 64-bit RISC-V.

We have created 32-bit NaxRiscv SoC gatewares for the Digilent FPGA boards, an Arty A7-35T and a Nexys Video.

Linux on LiteX-NaxRiscv

LiteX-NaxRiscv does not have a repository to build the operating environment of Linux like Linux on LiteX-VexRiscv.
For 32-bit NaxRiscv, you can run Linux using the Linux on LiteX-VexRiscv deliverables.

However, you will have to adapt the dts/dtb to your SoC.

Running Benchmarks on Hardware

We loaded the SoC gateware on the FPGA board and ran the benchmarks CoreMark and Dhrystone.

CoreMark

The following shows the console output when running CoreMark built with the -O3 option.

root@buildroot:~# coremark_o3
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 14985
Total time (secs): 14.985000
Iterations/Sec   : 400.400400
Iterations       : 6000
Compiler version : GCC10.3.0
Compiler flags   : -O3   -lrt
Memory location  : Please put data memory location here
			(e.g. code in flash, data on heap etc)
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0xa14c
Correct operation validated. See readme.txt for run and reporting rules.
CoreMark 1.0 : 400.400400 / GCC10.3.0 -O3   -lrt / Heap

For the -O3 option, the CoreMark score ranges from 392 to 401.
Since the operating frequency is 100MHz, CoreMark/MHz is 3.92 to 4.01.
The CoreMark/MHz of our NaxRiscv simulator is 4.70, so there is a slight difference.
In the case of the -O2 option, which is the default configuration of buildroot, the CoreMark score ranges from 366 to 368.

Dhrystone

The following shows the console output when running Dhrystone built with the -O3 option.

root@buildroot:~# dhrystone_o3 1000000

Dhrystone Benchmark, Version 2.1 (Language: C)

Program compiled without 'register' attribute

Execution starts, 1000000 runs through Dhrystone
Execution ends

...

Microseconds for one run through Dhrystone:    2.5 
Dhrystones per Second:                      403225.8 

For the -O3 option, the Dhrystone score ranges from 371,747 to 403,225.
DMIPS and DMIPS/MHz are 211 to 229 and 2.11 to 2.29, respectively.
The DMIPS/MHz of our NaxRiscv simulator is 2.60, so there is a slight difference.
Note that the Dhrystone score ranges from 198,807 to 202,429 for the -O2 option, which is the default configuration for buildroot.

Summary

We have successfully created NaxRiscv SoC gatewares for Digilent FPGA boards using LiteX-NaxRiscv and run 32-bit Linux.