Read CEO Ron Black’s ‘An open letter regarding Cyber Resilience of the UK’s Critical National Infrastructure’


Custom instructions

What is a custom instruction?

A custom instruction is a machine instruction that is not part of the standard set of instructions of an instruction set architecture (ISA).

Typically it is specifically designed for the needs of a particular application or domain.

Implementing custom instructions usually requires modifications to the processor’s microarchitecture, as well as support from the software toolchain and programming languages to recognize and use these instructions. The availability and support for custom instructions depend on the specific processor architecture and the tools and development ecosystem associated with it.

The RISC-V instruction set architecture (ISA) is designed with extensibility in mind, allowing for the inclusion of custom instructions. One of the key features of RISC-V is its modular design, which enables the addition of custom instructions without modifying the base instruction set. The RISC-V ISA defines a base instruction set, referred to as the “RV32I” or “RV64I,” which provides a minimal set of instructions to ensure basic functionality. This base instruction set is intentionally kept small and simple to enable easy porting and implementation.

In addition to the base instruction set, RISC-V introduces a modular extension framework. This framework allows designers to add custom extensions to the base ISA, including custom instructions tailored to specific applications or domains. These custom extensions can range from specialized arithmetic operations to domain-specific instructions that accelerate certain tasks.

Codasip glossary - image for RISC-V architecture

See our blog post on RISC-V customization, HW/SW co-optimization, and custom compute.

Why custom instructions?

Custom instructions are typically created to enhance the performance or efficiency of certain tasks that are frequently performed in a particular application domain. By incorporating custom instructions, specialized hardware or software implementations can execute these tasks more efficiently than using the standard instructions of the ISA.

Custom instructions are often utilized in fields such as digital signal processing (DSP), multimedia processing, cryptography, networking, and other application-specific areas. By tailoring the instruction set to the specific requirements of an application, custom instructions can improve performance, reduce power consumption, and provide other advantages in terms of execution speed or resource utilization.

You could also be interested in our case studies and papers on the topic of custom instructions:

Getting started with Codasip