Skip to content

Instruction Reference

ÆRIS implements the base integer RV32I set

This page describes the actual instructions supported by the simulator, organized by instruction format

All instructions operate on:

  • 32-bit registers
  • byte-addressable memory

R-type instructions perform operations between registers.

InstructionDescription
add rd, rs1, rs2Adds two registers and stores the result in rd.
sub rd, rs1, rs2Subtracts rs2 from rs1.
and rd, rs1, rs2Bitwise AND between registers.
or rd, rs1, rs2Bitwise OR between registers.
xor rd, rs1, rs2Bitwise XOR between registers.
slt rd, rs1, rs2Sets rd = 1 if rs1 < rs2 (signed).
sltu rd, rs1, rs2Sets rd = 1 if rs1 < rs2 (unsigned).
sll rd, rs1, rs2Logical left shift.
srl rd, rs1, rs2Logical right shift.
sra rd, rs1, rs2Arithmetic right shift.

I-type instructions use immediates or access memory.

InstructionDescription
addi rd, rs1, immAdds a 12-bit immediate to the register.
andi rd, rs1, immBitwise AND with immediate.
ori rd, rs1, immBitwise OR with immediate.
xori rd, rs1, immBitwise XOR with immediate.
slti rd, rs1, immSets rd = 1 if rs1 < imm (signed).
sltiu rd, rs1, immSets rd = 1 if rs1 < imm (unsigned).
InstructionDescription
slli rd, rs1, shamtLogical left shift with immediate.
srli rd, rs1, shamtLogical right shift with immediate.
srai rd, rs1, shamtArithmetic right shift with immediate.
InstructionDescription
lw rd, offset(rs1)Loads a 32-bit word from memory.
lh rd, offset(rs1)Loads a halfword (16 bits) with sign.
lhu rd, offset(rs1)Loads a halfword without sign.
lb rd, offset(rs1)Loads a byte with sign.
lbu rd, offset(rs1)Loads a byte without sign.

S-type instructions store values in memory.

InstructionDescription
sw rs2, offset(rs1)Stores a 32-bit word in memory.
sh rs2, offset(rs1)Stores a halfword (16 bits).
sb rs2, offset(rs1)Stores a byte (8 bits).

B-type instructions perform conditional branches.

InstructionDescription
beq rs1, rs2, labelBranches if the registers are equal.
bne rs1, rs2, labelBranches if the registers are different.
blt rs1, rs2, labelBranches if rs1 < rs2 (signed).
bge rs1, rs2, labelBranches if rs1 >= rs2 (signed).
bltu rs1, rs2, labelBranches if rs1 < rs2 (unsigned).
bgeu rs1, rs2, labelBranches if rs1 >= rs2 (unsigned).

Load large immediates.

InstructionDescription
lui rd, immLoads a 20-bit immediate into the upper bits of the register.
auipc rd, immAdds a 20-bit immediate to the current PC value.

Perform unconditional jumps.

InstructionDescription
jal rd, labelJumps to the specified address and stores the return address in rd.
InstructionDescription
jalr rd, rs1, immJumps to the address rs1 + imm and stores the return address in rd.
InstructionDescription
ecallExecutes a system call.