Codasip指令及拓展白皮书

1 minute read

Published:

Codasip公司专注于RV的定制化指令及拓展,以下是该公司白皮书介绍,原文链接

传统的指令集拓展

  • First, you need to identify the instructions.
  • Then you need to add them into the C compiler, simulators, debuggers and other tools, and verify that the changes add the same thing to all these different tools.

  • Adding a custom instruction usually requires some manual effort, too. Typically, you need a team who will add the new instructions into the SDK so that the programming tools can pass and compile the instructions. You also need to add new code to the instruction setsimulator.

  • Finally, RTL must be extended, and any changes to the RTL must be verified.

  • Depending on the amount of manual effort, ISA extensions can be rather expensive in terms of time and resources.

内联函数裤实现拓展

Custom instructions differ by complexity. This, among other things, influences the capabilities of the C compiler and the performance of the resultant processor. Simple instructions may be used by the C compiler without having to alter the original C code. In other words, you can have one app, and you can compile it for x86 or RISC-V. If the instruction is too complex, the only way to use it is inline assembly or C intrinsic. The limit is around ~25 operations and ~3 outputs. On the other hand, more complex instructions usually improve performance, so the result is worth the effort.

  • 拓展的指令集复杂度不同,这会影响C编译器的功能和生成的处理器的性能。简单指令可以由C编译器使用,而无需更改原始C代码。换句话说,你可以有一个应用程序,你可以为x86或RISC-V编译它。如果指令太复杂,使用它的唯一方法是内联汇编或C内在函数。极限约为25次操作和3次输出。另一方面,更复杂的指令通常会提高性能,因此结果是值得努力的。

There is an easy way to integrate the inline assembly or intrinsic into a library. The library has a generic implementation as well. Each target may use a different implementation.

  • 有一种简单的方法可以将内联程序集或内部程序集集成到库中。这个库也有一个通用的实现。如果处理器满足特定的宏(支持指令集拓展)就用特殊的指令实现。