summaryrefslogtreecommitdiff
path: root/pysc-v
diff options
context:
space:
mode:
Diffstat (limited to 'pysc-v')
-rw-r--r--pysc-v/InstructionSets/RV32I.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/pysc-v/InstructionSets/RV32I.py b/pysc-v/InstructionSets/RV32I.py
index 967b24d..dcdee36 100644
--- a/pysc-v/InstructionSets/RV32I.py
+++ b/pysc-v/InstructionSets/RV32I.py
@@ -50,7 +50,19 @@ class U(Instruction):
pass
class J(Instruction):
- pass
+ # TODO check if it's correct
+ opcode = None
+
+ def __init__(self, rd, imm):
+ self.rd = rd
+ self.imm = imm
+
+ def compile(self):
+ return c_uint32(
+ (self.imm << 12) +\
+ (self.rd << 7) +\
+ self.opcode
+ )
class add(R):