API Reference
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_intrinsics.h File Reference

Prototypes for custom RISC-V instructions ("intrinsics"). Based on the ".insn" pseudo directive: https://sourceware.org/binutils/docs/as/RISC_002dV_002dFormats.html. More...

#include <neorv32.h>
#include <stdint.h>

Go to the source code of this file.

Macros

RISC-V opcodes for custom instructions / NEORV32 CFU
#define RISCV_OPCODE_CUSTOM0   0b0001011
 
#define RISCV_OPCODE_CUSTOM1   0b0101011
 

Functions

uint32_t RISCV_INSTR_R_TYPE (const int opcode, const int funct3, const int funct7, uint32_t rs1, uint32_t rs2)
 
uint32_t RISCV_INSTR_I_TYPE (const int opcode, const int funct3, uint32_t rs1, const int imm12)
 

Detailed Description

Prototypes for custom RISC-V instructions ("intrinsics"). Based on the ".insn" pseudo directive: https://sourceware.org/binutils/docs/as/RISC_002dV_002dFormats.html.

Function Documentation

◆ RISCV_INSTR_I_TYPE()

uint32_t RISCV_INSTR_I_TYPE ( const int opcode,
const int funct3,
uint32_t rs1,
const int imm12 )
inline

Emit a RISC-V I-type instruction.

Parameters
[in]opcodeOpcode (7-bit).
[in]funct3Function select (3-bit).
[in]rs1Register source operand 1 (32-bit).
[in]imm12Immediate source operand (12-bit).
Returns
Instruction result (destination register rd, 32-bit).

◆ RISCV_INSTR_R_TYPE()

uint32_t RISCV_INSTR_R_TYPE ( const int opcode,
const int funct3,
const int funct7,
uint32_t rs1,
uint32_t rs2 )
inline

Emit a RISC-V R-type instruction.

Parameters
[in]opcodeOpcode (7-bit).
[in]funct3Function select (3-bit).
[in]funct7Function select (7-bit).
[in]rs1Register source operand 1 (32-bit).
[in]rs2Register source operand 2 (32-bit).
Returns
Instruction result (destination register rd, 32-bit).