Benchmarking Nios II

2012-04-11Publicerad av Sven-Åke Andersson


In computing, a benchmark is the act of running a computer program, a set of programs, or other operations, in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it. The term 'benchmark' is also mostly utilized for the purposes of elaborately-designed benchmarking programs themselves.

Benchmarking is usually associated with assessing performance characteristics of computer hardware, for example, the floating point operation performance of a CPU, but there are circumstances when the technique is also applicable to software. Software benchmarks are, for example, run against compilers or database management systems.

CPU core benchmarking

Although it doesn’t reflect how you would use a processor in a real application, sometimes it’s important to isolate the CPU’s core from the other elements of the processor and focus on one key element. For example, you might want to have the ability to ignore memory and I/O effects and focus primarily on the pipeline operation. This is CoreMark’s domain. CoreMark is capable of testing a processor’s basic pipeline structure, as well as the ability to test basic read/write operations, integer operations, and control operations. Read more.


CoreMark is a benchmark that aims to measure the performance of central processing units (CPU) used in embedded systems. It was developed in 2009 by Shay Gal-On at EEMBC and is intended to become an industry standard, replacing the antiquated Dhrystone benchmark. The code is written in C code and contains implementations of the following algorithms: list processing (find and sort), Matrix (mathematics) manipulation (common matrix operations), state machine (determine if an input stream contains valid numbers), and CRC.

Downloading CoreMark

For information on how to download the benchmark see: Benchmarking LEON3.

Adopting to Nios II platform

The CoreMark program suite can be used as is. We will setup a new project in Eclipse called CoreMark1 and import all the source files. We will use the pre-built linux_cpu design from an earlier example.

Here are all the files that make up the benchmark.


Use the F5 key to import the files to the Eclipse database.

Add number of iterations

We will add these lines in the file core_portme.h to define the number of iterations to run.


 Defining Nios II application properties

To get good benchmark figures we will disable all debugging and set the optimization level to O3.



Compile and build the project

To build the project right-click the CoreMark1 entry in the Project Explorer and select Build project.



Load and run the benchmark

Right-click the Coremark1 entry in the Project Explorer and select Run As->Run Configuration. Select the CoreMark1.elf file and click Run.

Benchmark conditions


Condition Value
Development board Cyclone III FPGA Development Board 
FPGA Altera Cyclone III EP3C120F780C7
Processor clock 125 MHz
Instruction cache 32 KB
Data cache 32 KB
Hardware multiply Yes
Hardware divide Yes
Floating point No


Benchmark results

Here is a printout from the benchmark program on the Nios II console:


This gives a CoreMark value of 214.88/125 = 1.72/MHz. We will try to improve this value by adding some compiler options, compile the program and rerun the test.

Compiler Option -O2 -O3
No extra 1.48 1.72
-fgcse-sm 1.48 1.72
-funroll-loops 1.68 1.88
-funroll-all-loops 1.72 1.93