Skip to content

Commit f27724c

Browse files
author
Peter Birch
committed
insn.py: Correcting issue with LR and SC
* Misunderstanding of spec, had fixed RL and AQ both to 1 for LR and SC instructions * Now using InstructionAMOType as base class for LR & SC
1 parent abe8d69 commit f27724c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

riscvmodel/insn.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,16 +483,16 @@ def execute(self, model: Model):
483483
model.state.intreg[self.rd] = model.state.intreg[self.rs]
484484

485485

486-
@isa("lr", RV32A, opcode=0b0101111, funct7=0b0001011, funct3=0b010)
487-
class InstructionLR(InstructionRType):
486+
@isa("lr", RV32A, opcode=0b0101111, funct5=0b00010, funct3=0b010)
487+
class InstructionLR(InstructionAMOType):
488488
""" Load reserved """
489489
def execute(self, model: Model):
490490
# TODO: implement
491491
pass
492492

493493

494-
@isa("sc", RV32A, opcode=0b0101111, funct7=0b0001111, funct3=0b010)
495-
class InstructionSC(InstructionRType):
494+
@isa("sc", RV32A, opcode=0b0101111, funct5=0b00011, funct3=0b010)
495+
class InstructionSC(InstructionAMOType):
496496
""" Store conditional """
497497
def execute(self, model: Model):
498498
# TODO: implement

0 commit comments

Comments
 (0)