Just to do a quick and dirty comparison of several popular ISAs, I compiled a simple C application that calculates primes using the Sieve of Eratosthenes using the following command:

gcc -O2 -c -o prime.o prime.c

Then, I compared the output binaries just on memory size using the ELF size command. I used the ARM and THUMB outputs as a benchmark for comparison.

$ size prime.arm
   text    data     bss     dec     hex filename
    244       0       0     244      f4 prime.arm

$ size prime.mb
   text    data     bss     dec     hex filename
    316       0       0     316     13c prime.mb

$ size prime.riscv 
   text    data     bss     dec     hex filename
    324       0       0     324     144 prime.riscv

$ size prime.thumb
   text    data     bss     dec     hex filename
    140       0       0     140      8c prime.thumb

$ size prime.msp 
   text    data     bss     dec     hex filename
    134       0       0     134      86 prime.msp

As we can see from the output of the simple programme, the ARM instruction set is truly compact as it uses only 244 bytes of instruction memory to do the work while the THUMB instruction uses only 140 bytes. Nice!

However, our focus was on the RISC-V which shows that it uses the most instruction memory. However, it is not very different from the existing Microblaze result. Therefore, it is a viable alternative ISA for the processor.

What would be more interesting would be to pit the future RISC-V 16-bit extensions against the THUMB and MSP to see how it performs.

Notes: A more robust comparison would include practical code from various software such as various RTOS etc. However, that is beyond the scope at the moment. Also, although code size is a simple metric for comparison, it is not an indicator of speed.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.