Skip to content

Commit

Permalink
Add FENCE.TSO RV32I instruction
Browse files Browse the repository at this point in the history
Add optional RV32 instruction `FENCE.TSO` as `fence_tso`.
  • Loading branch information
elliotb-lowrisc committed Apr 22, 2024
1 parent 4a65da8 commit 268056c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/RISCV/RV32_I.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module RISCV.RV32_I (
, sh
, sw
, fence
, fence_tso
, resrvd
, mret
, sret
Expand Down Expand Up @@ -204,6 +205,8 @@ sw_raw = "imm[11:5] rs2[4:0] rs1[4:0] 010 imm[4:0] 0
sw rs1 rs2 imm = encode sw_raw imm rs2 rs1
fence_raw = "0000 pred[3:0] succ[3:0] 00000 000 00000 0001111"
fence pred succ = encode fence_raw pred succ
fence_tso_raw = "1000 0011 0011 00000 000 00000 0001111" -- Optional instruction
fence_tso = encode fence_tso_raw -- Optional instruction
resrvd_raw = "0000 0000 0000 00000 000 00000 0000000"
resrvd = encode resrvd_raw
mret_raw = "0011 0000 0010 00000 000 00000 1110011"
Expand Down Expand Up @@ -259,6 +262,7 @@ rv32_i_disass = [ add_raw --> prettyR "add"
, sh_raw --> prettyS "sh"
, sw_raw --> prettyS "sw"
, fence_raw --> prettyF
, fence_tso_raw --> "fence.tso"
, resrvd_raw --> "reserved"
, mret_raw --> "mret"
, sret_raw --> "sret"
Expand Down Expand Up @@ -325,6 +329,7 @@ rv32_i_extract = [ add_raw --> extract_2op add_raw
, sh_raw --> extract_nodst sh_raw
, sw_raw --> extract_nodst sw_raw
-- , fence_raw --> noextract
-- , fence_tso_raw --> noextract
-- , resrvd_raw --> noextract
-- , mret_raw --> noextract
-- , sret_raw --> noextract
Expand Down Expand Up @@ -399,6 +404,7 @@ rv32_i_shrink = [ add_raw --> shrink_arith
, sh_raw --> shrink_store
, sw_raw --> shrink_store
-- , fence_raw --> noshrink
-- , fence_tso_raw --> noshrink
, resrvd_raw --> shrink_illegal
, mret_raw --> shrink_illegal
, sret_raw --> shrink_illegal
Expand Down Expand Up @@ -475,7 +481,8 @@ rv32_i_store srcAddr srcData imm = [ sb srcAddr srcData imm

-- | List of RV32 base integer fence instructions
rv32_i_fence :: Integer -> Integer -> [Instruction]
rv32_i_fence fenceOp1 fenceOp2 = [fence fenceOp1 fenceOp2]
rv32_i_fence fenceOp1 fenceOp2 = [fence fenceOp1 fenceOp2
, fence_tso ]

-- | List of RV32 base integer memory instructions
rv32_i_mem :: Integer -> Integer -> Integer -> Integer -> Integer -> Integer
Expand Down

0 comments on commit 268056c

Please sign in to comment.