1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

risc-v アセンブラ 命令セット

Last updated at Posted at 2021-08-21

#概要

risc-vの命令セット、調べてみた。

#命令セット

命令 意味
lui rd, imm rd = imm << 12, pc++
auipc rd, imm rd = pc + (imm << 12), pc++
jal rd, imm rd = pc + 1, pc += imm
jalr rd, rs1, imm rd = pc + 1, pc = rs1 + imm
beq rs1, rs2, pc + imm if (rs1 == rs2) then pc += imm else pc++
bne rs1, rs2, pc + imm if (rs1 != rs2) then pc += imm else pc++
blt rs1, rs2, pc + imm if (rs1 < rs2) then pc += imm else pc++
bge rs1, rs2, pc + imm if (rs1 >= rs2) then pc += imm else pc++
bltu rs1, rs2, pc + imm if (rs1 < rs2) then pc += imm else pc++
bgeu rs1, rs2, pc + imm if (rs1 >= rs2) then pc += imm else pc++
lb rd, offset(rs1) rd = mem[rs1 + offset], pc++
lh rd, offset(rs1) rd = mem[rs1 + offset], pc++
lw rd, offset(rs1) rd = mem[rs1 + offset], pc++
lbu rd, offset(rs1) rd = mem[rs1 + offset], pc++
lhu rd, offset(rs1) rd = mem[rs1 + offset]
sb rs2, offset(rs1) mem[rs1 + offset] = rs2, pc++
sh rs2, offset(rs1) mem[rs1 + offset] = rs2, pc++
sw rs2, offset(rs1) mem[rs1 + offset] = rs2, pc++
addi rd, rs1, imm rd = rs1 + imm, pc++
slti rd, rs1, imm rd = (rs1 < imm) ? 1 : 0, pc++
sltiu rd, rs1, imm rd = (rs1 < imm) ? 1 : 0, pc++
xori rd, rs1, imm rd = rs1 ^ imm, pc++
ori rd, rs1, imm rd = rs1 |imm, pc++
andi rd, rs1, imm rd = rs1 & imm, pc++
slli rd, rs1, imm rd = rs1 << imm, pc++
srli rd, rs1, imm rd = rs1 >> imm, pc++
srai rd, rs1, imm rd = rs1 >>> imm, pc++
add rd, rs1, rs2 rd = rs1 + rs2, pc++
sub rd, rs1, rs2 rd = rs1 - rs2, pc++
sll rd, rs1, rs2 rd = rs1 << rs2, pc++
slt rd, rs1, rs2 rd = (rs1 < rs2) ? 1 : 0, pc++
sltu rd, rs1, rs2 rd = (rs1 < rs2) ? 1 : 0, pc++
xor rd, rs1, rs2 rd = rs1 ^ rs2, pc++
srl rd, rs1, rs2 rd = rs1 >> rs2, pc++
sra rd, rs1, rs2 rd = rs1 >>> rs2, pc++
or rd, rs1, rs2 rd = rs1 |rs2, pc++
and rd, rs1, rs2 rd = rs1 & rs2, pc++

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?