Skip to content

Commit f7c05c6

Browse files
author
Peter Birch
committed
insn.py: Adding URET, SRET, HRET, MRET instructions for exception return
1 parent 2aea6b9 commit f7c05c6

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

riscvmodel/insn.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,38 @@ def __str__(self):
299299
return "ecall"
300300

301301

302+
@isa("uret", RV32I, opcode=0b1110011, funct3=0b000, imm=0b000000000010, rs1=0b00000, rd=0b00000)
303+
class InstructionURET(InstructionIType):
304+
""" Machine level exception return """
305+
def execute(self, model: Model):
306+
# TODO: implement
307+
pass
308+
309+
310+
@isa("sret", RV32I, opcode=0b1110011, funct3=0b000, imm=0b000100000010, rs1=0b00000, rd=0b00000)
311+
class InstructionSRET(InstructionIType):
312+
""" Machine level exception return """
313+
def execute(self, model: Model):
314+
# TODO: implement
315+
pass
316+
317+
318+
@isa("hret", RV32I, opcode=0b1110011, funct3=0b000, imm=0b001000000010, rs1=0b00000, rd=0b00000)
319+
class InstructionHRET(InstructionIType):
320+
""" Machine level exception return """
321+
def execute(self, model: Model):
322+
# TODO: implement
323+
pass
324+
325+
326+
@isa("mret", RV32I, opcode=0b1110011, funct3=0b000, imm=0b001100000010, rs1=0b00000, rd=0b00000)
327+
class InstructionMRET(InstructionIType):
328+
""" Machine level exception return """
329+
def execute(self, model: Model):
330+
# TODO: implement
331+
pass
332+
333+
302334
@isa("wfi", RV32I, opcode=0b1110011, funct3=0b000, imm=0b000100000101, rs1=0b00000, rd=0b00000)
303335
class InstructionWFI(InstructionIType):
304336
def execute(self, model: Model):

0 commit comments

Comments
 (0)