summaryrefslogtreecommitdiff
path: root/risc-v/hgen/parser.hgen
diff options
context:
space:
mode:
Diffstat (limited to 'risc-v/hgen/parser.hgen')
-rw-r--r--risc-v/hgen/parser.hgen14
1 files changed, 12 insertions, 2 deletions
diff --git a/risc-v/hgen/parser.hgen b/risc-v/hgen/parser.hgen
index 8bb8ae2b..37fd8d8d 100644
--- a/risc-v/hgen/parser.hgen
+++ b/risc-v/hgen/parser.hgen
@@ -22,5 +22,15 @@
{ `RISCVSHIFTW ($6, $4, $2, $1.op) }
| RTYPEW reg COMMA reg COMMA reg
{ `RISCVRTYPEW ($6, $4, $2, $1.op) }
-| FENCE
- { `RISCVFENCE }
+| FENCE FENCEOPTION COMMA FENCEOPTION
+ { match ($2, $4) with
+ | (Fence_RW, Fence_RW) -> `RISCVFENCE (0b0011, 0b0011)
+ | (Fence_R, Fence_RW) -> `RISCVFENCE (0b0010, 0b0011)
+ | (Fence_RW, Fence_W) -> `RISCVFENCE (0b0011, 0b0001)
+ | (Fence_RW, Fence_R) -> failwith "'fence rw,r' is not supported"
+ | (Fence_R, Fence_R) -> failwith "'fence r,r' is not supported"
+ | (Fence_R, Fence_W) -> failwith "'fence r,w' is not supported"
+ | (Fence_W, Fence_RW) -> failwith "'fence w,rw' is not supported"
+ | (Fence_W, Fence_R) -> failwith "'fence w,r' is not supported"
+ | (Fence_W, Fence_W) -> failwith "'fence w,w' is not supported"
+ }