summaryrefslogtreecommitdiff
path: root/lib/Language/Elna/Architecture/RiscV.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Language/Elna/Architecture/RiscV.hs')
-rw-r--r--lib/Language/Elna/Architecture/RiscV.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Language/Elna/Architecture/RiscV.hs b/lib/Language/Elna/Architecture/RiscV.hs
index 808e19e..03895a3 100644
--- a/lib/Language/Elna/Architecture/RiscV.hs
+++ b/lib/Language/Elna/Architecture/RiscV.hs
@@ -142,9 +142,10 @@ data Type
deriving Eq
data RelocationType
- = Lower12I XRegister Funct3 XRegister Text
- | Lower12S Text Funct3 XRegister XRegister
- | Higher20 XRegister Text -- Type U.
+ = RLower12I XRegister Funct3 XRegister Text
+ | RLower12S Text Funct3 XRegister XRegister
+ | RHigher20 XRegister Text -- Type U.
+ | RBranch Text Funct3 XRegister XRegister -- Type B.
deriving Eq
data Instruction
@@ -299,9 +300,10 @@ type' (Type rd funct3' rs1 funct12')
.|. (fromIntegral (funct12 funct12') `shiftL` 20);
relocationType :: RelocationType -> Word32
-relocationType (Lower12I rd funct3' rs1 _) = type' $ I rd funct3' rs1 0
-relocationType (Lower12S _ funct3' rs1 rs2) = type' $ S 0 funct3' rs1 rs2
-relocationType (Higher20 rd _) = type' $ U rd 0
+relocationType (RLower12I rd funct3' rs1 _) = type' $ I rd funct3' rs1 0
+relocationType (RLower12S _ funct3' rs1 rs2) = type' $ S 0 funct3' rs1 rs2
+relocationType (RHigher20 rd _) = type' $ U rd 0
+relocationType (RBranch _ funct3' rs1 rs2) = type' $ B 0 funct3' rs1 rs2
instruction :: Instruction -> ByteString.Builder.Builder
instruction = \case