That Killer RISC-V Toolchain by Terapines is coming: Up to 90% code size reduction, 64% performance improvements

The first generation of RISC-V toolchain by Terapines Technology have emerged, including RISC-V elf/linux toolchains, newlib, glibc and c++ libraries, high performance libml DSP library, zdb(debugger), zemu(simulator), zchecker for ISO 26262 MISRA C, etc. We will go through the detailed test report to demonstrate how advantage our RISC-V is against open source toolchains.

The first generation of Terapines ‘s RISC-V Toolchain has been greatly optimized in code size and code performance, as code size is the most concern in MCU Market.

1.DSP library

CMSIS DSP library of ARM is widely used in the industry, but some algorithms in the CMSIS DSP library have great room for improvement. Terapines now provide the libml DSP library (algorithm version), which fulfills the code size of transformation class 90% to 50% smaller as well as much less error than that of the CMSIS DSP library while outperforming the CMSIS DSP library.

Code size comparison (left – CMSIS DSP, right – Terapines libml DSP)
Algorithm version performance comparison (left-CMSIS DSP, right- Terapines libml DSP)
Cumulative error (Left-CMSIS DSP, Right- Terapines libml DSP)
90% smaller code size (without stdio library function) (left-CMSIS DSP, right- Terapines libml DSP)
50% smaller code size (with stdio library function) (Left-CMSIS DSP, Right- Terapines libml DSP)

2. zcc C/C++ Compiler

The coremark compiled by zcc scores 3.78 on the N300 development board of Nuclei System Technology, which is 64% higher than the llvm 11.0 and 11.4% higher than the RISC-V gcc 11.1.

GCC 11.1 scores 3.32 CoreMark/MHz on N300
zcc scores 3.78 CoreMark/MHz on N300
llvm 11 scores 2.23 CoreMark/MHz on N300

The embench-IoT test results show that zcc is on average about 33% code size smaller than gcc 11.1 with comparable performance. And its advantage is even more obvious in the polybench tests, with code size about 38% smaller than gcc 11.1 on average. All these test data were obtained under consistent objective conditions: both gcc and zcc used the standard version of the newlib nano library with Os and LTO optimizations enabled, and the test target was RV32IMAC.

Embench-IoT code size and performance comparison, zcc is about 33% smaller than gcc 11.1 on average
Polybench code size and performance comparison, zcc is about 38% smaller than gcc on average

The automatic vectorization of zcc for RVV is also progressing quite well, with a preview release expected in Q1 2022.The following figure shows the comparison of code performance of EPI (European Supercomputing Center compiler project) and zcc, please refer to the article “RISC-V Vector auto-vectorization and implementation in llvm《RISC-V Vector自动向量化及llvm当中的实现》for the detailed comparison.

In addition to the achievement above, Terapines will release a compiler with complete RVV auto-vectorization support, and a libml DSP library optimized for RISC-V P extensions in the next version, which will have a very significant code size and performance improvement over the algorithmic version.

3.Debugger and Simulator

Zstudio has perfectly integrated zdb and zemu, the following figure shows an example of debugging RISC-V program using zdb connected to zemu. In addition to functional simulation for ISA at the ISS level, zemu also supports fast modeling and simulation at the SoC level, as well as near cycle accurate simulation.

debugging RISC-V program using zdb and zemu

4.zchecker for ISO 26262

ISO26262 is an international standard for functional safety of electrical and electronic systems that are installed in serial production road vehicles (excluding mopeds). In addition to the hardware design and manufacturing engineering, the ISO26262 also define the standard of the applications executed on the chip.

The first version of zchecker, the automotive functional safety inspection tool, released by Terapines, includes 143 safety rules of MSRA C 2012, as well as the 23 new safety rules in MISRA C 2012 amendment 1 and 2. MISRA C++ 202x safety specifications will be supported in later versions.

zhecker running MISRA C 2012 checks
Detailed non-compliant rules and source code location in zchecker

5.Other features

Besides supporting syntax highlighting for various programming languages, IntelliSense code completion, git version control, disassembly, control flow graph analysis, FlameGraph for performance analysis, etc., zstudio IDE also supports rich VS Code plugins.

Disassembler in Zstudio
Control flow graph of assembly code in zstudio

6.The future is promising

We are in the process of deploying a cloud-based IDE SaaS platform, which is expected to be launched in the spring of 2022 and will be free and open to all universities and non-commercial users at that time. Also, zstudio for Mac OS will be available this spring.

Preview of Terapines Cloud Platform