Benchmarking MicroBlaze

2012-04-23Publicerad 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.


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. Read more here.

Downloading CoreMark

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

Adopting to the MicroBlaze platform

We will create a new C-project (CoreMark1) and copy the CoreMark source files to the SDK project source directory in our MicroBlaze setup. Here is screenshot showing the software setup.

The core_portme.c and core_portme.h  files are modified to match the MicroBlaze hardware and software requirements and the mb_hal.c file is added.  The file ee_printf.c is used as a replacement for printf.

Here is the project SDK setup.


Generate linker script

We will put all the program code in the DDR3 memory (SDRAM).



Configure the FPGA

The board was powered down during the weekend. We need to configure the FPGA again.



Compiling and building the benchmark

Before compiling our program we need to modifiy the compiler settings. First add the following in the Symbols setting window: ITERATIONS=8000

Then set the Optimization level to -O3 and add <-funroll-all-loops> in the field: Other optimization flags.


Compile and build the project (Project->Build Project).

MicroBlaze compiler options

For more information about gcc compiler options study the Embedded System Tools Reference Manual.

Setup a terminal

Start gtkterm and setup the port configuration.

gtkterm &

Running the benchmark

Right-click the CoreMark entry in the Project Explorer and select <Run As -> Run Configuration> and create a new Xilinx C/C++ELF configuration. Select the port and set the baud rate to 115 200. Click RUN to load and run the program.



Benchmark conditions

Here is a table showing the hardware and software setup.

Condition Value
Development board Xilinx SP-605 Development Board
FPGA Spartan-6 XC6SLX45T-3FGG484
MicroBlaze version 8.20b
Processor clock 100 MHz
AXI bus clock 100 MHz
GCC compiler mb-gcc 4.1.2
Instruction cache 32 KB
Data cache 32 KB
Hardware multiply Yes
Hardware divide Yes
Floating point Yes

Benchmark results

Here is the print out from the CoreMark program on the console.


The CoreMark value is calculated by dividing the number of iterations/sec with the processor clock speed: 190/100=1.9 The table shows the CoreMark values for different compiler options. The -O3 compiler options seems to override all other options.

Compiler Option -O2 -O3
No extra 1.66 1.9
-funroll-loops 1.81 1.9
-funroll-all-loops 1.81 1.9
fgcse-sm 1.66 1.9
All 1.81 1.9