From dfc17c3ab7ed22e19db7b62f86079cceaa79af12 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Mon, 24 May 2021 11:19:41 +0200 Subject: Add ecall and ebreak --- pysc-v/InstructionSets/RV32I.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pysc-v/InstructionSets/RV32I.py b/pysc-v/InstructionSets/RV32I.py index 7f4a428..5992869 100644 --- a/pysc-v/InstructionSets/RV32I.py +++ b/pysc-v/InstructionSets/RV32I.py @@ -406,8 +406,32 @@ class and(R): funct3 = 0b111 funct7 = 0b0000000 +@RV32I.instruction +class ecall(I): + name = "ecall" + opcode = 0b1110011 + funct3 = 0b000 + + def __init__(self): + # NOTE: ecall is a I-type instruction but doesn't get any arg and sets + # every field to 0 + self.rd = 0b00000 + self.rs = 0b00000 + self.imm = 0b000000000000 +@RV32I.instruction +class ebreak(I): + name = "ebreak" + opcode = 0b1110011 + funct3 = 0b000 + + def __init__(self): + # NOTE: ebreak is a I-type instruction but doesn't get any arg and pre- + # -sets every field to a fixed value + self.rd = 0b00000 + self.rs = 0b00000 + self.imm = 0b000000000001 -- cgit v1.2.3