Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FENCE.TSO RV32I instruction #43

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading