diff options
Diffstat (limited to 'snapshots/coq/riscv/riscv.v')
| -rw-r--r-- | snapshots/coq/riscv/riscv.v | 37814 |
1 files changed, 37814 insertions, 0 deletions
diff --git a/snapshots/coq/riscv/riscv.v b/snapshots/coq/riscv/riscv.v new file mode 100644 index 00000000..620e5c37 --- /dev/null +++ b/snapshots/coq/riscv/riscv.v @@ -0,0 +1,37814 @@ +(*Generated by Sail from riscv.*) +Require Import Sail2_instr_kinds. +Require Import Sail2_values. +Require Import Sail2_string. +Require Import Sail2_real. +Require Import Sail2_operators_mwords. +Require Import Sail2_prompt_monad. +Require Import Sail2_prompt. +Require Import Sail2_state. +Require Import riscv_types. +Require Import riscv_extras. +Import ListNotations. +Open Scope string. +Open Scope bool. +Section Content. + +Definition eq_unit (g__147 : unit) (g__148 : unit) : bool := true. + +Definition neq_int (x : Z) (y : Z) : bool := negb (Z.eqb x y). + +Definition neq_bool (x : bool) (y : bool) : bool := negb (Bool.eqb x y). + +Axiom eq_real : forall (_ : R) (_ : R) , bool. + +Axiom lteq_real : forall (_ : R) (_ : R) , bool. + +Axiom lt_real : forall (_ : R) (_ : R) , bool. + +Axiom gteq_real : forall (_ : R) (_ : R) , bool. + +Axiom gt_real : forall (_ : R) (_ : R) , bool. + +Definition hex_bits_1_forwards_matches (bv : mword 1) : bool := true. + +Definition hex_bits_1_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_1_matches_prefix s) with + | Some (g__144,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__145 := Some ((g__144, n)) in + false + | g__145 => false + end)) then + true + else + let g__146 := s in + false + end. + +Definition hex_bits_1_backwards (s : string) +: M (mword 1) := + + (match (hex_bits_1_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 1) + | _ => exit tt : M (mword 1) + end) + : M (mword 1). + +Definition hex_bits_2_forwards_matches (bv : mword 2) : bool := true. + +Definition hex_bits_2_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_2_matches_prefix s) with + | Some (g__141,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__142 := Some ((g__141, n)) in + false + | g__142 => false + end)) then + true + else + let g__143 := s in + false + end. + +Definition hex_bits_2_backwards (s : string) +: M (mword 2) := + + (match (hex_bits_2_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 2) + | _ => exit tt : M (mword 2) + end) + : M (mword 2). + +Definition hex_bits_3_forwards_matches (bv : mword 3) : bool := true. + +Definition hex_bits_3_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_3_matches_prefix s) with + | Some (g__138,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__139 := Some ((g__138, n)) in + false + | g__139 => false + end)) then + true + else + let g__140 := s in + false + end. + +Definition hex_bits_3_backwards (s : string) +: M (mword 3) := + + (match (hex_bits_3_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 3) + | _ => exit tt : M (mword 3) + end) + : M (mword 3). + +Definition hex_bits_4_forwards_matches (bv : mword 4) : bool := true. + +Definition hex_bits_4_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_4_matches_prefix s) with + | Some (g__135,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__136 := Some ((g__135, n)) in + false + | g__136 => false + end)) then + true + else + let g__137 := s in + false + end. + +Definition hex_bits_4_backwards (s : string) +: M (mword 4) := + + (match (hex_bits_4_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 4) + | _ => exit tt : M (mword 4) + end) + : M (mword 4). + +Definition hex_bits_5_forwards_matches (bv : mword 5) : bool := true. + +Definition hex_bits_5_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_5_matches_prefix s) with + | Some (g__132,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__133 := Some ((g__132, n)) in + false + | g__133 => false + end)) then + true + else + let g__134 := s in + false + end. + +Definition hex_bits_5_backwards (s : string) +: M (mword 5) := + + (match (hex_bits_5_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 5) + | _ => exit tt : M (mword 5) + end) + : M (mword 5). + +Definition hex_bits_6_forwards_matches (bv : mword 6) : bool := true. + +Definition hex_bits_6_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_6_matches_prefix s) with + | Some (g__129,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__130 := Some ((g__129, n)) in + false + | g__130 => false + end)) then + true + else + let g__131 := s in + false + end. + +Definition hex_bits_6_backwards (s : string) +: M (mword 6) := + + (match (hex_bits_6_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 6) + | _ => exit tt : M (mword 6) + end) + : M (mword 6). + +Definition hex_bits_7_forwards_matches (bv : mword 7) : bool := true. + +Definition hex_bits_7_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_7_matches_prefix s) with + | Some (g__126,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__127 := Some ((g__126, n)) in + false + | g__127 => false + end)) then + true + else + let g__128 := s in + false + end. + +Definition hex_bits_7_backwards (s : string) +: M (mword 7) := + + (match (hex_bits_7_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 7) + | _ => exit tt : M (mword 7) + end) + : M (mword 7). + +Definition hex_bits_8_forwards_matches (bv : mword 8) : bool := true. + +Definition hex_bits_8_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_8_matches_prefix s) with + | Some (g__123,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__124 := Some ((g__123, n)) in + false + | g__124 => false + end)) then + true + else + let g__125 := s in + false + end. + +Definition hex_bits_8_backwards (s : string) +: M (mword 8) := + + (match (hex_bits_8_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 8) + | _ => exit tt : M (mword 8) + end) + : M (mword 8). + +Definition hex_bits_9_forwards_matches (bv : mword 9) : bool := true. + +Definition hex_bits_9_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_9_matches_prefix s) with + | Some (g__120,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__121 := Some ((g__120, n)) in + false + | g__121 => false + end)) then + true + else + let g__122 := s in + false + end. + +Definition hex_bits_9_backwards (s : string) +: M (mword 9) := + + (match (hex_bits_9_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 9) + | _ => exit tt : M (mword 9) + end) + : M (mword 9). + +Definition hex_bits_10_forwards_matches (bv : mword 10) : bool := true. + +Definition hex_bits_10_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_10_matches_prefix s) with + | Some (g__117,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__118 := Some ((g__117, n)) in + false + | g__118 => false + end)) then + true + else + let g__119 := s in + false + end. + +Definition hex_bits_10_backwards (s : string) +: M (mword 10) := + + (match (hex_bits_10_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 10) + | _ => exit tt : M (mword 10) + end) + : M (mword 10). + +Definition hex_bits_11_forwards_matches (bv : mword 11) : bool := true. + +Definition hex_bits_11_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_11_matches_prefix s) with + | Some (g__114,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__115 := Some ((g__114, n)) in + false + | g__115 => false + end)) then + true + else + let g__116 := s in + false + end. + +Definition hex_bits_11_backwards (s : string) +: M (mword 11) := + + (match (hex_bits_11_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 11) + | _ => exit tt : M (mword 11) + end) + : M (mword 11). + +Definition hex_bits_12_forwards_matches (bv : mword 12) : bool := true. + +Definition hex_bits_12_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_12_matches_prefix s) with + | Some (g__111,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__112 := Some ((g__111, n)) in + false + | g__112 => false + end)) then + true + else + let g__113 := s in + false + end. + +Definition hex_bits_12_backwards (s : string) +: M (mword 12) := + + (match (hex_bits_12_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 12) + | _ => exit tt : M (mword 12) + end) + : M (mword 12). + +Definition hex_bits_13_forwards_matches (bv : mword 13) : bool := true. + +Definition hex_bits_13_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_13_matches_prefix s) with + | Some (g__108,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__109 := Some ((g__108, n)) in + false + | g__109 => false + end)) then + true + else + let g__110 := s in + false + end. + +Definition hex_bits_13_backwards (s : string) +: M (mword 13) := + + (match (hex_bits_13_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 13) + | _ => exit tt : M (mword 13) + end) + : M (mword 13). + +Definition hex_bits_14_forwards_matches (bv : mword 14) : bool := true. + +Definition hex_bits_14_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_14_matches_prefix s) with + | Some (g__105,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__106 := Some ((g__105, n)) in + false + | g__106 => false + end)) then + true + else + let g__107 := s in + false + end. + +Definition hex_bits_14_backwards (s : string) +: M (mword 14) := + + (match (hex_bits_14_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 14) + | _ => exit tt : M (mword 14) + end) + : M (mword 14). + +Definition hex_bits_15_forwards_matches (bv : mword 15) : bool := true. + +Definition hex_bits_15_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_15_matches_prefix s) with + | Some (g__102,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__103 := Some ((g__102, n)) in + false + | g__103 => false + end)) then + true + else + let g__104 := s in + false + end. + +Definition hex_bits_15_backwards (s : string) +: M (mword 15) := + + (match (hex_bits_15_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 15) + | _ => exit tt : M (mword 15) + end) + : M (mword 15). + +Definition hex_bits_16_forwards_matches (bv : mword 16) : bool := true. + +Definition hex_bits_16_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_16_matches_prefix s) with + | Some (g__99,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__100 := Some ((g__99, n)) in + false + | g__100 => false + end)) then + true + else + let g__101 := s in + false + end. + +Definition hex_bits_16_backwards (s : string) +: M (mword 16) := + + (match (hex_bits_16_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 16) + | _ => exit tt : M (mword 16) + end) + : M (mword 16). + +Definition hex_bits_17_forwards_matches (bv : mword 17) : bool := true. + +Definition hex_bits_17_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_17_matches_prefix s) with + | Some (g__96,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__97 := Some ((g__96, n)) in + false + | g__97 => false + end)) then + true + else + let g__98 := s in + false + end. + +Definition hex_bits_17_backwards (s : string) +: M (mword 17) := + + (match (hex_bits_17_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 17) + | _ => exit tt : M (mword 17) + end) + : M (mword 17). + +Definition hex_bits_18_forwards_matches (bv : mword 18) : bool := true. + +Definition hex_bits_18_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_18_matches_prefix s) with + | Some (g__93,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__94 := Some ((g__93, n)) in + false + | g__94 => false + end)) then + true + else + let g__95 := s in + false + end. + +Definition hex_bits_18_backwards (s : string) +: M (mword 18) := + + (match (hex_bits_18_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 18) + | _ => exit tt : M (mword 18) + end) + : M (mword 18). + +Definition hex_bits_19_forwards_matches (bv : mword 19) : bool := true. + +Definition hex_bits_19_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_19_matches_prefix s) with + | Some (g__90,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__91 := Some ((g__90, n)) in + false + | g__91 => false + end)) then + true + else + let g__92 := s in + false + end. + +Definition hex_bits_19_backwards (s : string) +: M (mword 19) := + + (match (hex_bits_19_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 19) + | _ => exit tt : M (mword 19) + end) + : M (mword 19). + +Definition hex_bits_20_forwards_matches (bv : mword 20) : bool := true. + +Definition hex_bits_20_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_20_matches_prefix s) with + | Some (g__87,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__88 := Some ((g__87, n)) in + false + | g__88 => false + end)) then + true + else + let g__89 := s in + false + end. + +Definition hex_bits_20_backwards (s : string) +: M (mword 20) := + + (match (hex_bits_20_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 20) + | _ => exit tt : M (mword 20) + end) + : M (mword 20). + +Definition hex_bits_21_forwards_matches (bv : mword 21) : bool := true. + +Definition hex_bits_21_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_21_matches_prefix s) with + | Some (g__84,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__85 := Some ((g__84, n)) in + false + | g__85 => false + end)) then + true + else + let g__86 := s in + false + end. + +Definition hex_bits_21_backwards (s : string) +: M (mword 21) := + + (match (hex_bits_21_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 21) + | _ => exit tt : M (mword 21) + end) + : M (mword 21). + +Definition hex_bits_22_forwards_matches (bv : mword 22) : bool := true. + +Definition hex_bits_22_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_22_matches_prefix s) with + | Some (g__81,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__82 := Some ((g__81, n)) in + false + | g__82 => false + end)) then + true + else + let g__83 := s in + false + end. + +Definition hex_bits_22_backwards (s : string) +: M (mword 22) := + + (match (hex_bits_22_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 22) + | _ => exit tt : M (mword 22) + end) + : M (mword 22). + +Definition hex_bits_23_forwards_matches (bv : mword 23) : bool := true. + +Definition hex_bits_23_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_23_matches_prefix s) with + | Some (g__78,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__79 := Some ((g__78, n)) in + false + | g__79 => false + end)) then + true + else + let g__80 := s in + false + end. + +Definition hex_bits_23_backwards (s : string) +: M (mword 23) := + + (match (hex_bits_23_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 23) + | _ => exit tt : M (mword 23) + end) + : M (mword 23). + +Definition hex_bits_24_forwards_matches (bv : mword 24) : bool := true. + +Definition hex_bits_24_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_24_matches_prefix s) with + | Some (g__75,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__76 := Some ((g__75, n)) in + false + | g__76 => false + end)) then + true + else + let g__77 := s in + false + end. + +Definition hex_bits_24_backwards (s : string) +: M (mword 24) := + + (match (hex_bits_24_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 24) + | _ => exit tt : M (mword 24) + end) + : M (mword 24). + +Definition hex_bits_25_forwards_matches (bv : mword 25) : bool := true. + +Definition hex_bits_25_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_25_matches_prefix s) with + | Some (g__72,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__73 := Some ((g__72, n)) in + false + | g__73 => false + end)) then + true + else + let g__74 := s in + false + end. + +Definition hex_bits_25_backwards (s : string) +: M (mword 25) := + + (match (hex_bits_25_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 25) + | _ => exit tt : M (mword 25) + end) + : M (mword 25). + +Definition hex_bits_26_forwards_matches (bv : mword 26) : bool := true. + +Definition hex_bits_26_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_26_matches_prefix s) with + | Some (g__69,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__70 := Some ((g__69, n)) in + false + | g__70 => false + end)) then + true + else + let g__71 := s in + false + end. + +Definition hex_bits_26_backwards (s : string) +: M (mword 26) := + + (match (hex_bits_26_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 26) + | _ => exit tt : M (mword 26) + end) + : M (mword 26). + +Definition hex_bits_27_forwards_matches (bv : mword 27) : bool := true. + +Definition hex_bits_27_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_27_matches_prefix s) with + | Some (g__66,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__67 := Some ((g__66, n)) in + false + | g__67 => false + end)) then + true + else + let g__68 := s in + false + end. + +Definition hex_bits_27_backwards (s : string) +: M (mword 27) := + + (match (hex_bits_27_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 27) + | _ => exit tt : M (mword 27) + end) + : M (mword 27). + +Definition hex_bits_28_forwards_matches (bv : mword 28) : bool := true. + +Definition hex_bits_28_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_28_matches_prefix s) with + | Some (g__63,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__64 := Some ((g__63, n)) in + false + | g__64 => false + end)) then + true + else + let g__65 := s in + false + end. + +Definition hex_bits_28_backwards (s : string) +: M (mword 28) := + + (match (hex_bits_28_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 28) + | _ => exit tt : M (mword 28) + end) + : M (mword 28). + +Definition hex_bits_29_forwards_matches (bv : mword 29) : bool := true. + +Definition hex_bits_29_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_29_matches_prefix s) with + | Some (g__60,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__61 := Some ((g__60, n)) in + false + | g__61 => false + end)) then + true + else + let g__62 := s in + false + end. + +Definition hex_bits_29_backwards (s : string) +: M (mword 29) := + + (match (hex_bits_29_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 29) + | _ => exit tt : M (mword 29) + end) + : M (mword 29). + +Definition hex_bits_30_forwards_matches (bv : mword 30) : bool := true. + +Definition hex_bits_30_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_30_matches_prefix s) with + | Some (g__57,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__58 := Some ((g__57, n)) in + false + | g__58 => false + end)) then + true + else + let g__59 := s in + false + end. + +Definition hex_bits_30_backwards (s : string) +: M (mword 30) := + + (match (hex_bits_30_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 30) + | _ => exit tt : M (mword 30) + end) + : M (mword 30). + +Definition hex_bits_31_forwards_matches (bv : mword 31) : bool := true. + +Definition hex_bits_31_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_31_matches_prefix s) with + | Some (g__54,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__55 := Some ((g__54, n)) in + false + | g__55 => false + end)) then + true + else + let g__56 := s in + false + end. + +Definition hex_bits_31_backwards (s : string) +: M (mword 31) := + + (match (hex_bits_31_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 31) + | _ => exit tt : M (mword 31) + end) + : M (mword 31). + +Definition hex_bits_32_forwards_matches (bv : mword 32) : bool := true. + +Definition hex_bits_32_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_32_matches_prefix s) with + | Some (g__51,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__52 := Some ((g__51, n)) in + false + | g__52 => false + end)) then + true + else + let g__53 := s in + false + end. + +Definition hex_bits_32_backwards (s : string) +: M (mword 32) := + + (match (hex_bits_32_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 32) + | _ => exit tt : M (mword 32) + end) + : M (mword 32). + +Definition hex_bits_33_forwards_matches (bv : mword 33) : bool := true. + +Definition hex_bits_33_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_33_matches_prefix s) with + | Some (g__48,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__49 := Some ((g__48, n)) in + false + | g__49 => false + end)) then + true + else + let g__50 := s in + false + end. + +Definition hex_bits_33_backwards (s : string) +: M (mword 33) := + + (match (hex_bits_33_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 33) + | _ => exit tt : M (mword 33) + end) + : M (mword 33). + +Definition hex_bits_48_forwards_matches (bv : mword 48) : bool := true. + +Definition hex_bits_48_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_48_matches_prefix s) with + | Some (g__45,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__46 := Some ((g__45, n)) in + false + | g__46 => false + end)) then + true + else + let g__47 := s in + false + end. + +Definition hex_bits_48_backwards (s : string) +: M (mword 48) := + + (match (hex_bits_48_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 48) + | _ => exit tt : M (mword 48) + end) + : M (mword 48). + +Definition hex_bits_64_forwards_matches (bv : mword 64) : bool := true. + +Definition hex_bits_64_backwards_matches (s : string) +: bool := + + match s with + | s => + if sumbool_of_bool ((match (hex_bits_64_matches_prefix s) with + | Some (g__42,(existT _ n _)) => + if sumbool_of_bool ((Z.eqb n (projT1 (string_length s)))) then true + else + let g__43 := Some ((g__42, n)) in + false + | g__43 => false + end)) then + true + else + let g__44 := s in + false + end. + +Definition hex_bits_64_backwards (s : string) +: M (mword 64) := + + (match (hex_bits_64_matches_prefix s) with + | Some (bv,(existT _ n _)) => returnm (bv : mword 64) + | _ => exit tt : M (mword 64) + end) + : M (mword 64). + +Axiom vcons : forall {n : Z} {a : Type} (_ : a) (_ : vec a n) , vec a (n + 1). + +Axiom vector_concat : forall {n : Z} {m : Z} {a : Type} (_ : vec a n) (_ : vec a m) , vec a (n + m). + +Definition neq_vec {n : Z} (x : mword n) (y : mword n) : bool := negb (eq_vec x y). + + + +Axiom __raw_SetSlice_int : forall (w : Z) (_ : Z) (_ : Z) (_ : mword w) , Z. + +Definition __GetSlice_int (n : Z) (m : Z) (o : Z) `{ArithFact (n >= 0)} +: mword n := + + get_slice_int n m o. + +Axiom __raw_SetSlice_bits : forall (n : Z) (w : Z) (_ : mword n) (_ : Z) (_ : mword w) , mword n. + +Axiom __raw_GetSlice_bits : forall + +(n : Z) (w : Z) (_ : mword n) (_ : Z) +`{ArithFact (w >= 0)}, +mword w. + +Axiom __SignExtendSlice : forall {m : Z} (_ : mword m) (_ : Z) (_ : Z) , mword m. + +Axiom __ZeroExtendSlice : forall {m : Z} (_ : mword m) (_ : Z) (_ : Z) , mword m. + +Definition cast_unit_vec (b : bitU) +: M (mword 1) := + + (match b with + | B0 => returnm ((vec_of_bits [B0] : mword 1) : mword 1) + | B1 => returnm ((vec_of_bits [B1] : mword 1) : mword 1) + | _ => exit tt : M (mword 1) + end) + : M (mword 1). + +Axiom DecStr : forall (_ : Z) , string. + +Axiom HexStr : forall (_ : Z) , string. + +Axiom real_power : forall (_ : R) (_ : Z) , R. + +Axiom add_real : forall (_ : R) (_ : R) , R. + +Axiom sub_real : forall (_ : R) (_ : R) , R. + +Axiom negate_real : forall (_ : R) , R. + +Axiom mult_real : forall (_ : R) (_ : R) , R. + +Axiom Sqrt : forall (_ : R) , R. + +Axiom RoundDown : forall (_ : R) , Z. + +Axiom RoundUp : forall (_ : R) , Z. + +Axiom abs_real : forall (_ : R) , R. + +Axiom quotient_nat : forall + +(_ : {n : Z & ArithFact (n >= 0)}) (_ : {n : Z & ArithFact (n >= 0)}) +, +{n : Z & ArithFact (n >= 0)}. + +Axiom quotient_real : forall (_ : R) (_ : R) , R. + +Axiom quotient : forall (_ : Z) (_ : Z) , Z. + +Axiom quot_round_zero : forall (_ : Z) (_ : Z) , Z. + +Axiom rem_round_zero : forall (_ : Z) (_ : Z) , Z. + +Axiom modulus : forall (_ : Z) (_ : Z) , Z. + +Axiom Real : forall (_ : Z) , R. + +Definition __RISCV_write (addr : mword 64) (width : Z) (data : mword (8 * width)) +: M (bool) := + + (write_ram 64 width + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) addr data) + : M (bool). + +Axiom __TraceMemoryWrite : forall {m : Z} (n : Z) (_ : mword m) (_ : mword (8 * n)) , unit. + +Definition __RISCV_read (addr : mword 64) (width : Z) (aq : bool) (rl : bool) (res : bool) +`{ArithFact (width >= 0)} +: M (option (mword (8 * width))) := + + (match (aq, rl, res) with + | (false, false, false) => + (read_ram 64 width + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) addr) >>= fun w__0 : mword (8 * width) => + returnm ((Some + (w__0)) + : option (mword (8 * width))) + | (true, false, false) => + (read_ram 64 width + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) addr) >>= fun w__1 : mword (8 * width) => + returnm ((Some + (w__1)) + : option (mword (8 * width))) + | (true, true, false) => + (read_ram 64 width + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) addr) >>= fun w__2 : mword (8 * width) => + returnm ((Some + (w__2)) + : option (mword (8 * width))) + | (false, false, true) => + (read_ram 64 width + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) addr) >>= fun w__3 : mword (8 * width) => + returnm ((Some + (w__3)) + : option (mword (8 * width))) + | (true, false, true) => + (read_ram 64 width + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) addr) >>= fun w__4 : mword (8 * width) => + returnm ((Some + (w__4)) + : option (mword (8 * width))) + | (true, true, true) => + (read_ram 64 width + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) addr) >>= fun w__5 : mword (8 * width) => + returnm ((Some + (w__5)) + : option (mword (8 * width))) + | (false, true, false) => returnm (None : option (mword (8 * width))) + | (false, true, true) => returnm (None : option (mword (8 * width))) + end) + : M (option (mword (8 * width))). + +Axiom __TraceMemoryRead : forall {m : Z} (n : Z) (_ : mword m) (_ : mword (8 * n)) , unit. + +Definition ex_nat {ex30597_ : Z} (n : Z) `{ArithFact (0 <= ex30597_)} `{ArithFact (n = ex30597_)} +: {syn_n : Z & ArithFact (syn_n >= 0)} := + + build_ex(n). + +Definition ex_int {ex30599_ : Z} (n : Z) `{ArithFact (n = ex30599_)} +: {syn_n : Z & ArithFact (True)} := + + build_ex(n). + +Definition coerce_int_nat {ex30601_ : Z} (x : Z) `{ArithFact (x = ex30601_)} +: M ({n : Z & ArithFact (n >= 0)}) := + + assert_exp' (x >=? 0) "file ""prelude.sail"", line 1034, character 29 to line 1034, character 29: constraint('x >= 0)" >>= fun _ => + returnm (build_ex (x + : Z)). + +Definition EXTS {n : Z} (m__tv : Z) (v : mword n) `{ArithFact (m__tv >= n)} +: mword m__tv := + + sign_extend v m__tv. + +Definition EXTZ {n : Z} (m__tv : Z) (v : mword n) `{ArithFact (m__tv >= n)} +: mword m__tv := + + zero_extend v m__tv. + +Definition zopz0zI_s {n : Z} (x : mword n) (y : mword n) `{ArithFact (n >= (0 + 1))} +: bool := + + Z.ltb (projT1 (sint x)) (projT1 (sint y)). + +Definition zopz0zKzJ_s {n : Z} (x : mword n) (y : mword n) `{ArithFact (n >= (0 + 1))} +: bool := + + Z.geb (projT1 (sint x)) (projT1 (sint y)). + +Definition zopz0zI_u {n : Z} (x : mword n) (y : mword n) +: bool := + + Z.ltb (projT1 (uint x)) (projT1 (uint y)). + +Definition zopz0zKzJ_u {n : Z} (x : mword n) (y : mword n) +: bool := + + Z.geb (projT1 (uint x)) (projT1 (uint y)). + +Definition zopz0zIzJ_u {n : Z} (x : mword n) (y : mword n) +: bool := + + Z.leb (projT1 (uint x)) (projT1 (uint y)). + +Definition bool_to_bits (x : bool) +: mword 1 := + + if (x) then (vec_of_bits [B1] : mword 1) + else (vec_of_bits [B0] : mword 1). + +Definition bit_to_bool (b : bitU) +: M (bool) := + + (match b with + | B1 => returnm (true : bool) + | B0 => returnm (false : bool) + | _ => exit tt : M (bool) + end) + : M (bool). + +Definition vector64 (n : Z) : mword 64 := get_slice_int 64 n 0. + +Definition to_bits (l : Z) (n : Z) `{ArithFact (l >= 0)} : mword l := get_slice_int l n 0. + +Axiom vector_update_subrange_inc : forall +{n : Z} +(_ : mword n) (m : Z) (o : Z) (_ : mword (o - (m - 1))) +, +mword n. + +Definition shift_right_arith64 (v : mword 64) (shift : mword 6) +: mword 64 := + + let v128 : bits 128 := EXTS 128 v in + subrange_vec_dec (shift_bits_right v128 shift) 63 0. + +Definition shift_right_arith32 (v : mword 32) (shift : mword 5) +: mword 32 := + + let v64 : bits 64 := EXTS 64 v in + subrange_vec_dec (shift_bits_right v64 shift) 31 0. + +Fixpoint _rec_n_leading_spaces (s : string) (_reclimit : Z) (_acc : Acc (Zwf 0) _reclimit) +{struct _acc} : M ({n : Z & ArithFact (n >= 0)}) := + + assert_exp' (Z.geb _reclimit 0) "recursion limit reached" >>= fun _ => + let p0_ := s in + (if ((generic_eq p0_ "")) then returnm (build_ex (0 : Z)) + else + let p0_ := string_take s 1 in + (if ((generic_eq p0_ " ")) then + (_rec_n_leading_spaces (string_drop s 1) (Z.sub _reclimit 1) (_limit_reduces _acc)) >>= fun '(existT _ w__0 _ : {n : Z & ArithFact (n >= + 0)}) => + returnm (build_ex (projT1 (build_ex (Z.add 1 w__0) + : {_atom : Z & ArithFact (exists ex21215_ , _atom = (1 + ex21215_) /\ 0 <= ex21215_)}))) + else returnm (build_ex (0 : Z))) + : M ({n : Z & ArithFact (n >= 0)})) + : M ({n : Z & ArithFact (n >= 0)}). + +Definition n_leading_spaces (s : string) +: M ({n : Z & ArithFact (n >= 0)}) := + + (_rec_n_leading_spaces s ((projT1 (string_length s)) : Z) (Zwf_guarded _)) + : M ({n : Z & ArithFact (n >= 0)}). + +Definition spc_forwards '(tt : unit) : string := " ". + +Definition spc_backwards (s : string) : unit := tt. + +Definition spc_matches_prefix (s : string) +: M (option ((unit * {n : Z & ArithFact (n >= 0)}))) := + + (n_leading_spaces s) >>= fun '(existT _ n _) => + let p0_ := n in + returnm ((if sumbool_of_bool ((Z.eqb p0_ 0)) then None + else Some ((tt, build_ex n))) + : option ((unit * {n : Z & ArithFact (n >= 0)}))). + +Definition opt_spc_forwards '(tt : unit) : string := "". + +Definition opt_spc_backwards (s : string) : unit := tt. + +Definition opt_spc_matches_prefix (s : string) +: M (option ((unit * {n : Z & ArithFact (n >= 0)}))) := + + (n_leading_spaces s) >>= fun '(existT _ w__0 _ : {n : Z & ArithFact (n >= 0)}) => + returnm ((Some + ((tt, build_ex w__0))) + : option ((unit * {n : Z & ArithFact (n >= 0)}))). + +Definition def_spc_forwards '(tt : unit) : string := " ". + +Definition def_spc_backwards (s : string) : unit := tt. + +Definition def_spc_matches_prefix (s : string) +: M (option ((unit * {n : Z & ArithFact (n >= 0)}))) := + + (opt_spc_matches_prefix s) + : M (option ((unit * {n : Z & ArithFact (n >= 0)}))). + +Definition xlen := 64. +Hint Unfold xlen : sail. +Definition xlen_max_unsigned := Z.sub (projT1 (pow2 xlen)) 1. +Hint Unfold xlen_max_unsigned : sail. +Definition xlen_max_signed := Z.sub (projT1 (pow2 (Z.sub xlen 1))) 1. +Hint Unfold xlen_max_signed : sail. +Definition xlen_min_signed := Z.sub 0 (projT1 (pow2 (Z.sub xlen 1))). +Hint Unfold xlen_min_signed : sail. +Definition regbits_to_regno (b : mword 5) +: {n : Z & ArithFact (0 <= n /\ (n + 1) <= 32)} := + + build_ex(let 'r := projT1 (uint b) in + r). + +Definition creg2reg_bits (creg : mword 3) +: mword 5 := + + concat_vec (vec_of_bits [B0;B1] : mword 2) creg. + +Definition zreg : regbits := (vec_of_bits [B0;B0;B0;B0;B0] : mword 5). +Hint Unfold zreg : sail. +Definition ra : regbits := (vec_of_bits [B0;B0;B0;B0;B1] : mword 5). +Hint Unfold ra : sail. +Definition sp : regbits := (vec_of_bits [B0;B0;B0;B1;B0] : mword 5). +Hint Unfold sp : sail. +Definition rX (r : Z) `{ArithFact (0 <= r /\ (r + 1) <= 32)} +: M (mword 64) := + + let p0_ := r in + (if sumbool_of_bool ((Z.eqb p0_ 0)) then + returnm ((vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) + : mword 64) + else if sumbool_of_bool ((Z.eqb p0_ 1)) then ((read_reg x1_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 2)) then ((read_reg x2_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 3)) then ((read_reg x3_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 4)) then ((read_reg x4_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 5)) then ((read_reg x5_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 6)) then ((read_reg x6_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 7)) then ((read_reg x7_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 8)) then ((read_reg x8_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 9)) then ((read_reg x9_ref) : M (mword 64)) : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 10)) then + ((read_reg x10_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 11)) then + ((read_reg x11_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 12)) then + ((read_reg x12_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 13)) then + ((read_reg x13_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 14)) then + ((read_reg x14_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 15)) then + ((read_reg x15_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 16)) then + ((read_reg x16_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 17)) then + ((read_reg x17_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 18)) then + ((read_reg x18_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 19)) then + ((read_reg x19_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 20)) then + ((read_reg x20_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 21)) then + ((read_reg x21_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 22)) then + ((read_reg x22_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 23)) then + ((read_reg x23_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 24)) then + ((read_reg x24_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 25)) then + ((read_reg x25_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 26)) then + ((read_reg x26_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 27)) then + ((read_reg x27_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 28)) then + ((read_reg x28_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 29)) then + ((read_reg x29_ref) : M (mword 64)) + : M (xlenbits) + else if sumbool_of_bool ((Z.eqb p0_ 30)) then + ((read_reg x30_ref) : M (mword 64)) + : M (xlenbits) + else ((read_reg x31_ref) : M (mword 64)) : M (xlenbits)) + : M (mword 64). + +Definition rvfi_wX (r : Z) (v : mword 64) `{ArithFact (0 <= r /\ (r + 1) <= 32)} : unit := tt. + +Definition wX (r : Z) (v : mword 64) `{ArithFact (0 <= r /\ (r + 1) <= 32)} +: M (unit) := + + let p0_ := r in + (if sumbool_of_bool ((Z.eqb p0_ 0)) then returnm (tt : unit) + else if sumbool_of_bool ((Z.eqb p0_ 1)) then write_reg x1_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 2)) then write_reg x2_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 3)) then write_reg x3_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 4)) then write_reg x4_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 5)) then write_reg x5_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 6)) then write_reg x6_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 7)) then write_reg x7_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 8)) then write_reg x8_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 9)) then write_reg x9_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 10)) then write_reg x10_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 11)) then write_reg x11_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 12)) then write_reg x12_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 13)) then write_reg x13_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 14)) then write_reg x14_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 15)) then write_reg x15_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 16)) then write_reg x16_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 17)) then write_reg x17_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 18)) then write_reg x18_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 19)) then write_reg x19_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 20)) then write_reg x20_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 21)) then write_reg x21_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 22)) then write_reg x22_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 23)) then write_reg x23_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 24)) then write_reg x24_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 25)) then write_reg x25_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 26)) then write_reg x26_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 27)) then write_reg x27_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 28)) then write_reg x28_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 29)) then write_reg x29_ref v : M (unit) + else if sumbool_of_bool ((Z.eqb p0_ 30)) then write_reg x30_ref v : M (unit) + else write_reg x31_ref v : M (unit)) >> + returnm ((if ((neq_int r 0)) then + let '_ := (rvfi_wX r v) : unit in + print_endline + (String.append "x" + (String.append (string_of_int r) (String.append " <- " (string_of_bits v)))) + else tt) + : unit). + +Definition reg_name_abi (r : mword 5) +: string := + + let b__0 := r in + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B0] : mword 5))))) + then + "zero" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B1] : mword 5))))) + then + "ra" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B1;B0] : mword 5))))) + then + "sp" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B1;B1] : mword 5))))) + then + "gp" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B0;B0] : mword 5))))) + then + "tp" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B0;B1] : mword 5))))) + then + "t0" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B1;B0] : mword 5))))) + then + "t1" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B1;B1] : mword 5))))) + then + "t2" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B0;B0] : mword 5))))) + then + "fp" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B0;B1] : mword 5))))) + then + "s1" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B1;B0] : mword 5))))) + then + "a0" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B1;B1] : mword 5))))) + then + "a1" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B0;B0] : mword 5))))) + then + "a2" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B0;B1] : mword 5))))) + then + "a3" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B1;B0] : mword 5))))) + then + "a4" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B1;B1] : mword 5))))) + then + "a5" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B0;B0] : mword 5))))) + then + "a6" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B0;B1] : mword 5))))) + then + "a7" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B1;B0] : mword 5))))) + then + "s2" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B1;B1] : mword 5))))) + then + "s3" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B0;B0] : mword 5))))) + then + "s4" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B0;B1] : mword 5))))) + then + "s5" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B1;B0] : mword 5))))) + then + "s6" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B1;B1] : mword 5))))) + then + "s7" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B0;B0] : mword 5))))) + then + "s8" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B0;B1] : mword 5))))) + then + "s9" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B1;B0] : mword 5))))) + then + "s10" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B1;B1] : mword 5))))) + then + "s11" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B0;B0] : mword 5))))) + then + "t3" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B0;B1] : mword 5))))) + then + "t4" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B1;B0] : mword 5))))) + then + "t5" + else "t6". + +Definition Architecture_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 2)} +: Architecture := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then RV32 + else if sumbool_of_bool ((Z.eqb p0_ 1)) then RV64 + else RV128. + +Definition num_of_Architecture (arg_ : Architecture) +: {e : Z & ArithFact (0 <= e /\ e <= 2)} := + + build_ex(match arg_ with | RV32 => 0 | RV64 => 1 | RV128 => 2 end). + +Definition architecture (a : mword 2) +: option Architecture := + + let b__0 := a in + if ((eq_vec b__0 (vec_of_bits [B0;B1] : mword 2))) then Some (RV32) + else if ((eq_vec b__0 (vec_of_bits [B1;B0] : mword 2))) then Some (RV64) + else if ((eq_vec b__0 (vec_of_bits [B1;B1] : mword 2))) then Some (RV128) + else None. + +Definition arch_to_bits (a : Architecture) +: mword 2 := + + match a with + | RV32 => (vec_of_bits [B0;B1] : mword 2) + | RV64 => (vec_of_bits [B1;B0] : mword 2) + | RV128 => (vec_of_bits [B1;B1] : mword 2) + end. + +Definition Privilege_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 2)} +: Privilege := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then User + else if sumbool_of_bool ((Z.eqb p0_ 1)) then Supervisor + else Machine. + +Definition num_of_Privilege (arg_ : Privilege) +: {e : Z & ArithFact (0 <= e /\ e <= 2)} := + + build_ex(match arg_ with | User => 0 | Supervisor => 1 | Machine => 2 end). + +Definition privLevel_to_bits (p : Privilege) +: mword 2 := + + match p with + | User => (vec_of_bits [B0;B0] : mword 2) + | Supervisor => (vec_of_bits [B0;B1] : mword 2) + | Machine => (vec_of_bits [B1;B1] : mword 2) + end. + +Definition privLevel_of_bits (p : mword 2) +: Privilege := + + let b__0 := p in + if ((eq_vec b__0 (vec_of_bits [B0;B0] : mword 2))) then User + else if ((eq_vec b__0 (vec_of_bits [B0;B1] : mword 2))) then Supervisor + else Machine. + +Definition privLevel_to_str (p : Privilege) +: string := + + match p with | User => "U" | Supervisor => "S" | Machine => "M" end. + +Definition AccessType_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 3)} +: AccessType := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then Read + else if sumbool_of_bool ((Z.eqb p0_ 1)) then Write + else if sumbool_of_bool ((Z.eqb p0_ 2)) then ReadWrite + else Execute. + +Definition num_of_AccessType (arg_ : AccessType) +: {e : Z & ArithFact (0 <= e /\ e <= 3)} := + + build_ex(match arg_ with | Read => 0 | Write => 1 | ReadWrite => 2 | Execute => 3 end). + +Definition accessType_to_str (a : AccessType) +: string := + + match a with | Read => "R" | Write => "W" | ReadWrite => "RW" | Execute => "X" end. + +Definition ReadType_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 1)} +: ReadType := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then Instruction + else Data. + +Definition num_of_ReadType (arg_ : ReadType) +: {e : Z & ArithFact (0 <= e /\ e <= 1)} := + + build_ex(match arg_ with | Instruction => 0 | Data => 1 end). + +Definition readType_to_str (r : ReadType) +: string := + + match r with | Instruction => "I" | Data => "D" end. + +Definition word_width_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 3)} +: word_width := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then BYTE + else if sumbool_of_bool ((Z.eqb p0_ 1)) then HALF + else if sumbool_of_bool ((Z.eqb p0_ 2)) then WORD + else DOUBLE. + +Definition num_of_word_width (arg_ : word_width) +: {e : Z & ArithFact (0 <= e /\ e <= 3)} := + + build_ex(match arg_ with | BYTE => 0 | HALF => 1 | WORD => 2 | DOUBLE => 3 end). + +Definition InterruptType_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 8)} +: InterruptType := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then I_U_Software + else if sumbool_of_bool ((Z.eqb p0_ 1)) then I_S_Software + else if sumbool_of_bool ((Z.eqb p0_ 2)) then I_M_Software + else if sumbool_of_bool ((Z.eqb p0_ 3)) then I_U_Timer + else if sumbool_of_bool ((Z.eqb p0_ 4)) then I_S_Timer + else if sumbool_of_bool ((Z.eqb p0_ 5)) then I_M_Timer + else if sumbool_of_bool ((Z.eqb p0_ 6)) then I_U_External + else if sumbool_of_bool ((Z.eqb p0_ 7)) then I_S_External + else I_M_External. + +Definition num_of_InterruptType (arg_ : InterruptType) +: {e : Z & ArithFact (0 <= e /\ e <= 8)} := + + build_ex(match arg_ with + | I_U_Software => 0 + | I_S_Software => 1 + | I_M_Software => 2 + | I_U_Timer => 3 + | I_S_Timer => 4 + | I_M_Timer => 5 + | I_U_External => 6 + | I_S_External => 7 + | I_M_External => 8 + end). + +Definition interruptType_to_bits (i : InterruptType) +: mword 4 := + + match i with + | I_U_Software => (vec_of_bits [B0;B0;B0;B0] : mword 4) + | I_S_Software => (vec_of_bits [B0;B0;B0;B1] : mword 4) + | I_M_Software => (vec_of_bits [B0;B0;B1;B1] : mword 4) + | I_U_Timer => (vec_of_bits [B0;B1;B0;B0] : mword 4) + | I_S_Timer => (vec_of_bits [B0;B1;B0;B1] : mword 4) + | I_M_Timer => (vec_of_bits [B0;B1;B1;B1] : mword 4) + | I_U_External => (vec_of_bits [B1;B0;B0;B0] : mword 4) + | I_S_External => (vec_of_bits [B1;B0;B0;B1] : mword 4) + | I_M_External => (vec_of_bits [B1;B0;B1;B1] : mword 4) + end. + +Definition ExceptionType_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 15)} +: ExceptionType := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then E_Fetch_Addr_Align + else if sumbool_of_bool ((Z.eqb p0_ 1)) then E_Fetch_Access_Fault + else if sumbool_of_bool ((Z.eqb p0_ 2)) then E_Illegal_Instr + else if sumbool_of_bool ((Z.eqb p0_ 3)) then E_Breakpoint + else if sumbool_of_bool ((Z.eqb p0_ 4)) then E_Load_Addr_Align + else if sumbool_of_bool ((Z.eqb p0_ 5)) then E_Load_Access_Fault + else if sumbool_of_bool ((Z.eqb p0_ 6)) then E_SAMO_Addr_Align + else if sumbool_of_bool ((Z.eqb p0_ 7)) then E_SAMO_Access_Fault + else if sumbool_of_bool ((Z.eqb p0_ 8)) then E_U_EnvCall + else if sumbool_of_bool ((Z.eqb p0_ 9)) then E_S_EnvCall + else if sumbool_of_bool ((Z.eqb p0_ 10)) then E_Reserved_10 + else if sumbool_of_bool ((Z.eqb p0_ 11)) then E_M_EnvCall + else if sumbool_of_bool ((Z.eqb p0_ 12)) then E_Fetch_Page_Fault + else if sumbool_of_bool ((Z.eqb p0_ 13)) then E_Load_Page_Fault + else if sumbool_of_bool ((Z.eqb p0_ 14)) then E_Reserved_14 + else E_SAMO_Page_Fault. + +Definition num_of_ExceptionType (arg_ : ExceptionType) +: {e : Z & ArithFact (0 <= e /\ e <= 15)} := + + build_ex(match arg_ with + | E_Fetch_Addr_Align => 0 + | E_Fetch_Access_Fault => 1 + | E_Illegal_Instr => 2 + | E_Breakpoint => 3 + | E_Load_Addr_Align => 4 + | E_Load_Access_Fault => 5 + | E_SAMO_Addr_Align => 6 + | E_SAMO_Access_Fault => 7 + | E_U_EnvCall => 8 + | E_S_EnvCall => 9 + | E_Reserved_10 => 10 + | E_M_EnvCall => 11 + | E_Fetch_Page_Fault => 12 + | E_Load_Page_Fault => 13 + | E_Reserved_14 => 14 + | E_SAMO_Page_Fault => 15 + end). + +Definition exceptionType_to_bits (e : ExceptionType) +: mword 4 := + + match e with + | E_Fetch_Addr_Align => (vec_of_bits [B0;B0;B0;B0] : mword 4) + | E_Fetch_Access_Fault => (vec_of_bits [B0;B0;B0;B1] : mword 4) + | E_Illegal_Instr => (vec_of_bits [B0;B0;B1;B0] : mword 4) + | E_Breakpoint => (vec_of_bits [B0;B0;B1;B1] : mword 4) + | E_Load_Addr_Align => (vec_of_bits [B0;B1;B0;B0] : mword 4) + | E_Load_Access_Fault => (vec_of_bits [B0;B1;B0;B1] : mword 4) + | E_SAMO_Addr_Align => (vec_of_bits [B0;B1;B1;B0] : mword 4) + | E_SAMO_Access_Fault => (vec_of_bits [B0;B1;B1;B1] : mword 4) + | E_U_EnvCall => (vec_of_bits [B1;B0;B0;B0] : mword 4) + | E_S_EnvCall => (vec_of_bits [B1;B0;B0;B1] : mword 4) + | E_Reserved_10 => (vec_of_bits [B1;B0;B1;B0] : mword 4) + | E_M_EnvCall => (vec_of_bits [B1;B0;B1;B1] : mword 4) + | E_Fetch_Page_Fault => (vec_of_bits [B1;B1;B0;B0] : mword 4) + | E_Load_Page_Fault => (vec_of_bits [B1;B1;B0;B1] : mword 4) + | E_Reserved_14 => (vec_of_bits [B1;B1;B1;B0] : mword 4) + | E_SAMO_Page_Fault => (vec_of_bits [B1;B1;B1;B1] : mword 4) + end. + +Definition exceptionType_to_str (e : ExceptionType) +: string := + + match e with + | E_Fetch_Addr_Align => "misaligned-fetch" + | E_Fetch_Access_Fault => "fetch-access-fault" + | E_Illegal_Instr => "illegal-instruction" + | E_Breakpoint => "breakpoint" + | E_Load_Addr_Align => "misaligned-load" + | E_Load_Access_Fault => "load-access-fault" + | E_SAMO_Addr_Align => "misaliged-store/amo" + | E_SAMO_Access_Fault => "store/amo-access-fault" + | E_U_EnvCall => "u-call" + | E_S_EnvCall => "s-call" + | E_Reserved_10 => "reserved-0" + | E_M_EnvCall => "m-call" + | E_Fetch_Page_Fault => "fetch-page-fault" + | E_Load_Page_Fault => "load-page-fault" + | E_Reserved_14 => "reserved-1" + | E_SAMO_Page_Fault => "store/amo-page-fault" + end. + +Definition not_implemented {a : Type} (message : string) +: M (a) := + + (throw (Error_not_implemented + (message))) + : M (a). + +Definition internal_error {a : Type} (s : string) +: M (a) := + + assert_exp' false s >>= fun _ => (throw (Error_internal_error (tt))) : M (a). + +Definition TrapVectorMode_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 2)} +: TrapVectorMode := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then TV_Direct + else if sumbool_of_bool ((Z.eqb p0_ 1)) then TV_Vector + else TV_Reserved. + +Definition num_of_TrapVectorMode (arg_ : TrapVectorMode) +: {e : Z & ArithFact (0 <= e /\ e <= 2)} := + + build_ex(match arg_ with | TV_Direct => 0 | TV_Vector => 1 | TV_Reserved => 2 end). + +Definition trapVectorMode_of_bits (m : mword 2) +: TrapVectorMode := + + let b__0 := m in + if ((eq_vec b__0 (vec_of_bits [B0;B0] : mword 2))) then TV_Direct + else if ((eq_vec b__0 (vec_of_bits [B0;B1] : mword 2))) then TV_Vector + else TV_Reserved. + +Definition ExtStatus_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 3)} +: ExtStatus := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then Off + else if sumbool_of_bool ((Z.eqb p0_ 1)) then Initial + else if sumbool_of_bool ((Z.eqb p0_ 2)) then Clean + else Dirty. + +Definition num_of_ExtStatus (arg_ : ExtStatus) +: {e : Z & ArithFact (0 <= e /\ e <= 3)} := + + build_ex(match arg_ with | Off => 0 | Initial => 1 | Clean => 2 | Dirty => 3 end). + +Definition extStatus_to_bits (e : ExtStatus) +: mword 2 := + + match e with + | Off => (vec_of_bits [B0;B0] : mword 2) + | Initial => (vec_of_bits [B0;B1] : mword 2) + | Clean => (vec_of_bits [B1;B0] : mword 2) + | Dirty => (vec_of_bits [B1;B1] : mword 2) + end. + +Definition extStatus_of_bits (e : mword 2) +: ExtStatus := + + let b__0 := e in + if ((eq_vec b__0 (vec_of_bits [B0;B0] : mword 2))) then Off + else if ((eq_vec b__0 (vec_of_bits [B0;B1] : mword 2))) then Initial + else if ((eq_vec b__0 (vec_of_bits [B1;B0] : mword 2))) then Clean + else Dirty. + +Definition SATPMode_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 2)} +: SATPMode := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then Sbare + else if sumbool_of_bool ((Z.eqb p0_ 1)) then Sv32 + else Sv39. + +Definition num_of_SATPMode (arg_ : SATPMode) +: {e : Z & ArithFact (0 <= e /\ e <= 2)} := + + build_ex(match arg_ with | Sbare => 0 | Sv32 => 1 | Sv39 => 2 end). + +Definition satpMode_of_bits (a : Architecture) (m : mword 4) +: option SATPMode := + + match (a, m) with + | (g__39, b__0) => + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0] : mword 4))) then Some (Sbare) + else + match (g__39, b__0) with + | (RV32, b__0) => + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1] : mword 4))) then Some (Sv32) + else match (RV32, b__0) with | (g__40, g__41) => None end + | (RV64, b__0) => + if ((eq_vec b__0 (vec_of_bits [B1;B0;B0;B0] : mword 4))) then Some (Sv39) + else match (RV64, b__0) with | (g__40, g__41) => None end + | (g__40, g__41) => None + end + end. + +Definition uop_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 1)} +: uop := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then RISCV_LUI + else RISCV_AUIPC. + +Definition num_of_uop (arg_ : uop) +: {e : Z & ArithFact (0 <= e /\ e <= 1)} := + + build_ex(match arg_ with | RISCV_LUI => 0 | RISCV_AUIPC => 1 end). + +Definition bop_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 5)} +: bop := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then RISCV_BEQ + else if sumbool_of_bool ((Z.eqb p0_ 1)) then RISCV_BNE + else if sumbool_of_bool ((Z.eqb p0_ 2)) then RISCV_BLT + else if sumbool_of_bool ((Z.eqb p0_ 3)) then RISCV_BGE + else if sumbool_of_bool ((Z.eqb p0_ 4)) then RISCV_BLTU + else RISCV_BGEU. + +Definition num_of_bop (arg_ : bop) +: {e : Z & ArithFact (0 <= e /\ e <= 5)} := + + build_ex(match arg_ with + | RISCV_BEQ => 0 + | RISCV_BNE => 1 + | RISCV_BLT => 2 + | RISCV_BGE => 3 + | RISCV_BLTU => 4 + | RISCV_BGEU => 5 + end). + +Definition iop_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 5)} +: iop := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then RISCV_ADDI + else if sumbool_of_bool ((Z.eqb p0_ 1)) then RISCV_SLTI + else if sumbool_of_bool ((Z.eqb p0_ 2)) then RISCV_SLTIU + else if sumbool_of_bool ((Z.eqb p0_ 3)) then RISCV_XORI + else if sumbool_of_bool ((Z.eqb p0_ 4)) then RISCV_ORI + else RISCV_ANDI. + +Definition num_of_iop (arg_ : iop) +: {e : Z & ArithFact (0 <= e /\ e <= 5)} := + + build_ex(match arg_ with + | RISCV_ADDI => 0 + | RISCV_SLTI => 1 + | RISCV_SLTIU => 2 + | RISCV_XORI => 3 + | RISCV_ORI => 4 + | RISCV_ANDI => 5 + end). + +Definition sop_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 2)} +: sop := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then RISCV_SLLI + else if sumbool_of_bool ((Z.eqb p0_ 1)) then RISCV_SRLI + else RISCV_SRAI. + +Definition num_of_sop (arg_ : sop) +: {e : Z & ArithFact (0 <= e /\ e <= 2)} := + + build_ex(match arg_ with | RISCV_SLLI => 0 | RISCV_SRLI => 1 | RISCV_SRAI => 2 end). + +Definition rop_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 9)} +: rop := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then RISCV_ADD + else if sumbool_of_bool ((Z.eqb p0_ 1)) then RISCV_SUB + else if sumbool_of_bool ((Z.eqb p0_ 2)) then RISCV_SLL + else if sumbool_of_bool ((Z.eqb p0_ 3)) then RISCV_SLT + else if sumbool_of_bool ((Z.eqb p0_ 4)) then RISCV_SLTU + else if sumbool_of_bool ((Z.eqb p0_ 5)) then RISCV_XOR + else if sumbool_of_bool ((Z.eqb p0_ 6)) then RISCV_SRL + else if sumbool_of_bool ((Z.eqb p0_ 7)) then RISCV_SRA + else if sumbool_of_bool ((Z.eqb p0_ 8)) then RISCV_OR + else RISCV_AND. + +Definition num_of_rop (arg_ : rop) +: {e : Z & ArithFact (0 <= e /\ e <= 9)} := + + build_ex(match arg_ with + | RISCV_ADD => 0 + | RISCV_SUB => 1 + | RISCV_SLL => 2 + | RISCV_SLT => 3 + | RISCV_SLTU => 4 + | RISCV_XOR => 5 + | RISCV_SRL => 6 + | RISCV_SRA => 7 + | RISCV_OR => 8 + | RISCV_AND => 9 + end). + +Definition ropw_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 4)} +: ropw := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then RISCV_ADDW + else if sumbool_of_bool ((Z.eqb p0_ 1)) then RISCV_SUBW + else if sumbool_of_bool ((Z.eqb p0_ 2)) then RISCV_SLLW + else if sumbool_of_bool ((Z.eqb p0_ 3)) then RISCV_SRLW + else RISCV_SRAW. + +Definition num_of_ropw (arg_ : ropw) +: {e : Z & ArithFact (0 <= e /\ e <= 4)} := + + build_ex(match arg_ with + | RISCV_ADDW => 0 + | RISCV_SUBW => 1 + | RISCV_SLLW => 2 + | RISCV_SRLW => 3 + | RISCV_SRAW => 4 + end). + +Definition sopw_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 2)} +: sopw := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then RISCV_SLLIW + else if sumbool_of_bool ((Z.eqb p0_ 1)) then RISCV_SRLIW + else RISCV_SRAIW. + +Definition num_of_sopw (arg_ : sopw) +: {e : Z & ArithFact (0 <= e /\ e <= 2)} := + + build_ex(match arg_ with | RISCV_SLLIW => 0 | RISCV_SRLIW => 1 | RISCV_SRAIW => 2 end). + +Definition amoop_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 8)} +: amoop := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then AMOSWAP + else if sumbool_of_bool ((Z.eqb p0_ 1)) then AMOADD + else if sumbool_of_bool ((Z.eqb p0_ 2)) then AMOXOR + else if sumbool_of_bool ((Z.eqb p0_ 3)) then AMOAND + else if sumbool_of_bool ((Z.eqb p0_ 4)) then AMOOR + else if sumbool_of_bool ((Z.eqb p0_ 5)) then AMOMIN + else if sumbool_of_bool ((Z.eqb p0_ 6)) then AMOMAX + else if sumbool_of_bool ((Z.eqb p0_ 7)) then AMOMINU + else AMOMAXU. + +Definition num_of_amoop (arg_ : amoop) +: {e : Z & ArithFact (0 <= e /\ e <= 8)} := + + build_ex(match arg_ with + | AMOSWAP => 0 + | AMOADD => 1 + | AMOXOR => 2 + | AMOAND => 3 + | AMOOR => 4 + | AMOMIN => 5 + | AMOMAX => 6 + | AMOMINU => 7 + | AMOMAXU => 8 + end). + +Definition csrop_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 2)} +: csrop := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then CSRRW + else if sumbool_of_bool ((Z.eqb p0_ 1)) then CSRRS + else CSRRC. + +Definition num_of_csrop (arg_ : csrop) +: {e : Z & ArithFact (0 <= e /\ e <= 2)} := + + build_ex(match arg_ with | CSRRW => 0 | CSRRS => 1 | CSRRC => 2 end). + +Definition reg_name_forwards (arg_ : mword 5) +: string := + + let b__0 := arg_ in + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B0] : mword 5))))) + then + "zero" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B1] : mword 5))))) + then + "ra" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B1;B0] : mword 5))))) + then + "sp" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B1;B1] : mword 5))))) + then + "gp" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B0;B0] : mword 5))))) + then + "tp" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B0;B1] : mword 5))))) + then + "t0" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B1;B0] : mword 5))))) + then + "t1" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B1;B1] : mword 5))))) + then + "t2" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B0;B0] : mword 5))))) + then + "fp" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B0;B1] : mword 5))))) + then + "s1" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B1;B0] : mword 5))))) + then + "a0" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B1;B1] : mword 5))))) + then + "a1" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B0;B0] : mword 5))))) + then + "a2" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B0;B1] : mword 5))))) + then + "a3" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B1;B0] : mword 5))))) + then + "a4" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B1;B1] : mword 5))))) + then + "a5" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B0;B0] : mword 5))))) + then + "a6" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B0;B1] : mword 5))))) + then + "a7" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B1;B0] : mword 5))))) + then + "s2" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B1;B1] : mword 5))))) + then + "s3" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B0;B0] : mword 5))))) + then + "s4" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B0;B1] : mword 5))))) + then + "s5" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B1;B0] : mword 5))))) + then + "s6" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B1;B1] : mword 5))))) + then + "s7" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B0;B0] : mword 5))))) + then + "s8" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B0;B1] : mword 5))))) + then + "s9" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B1;B0] : mword 5))))) + then + "s10" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B1;B1] : mword 5))))) + then + "s11" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B0;B0] : mword 5))))) + then + "t3" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B0;B1] : mword 5))))) + then + "t4" + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B1;B0] : mword 5))))) + then + "t5" + else "t6". + +Definition reg_name_backwards (arg_ : string) +: mword 5 := + + let p0_ := arg_ in + if ((generic_eq p0_ "zero")) then (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + else if ((generic_eq p0_ "ra")) then (vec_of_bits [B0;B0;B0;B0;B1] : mword 5) + else if ((generic_eq p0_ "sp")) then (vec_of_bits [B0;B0;B0;B1;B0] : mword 5) + else if ((generic_eq p0_ "gp")) then (vec_of_bits [B0;B0;B0;B1;B1] : mword 5) + else if ((generic_eq p0_ "tp")) then (vec_of_bits [B0;B0;B1;B0;B0] : mword 5) + else if ((generic_eq p0_ "t0")) then (vec_of_bits [B0;B0;B1;B0;B1] : mword 5) + else if ((generic_eq p0_ "t1")) then (vec_of_bits [B0;B0;B1;B1;B0] : mword 5) + else if ((generic_eq p0_ "t2")) then (vec_of_bits [B0;B0;B1;B1;B1] : mword 5) + else if ((generic_eq p0_ "fp")) then (vec_of_bits [B0;B1;B0;B0;B0] : mword 5) + else if ((generic_eq p0_ "s1")) then (vec_of_bits [B0;B1;B0;B0;B1] : mword 5) + else if ((generic_eq p0_ "a0")) then (vec_of_bits [B0;B1;B0;B1;B0] : mword 5) + else if ((generic_eq p0_ "a1")) then (vec_of_bits [B0;B1;B0;B1;B1] : mword 5) + else if ((generic_eq p0_ "a2")) then (vec_of_bits [B0;B1;B1;B0;B0] : mword 5) + else if ((generic_eq p0_ "a3")) then (vec_of_bits [B0;B1;B1;B0;B1] : mword 5) + else if ((generic_eq p0_ "a4")) then (vec_of_bits [B0;B1;B1;B1;B0] : mword 5) + else if ((generic_eq p0_ "a5")) then (vec_of_bits [B0;B1;B1;B1;B1] : mword 5) + else if ((generic_eq p0_ "a6")) then (vec_of_bits [B1;B0;B0;B0;B0] : mword 5) + else if ((generic_eq p0_ "a7")) then (vec_of_bits [B1;B0;B0;B0;B1] : mword 5) + else if ((generic_eq p0_ "s2")) then (vec_of_bits [B1;B0;B0;B1;B0] : mword 5) + else if ((generic_eq p0_ "s3")) then (vec_of_bits [B1;B0;B0;B1;B1] : mword 5) + else if ((generic_eq p0_ "s4")) then (vec_of_bits [B1;B0;B1;B0;B0] : mword 5) + else if ((generic_eq p0_ "s5")) then (vec_of_bits [B1;B0;B1;B0;B1] : mword 5) + else if ((generic_eq p0_ "s6")) then (vec_of_bits [B1;B0;B1;B1;B0] : mword 5) + else if ((generic_eq p0_ "s7")) then (vec_of_bits [B1;B0;B1;B1;B1] : mword 5) + else if ((generic_eq p0_ "s8")) then (vec_of_bits [B1;B1;B0;B0;B0] : mword 5) + else if ((generic_eq p0_ "s9")) then (vec_of_bits [B1;B1;B0;B0;B1] : mword 5) + else if ((generic_eq p0_ "s10")) then (vec_of_bits [B1;B1;B0;B1;B0] : mword 5) + else if ((generic_eq p0_ "s11")) then (vec_of_bits [B1;B1;B0;B1;B1] : mword 5) + else if ((generic_eq p0_ "t3")) then (vec_of_bits [B1;B1;B1;B0;B0] : mword 5) + else if ((generic_eq p0_ "t4")) then (vec_of_bits [B1;B1;B1;B0;B1] : mword 5) + else if ((generic_eq p0_ "t5")) then (vec_of_bits [B1;B1;B1;B1;B0] : mword 5) + else (vec_of_bits [B1;B1;B1;B1;B1] : mword 5). + +Definition reg_name_forwards_matches (arg_ : mword 5) +: bool := + + let b__0 := arg_ in + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B1;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B1;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B1;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B1;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B1;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B1;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B1;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B1;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B1;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B1;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B1;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B1;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B1;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B1;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B1;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B1;B1] : mword 5))))) + then + true + else false. + +Definition reg_name_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "zero")) then true + else if ((generic_eq p0_ "ra")) then true + else if ((generic_eq p0_ "sp")) then true + else if ((generic_eq p0_ "gp")) then true + else if ((generic_eq p0_ "tp")) then true + else if ((generic_eq p0_ "t0")) then true + else if ((generic_eq p0_ "t1")) then true + else if ((generic_eq p0_ "t2")) then true + else if ((generic_eq p0_ "fp")) then true + else if ((generic_eq p0_ "s1")) then true + else if ((generic_eq p0_ "a0")) then true + else if ((generic_eq p0_ "a1")) then true + else if ((generic_eq p0_ "a2")) then true + else if ((generic_eq p0_ "a3")) then true + else if ((generic_eq p0_ "a4")) then true + else if ((generic_eq p0_ "a5")) then true + else if ((generic_eq p0_ "a6")) then true + else if ((generic_eq p0_ "a7")) then true + else if ((generic_eq p0_ "s2")) then true + else if ((generic_eq p0_ "s3")) then true + else if ((generic_eq p0_ "s4")) then true + else if ((generic_eq p0_ "s5")) then true + else if ((generic_eq p0_ "s6")) then true + else if ((generic_eq p0_ "s7")) then true + else if ((generic_eq p0_ "s8")) then true + else if ((generic_eq p0_ "s9")) then true + else if ((generic_eq p0_ "s10")) then true + else if ((generic_eq p0_ "s11")) then true + else if ((generic_eq p0_ "t3")) then true + else if ((generic_eq p0_ "t4")) then true + else if ((generic_eq p0_ "t5")) then true + else if ((generic_eq p0_ "t6")) then true + else false. + +Definition _s124_ (_s125_ : string) +: option string := + + let _s126_ := _s125_ in + if ((string_startswith _s126_ "t6")) then + match (string_drop _s126_ (projT1 (string_length "t6"))) with | s_ => Some (s_) end + else None. + +Definition _s120_ (_s121_ : string) +: option string := + + let _s122_ := _s121_ in + if ((string_startswith _s122_ "t5")) then + match (string_drop _s122_ (projT1 (string_length "t5"))) with | s_ => Some (s_) end + else None. + +Definition _s116_ (_s117_ : string) +: option string := + + let _s118_ := _s117_ in + if ((string_startswith _s118_ "t4")) then + match (string_drop _s118_ (projT1 (string_length "t4"))) with | s_ => Some (s_) end + else None. + +Definition _s112_ (_s113_ : string) +: option string := + + let _s114_ := _s113_ in + if ((string_startswith _s114_ "t3")) then + match (string_drop _s114_ (projT1 (string_length "t3"))) with | s_ => Some (s_) end + else None. + +Definition _s108_ (_s109_ : string) +: option string := + + let _s110_ := _s109_ in + if ((string_startswith _s110_ "s11")) then + match (string_drop _s110_ (projT1 (string_length "s11"))) with | s_ => Some (s_) end + else None. + +Definition _s104_ (_s105_ : string) +: option string := + + let _s106_ := _s105_ in + if ((string_startswith _s106_ "s10")) then + match (string_drop _s106_ (projT1 (string_length "s10"))) with | s_ => Some (s_) end + else None. + +Definition _s100_ (_s101_ : string) +: option string := + + let _s102_ := _s101_ in + if ((string_startswith _s102_ "s9")) then + match (string_drop _s102_ (projT1 (string_length "s9"))) with | s_ => Some (s_) end + else None. + +Definition _s96_ (_s97_ : string) +: option string := + + let _s98_ := _s97_ in + if ((string_startswith _s98_ "s8")) then + match (string_drop _s98_ (projT1 (string_length "s8"))) with | s_ => Some (s_) end + else None. + +Definition _s92_ (_s93_ : string) +: option string := + + let _s94_ := _s93_ in + if ((string_startswith _s94_ "s7")) then + match (string_drop _s94_ (projT1 (string_length "s7"))) with | s_ => Some (s_) end + else None. + +Definition _s88_ (_s89_ : string) +: option string := + + let _s90_ := _s89_ in + if ((string_startswith _s90_ "s6")) then + match (string_drop _s90_ (projT1 (string_length "s6"))) with | s_ => Some (s_) end + else None. + +Definition _s84_ (_s85_ : string) +: option string := + + let _s86_ := _s85_ in + if ((string_startswith _s86_ "s5")) then + match (string_drop _s86_ (projT1 (string_length "s5"))) with | s_ => Some (s_) end + else None. + +Definition _s80_ (_s81_ : string) +: option string := + + let _s82_ := _s81_ in + if ((string_startswith _s82_ "s4")) then + match (string_drop _s82_ (projT1 (string_length "s4"))) with | s_ => Some (s_) end + else None. + +Definition _s76_ (_s77_ : string) +: option string := + + let _s78_ := _s77_ in + if ((string_startswith _s78_ "s3")) then + match (string_drop _s78_ (projT1 (string_length "s3"))) with | s_ => Some (s_) end + else None. + +Definition _s72_ (_s73_ : string) +: option string := + + let _s74_ := _s73_ in + if ((string_startswith _s74_ "s2")) then + match (string_drop _s74_ (projT1 (string_length "s2"))) with | s_ => Some (s_) end + else None. + +Definition _s68_ (_s69_ : string) +: option string := + + let _s70_ := _s69_ in + if ((string_startswith _s70_ "a7")) then + match (string_drop _s70_ (projT1 (string_length "a7"))) with | s_ => Some (s_) end + else None. + +Definition _s64_ (_s65_ : string) +: option string := + + let _s66_ := _s65_ in + if ((string_startswith _s66_ "a6")) then + match (string_drop _s66_ (projT1 (string_length "a6"))) with | s_ => Some (s_) end + else None. + +Definition _s60_ (_s61_ : string) +: option string := + + let _s62_ := _s61_ in + if ((string_startswith _s62_ "a5")) then + match (string_drop _s62_ (projT1 (string_length "a5"))) with | s_ => Some (s_) end + else None. + +Definition _s56_ (_s57_ : string) +: option string := + + let _s58_ := _s57_ in + if ((string_startswith _s58_ "a4")) then + match (string_drop _s58_ (projT1 (string_length "a4"))) with | s_ => Some (s_) end + else None. + +Definition _s52_ (_s53_ : string) +: option string := + + let _s54_ := _s53_ in + if ((string_startswith _s54_ "a3")) then + match (string_drop _s54_ (projT1 (string_length "a3"))) with | s_ => Some (s_) end + else None. + +Definition _s48_ (_s49_ : string) +: option string := + + let _s50_ := _s49_ in + if ((string_startswith _s50_ "a2")) then + match (string_drop _s50_ (projT1 (string_length "a2"))) with | s_ => Some (s_) end + else None. + +Definition _s44_ (_s45_ : string) +: option string := + + let _s46_ := _s45_ in + if ((string_startswith _s46_ "a1")) then + match (string_drop _s46_ (projT1 (string_length "a1"))) with | s_ => Some (s_) end + else None. + +Definition _s40_ (_s41_ : string) +: option string := + + let _s42_ := _s41_ in + if ((string_startswith _s42_ "a0")) then + match (string_drop _s42_ (projT1 (string_length "a0"))) with | s_ => Some (s_) end + else None. + +Definition _s36_ (_s37_ : string) +: option string := + + let _s38_ := _s37_ in + if ((string_startswith _s38_ "s1")) then + match (string_drop _s38_ (projT1 (string_length "s1"))) with | s_ => Some (s_) end + else None. + +Definition _s32_ (_s33_ : string) +: option string := + + let _s34_ := _s33_ in + if ((string_startswith _s34_ "fp")) then + match (string_drop _s34_ (projT1 (string_length "fp"))) with | s_ => Some (s_) end + else None. + +Definition _s28_ (_s29_ : string) +: option string := + + let _s30_ := _s29_ in + if ((string_startswith _s30_ "t2")) then + match (string_drop _s30_ (projT1 (string_length "t2"))) with | s_ => Some (s_) end + else None. + +Definition _s24_ (_s25_ : string) +: option string := + + let _s26_ := _s25_ in + if ((string_startswith _s26_ "t1")) then + match (string_drop _s26_ (projT1 (string_length "t1"))) with | s_ => Some (s_) end + else None. + +Definition _s20_ (_s21_ : string) +: option string := + + let _s22_ := _s21_ in + if ((string_startswith _s22_ "t0")) then + match (string_drop _s22_ (projT1 (string_length "t0"))) with | s_ => Some (s_) end + else None. + +Definition _s16_ (_s17_ : string) +: option string := + + let _s18_ := _s17_ in + if ((string_startswith _s18_ "tp")) then + match (string_drop _s18_ (projT1 (string_length "tp"))) with | s_ => Some (s_) end + else None. + +Definition _s12_ (_s13_ : string) +: option string := + + let _s14_ := _s13_ in + if ((string_startswith _s14_ "gp")) then + match (string_drop _s14_ (projT1 (string_length "gp"))) with | s_ => Some (s_) end + else None. + +Definition _s8_ (_s9_ : string) +: option string := + + let _s10_ := _s9_ in + if ((string_startswith _s10_ "sp")) then + match (string_drop _s10_ (projT1 (string_length "sp"))) with | s_ => Some (s_) end + else None. + +Definition _s4_ (_s5_ : string) +: option string := + + let _s6_ := _s5_ in + if ((string_startswith _s6_ "ra")) then + match (string_drop _s6_ (projT1 (string_length "ra"))) with | s_ => Some (s_) end + else None. + +Definition _s0_ (_s1_ : string) +: option string := + + let _s2_ := _s1_ in + if ((string_startswith _s2_ "zero")) then + match (string_drop _s2_ (projT1 (string_length "zero"))) with | s_ => Some (s_) end + else None. + +Definition reg_name_matches_prefix (arg_ : string) +: M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) := + + let _s3_ := arg_ in + (if ((match (_s0_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s0_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s4_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s4_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s8_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s8_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s12_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s12_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s16_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s16_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B0;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s20_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s20_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B0;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s24_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s24_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s28_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s28_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s32_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s32_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B0;B0;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s36_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s36_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B0;B0;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s40_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s40_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B0;B1;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s44_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s44_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B0;B1;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s48_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s48_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1;B0;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s52_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s52_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1;B0;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s56_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s56_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1;B1;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s60_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s60_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1;B1;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s64_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s64_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B0;B0;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s68_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s68_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B0;B0;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s72_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s72_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B0;B1;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s76_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s76_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B0;B1;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s80_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s80_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1;B0;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s84_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s84_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1;B0;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s88_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s88_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1;B1;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s92_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s92_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1;B1;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s96_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s96_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B0;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s100_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s100_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B0;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s104_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s104_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B1;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s108_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s108_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B1;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s112_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s112_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1;B0;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s116_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s116_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1;B0;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s120_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s120_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1;B1;B0] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s124_ _s3_) with | Some (s_) => true | _ => false end)) then + (match (_s124_ _s3_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1;B1;B1] : mword 5), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((mword 5 * {n : Z & ArithFact (n >= 0)})))) + : M (option ((mword 5 * {n : Z & ArithFact (n >= 0)}))). + +Definition creg_name_forwards (arg_ : mword 3) +: string := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0] : mword 3))) then "s0" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1] : mword 3))) then "s1" + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B0] : mword 3))) then "a0" + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1] : mword 3))) then "a1" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B0] : mword 3))) then "a2" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1] : mword 3))) then "a3" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0] : mword 3))) then "a4" + else "a5". + +Definition creg_name_backwards (arg_ : string) +: mword 3 := + + let p0_ := arg_ in + if ((generic_eq p0_ "s0")) then (vec_of_bits [B0;B0;B0] : mword 3) + else if ((generic_eq p0_ "s1")) then (vec_of_bits [B0;B0;B1] : mword 3) + else if ((generic_eq p0_ "a0")) then (vec_of_bits [B0;B1;B0] : mword 3) + else if ((generic_eq p0_ "a1")) then (vec_of_bits [B0;B1;B1] : mword 3) + else if ((generic_eq p0_ "a2")) then (vec_of_bits [B1;B0;B0] : mword 3) + else if ((generic_eq p0_ "a3")) then (vec_of_bits [B1;B0;B1] : mword 3) + else if ((generic_eq p0_ "a4")) then (vec_of_bits [B1;B1;B0] : mword 3) + else (vec_of_bits [B1;B1;B1] : mword 3). + +Definition creg_name_forwards_matches (arg_ : mword 3) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1] : mword 3))) then true + else false. + +Definition creg_name_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "s0")) then true + else if ((generic_eq p0_ "s1")) then true + else if ((generic_eq p0_ "a0")) then true + else if ((generic_eq p0_ "a1")) then true + else if ((generic_eq p0_ "a2")) then true + else if ((generic_eq p0_ "a3")) then true + else if ((generic_eq p0_ "a4")) then true + else if ((generic_eq p0_ "a5")) then true + else false. + +Definition _s156_ (_s157_ : string) +: option string := + + let _s158_ := _s157_ in + if ((string_startswith _s158_ "a5")) then + match (string_drop _s158_ (projT1 (string_length "a5"))) with | s_ => Some (s_) end + else None. + +Definition _s152_ (_s153_ : string) +: option string := + + let _s154_ := _s153_ in + if ((string_startswith _s154_ "a4")) then + match (string_drop _s154_ (projT1 (string_length "a4"))) with | s_ => Some (s_) end + else None. + +Definition _s148_ (_s149_ : string) +: option string := + + let _s150_ := _s149_ in + if ((string_startswith _s150_ "a3")) then + match (string_drop _s150_ (projT1 (string_length "a3"))) with | s_ => Some (s_) end + else None. + +Definition _s144_ (_s145_ : string) +: option string := + + let _s146_ := _s145_ in + if ((string_startswith _s146_ "a2")) then + match (string_drop _s146_ (projT1 (string_length "a2"))) with | s_ => Some (s_) end + else None. + +Definition _s140_ (_s141_ : string) +: option string := + + let _s142_ := _s141_ in + if ((string_startswith _s142_ "a1")) then + match (string_drop _s142_ (projT1 (string_length "a1"))) with | s_ => Some (s_) end + else None. + +Definition _s136_ (_s137_ : string) +: option string := + + let _s138_ := _s137_ in + if ((string_startswith _s138_ "a0")) then + match (string_drop _s138_ (projT1 (string_length "a0"))) with | s_ => Some (s_) end + else None. + +Definition _s132_ (_s133_ : string) +: option string := + + let _s134_ := _s133_ in + if ((string_startswith _s134_ "s1")) then + match (string_drop _s134_ (projT1 (string_length "s1"))) with | s_ => Some (s_) end + else None. + +Definition _s128_ (_s129_ : string) +: option string := + + let _s130_ := _s129_ in + if ((string_startswith _s130_ "s0")) then + match (string_drop _s130_ (projT1 (string_length "s0"))) with | s_ => Some (s_) end + else None. + +Definition creg_name_matches_prefix (arg_ : string) +: M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) := + + let _s131_ := arg_ in + (if ((match (_s128_ _s131_) with | Some (s_) => true | _ => false end)) then + (match (_s128_ _s131_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0] : mword 3), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s132_ _s131_) with | Some (s_) => true | _ => false end)) then + (match (_s132_ _s131_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1] : mword 3), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s136_ _s131_) with | Some (s_) => true | _ => false end)) then + (match (_s136_ _s131_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B0] : mword 3), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s140_ _s131_) with | Some (s_) => true | _ => false end)) then + (match (_s140_ _s131_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1] : mword 3), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s144_ _s131_) with | Some (s_) => true | _ => false end)) then + (match (_s144_ _s131_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B0] : mword 3), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s148_ _s131_) with | Some (s_) => true | _ => false end)) then + (match (_s148_ _s131_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1] : mword 3), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s152_ _s131_) with | Some (s_) => true | _ => false end)) then + (match (_s152_ _s131_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0] : mword 3), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s156_ _s131_) with | Some (s_) => true | _ => false end)) then + (match (_s156_ _s131_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1] : mword 3), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((mword 3 * {n : Z & ArithFact (n >= 0)})))) + : M (option ((mword 3 * {n : Z & ArithFact (n >= 0)}))). + +Definition sep_forwards (arg_ : unit) +: string := + + match arg_ with + | tt => + string_append (opt_spc_forwards tt) + (string_append "," (string_append (def_spc_forwards tt) "")) + end. + +Definition _s160_ (_s161_ : string) +: M (option unit) := + + (match _s161_ with + | _s162_ => + (opt_spc_matches_prefix _s162_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s163_ _)) => + let _s164_ := string_drop _s162_ _s163_ in + (if ((string_startswith _s164_ ",")) then + (match (string_drop _s164_ (projT1 (string_length ","))) with + | _s165_ => + (def_spc_matches_prefix _s165_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (tt,(existT _ _s166_ _)) => + let p0_ := string_drop _s165_ _s166_ in + if ((generic_eq p0_ "")) then Some (tt) + else None + | _ => None + end) + : option unit) + end) + : M (option unit) + else returnm (None : option unit)) + : M (option unit) + | _ => returnm (None : option unit) + end) + : M (option unit) + end) + : M (option unit). + +Definition sep_backwards (arg_ : string) +: M (unit) := + + let _s167_ := arg_ in + (_s160_ _s167_) >>= fun w__0 : option unit => + (match w__0 with | Some (tt) => returnm (tt : unit) | _ => exit tt : M (unit) end) + : M (unit). + +Definition sep_forwards_matches (arg_ : unit) : bool := match arg_ with | tt => true end. + +Definition _s168_ (_s169_ : string) +: M (option unit) := + + (match _s169_ with + | _s170_ => + (opt_spc_matches_prefix _s170_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s171_ _)) => + let _s172_ := string_drop _s170_ _s171_ in + (if ((string_startswith _s172_ ",")) then + (match (string_drop _s172_ (projT1 (string_length ","))) with + | _s173_ => + (def_spc_matches_prefix _s173_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (tt,(existT _ _s174_ _)) => + let p0_ := string_drop _s173_ _s174_ in + if ((generic_eq p0_ "")) then Some (tt) + else None + | _ => None + end) + : option unit) + end) + : M (option unit) + else returnm (None : option unit)) + : M (option unit) + | _ => returnm (None : option unit) + end) + : M (option unit) + end) + : M (option unit). + +Definition sep_backwards_matches (arg_ : string) +: M (bool) := + + let _s175_ := arg_ in + (_s168_ _s175_) >>= fun w__0 : option unit => + (if ((match w__0 with | Some (tt) => true | _ => false end)) then + (_s168_ _s175_) >>= fun w__1 : option unit => + (match w__1 with | Some (tt) => returnm (true : bool) | _ => exit tt : M (bool) end) + : M (bool) + else returnm (false : bool)) + : M (bool). + +Definition _s176_ (_s177_ : string) +: M (option string) := + + (match _s177_ with + | _s178_ => + (opt_spc_matches_prefix _s178_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s179_ _)) => + let _s180_ := string_drop _s178_ _s179_ in + (if ((string_startswith _s180_ ",")) then + (match (string_drop _s180_ (projT1 (string_length ","))) with + | _s181_ => + (def_spc_matches_prefix _s181_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (tt,(existT _ _s182_ _)) => + match (string_drop _s181_ _s182_) with | s_ => Some (s_) end + | _ => None + end) + : option string) + end) + : M (option string) + else returnm (None : option string)) + : M (option string) + | _ => returnm (None : option string) + end) + : M (option string) + end) + : M (option string). + +Definition sep_matches_prefix (arg_ : string) +: M (option ((unit * {n : Z & ArithFact (n >= 0)}))) := + + let _s183_ := arg_ in + (_s176_ _s183_) >>= fun w__0 : option string => + (if ((match w__0 with | Some (s_) => true | _ => false end)) then + (_s176_ _s183_) >>= fun w__1 : option string => + (match w__1 with + | Some (s_) => + returnm ((Some + ((tt, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((unit * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((unit * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((unit * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((unit * {n : Z & ArithFact (n >= 0)})))) + : M (option ((unit * {n : Z & ArithFact (n >= 0)}))). + +Definition bool_bits_forwards (arg_ : bool) +: mword 1 := + + match arg_ with + | true => (vec_of_bits [B1] : mword 1) + | false => (vec_of_bits [B0] : mword 1) + end. + +Definition bool_bits_backwards (arg_ : mword 1) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then true + else false. + +Definition bool_bits_forwards_matches (arg_ : bool) +: bool := + + match arg_ with | true => true | false => true end. + +Definition bool_bits_backwards_matches (arg_ : mword 1) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then true + else if ((eq_vec b__0 (vec_of_bits [B0] : mword 1))) then true + else false. + +Definition bool_not_bits_forwards (arg_ : bool) +: mword 1 := + + match arg_ with + | true => (vec_of_bits [B0] : mword 1) + | false => (vec_of_bits [B1] : mword 1) + end. + +Definition bool_not_bits_backwards (arg_ : mword 1) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0] : mword 1))) then true + else false. + +Definition bool_not_bits_forwards_matches (arg_ : bool) +: bool := + + match arg_ with | true => true | false => true end. + +Definition bool_not_bits_backwards_matches (arg_ : mword 1) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0] : mword 1))) then true + else if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then true + else false. + +Definition size_bits_forwards (arg_ : word_width) +: mword 2 := + + match arg_ with + | BYTE => (vec_of_bits [B0;B0] : mword 2) + | HALF => (vec_of_bits [B0;B1] : mword 2) + | WORD => (vec_of_bits [B1;B0] : mword 2) + | DOUBLE => (vec_of_bits [B1;B1] : mword 2) + end. + +Definition size_bits_backwards (arg_ : mword 2) +: word_width := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0] : mword 2))) then BYTE + else if ((eq_vec b__0 (vec_of_bits [B0;B1] : mword 2))) then HALF + else if ((eq_vec b__0 (vec_of_bits [B1;B0] : mword 2))) then WORD + else DOUBLE. + +Definition size_bits_forwards_matches (arg_ : word_width) +: bool := + + match arg_ with | BYTE => true | HALF => true | WORD => true | DOUBLE => true end. + +Definition size_bits_backwards_matches (arg_ : mword 2) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0] : mword 2))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1] : mword 2))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0] : mword 2))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1] : mword 2))) then true + else false. + +Definition size_mnemonic_forwards (arg_ : word_width) +: string := + + match arg_ with | BYTE => "b" | HALF => "h" | WORD => "w" | DOUBLE => "d" end. + +Definition size_mnemonic_backwards (arg_ : string) +: word_width := + + let p0_ := arg_ in + if ((generic_eq p0_ "b")) then BYTE + else if ((generic_eq p0_ "h")) then HALF + else if ((generic_eq p0_ "w")) then WORD + else DOUBLE. + +Definition size_mnemonic_forwards_matches (arg_ : word_width) +: bool := + + match arg_ with | BYTE => true | HALF => true | WORD => true | DOUBLE => true end. + +Definition size_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "b")) then true + else if ((generic_eq p0_ "h")) then true + else if ((generic_eq p0_ "w")) then true + else if ((generic_eq p0_ "d")) then true + else false. + +Definition _s196_ (_s197_ : string) +: option string := + + let _s198_ := _s197_ in + if ((string_startswith _s198_ "d")) then + match (string_drop _s198_ (projT1 (string_length "d"))) with | s_ => Some (s_) end + else None. + +Definition _s192_ (_s193_ : string) +: option string := + + let _s194_ := _s193_ in + if ((string_startswith _s194_ "w")) then + match (string_drop _s194_ (projT1 (string_length "w"))) with | s_ => Some (s_) end + else None. + +Definition _s188_ (_s189_ : string) +: option string := + + let _s190_ := _s189_ in + if ((string_startswith _s190_ "h")) then + match (string_drop _s190_ (projT1 (string_length "h"))) with | s_ => Some (s_) end + else None. + +Definition _s184_ (_s185_ : string) +: option string := + + let _s186_ := _s185_ in + if ((string_startswith _s186_ "b")) then + match (string_drop _s186_ (projT1 (string_length "b"))) with | s_ => Some (s_) end + else None. + +Definition size_mnemonic_matches_prefix (arg_ : string) +: M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) := + + let _s187_ := arg_ in + (if ((match (_s184_ _s187_) with | Some (s_) => true | _ => false end)) then + (match (_s184_ _s187_) with + | Some (s_) => + returnm ((Some + ((BYTE, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((word_width * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s188_ _s187_) with | Some (s_) => true | _ => false end)) then + (match (_s188_ _s187_) with + | Some (s_) => + returnm ((Some + ((HALF, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((word_width * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s192_ _s187_) with | Some (s_) => true | _ => false end)) then + (match (_s192_ _s187_) with + | Some (s_) => + returnm ((Some + ((WORD, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((word_width * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s196_ _s187_) with | Some (s_) => true | _ => false end)) then + (match (_s196_ _s187_) with + | Some (s_) => + returnm ((Some + ((DOUBLE, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((word_width * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((word_width * {n : Z & ArithFact (n >= 0)})))) + : M (option ((word_width * {n : Z & ArithFact (n >= 0)}))). + +Definition Mk_Misa (v : mword 64) : Misa := {| Misa_Misa_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Misa_bits (v : Misa) : mword 64 := subrange_vec_dec v.(Misa_Misa_chunk_0) 63 0. + +Definition _set_Misa_bits (r_ref : register_ref regstate register_value Misa) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_bits (v : Misa) (x : mword 64) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Misa_MXL (v : Misa) : mword 2 := subrange_vec_dec v.(Misa_Misa_chunk_0) 63 62. + +Definition _set_Misa_MXL (r_ref : register_ref regstate register_value Misa) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 63 62 (subrange_vec_dec v 1 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_MXL (v : Misa) (x : mword 2) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 63 62 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Misa_Z (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 25 25. + +Definition _set_Misa_Z (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 25 25 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_Z (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 25 25 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_Y (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 24 24. + +Definition _set_Misa_Y (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 24 24 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_Y (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 24 24 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_X (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 23 23. + +Definition _set_Misa_X (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 23 23 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_X (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 23 23 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_W (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 22 22. + +Definition _set_Misa_W (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 22 22 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_W (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 22 22 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_V (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 21 21. + +Definition _set_Misa_V (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 21 21 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_V (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 21 21 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_U (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 20 20. + +Definition _set_Misa_U (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 20 20 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_U (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 20 20 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_T (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 19 19. + +Definition _set_Misa_T (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 19 19 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_T (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 19 19 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_S (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 18 18. + +Definition _set_Misa_S (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 18 18 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_S (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 18 18 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_R (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 17 17. + +Definition _set_Misa_R (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 17 17 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_R (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 17 17 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_Q (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 16 16. + +Definition _set_Misa_Q (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 16 16 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_Q (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 16 16 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_P (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 15 15. + +Definition _set_Misa_P (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 15 15 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_P (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 15 15 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_O (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 14 14. + +Definition _set_Misa_O (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 14 14 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_O (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 14 14 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_N (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 13 13. + +Definition _set_Misa_N (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 13 13 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_N (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 13 13 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_M (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 12 12. + +Definition _set_Misa_M (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 12 12 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_M (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 12 12 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_L (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 11 11. + +Definition _set_Misa_L (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 11 11 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_L (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 11 11 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_K (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 10 10. + +Definition _set_Misa_K (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 10 10 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_K (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 10 10 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_J (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 9 9. + +Definition _set_Misa_J (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 9 9 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_J (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 9 9 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_I (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 8 8. + +Definition _set_Misa_I (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_I (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_H (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 7 7. + +Definition _set_Misa_H (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_H (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_G (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 6 6. + +Definition _set_Misa_G (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 6 6 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_G (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 6 6 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_F (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 5 5. + +Definition _set_Misa_F (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_F (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_E (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 4 4. + +Definition _set_Misa_E (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_E (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_D (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 3 3. + +Definition _set_Misa_D (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_D (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_C (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 2 2. + +Definition _set_Misa_C (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_C (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_B (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 1 1. + +Definition _set_Misa_B (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_B (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Misa_A (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 0 0. + +Definition _set_Misa_A (r_ref : register_ref regstate register_value Misa) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : Misa in + write_reg r_ref r + : M (unit). + +Definition _update_Misa_A (v : Misa) (x : mword 1) +: Misa := + + {[ v with + Misa_Misa_chunk_0 := + (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition legalize_misa (m : Misa) (v : mword 64) +: M (Misa) := + + let v := Mk_Misa v in + (and_boolM (returnm ((eq_vec (_get_Misa_C v) ((bool_to_bits false) : mword 1)) : bool)) + (((read_reg nextPC_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + (bit_to_bool (access_vec_dec w__0 1)) >>= fun w__1 : bool => + returnm ((Bool.eqb (w__1 : bool) true) + : bool))) >>= fun w__2 : bool => + returnm ((if (w__2) then m + else _update_Misa_C m (_get_Misa_C v)) + : Misa). + +Definition Mk_Mstatus (v : mword 64) +: Mstatus := + + {| Mstatus_Mstatus_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Mstatus_bits (v : Mstatus) +: mword 64 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 63 0. + +Definition _set_Mstatus_bits (r_ref : register_ref regstate register_value Mstatus) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_bits (v : Mstatus) (x : mword 64) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Mstatus_SD (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 63 63. + +Definition _set_Mstatus_SD (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 63 63 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_SD (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 63 63 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_SXL (v : Mstatus) +: mword 2 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 35 34. + +Definition _set_Mstatus_SXL (r_ref : register_ref regstate register_value Mstatus) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 35 34 (subrange_vec_dec v 1 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_SXL (v : Mstatus) (x : mword 2) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 35 34 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Mstatus_UXL (v : Mstatus) +: mword 2 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 33 32. + +Definition _set_Mstatus_UXL (r_ref : register_ref regstate register_value Mstatus) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 33 32 (subrange_vec_dec v 1 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_UXL (v : Mstatus) (x : mword 2) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 33 32 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Mstatus_TSR (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 22 22. + +Definition _set_Mstatus_TSR (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 22 22 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_TSR (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 22 22 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_TW (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 21 21. + +Definition _set_Mstatus_TW (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 21 21 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_TW (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 21 21 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_TVM (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 20 20. + +Definition _set_Mstatus_TVM (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 20 20 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_TVM (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 20 20 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_MXR (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 19 19. + +Definition _set_Mstatus_MXR (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 19 19 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_MXR (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 19 19 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_SUM (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 18 18. + +Definition _set_Mstatus_SUM (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 18 18 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_SUM (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 18 18 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_MPRV (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 17 17. + +Definition _set_Mstatus_MPRV (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 17 17 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_MPRV (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 17 17 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_XS (v : Mstatus) +: mword 2 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 16 15. + +Definition _set_Mstatus_XS (r_ref : register_ref regstate register_value Mstatus) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 16 15 (subrange_vec_dec v 1 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_XS (v : Mstatus) (x : mword 2) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 16 15 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Mstatus_FS (v : Mstatus) +: mword 2 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 14 13. + +Definition _set_Mstatus_FS (r_ref : register_ref regstate register_value Mstatus) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 14 13 (subrange_vec_dec v 1 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_FS (v : Mstatus) (x : mword 2) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 14 13 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Mstatus_MPP (v : Mstatus) +: mword 2 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 12 11. + +Definition _set_Mstatus_MPP (r_ref : register_ref regstate register_value Mstatus) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 12 11 (subrange_vec_dec v 1 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_MPP (v : Mstatus) (x : mword 2) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 12 11 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Mstatus_SPP (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 8 8. + +Definition _set_Mstatus_SPP (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_SPP (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_MPIE (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 7 7. + +Definition _set_Mstatus_MPIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_MPIE (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_SPIE (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 5 5. + +Definition _set_Mstatus_SPIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_SPIE (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_UPIE (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 4 4. + +Definition _set_Mstatus_UPIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_UPIE (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_MIE (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 3 3. + +Definition _set_Mstatus_MIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_MIE (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_SIE (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 1 1. + +Definition _set_Mstatus_SIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_SIE (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mstatus_UIE (v : Mstatus) +: mword 1 := + + subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 0 0. + +Definition _set_Mstatus_UIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : Mstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Mstatus_UIE (v : Mstatus) (x : mword 1) +: Mstatus := + + {[ v with + Mstatus_Mstatus_chunk_0 := + (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition legalize_mstatus (o : Mstatus) (v : mword 64) +: Mstatus := + + let m : Mstatus := Mk_Mstatus v in + let m := _update_Mstatus_XS m (extStatus_to_bits Off) in + let m := _update_Mstatus_FS m (extStatus_to_bits Off) in + let m := + _update_Mstatus_SD m + ((bool_to_bits + (orb + (eq_vec (extStatus_to_bits (extStatus_of_bits (_get_Mstatus_FS m))) + ((extStatus_to_bits Dirty) + : mword 2)) + (eq_vec (extStatus_to_bits (extStatus_of_bits (_get_Mstatus_XS m))) + ((extStatus_to_bits Dirty) + : mword 2)))) + : mword 1) in + let m := _update_Mstatus_SXL m (_get_Mstatus_SXL o) in + let m := _update_Mstatus_UXL m (_get_Mstatus_UXL o) in + let m := _update_Mstatus_UPIE m ((bool_to_bits false) : mword 1) in + _update_Mstatus_UIE m ((bool_to_bits false) : mword 1). + +Definition cur_Architecture '(tt : unit) +: M (Architecture) := + + read_reg cur_privilege_ref >>= fun w__0 : Privilege => + (match w__0 with + | Machine => read_reg misa_ref >>= fun w__1 : Misa => returnm ((_get_Misa_MXL w__1) : mword 2) + | Supervisor => + read_reg mstatus_ref >>= fun w__2 : Mstatus => returnm ((_get_Mstatus_SXL w__2) : mword 2) + | User => + read_reg mstatus_ref >>= fun w__3 : Mstatus => returnm ((_get_Mstatus_UXL w__3) : mword 2) + end) >>= fun a : arch_xlen => + (match (architecture a) with + | Some (a) => returnm (a : Architecture) + | None => (internal_error "Invalid current architecture") : M (Architecture) + end) + : M (Architecture). + +Definition in32BitMode '(tt : unit) +: M (bool) := + + (cur_Architecture tt) >>= fun w__0 : Architecture => returnm ((generic_eq w__0 RV32) : bool). + +Definition haveAtomics '(tt : unit) +: M (bool) := + + read_reg misa_ref >>= fun w__0 : Misa => + returnm ((eq_vec (_get_Misa_A w__0) ((bool_to_bits true) : mword 1)) + : bool). + +Definition haveRVC '(tt : unit) +: M (bool) := + + read_reg misa_ref >>= fun w__0 : Misa => + returnm ((eq_vec (_get_Misa_C w__0) ((bool_to_bits true) : mword 1)) + : bool). + +Definition haveMulDiv '(tt : unit) +: M (bool) := + + read_reg misa_ref >>= fun w__0 : Misa => + returnm ((eq_vec (_get_Misa_M w__0) ((bool_to_bits true) : mword 1)) + : bool). + +Definition haveFP '(tt : unit) +: M (bool) := + + (or_boolM + (read_reg misa_ref >>= fun w__0 : Misa => + returnm ((eq_vec (_get_Misa_F w__0) ((bool_to_bits true) : mword 1)) + : bool)) + (read_reg misa_ref >>= fun w__1 : Misa => + returnm ((eq_vec (_get_Misa_D w__1) ((bool_to_bits true) : mword 1)) + : bool))) + : M (bool). + +Definition Mk_Minterrupts (v : mword 64) +: Minterrupts := + + {| Minterrupts_Minterrupts_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Minterrupts_bits (v : Minterrupts) +: mword 64 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 63 0. + +Definition _set_Minterrupts_bits +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_bits (v : Minterrupts) (x : mword 64) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Minterrupts_MEI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 11 11. + +Definition _set_Minterrupts_MEI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 11 11 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_MEI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 11 11 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Minterrupts_SEI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 9 9. + +Definition _set_Minterrupts_SEI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 9 9 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_SEI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 9 9 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Minterrupts_UEI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 8 8. + +Definition _set_Minterrupts_UEI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_UEI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Minterrupts_MTI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 7 7. + +Definition _set_Minterrupts_MTI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_MTI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Minterrupts_STI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 5 5. + +Definition _set_Minterrupts_STI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_STI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Minterrupts_UTI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 4 4. + +Definition _set_Minterrupts_UTI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_UTI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Minterrupts_MSI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 3 3. + +Definition _set_Minterrupts_MSI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_MSI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Minterrupts_SSI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 1 1. + +Definition _set_Minterrupts_SSI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_SSI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Minterrupts_USI (v : Minterrupts) +: mword 1 := + + subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 0 0. + +Definition _set_Minterrupts_USI +(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : Minterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Minterrupts_USI (v : Minterrupts) (x : mword 1) +: Minterrupts := + + {[ v with + Minterrupts_Minterrupts_chunk_0 := + (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition legalize_mip (o : Minterrupts) (v : mword 64) +: Minterrupts := + + let v := Mk_Minterrupts v in + let m := _update_Minterrupts_SEI o (_get_Minterrupts_SEI v) in + let m := _update_Minterrupts_STI m (_get_Minterrupts_STI v) in + _update_Minterrupts_SSI m (_get_Minterrupts_SSI v). + +Definition legalize_mie (o : Minterrupts) (v : mword 64) +: Minterrupts := + + let v := Mk_Minterrupts v in + let m := _update_Minterrupts_MEI o (_get_Minterrupts_MEI v) in + let m := _update_Minterrupts_MTI m (_get_Minterrupts_MTI v) in + let m := _update_Minterrupts_MSI m (_get_Minterrupts_MSI v) in + let m := _update_Minterrupts_SEI m (_get_Minterrupts_SEI v) in + let m := _update_Minterrupts_STI m (_get_Minterrupts_STI v) in + _update_Minterrupts_SSI m (_get_Minterrupts_SSI v). + +Definition legalize_mideleg (o : Minterrupts) (v : mword 64) +: Minterrupts := + + let m := Mk_Minterrupts v in + let m := _update_Minterrupts_MEI m ((bool_to_bits false) : mword 1) in + let m := _update_Minterrupts_MTI m ((bool_to_bits false) : mword 1) in + _update_Minterrupts_MSI m ((bool_to_bits false) : mword 1). + +Definition Mk_Medeleg (v : mword 64) +: Medeleg := + + {| Medeleg_Medeleg_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Medeleg_bits (v : Medeleg) +: mword 64 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 63 0. + +Definition _set_Medeleg_bits (r_ref : register_ref regstate register_value Medeleg) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_bits (v : Medeleg) (x : mword 64) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Medeleg_SAMO_Page_Fault (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 15 15. + +Definition _set_Medeleg_SAMO_Page_Fault +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 15 15 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_SAMO_Page_Fault (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 15 15 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_Load_Page_Fault (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 13 13. + +Definition _set_Medeleg_Load_Page_Fault +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 13 13 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_Load_Page_Fault (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 13 13 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_Fetch_Page_Fault (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 12 12. + +Definition _set_Medeleg_Fetch_Page_Fault +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 12 12 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_Fetch_Page_Fault (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 12 12 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_MEnvCall (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 10 10. + +Definition _set_Medeleg_MEnvCall +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 10 10 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_MEnvCall (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 10 10 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_SEnvCall (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 9 9. + +Definition _set_Medeleg_SEnvCall +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 9 9 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_SEnvCall (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 9 9 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_UEnvCall (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 8 8. + +Definition _set_Medeleg_UEnvCall +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_UEnvCall (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_SAMO_Access_Fault (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 7 7. + +Definition _set_Medeleg_SAMO_Access_Fault +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_SAMO_Access_Fault (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_SAMO_Addr_Align (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 6 6. + +Definition _set_Medeleg_SAMO_Addr_Align +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 6 6 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_SAMO_Addr_Align (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 6 6 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_Load_Access_Fault (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 5 5. + +Definition _set_Medeleg_Load_Access_Fault +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_Load_Access_Fault (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_Load_Addr_Align (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 4 4. + +Definition _set_Medeleg_Load_Addr_Align +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_Load_Addr_Align (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_Breakpoint (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 3 3. + +Definition _set_Medeleg_Breakpoint +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_Breakpoint (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_Illegal_Instr (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 2 2. + +Definition _set_Medeleg_Illegal_Instr +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_Illegal_Instr (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_Fetch_Access_Fault (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 1 1. + +Definition _set_Medeleg_Fetch_Access_Fault +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_Fetch_Access_Fault (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Medeleg_Fetch_Addr_Align (v : Medeleg) +: mword 1 := + + subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 0 0. + +Definition _set_Medeleg_Fetch_Addr_Align +(r_ref : register_ref regstate register_value Medeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : Medeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Medeleg_Fetch_Addr_Align (v : Medeleg) (x : mword 1) +: Medeleg := + + {[ v with + Medeleg_Medeleg_chunk_0 := + (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition legalize_medeleg (o : Medeleg) (v : mword 64) +: Medeleg := + + let m := Mk_Medeleg v in + _update_Medeleg_MEnvCall m ((bool_to_bits false) : mword 1). + +Definition Mk_Mtvec (v : mword 64) +: Mtvec := + + {| Mtvec_Mtvec_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Mtvec_bits (v : Mtvec) +: mword 64 := + + subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 63 0. + +Definition _set_Mtvec_bits (r_ref : register_ref regstate register_value Mtvec) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mtvec_Mtvec_chunk_0 := + (update_subrange_vec_dec r.(Mtvec_Mtvec_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Mtvec in + write_reg r_ref r + : M (unit). + +Definition _update_Mtvec_bits (v : Mtvec) (x : mword 64) +: Mtvec := + + {[ v with + Mtvec_Mtvec_chunk_0 := + (update_subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Mtvec_Base (v : Mtvec) +: mword 62 := + + subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 63 2. + +Definition _set_Mtvec_Base (r_ref : register_ref regstate register_value Mtvec) (v : mword 62) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mtvec_Mtvec_chunk_0 := + (update_subrange_vec_dec r.(Mtvec_Mtvec_chunk_0) 63 2 (subrange_vec_dec v 61 0)) ]} + : Mtvec in + write_reg r_ref r + : M (unit). + +Definition _update_Mtvec_Base (v : Mtvec) (x : mword 62) +: Mtvec := + + {[ v with + Mtvec_Mtvec_chunk_0 := + (update_subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 63 2 (subrange_vec_dec x 61 0)) ]}. + +Definition _get_Mtvec_Mode (v : Mtvec) : mword 2 := subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 1 0. + +Definition _set_Mtvec_Mode (r_ref : register_ref regstate register_value Mtvec) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mtvec_Mtvec_chunk_0 := + (update_subrange_vec_dec r.(Mtvec_Mtvec_chunk_0) 1 0 (subrange_vec_dec v 1 0)) ]} + : Mtvec in + write_reg r_ref r + : M (unit). + +Definition _update_Mtvec_Mode (v : Mtvec) (x : mword 2) +: Mtvec := + + {[ v with + Mtvec_Mtvec_chunk_0 := + (update_subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 1 0 (subrange_vec_dec x 1 0)) ]}. + +Definition legalize_tvec (o : Mtvec) (v : mword 64) +: Mtvec := + + let v := Mk_Mtvec v in + match (trapVectorMode_of_bits (_get_Mtvec_Mode v)) with + | TV_Direct => v + | TV_Vector => v + | _ => _update_Mtvec_Mode v (_get_Mtvec_Mode o) + end. + +Definition Mk_Mcause (v : mword 64) +: Mcause := + + {| Mcause_Mcause_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Mcause_bits (v : Mcause) +: mword 64 := + + subrange_vec_dec v.(Mcause_Mcause_chunk_0) 63 0. + +Definition _set_Mcause_bits (r_ref : register_ref regstate register_value Mcause) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mcause_Mcause_chunk_0 := + (update_subrange_vec_dec r.(Mcause_Mcause_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Mcause in + write_reg r_ref r + : M (unit). + +Definition _update_Mcause_bits (v : Mcause) (x : mword 64) +: Mcause := + + {[ v with + Mcause_Mcause_chunk_0 := + (update_subrange_vec_dec v.(Mcause_Mcause_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Mcause_IsInterrupt (v : Mcause) +: mword 1 := + + subrange_vec_dec v.(Mcause_Mcause_chunk_0) 63 63. + +Definition _set_Mcause_IsInterrupt +(r_ref : register_ref regstate register_value Mcause) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mcause_Mcause_chunk_0 := + (update_subrange_vec_dec r.(Mcause_Mcause_chunk_0) 63 63 (subrange_vec_dec v 0 0)) ]} + : Mcause in + write_reg r_ref r + : M (unit). + +Definition _update_Mcause_IsInterrupt (v : Mcause) (x : mword 1) +: Mcause := + + {[ v with + Mcause_Mcause_chunk_0 := + (update_subrange_vec_dec v.(Mcause_Mcause_chunk_0) 63 63 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Mcause_Cause (v : Mcause) +: mword 63 := + + subrange_vec_dec v.(Mcause_Mcause_chunk_0) 62 0. + +Definition _set_Mcause_Cause (r_ref : register_ref regstate register_value Mcause) (v : mword 63) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Mcause_Mcause_chunk_0 := + (update_subrange_vec_dec r.(Mcause_Mcause_chunk_0) 62 0 (subrange_vec_dec v 62 0)) ]} + : Mcause in + write_reg r_ref r + : M (unit). + +Definition _update_Mcause_Cause (v : Mcause) (x : mword 63) +: Mcause := + + {[ v with + Mcause_Mcause_chunk_0 := + (update_subrange_vec_dec v.(Mcause_Mcause_chunk_0) 62 0 (subrange_vec_dec x 62 0)) ]}. + +Definition tvec_addr (m : Mtvec) (c : Mcause) +: option (mword 64) := + + let base : xlenbits := concat_vec (_get_Mtvec_Base m) (vec_of_bits [B0;B0] : mword 2) in + match (trapVectorMode_of_bits (_get_Mtvec_Mode m)) with + | TV_Direct => Some (base) + | TV_Vector => + if ((eq_vec (_get_Mcause_IsInterrupt c) ((bool_to_bits true) : mword 1))) then + Some + (add_vec base + (shift_bits_left (EXTZ 64 (_get_Mcause_Cause c)) (vec_of_bits [B1;B0] : mword 2))) + else Some (base) + | TV_Reserved => None + end. + +Definition legalize_xepc (v : mword 64) +: M (mword 64) := + + (haveRVC tt) >>= fun w__0 : bool => + returnm ((and_vec v + (EXTS 64 + (if (w__0) then (vec_of_bits [B1;B1;B0] : mword 3) + else (vec_of_bits [B1;B0;B0] : mword 3)))) + : mword 64). + +Definition pc_alignment_mask '(tt : unit) +: M (mword 64) := + + read_reg misa_ref >>= fun w__0 : Misa => + returnm ((not_vec + (EXTZ 64 + (if ((eq_vec (_get_Misa_C w__0) ((bool_to_bits true) : mword 1))) then + (vec_of_bits [B0;B0] : mword 2) + else (vec_of_bits [B1;B0] : mword 2)))) + : mword 64). + +Definition Mk_Counteren (v : mword 32) +: Counteren := + + {| Counteren_Counteren_chunk_0 := (subrange_vec_dec v 31 0) |}. + +Definition _get_Counteren_bits (v : Counteren) +: mword 32 := + + subrange_vec_dec v.(Counteren_Counteren_chunk_0) 31 0. + +Definition _set_Counteren_bits +(r_ref : register_ref regstate register_value Counteren) (v : mword 32) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]} + : Counteren in + write_reg r_ref r + : M (unit). + +Definition _update_Counteren_bits (v : Counteren) (x : mword 32) +: Counteren := + + {[ v with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}. + +Definition _get_Counteren_HPM (v : Counteren) +: mword 29 := + + subrange_vec_dec v.(Counteren_Counteren_chunk_0) 31 3. + +Definition _set_Counteren_HPM +(r_ref : register_ref regstate register_value Counteren) (v : mword 29) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 31 3 (subrange_vec_dec v 28 0)) ]} + : Counteren in + write_reg r_ref r + : M (unit). + +Definition _update_Counteren_HPM (v : Counteren) (x : mword 29) +: Counteren := + + {[ v with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 31 3 (subrange_vec_dec x 28 0)) ]}. + +Definition _get_Counteren_IR (v : Counteren) +: mword 1 := + + subrange_vec_dec v.(Counteren_Counteren_chunk_0) 2 2. + +Definition _set_Counteren_IR (r_ref : register_ref regstate register_value Counteren) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]} + : Counteren in + write_reg r_ref r + : M (unit). + +Definition _update_Counteren_IR (v : Counteren) (x : mword 1) +: Counteren := + + {[ v with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Counteren_TM (v : Counteren) +: mword 1 := + + subrange_vec_dec v.(Counteren_Counteren_chunk_0) 1 1. + +Definition _set_Counteren_TM (r_ref : register_ref regstate register_value Counteren) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : Counteren in + write_reg r_ref r + : M (unit). + +Definition _update_Counteren_TM (v : Counteren) (x : mword 1) +: Counteren := + + {[ v with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Counteren_CY (v : Counteren) +: mword 1 := + + subrange_vec_dec v.(Counteren_Counteren_chunk_0) 0 0. + +Definition _set_Counteren_CY (r_ref : register_ref regstate register_value Counteren) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : Counteren in + write_reg r_ref r + : M (unit). + +Definition _update_Counteren_CY (v : Counteren) (x : mword 1) +: Counteren := + + {[ v with + Counteren_Counteren_chunk_0 := + (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition legalize_mcounteren (c : Counteren) (v : mword 64) +: M (Counteren) := + + (cast_unit_vec (access_vec_dec v 2)) >>= fun w__0 : mword 1 => + let c := _update_Counteren_IR c (w__0 : mword 1) in + (cast_unit_vec (access_vec_dec v 1)) >>= fun w__1 : mword 1 => + let c := _update_Counteren_TM c (w__1 : mword 1) in + (cast_unit_vec (access_vec_dec v 0)) >>= fun w__2 : mword 1 => + let c := _update_Counteren_CY c (w__2 : mword 1) in + returnm (c + : Counteren). + +Definition legalize_scounteren (c : Counteren) (v : mword 64) +: M (Counteren) := + + (cast_unit_vec (access_vec_dec v 2)) >>= fun w__0 : mword 1 => + let c := _update_Counteren_IR c (w__0 : mword 1) in + (cast_unit_vec (access_vec_dec v 1)) >>= fun w__1 : mword 1 => + let c := _update_Counteren_TM c (w__1 : mword 1) in + (cast_unit_vec (access_vec_dec v 0)) >>= fun w__2 : mword 1 => + let c := _update_Counteren_CY c (w__2 : mword 1) in + returnm (c + : Counteren). + +Definition retire_instruction '(tt : unit) +: M (unit) := + + read_reg minstret_written_ref >>= fun w__0 : bool => + (if ((Bool.eqb w__0 true)) then write_reg minstret_written_ref false : M (unit) + else + ((read_reg minstret_ref) : M (mword 64)) >>= fun w__1 : xlenbits => + write_reg minstret_ref (add_vec_int w__1 1) + : M (unit)) + : M (unit). + +Definition Mk_Sstatus (v : mword 64) +: Sstatus := + + {| Sstatus_Sstatus_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Sstatus_bits (v : Sstatus) +: mword 64 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 63 0. + +Definition _set_Sstatus_bits (r_ref : register_ref regstate register_value Sstatus) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_bits (v : Sstatus) (x : mword 64) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Sstatus_SD (v : Sstatus) +: mword 1 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 63 63. + +Definition _set_Sstatus_SD (r_ref : register_ref regstate register_value Sstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 63 63 (subrange_vec_dec v 0 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_SD (v : Sstatus) (x : mword 1) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 63 63 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sstatus_UXL (v : Sstatus) +: mword 2 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 33 32. + +Definition _set_Sstatus_UXL (r_ref : register_ref regstate register_value Sstatus) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 33 32 (subrange_vec_dec v 1 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_UXL (v : Sstatus) (x : mword 2) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 33 32 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Sstatus_MXR (v : Sstatus) +: mword 1 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 19 19. + +Definition _set_Sstatus_MXR (r_ref : register_ref regstate register_value Sstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 19 19 (subrange_vec_dec v 0 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_MXR (v : Sstatus) (x : mword 1) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 19 19 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sstatus_SUM (v : Sstatus) +: mword 1 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 18 18. + +Definition _set_Sstatus_SUM (r_ref : register_ref regstate register_value Sstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 18 18 (subrange_vec_dec v 0 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_SUM (v : Sstatus) (x : mword 1) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 18 18 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sstatus_XS (v : Sstatus) +: mword 2 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 16 15. + +Definition _set_Sstatus_XS (r_ref : register_ref regstate register_value Sstatus) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 16 15 (subrange_vec_dec v 1 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_XS (v : Sstatus) (x : mword 2) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 16 15 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Sstatus_FS (v : Sstatus) +: mword 2 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 14 13. + +Definition _set_Sstatus_FS (r_ref : register_ref regstate register_value Sstatus) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 14 13 (subrange_vec_dec v 1 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_FS (v : Sstatus) (x : mword 2) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 14 13 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_Sstatus_SPP (v : Sstatus) +: mword 1 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 8 8. + +Definition _set_Sstatus_SPP (r_ref : register_ref regstate register_value Sstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_SPP (v : Sstatus) (x : mword 1) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sstatus_SPIE (v : Sstatus) +: mword 1 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 5 5. + +Definition _set_Sstatus_SPIE (r_ref : register_ref regstate register_value Sstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_SPIE (v : Sstatus) (x : mword 1) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sstatus_UPIE (v : Sstatus) +: mword 1 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 4 4. + +Definition _set_Sstatus_UPIE (r_ref : register_ref regstate register_value Sstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_UPIE (v : Sstatus) (x : mword 1) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sstatus_SIE (v : Sstatus) +: mword 1 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 1 1. + +Definition _set_Sstatus_SIE (r_ref : register_ref regstate register_value Sstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_SIE (v : Sstatus) (x : mword 1) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sstatus_UIE (v : Sstatus) +: mword 1 := + + subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 0 0. + +Definition _set_Sstatus_UIE (r_ref : register_ref regstate register_value Sstatus) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : Sstatus in + write_reg r_ref r + : M (unit). + +Definition _update_Sstatus_UIE (v : Sstatus) (x : mword 1) +: Sstatus := + + {[ v with + Sstatus_Sstatus_chunk_0 := + (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition lower_mstatus (m : Mstatus) +: Sstatus := + + let s := Mk_Sstatus (EXTZ 64 (vec_of_bits [B0] : mword 1)) in + let s := _update_Sstatus_SD s (_get_Mstatus_SD m) in + let s := _update_Sstatus_UXL s (_get_Mstatus_UXL m) in + let s := _update_Sstatus_MXR s (_get_Mstatus_MXR m) in + let s := _update_Sstatus_SUM s (_get_Mstatus_SUM m) in + let s := _update_Sstatus_XS s (_get_Mstatus_XS m) in + let s := _update_Sstatus_FS s (_get_Mstatus_FS m) in + let s := _update_Sstatus_SPP s (_get_Mstatus_SPP m) in + let s := _update_Sstatus_SPIE s (_get_Mstatus_SPIE m) in + let s := _update_Sstatus_UPIE s (_get_Mstatus_UPIE m) in + let s := _update_Sstatus_SIE s (_get_Mstatus_SIE m) in + _update_Sstatus_UIE s (_get_Mstatus_UIE m). + +Definition lift_sstatus (m : Mstatus) (s : Sstatus) +: Mstatus := + + let m := _update_Mstatus_MXR m (_get_Sstatus_MXR s) in + let m := _update_Mstatus_SUM m (_get_Sstatus_SUM s) in + let m := _update_Mstatus_XS m (_get_Sstatus_XS s) in + let m := _update_Mstatus_FS m (_get_Sstatus_FS s) in + let m := + _update_Mstatus_SD m + ((bool_to_bits + (orb + (eq_vec (extStatus_to_bits (extStatus_of_bits (_get_Mstatus_FS m))) + ((extStatus_to_bits Dirty) + : mword 2)) + (eq_vec (extStatus_to_bits (extStatus_of_bits (_get_Mstatus_XS m))) + ((extStatus_to_bits Dirty) + : mword 2)))) + : mword 1) in + let m := _update_Mstatus_SPP m (_get_Sstatus_SPP s) in + let m := _update_Mstatus_SPIE m (_get_Sstatus_SPIE s) in + let m := _update_Mstatus_UPIE m (_get_Sstatus_UPIE s) in + let m := _update_Mstatus_SIE m (_get_Sstatus_SIE s) in + _update_Mstatus_UIE m (_get_Sstatus_UIE s). + +Definition legalize_sstatus (m : Mstatus) (v : mword 64) +: Mstatus := + + lift_sstatus m (Mk_Sstatus v). + +Definition Mk_Sedeleg (v : mword 64) +: Sedeleg := + + {| Sedeleg_Sedeleg_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Sedeleg_bits (v : Sedeleg) +: mword 64 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 63 0. + +Definition _set_Sedeleg_bits (r_ref : register_ref regstate register_value Sedeleg) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_bits (v : Sedeleg) (x : mword 64) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Sedeleg_UEnvCall (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 8 8. + +Definition _set_Sedeleg_UEnvCall +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_UEnvCall (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sedeleg_SAMO_Access_Fault (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 7 7. + +Definition _set_Sedeleg_SAMO_Access_Fault +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_SAMO_Access_Fault (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sedeleg_SAMO_Addr_Align (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 6 6. + +Definition _set_Sedeleg_SAMO_Addr_Align +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 6 6 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_SAMO_Addr_Align (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 6 6 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sedeleg_Load_Access_Fault (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 5 5. + +Definition _set_Sedeleg_Load_Access_Fault +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_Load_Access_Fault (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sedeleg_Load_Addr_Align (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 4 4. + +Definition _set_Sedeleg_Load_Addr_Align +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_Load_Addr_Align (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sedeleg_Breakpoint (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 3 3. + +Definition _set_Sedeleg_Breakpoint +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_Breakpoint (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sedeleg_Illegal_Instr (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 2 2. + +Definition _set_Sedeleg_Illegal_Instr +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_Illegal_Instr (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sedeleg_Fetch_Access_Fault (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 1 1. + +Definition _set_Sedeleg_Fetch_Access_Fault +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_Fetch_Access_Fault (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sedeleg_Fetch_Addr_Align (v : Sedeleg) +: mword 1 := + + subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 0 0. + +Definition _set_Sedeleg_Fetch_Addr_Align +(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : Sedeleg in + write_reg r_ref r + : M (unit). + +Definition _update_Sedeleg_Fetch_Addr_Align (v : Sedeleg) (x : mword 1) +: Sedeleg := + + {[ v with + Sedeleg_Sedeleg_chunk_0 := + (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition legalize_sedeleg (s : Sedeleg) (v : mword 64) +: Sedeleg := + + Mk_Sedeleg (EXTZ 64 (subrange_vec_dec v 8 0)). + +Definition Mk_Sinterrupts (v : mword 64) +: Sinterrupts := + + {| Sinterrupts_Sinterrupts_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Sinterrupts_bits (v : Sinterrupts) +: mword 64 := + + subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 63 0. + +Definition _set_Sinterrupts_bits +(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Sinterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Sinterrupts_bits (v : Sinterrupts) (x : mword 64) +: Sinterrupts := + + {[ v with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Sinterrupts_SEI (v : Sinterrupts) +: mword 1 := + + subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 9 9. + +Definition _set_Sinterrupts_SEI +(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 9 9 (subrange_vec_dec v 0 0)) ]} + : Sinterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Sinterrupts_SEI (v : Sinterrupts) (x : mword 1) +: Sinterrupts := + + {[ v with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 9 9 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sinterrupts_UEI (v : Sinterrupts) +: mword 1 := + + subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 8 8. + +Definition _set_Sinterrupts_UEI +(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]} + : Sinterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Sinterrupts_UEI (v : Sinterrupts) (x : mword 1) +: Sinterrupts := + + {[ v with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sinterrupts_STI (v : Sinterrupts) +: mword 1 := + + subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 5 5. + +Definition _set_Sinterrupts_STI +(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]} + : Sinterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Sinterrupts_STI (v : Sinterrupts) (x : mword 1) +: Sinterrupts := + + {[ v with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sinterrupts_UTI (v : Sinterrupts) +: mword 1 := + + subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 4 4. + +Definition _set_Sinterrupts_UTI +(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]} + : Sinterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Sinterrupts_UTI (v : Sinterrupts) (x : mword 1) +: Sinterrupts := + + {[ v with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sinterrupts_SSI (v : Sinterrupts) +: mword 1 := + + subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 1 1. + +Definition _set_Sinterrupts_SSI +(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : Sinterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Sinterrupts_SSI (v : Sinterrupts) (x : mword 1) +: Sinterrupts := + + {[ v with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_Sinterrupts_USI (v : Sinterrupts) +: mword 1 := + + subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 0 0. + +Definition _set_Sinterrupts_USI +(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : Sinterrupts in + write_reg r_ref r + : M (unit). + +Definition _update_Sinterrupts_USI (v : Sinterrupts) (x : mword 1) +: Sinterrupts := + + {[ v with + Sinterrupts_Sinterrupts_chunk_0 := + (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition lower_mip (m : Minterrupts) (d : Minterrupts) +: Sinterrupts := + + let s : Sinterrupts := Mk_Sinterrupts (EXTZ 64 (vec_of_bits [B0] : mword 1)) in + let s := _update_Sinterrupts_SEI s (and_vec (_get_Minterrupts_SEI m) (_get_Minterrupts_SEI d)) in + let s := _update_Sinterrupts_STI s (and_vec (_get_Minterrupts_STI m) (_get_Minterrupts_STI d)) in + let s := _update_Sinterrupts_SSI s (and_vec (_get_Minterrupts_SSI m) (_get_Minterrupts_SSI d)) in + let s := _update_Sinterrupts_UEI s (and_vec (_get_Minterrupts_UEI m) (_get_Minterrupts_UEI d)) in + let s := _update_Sinterrupts_UTI s (and_vec (_get_Minterrupts_UTI m) (_get_Minterrupts_UTI d)) in + _update_Sinterrupts_USI s (and_vec (_get_Minterrupts_USI m) (_get_Minterrupts_USI d)). + +Definition lower_mie (m : Minterrupts) (d : Minterrupts) +: Sinterrupts := + + let s : Sinterrupts := Mk_Sinterrupts (EXTZ 64 (vec_of_bits [B0] : mword 1)) in + let s := _update_Sinterrupts_SEI s (and_vec (_get_Minterrupts_SEI m) (_get_Minterrupts_SEI d)) in + let s := _update_Sinterrupts_STI s (and_vec (_get_Minterrupts_STI m) (_get_Minterrupts_STI d)) in + let s := _update_Sinterrupts_SSI s (and_vec (_get_Minterrupts_SSI m) (_get_Minterrupts_SSI d)) in + let s := _update_Sinterrupts_UEI s (and_vec (_get_Minterrupts_UEI m) (_get_Minterrupts_UEI d)) in + let s := _update_Sinterrupts_UTI s (and_vec (_get_Minterrupts_UTI m) (_get_Minterrupts_UTI d)) in + _update_Sinterrupts_USI s (and_vec (_get_Minterrupts_USI m) (_get_Minterrupts_USI d)). + +Definition lift_sip (o : Minterrupts) (d : Minterrupts) (s : Sinterrupts) +: Minterrupts := + + let m : Minterrupts := o in + let m := _update_Minterrupts_SSI m (and_vec (_get_Sinterrupts_SSI s) (_get_Minterrupts_SSI d)) in + let m := _update_Minterrupts_UEI m (and_vec (_get_Minterrupts_UEI m) (_get_Minterrupts_UEI d)) in + _update_Minterrupts_USI m (and_vec (_get_Minterrupts_USI m) (_get_Minterrupts_USI d)). + +Definition legalize_sip (m : Minterrupts) (d : Minterrupts) (v : mword 64) +: Minterrupts := + + lift_sip m d (Mk_Sinterrupts v). + +Definition lift_sie (o : Minterrupts) (d : Minterrupts) (s : Sinterrupts) +: Minterrupts := + + let m : Minterrupts := o in + let m := + if ((eq_vec (_get_Minterrupts_SEI d) ((bool_to_bits true) : mword 1))) then + _update_Minterrupts_SEI m (_get_Sinterrupts_SEI s) + else m in + let m := + if ((eq_vec (_get_Minterrupts_STI d) ((bool_to_bits true) : mword 1))) then + _update_Minterrupts_STI m (_get_Sinterrupts_STI s) + else m in + let m := + if ((eq_vec (_get_Minterrupts_SSI d) ((bool_to_bits true) : mword 1))) then + _update_Minterrupts_SSI m (_get_Sinterrupts_SSI s) + else m in + let m := + if ((eq_vec (_get_Minterrupts_UEI d) ((bool_to_bits true) : mword 1))) then + _update_Minterrupts_UEI m (_get_Sinterrupts_UEI s) + else m in + let m := + if ((eq_vec (_get_Minterrupts_UTI d) ((bool_to_bits true) : mword 1))) then + _update_Minterrupts_UTI m (_get_Sinterrupts_UTI s) + else m in + if ((eq_vec (_get_Minterrupts_USI d) ((bool_to_bits true) : mword 1))) then + _update_Minterrupts_USI m (_get_Sinterrupts_USI s) + else m. + +Definition legalize_sie (m : Minterrupts) (d : Minterrupts) (v : mword 64) +: Minterrupts := + + lift_sie m d (Mk_Sinterrupts v). + +Definition Mk_Satp64 (v : mword 64) +: Satp64 := + + {| Satp64_Satp64_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_Satp64_bits (v : Satp64) +: mword 64 := + + subrange_vec_dec v.(Satp64_Satp64_chunk_0) 63 0. + +Definition _set_Satp64_bits (r_ref : register_ref regstate register_value Satp64) (v : mword 64) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Satp64_Satp64_chunk_0 := + (update_subrange_vec_dec r.(Satp64_Satp64_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : Satp64 in + write_reg r_ref r + : M (unit). + +Definition _update_Satp64_bits (v : Satp64) (x : mword 64) +: Satp64 := + + {[ v with + Satp64_Satp64_chunk_0 := + (update_subrange_vec_dec v.(Satp64_Satp64_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_Satp64_Mode (v : Satp64) +: mword 4 := + + subrange_vec_dec v.(Satp64_Satp64_chunk_0) 63 60. + +Definition _set_Satp64_Mode (r_ref : register_ref regstate register_value Satp64) (v : mword 4) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Satp64_Satp64_chunk_0 := + (update_subrange_vec_dec r.(Satp64_Satp64_chunk_0) 63 60 (subrange_vec_dec v 3 0)) ]} + : Satp64 in + write_reg r_ref r + : M (unit). + +Definition _update_Satp64_Mode (v : Satp64) (x : mword 4) +: Satp64 := + + {[ v with + Satp64_Satp64_chunk_0 := + (update_subrange_vec_dec v.(Satp64_Satp64_chunk_0) 63 60 (subrange_vec_dec x 3 0)) ]}. + +Definition _get_Satp64_Asid (v : Satp64) +: mword 16 := + + subrange_vec_dec v.(Satp64_Satp64_chunk_0) 59 44. + +Definition _set_Satp64_Asid (r_ref : register_ref regstate register_value Satp64) (v : mword 16) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Satp64_Satp64_chunk_0 := + (update_subrange_vec_dec r.(Satp64_Satp64_chunk_0) 59 44 (subrange_vec_dec v 15 0)) ]} + : Satp64 in + write_reg r_ref r + : M (unit). + +Definition _update_Satp64_Asid (v : Satp64) (x : mword 16) +: Satp64 := + + {[ v with + Satp64_Satp64_chunk_0 := + (update_subrange_vec_dec v.(Satp64_Satp64_chunk_0) 59 44 (subrange_vec_dec x 15 0)) ]}. + +Definition _get_Satp64_PPN (v : Satp64) +: mword 44 := + + subrange_vec_dec v.(Satp64_Satp64_chunk_0) 43 0. + +Definition _set_Satp64_PPN (r_ref : register_ref regstate register_value Satp64) (v : mword 44) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + Satp64_Satp64_chunk_0 := + (update_subrange_vec_dec r.(Satp64_Satp64_chunk_0) 43 0 (subrange_vec_dec v 43 0)) ]} + : Satp64 in + write_reg r_ref r + : M (unit). + +Definition _update_Satp64_PPN (v : Satp64) (x : mword 44) +: Satp64 := + + {[ v with + Satp64_Satp64_chunk_0 := + (update_subrange_vec_dec v.(Satp64_Satp64_chunk_0) 43 0 (subrange_vec_dec x 43 0)) ]}. + +Definition legalize_satp (a : Architecture) (o : mword 64) (v : mword 64) +: mword 64 := + + let s := Mk_Satp64 v in + match (satpMode_of_bits a (_get_Satp64_Mode s)) with + | None => o + | Some (Sv32) => o + | Some (_) => _get_Satp64_bits s + end. + +Definition csr_name (csr : mword 12) +: string := + + let b__0 := csr in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then "ustatus" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + "uie" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + "utvec" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + "fflags" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "frm" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + "fcsr" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "cycle" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + "time" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "instret" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "cycleh" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + "timeh" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "instreth" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "sstatus" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "sedeleg" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + "sideleg" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + "sie" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + "stvec" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + "scounteren" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + "sscratch" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + "sepc" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + "scause" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + "stval" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + "sip" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "satp" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B0;B1] : mword 12))) then + "mvendorid" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B0] : mword 12))) then + "marchid" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B1] : mword 12))) then + "mimpid" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B1;B0;B0] : mword 12))) then + "mhartid" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "mstatus" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + "misa" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "medeleg" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + "mideleg" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + "mie" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + "mtvec" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + "mcounteren" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + "mscratch" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + "mepc" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + "mcause" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + "mtval" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + "mip" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + "pmpcfg0" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B0] : mword 12))) then + "pmpaddr0" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "mcycle" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "minstret" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "mcycleh" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "minstreth" + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + "tselect" + else "UNKNOWN". + +Definition csr_name_map_forwards (arg_ : mword 12) +: string := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then "ustatus" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + "uie" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + "utvec" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + "uscratch" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + "uepc" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + "ucause" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + "utval" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + "uip" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + "fflags" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "frm" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + "fcsr" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "cycle" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + "time" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "instret" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "cycleh" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + "timeh" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "instreth" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "sstatus" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "sedeleg" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + "sideleg" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + "sie" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + "stvec" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + "scounteren" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + "sscratch" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + "sepc" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + "scause" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + "stval" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + "sip" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "satp" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B0;B1] : mword 12))) then + "mvendorid" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B0] : mword 12))) then + "marchid" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B1] : mword 12))) then + "mimpid" + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B1;B0;B0] : mword 12))) then + "mhartid" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "mstatus" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + "misa" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "medeleg" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + "mideleg" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + "mie" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + "mtvec" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + "mcounteren" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + "mscratch" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + "mepc" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + "mcause" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + "mtval" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + "mip" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + "pmpcfg0" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B1] : mword 12))) then + "pmpcfg1" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B1;B0] : mword 12))) then + "pmpcfg2" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B1;B1] : mword 12))) then + "pmpcfg3" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B0] : mword 12))) then + "pmpaddr0" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B1] : mword 12))) then + "pmpaddr1" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B1;B0] : mword 12))) then + "pmpaddr2" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B1;B1] : mword 12))) then + "pmpaddr3" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B0;B0] : mword 12))) then + "pmpaddr4" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B0;B1] : mword 12))) then + "pmpaddr5" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B1;B0] : mword 12))) then + "pmpaddr6" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B1;B1] : mword 12))) then + "pmpaddr7" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B0;B0] : mword 12))) then + "pmpaddr8" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B0;B1] : mword 12))) then + "pmpaddr9" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B1;B0] : mword 12))) then + "pmpaddr10" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B1;B1] : mword 12))) then + "pmpaddr11" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B0;B0] : mword 12))) then + "pmpaddr12" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B0;B1] : mword 12))) then + "pmpaddr13" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B1;B0] : mword 12))) then + "pmpaddr14" + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B1;B1] : mword 12))) then + "pmpaddr15" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "mcycle" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "minstret" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + "mcycleh" + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + "minstreth" + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + "tselect" + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B1] : mword 12))) then + "tdata1" + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B1;B0] : mword 12))) then + "tdata2" + else "tdata3". + +Definition csr_name_map_backwards (arg_ : string) +: mword 12 := + + let p0_ := arg_ in + if ((generic_eq p0_ "ustatus")) then + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "uie")) then + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "utvec")) then + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12) + else if ((generic_eq p0_ "uscratch")) then + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "uepc")) then + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "ucause")) then + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "utval")) then + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "uip")) then + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "fflags")) then + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "frm")) then + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "fcsr")) then + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "cycle")) then + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "time")) then + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "instret")) then + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "cycleh")) then + (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "timeh")) then + (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "instreth")) then + (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "sstatus")) then + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "sedeleg")) then + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "sideleg")) then + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "sie")) then + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "stvec")) then + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12) + else if ((generic_eq p0_ "scounteren")) then + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12) + else if ((generic_eq p0_ "sscratch")) then + (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "sepc")) then + (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "scause")) then + (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "stval")) then + (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "sip")) then + (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "satp")) then + (vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "mvendorid")) then + (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "marchid")) then + (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "mimpid")) then + (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "mhartid")) then + (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "mstatus")) then + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "misa")) then + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "medeleg")) then + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "mideleg")) then + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "mie")) then + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "mtvec")) then + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12) + else if ((generic_eq p0_ "mcounteren")) then + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12) + else if ((generic_eq p0_ "mscratch")) then + (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "mepc")) then + (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "mcause")) then + (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "mtval")) then + (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "mip")) then + (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "pmpcfg0")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "pmpcfg1")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "pmpcfg2")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "pmpcfg3")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "pmpaddr0")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "pmpaddr1")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "pmpaddr2")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "pmpaddr3")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "pmpaddr4")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "pmpaddr5")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B0;B1] : mword 12) + else if ((generic_eq p0_ "pmpaddr6")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B1;B0] : mword 12) + else if ((generic_eq p0_ "pmpaddr7")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B1;B1] : mword 12) + else if ((generic_eq p0_ "pmpaddr8")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "pmpaddr9")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "pmpaddr10")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "pmpaddr11")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B1;B1] : mword 12) + else if ((generic_eq p0_ "pmpaddr12")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B0;B0] : mword 12) + else if ((generic_eq p0_ "pmpaddr13")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B0;B1] : mword 12) + else if ((generic_eq p0_ "pmpaddr14")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B1;B0] : mword 12) + else if ((generic_eq p0_ "pmpaddr15")) then + (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B1;B1] : mword 12) + else if ((generic_eq p0_ "mcycle")) then + (vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "minstret")) then + (vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "mcycleh")) then + (vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "minstreth")) then + (vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12) + else if ((generic_eq p0_ "tselect")) then + (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12) + else if ((generic_eq p0_ "tdata1")) then + (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B1] : mword 12) + else if ((generic_eq p0_ "tdata2")) then + (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B1;B0] : mword 12) + else (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B1;B1] : mword 12). + +Definition csr_name_map_forwards_matches (arg_ : mword 12) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B1;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B1] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B1;B0] : mword 12))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B1;B1] : mword 12))) then true + else false. + +Definition csr_name_map_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "ustatus")) then true + else if ((generic_eq p0_ "uie")) then true + else if ((generic_eq p0_ "utvec")) then true + else if ((generic_eq p0_ "uscratch")) then true + else if ((generic_eq p0_ "uepc")) then true + else if ((generic_eq p0_ "ucause")) then true + else if ((generic_eq p0_ "utval")) then true + else if ((generic_eq p0_ "uip")) then true + else if ((generic_eq p0_ "fflags")) then true + else if ((generic_eq p0_ "frm")) then true + else if ((generic_eq p0_ "fcsr")) then true + else if ((generic_eq p0_ "cycle")) then true + else if ((generic_eq p0_ "time")) then true + else if ((generic_eq p0_ "instret")) then true + else if ((generic_eq p0_ "cycleh")) then true + else if ((generic_eq p0_ "timeh")) then true + else if ((generic_eq p0_ "instreth")) then true + else if ((generic_eq p0_ "sstatus")) then true + else if ((generic_eq p0_ "sedeleg")) then true + else if ((generic_eq p0_ "sideleg")) then true + else if ((generic_eq p0_ "sie")) then true + else if ((generic_eq p0_ "stvec")) then true + else if ((generic_eq p0_ "scounteren")) then true + else if ((generic_eq p0_ "sscratch")) then true + else if ((generic_eq p0_ "sepc")) then true + else if ((generic_eq p0_ "scause")) then true + else if ((generic_eq p0_ "stval")) then true + else if ((generic_eq p0_ "sip")) then true + else if ((generic_eq p0_ "satp")) then true + else if ((generic_eq p0_ "mvendorid")) then true + else if ((generic_eq p0_ "marchid")) then true + else if ((generic_eq p0_ "mimpid")) then true + else if ((generic_eq p0_ "mhartid")) then true + else if ((generic_eq p0_ "mstatus")) then true + else if ((generic_eq p0_ "misa")) then true + else if ((generic_eq p0_ "medeleg")) then true + else if ((generic_eq p0_ "mideleg")) then true + else if ((generic_eq p0_ "mie")) then true + else if ((generic_eq p0_ "mtvec")) then true + else if ((generic_eq p0_ "mcounteren")) then true + else if ((generic_eq p0_ "mscratch")) then true + else if ((generic_eq p0_ "mepc")) then true + else if ((generic_eq p0_ "mcause")) then true + else if ((generic_eq p0_ "mtval")) then true + else if ((generic_eq p0_ "mip")) then true + else if ((generic_eq p0_ "pmpcfg0")) then true + else if ((generic_eq p0_ "pmpcfg1")) then true + else if ((generic_eq p0_ "pmpcfg2")) then true + else if ((generic_eq p0_ "pmpcfg3")) then true + else if ((generic_eq p0_ "pmpaddr0")) then true + else if ((generic_eq p0_ "pmpaddr1")) then true + else if ((generic_eq p0_ "pmpaddr2")) then true + else if ((generic_eq p0_ "pmpaddr3")) then true + else if ((generic_eq p0_ "pmpaddr4")) then true + else if ((generic_eq p0_ "pmpaddr5")) then true + else if ((generic_eq p0_ "pmpaddr6")) then true + else if ((generic_eq p0_ "pmpaddr7")) then true + else if ((generic_eq p0_ "pmpaddr8")) then true + else if ((generic_eq p0_ "pmpaddr9")) then true + else if ((generic_eq p0_ "pmpaddr10")) then true + else if ((generic_eq p0_ "pmpaddr11")) then true + else if ((generic_eq p0_ "pmpaddr12")) then true + else if ((generic_eq p0_ "pmpaddr13")) then true + else if ((generic_eq p0_ "pmpaddr14")) then true + else if ((generic_eq p0_ "pmpaddr15")) then true + else if ((generic_eq p0_ "mcycle")) then true + else if ((generic_eq p0_ "minstret")) then true + else if ((generic_eq p0_ "mcycleh")) then true + else if ((generic_eq p0_ "minstreth")) then true + else if ((generic_eq p0_ "tselect")) then true + else if ((generic_eq p0_ "tdata1")) then true + else if ((generic_eq p0_ "tdata2")) then true + else if ((generic_eq p0_ "tdata3")) then true + else false. + +Definition _s488_ (_s489_ : string) +: option string := + + let _s490_ := _s489_ in + if ((string_startswith _s490_ "tdata3")) then + match (string_drop _s490_ (projT1 (string_length "tdata3"))) with | s_ => Some (s_) end + else None. + +Definition _s484_ (_s485_ : string) +: option string := + + let _s486_ := _s485_ in + if ((string_startswith _s486_ "tdata2")) then + match (string_drop _s486_ (projT1 (string_length "tdata2"))) with | s_ => Some (s_) end + else None. + +Definition _s480_ (_s481_ : string) +: option string := + + let _s482_ := _s481_ in + if ((string_startswith _s482_ "tdata1")) then + match (string_drop _s482_ (projT1 (string_length "tdata1"))) with | s_ => Some (s_) end + else None. + +Definition _s476_ (_s477_ : string) +: option string := + + let _s478_ := _s477_ in + if ((string_startswith _s478_ "tselect")) then + match (string_drop _s478_ (projT1 (string_length "tselect"))) with | s_ => Some (s_) end + else None. + +Definition _s472_ (_s473_ : string) +: option string := + + let _s474_ := _s473_ in + if ((string_startswith _s474_ "minstreth")) then + match (string_drop _s474_ (projT1 (string_length "minstreth"))) with | s_ => Some (s_) end + else None. + +Definition _s468_ (_s469_ : string) +: option string := + + let _s470_ := _s469_ in + if ((string_startswith _s470_ "mcycleh")) then + match (string_drop _s470_ (projT1 (string_length "mcycleh"))) with | s_ => Some (s_) end + else None. + +Definition _s464_ (_s465_ : string) +: option string := + + let _s466_ := _s465_ in + if ((string_startswith _s466_ "minstret")) then + match (string_drop _s466_ (projT1 (string_length "minstret"))) with | s_ => Some (s_) end + else None. + +Definition _s460_ (_s461_ : string) +: option string := + + let _s462_ := _s461_ in + if ((string_startswith _s462_ "mcycle")) then + match (string_drop _s462_ (projT1 (string_length "mcycle"))) with | s_ => Some (s_) end + else None. + +Definition _s456_ (_s457_ : string) +: option string := + + let _s458_ := _s457_ in + if ((string_startswith _s458_ "pmpaddr15")) then + match (string_drop _s458_ (projT1 (string_length "pmpaddr15"))) with | s_ => Some (s_) end + else None. + +Definition _s452_ (_s453_ : string) +: option string := + + let _s454_ := _s453_ in + if ((string_startswith _s454_ "pmpaddr14")) then + match (string_drop _s454_ (projT1 (string_length "pmpaddr14"))) with | s_ => Some (s_) end + else None. + +Definition _s448_ (_s449_ : string) +: option string := + + let _s450_ := _s449_ in + if ((string_startswith _s450_ "pmpaddr13")) then + match (string_drop _s450_ (projT1 (string_length "pmpaddr13"))) with | s_ => Some (s_) end + else None. + +Definition _s444_ (_s445_ : string) +: option string := + + let _s446_ := _s445_ in + if ((string_startswith _s446_ "pmpaddr12")) then + match (string_drop _s446_ (projT1 (string_length "pmpaddr12"))) with | s_ => Some (s_) end + else None. + +Definition _s440_ (_s441_ : string) +: option string := + + let _s442_ := _s441_ in + if ((string_startswith _s442_ "pmpaddr11")) then + match (string_drop _s442_ (projT1 (string_length "pmpaddr11"))) with | s_ => Some (s_) end + else None. + +Definition _s436_ (_s437_ : string) +: option string := + + let _s438_ := _s437_ in + if ((string_startswith _s438_ "pmpaddr10")) then + match (string_drop _s438_ (projT1 (string_length "pmpaddr10"))) with | s_ => Some (s_) end + else None. + +Definition _s432_ (_s433_ : string) +: option string := + + let _s434_ := _s433_ in + if ((string_startswith _s434_ "pmpaddr9")) then + match (string_drop _s434_ (projT1 (string_length "pmpaddr9"))) with | s_ => Some (s_) end + else None. + +Definition _s428_ (_s429_ : string) +: option string := + + let _s430_ := _s429_ in + if ((string_startswith _s430_ "pmpaddr8")) then + match (string_drop _s430_ (projT1 (string_length "pmpaddr8"))) with | s_ => Some (s_) end + else None. + +Definition _s424_ (_s425_ : string) +: option string := + + let _s426_ := _s425_ in + if ((string_startswith _s426_ "pmpaddr7")) then + match (string_drop _s426_ (projT1 (string_length "pmpaddr7"))) with | s_ => Some (s_) end + else None. + +Definition _s420_ (_s421_ : string) +: option string := + + let _s422_ := _s421_ in + if ((string_startswith _s422_ "pmpaddr6")) then + match (string_drop _s422_ (projT1 (string_length "pmpaddr6"))) with | s_ => Some (s_) end + else None. + +Definition _s416_ (_s417_ : string) +: option string := + + let _s418_ := _s417_ in + if ((string_startswith _s418_ "pmpaddr5")) then + match (string_drop _s418_ (projT1 (string_length "pmpaddr5"))) with | s_ => Some (s_) end + else None. + +Definition _s412_ (_s413_ : string) +: option string := + + let _s414_ := _s413_ in + if ((string_startswith _s414_ "pmpaddr4")) then + match (string_drop _s414_ (projT1 (string_length "pmpaddr4"))) with | s_ => Some (s_) end + else None. + +Definition _s408_ (_s409_ : string) +: option string := + + let _s410_ := _s409_ in + if ((string_startswith _s410_ "pmpaddr3")) then + match (string_drop _s410_ (projT1 (string_length "pmpaddr3"))) with | s_ => Some (s_) end + else None. + +Definition _s404_ (_s405_ : string) +: option string := + + let _s406_ := _s405_ in + if ((string_startswith _s406_ "pmpaddr2")) then + match (string_drop _s406_ (projT1 (string_length "pmpaddr2"))) with | s_ => Some (s_) end + else None. + +Definition _s400_ (_s401_ : string) +: option string := + + let _s402_ := _s401_ in + if ((string_startswith _s402_ "pmpaddr1")) then + match (string_drop _s402_ (projT1 (string_length "pmpaddr1"))) with | s_ => Some (s_) end + else None. + +Definition _s396_ (_s397_ : string) +: option string := + + let _s398_ := _s397_ in + if ((string_startswith _s398_ "pmpaddr0")) then + match (string_drop _s398_ (projT1 (string_length "pmpaddr0"))) with | s_ => Some (s_) end + else None. + +Definition _s392_ (_s393_ : string) +: option string := + + let _s394_ := _s393_ in + if ((string_startswith _s394_ "pmpcfg3")) then + match (string_drop _s394_ (projT1 (string_length "pmpcfg3"))) with | s_ => Some (s_) end + else None. + +Definition _s388_ (_s389_ : string) +: option string := + + let _s390_ := _s389_ in + if ((string_startswith _s390_ "pmpcfg2")) then + match (string_drop _s390_ (projT1 (string_length "pmpcfg2"))) with | s_ => Some (s_) end + else None. + +Definition _s384_ (_s385_ : string) +: option string := + + let _s386_ := _s385_ in + if ((string_startswith _s386_ "pmpcfg1")) then + match (string_drop _s386_ (projT1 (string_length "pmpcfg1"))) with | s_ => Some (s_) end + else None. + +Definition _s380_ (_s381_ : string) +: option string := + + let _s382_ := _s381_ in + if ((string_startswith _s382_ "pmpcfg0")) then + match (string_drop _s382_ (projT1 (string_length "pmpcfg0"))) with | s_ => Some (s_) end + else None. + +Definition _s376_ (_s377_ : string) +: option string := + + let _s378_ := _s377_ in + if ((string_startswith _s378_ "mip")) then + match (string_drop _s378_ (projT1 (string_length "mip"))) with | s_ => Some (s_) end + else None. + +Definition _s372_ (_s373_ : string) +: option string := + + let _s374_ := _s373_ in + if ((string_startswith _s374_ "mtval")) then + match (string_drop _s374_ (projT1 (string_length "mtval"))) with | s_ => Some (s_) end + else None. + +Definition _s368_ (_s369_ : string) +: option string := + + let _s370_ := _s369_ in + if ((string_startswith _s370_ "mcause")) then + match (string_drop _s370_ (projT1 (string_length "mcause"))) with | s_ => Some (s_) end + else None. + +Definition _s364_ (_s365_ : string) +: option string := + + let _s366_ := _s365_ in + if ((string_startswith _s366_ "mepc")) then + match (string_drop _s366_ (projT1 (string_length "mepc"))) with | s_ => Some (s_) end + else None. + +Definition _s360_ (_s361_ : string) +: option string := + + let _s362_ := _s361_ in + if ((string_startswith _s362_ "mscratch")) then + match (string_drop _s362_ (projT1 (string_length "mscratch"))) with | s_ => Some (s_) end + else None. + +Definition _s356_ (_s357_ : string) +: option string := + + let _s358_ := _s357_ in + if ((string_startswith _s358_ "mcounteren")) then + match (string_drop _s358_ (projT1 (string_length "mcounteren"))) with | s_ => Some (s_) end + else None. + +Definition _s352_ (_s353_ : string) +: option string := + + let _s354_ := _s353_ in + if ((string_startswith _s354_ "mtvec")) then + match (string_drop _s354_ (projT1 (string_length "mtvec"))) with | s_ => Some (s_) end + else None. + +Definition _s348_ (_s349_ : string) +: option string := + + let _s350_ := _s349_ in + if ((string_startswith _s350_ "mie")) then + match (string_drop _s350_ (projT1 (string_length "mie"))) with | s_ => Some (s_) end + else None. + +Definition _s344_ (_s345_ : string) +: option string := + + let _s346_ := _s345_ in + if ((string_startswith _s346_ "mideleg")) then + match (string_drop _s346_ (projT1 (string_length "mideleg"))) with | s_ => Some (s_) end + else None. + +Definition _s340_ (_s341_ : string) +: option string := + + let _s342_ := _s341_ in + if ((string_startswith _s342_ "medeleg")) then + match (string_drop _s342_ (projT1 (string_length "medeleg"))) with | s_ => Some (s_) end + else None. + +Definition _s336_ (_s337_ : string) +: option string := + + let _s338_ := _s337_ in + if ((string_startswith _s338_ "misa")) then + match (string_drop _s338_ (projT1 (string_length "misa"))) with | s_ => Some (s_) end + else None. + +Definition _s332_ (_s333_ : string) +: option string := + + let _s334_ := _s333_ in + if ((string_startswith _s334_ "mstatus")) then + match (string_drop _s334_ (projT1 (string_length "mstatus"))) with | s_ => Some (s_) end + else None. + +Definition _s328_ (_s329_ : string) +: option string := + + let _s330_ := _s329_ in + if ((string_startswith _s330_ "mhartid")) then + match (string_drop _s330_ (projT1 (string_length "mhartid"))) with | s_ => Some (s_) end + else None. + +Definition _s324_ (_s325_ : string) +: option string := + + let _s326_ := _s325_ in + if ((string_startswith _s326_ "mimpid")) then + match (string_drop _s326_ (projT1 (string_length "mimpid"))) with | s_ => Some (s_) end + else None. + +Definition _s320_ (_s321_ : string) +: option string := + + let _s322_ := _s321_ in + if ((string_startswith _s322_ "marchid")) then + match (string_drop _s322_ (projT1 (string_length "marchid"))) with | s_ => Some (s_) end + else None. + +Definition _s316_ (_s317_ : string) +: option string := + + let _s318_ := _s317_ in + if ((string_startswith _s318_ "mvendorid")) then + match (string_drop _s318_ (projT1 (string_length "mvendorid"))) with | s_ => Some (s_) end + else None. + +Definition _s312_ (_s313_ : string) +: option string := + + let _s314_ := _s313_ in + if ((string_startswith _s314_ "satp")) then + match (string_drop _s314_ (projT1 (string_length "satp"))) with | s_ => Some (s_) end + else None. + +Definition _s308_ (_s309_ : string) +: option string := + + let _s310_ := _s309_ in + if ((string_startswith _s310_ "sip")) then + match (string_drop _s310_ (projT1 (string_length "sip"))) with | s_ => Some (s_) end + else None. + +Definition _s304_ (_s305_ : string) +: option string := + + let _s306_ := _s305_ in + if ((string_startswith _s306_ "stval")) then + match (string_drop _s306_ (projT1 (string_length "stval"))) with | s_ => Some (s_) end + else None. + +Definition _s300_ (_s301_ : string) +: option string := + + let _s302_ := _s301_ in + if ((string_startswith _s302_ "scause")) then + match (string_drop _s302_ (projT1 (string_length "scause"))) with | s_ => Some (s_) end + else None. + +Definition _s296_ (_s297_ : string) +: option string := + + let _s298_ := _s297_ in + if ((string_startswith _s298_ "sepc")) then + match (string_drop _s298_ (projT1 (string_length "sepc"))) with | s_ => Some (s_) end + else None. + +Definition _s292_ (_s293_ : string) +: option string := + + let _s294_ := _s293_ in + if ((string_startswith _s294_ "sscratch")) then + match (string_drop _s294_ (projT1 (string_length "sscratch"))) with | s_ => Some (s_) end + else None. + +Definition _s288_ (_s289_ : string) +: option string := + + let _s290_ := _s289_ in + if ((string_startswith _s290_ "scounteren")) then + match (string_drop _s290_ (projT1 (string_length "scounteren"))) with | s_ => Some (s_) end + else None. + +Definition _s284_ (_s285_ : string) +: option string := + + let _s286_ := _s285_ in + if ((string_startswith _s286_ "stvec")) then + match (string_drop _s286_ (projT1 (string_length "stvec"))) with | s_ => Some (s_) end + else None. + +Definition _s280_ (_s281_ : string) +: option string := + + let _s282_ := _s281_ in + if ((string_startswith _s282_ "sie")) then + match (string_drop _s282_ (projT1 (string_length "sie"))) with | s_ => Some (s_) end + else None. + +Definition _s276_ (_s277_ : string) +: option string := + + let _s278_ := _s277_ in + if ((string_startswith _s278_ "sideleg")) then + match (string_drop _s278_ (projT1 (string_length "sideleg"))) with | s_ => Some (s_) end + else None. + +Definition _s272_ (_s273_ : string) +: option string := + + let _s274_ := _s273_ in + if ((string_startswith _s274_ "sedeleg")) then + match (string_drop _s274_ (projT1 (string_length "sedeleg"))) with | s_ => Some (s_) end + else None. + +Definition _s268_ (_s269_ : string) +: option string := + + let _s270_ := _s269_ in + if ((string_startswith _s270_ "sstatus")) then + match (string_drop _s270_ (projT1 (string_length "sstatus"))) with | s_ => Some (s_) end + else None. + +Definition _s264_ (_s265_ : string) +: option string := + + let _s266_ := _s265_ in + if ((string_startswith _s266_ "instreth")) then + match (string_drop _s266_ (projT1 (string_length "instreth"))) with | s_ => Some (s_) end + else None. + +Definition _s260_ (_s261_ : string) +: option string := + + let _s262_ := _s261_ in + if ((string_startswith _s262_ "timeh")) then + match (string_drop _s262_ (projT1 (string_length "timeh"))) with | s_ => Some (s_) end + else None. + +Definition _s256_ (_s257_ : string) +: option string := + + let _s258_ := _s257_ in + if ((string_startswith _s258_ "cycleh")) then + match (string_drop _s258_ (projT1 (string_length "cycleh"))) with | s_ => Some (s_) end + else None. + +Definition _s252_ (_s253_ : string) +: option string := + + let _s254_ := _s253_ in + if ((string_startswith _s254_ "instret")) then + match (string_drop _s254_ (projT1 (string_length "instret"))) with | s_ => Some (s_) end + else None. + +Definition _s248_ (_s249_ : string) +: option string := + + let _s250_ := _s249_ in + if ((string_startswith _s250_ "time")) then + match (string_drop _s250_ (projT1 (string_length "time"))) with | s_ => Some (s_) end + else None. + +Definition _s244_ (_s245_ : string) +: option string := + + let _s246_ := _s245_ in + if ((string_startswith _s246_ "cycle")) then + match (string_drop _s246_ (projT1 (string_length "cycle"))) with | s_ => Some (s_) end + else None. + +Definition _s240_ (_s241_ : string) +: option string := + + let _s242_ := _s241_ in + if ((string_startswith _s242_ "fcsr")) then + match (string_drop _s242_ (projT1 (string_length "fcsr"))) with | s_ => Some (s_) end + else None. + +Definition _s236_ (_s237_ : string) +: option string := + + let _s238_ := _s237_ in + if ((string_startswith _s238_ "frm")) then + match (string_drop _s238_ (projT1 (string_length "frm"))) with | s_ => Some (s_) end + else None. + +Definition _s232_ (_s233_ : string) +: option string := + + let _s234_ := _s233_ in + if ((string_startswith _s234_ "fflags")) then + match (string_drop _s234_ (projT1 (string_length "fflags"))) with | s_ => Some (s_) end + else None. + +Definition _s228_ (_s229_ : string) +: option string := + + let _s230_ := _s229_ in + if ((string_startswith _s230_ "uip")) then + match (string_drop _s230_ (projT1 (string_length "uip"))) with | s_ => Some (s_) end + else None. + +Definition _s224_ (_s225_ : string) +: option string := + + let _s226_ := _s225_ in + if ((string_startswith _s226_ "utval")) then + match (string_drop _s226_ (projT1 (string_length "utval"))) with | s_ => Some (s_) end + else None. + +Definition _s220_ (_s221_ : string) +: option string := + + let _s222_ := _s221_ in + if ((string_startswith _s222_ "ucause")) then + match (string_drop _s222_ (projT1 (string_length "ucause"))) with | s_ => Some (s_) end + else None. + +Definition _s216_ (_s217_ : string) +: option string := + + let _s218_ := _s217_ in + if ((string_startswith _s218_ "uepc")) then + match (string_drop _s218_ (projT1 (string_length "uepc"))) with | s_ => Some (s_) end + else None. + +Definition _s212_ (_s213_ : string) +: option string := + + let _s214_ := _s213_ in + if ((string_startswith _s214_ "uscratch")) then + match (string_drop _s214_ (projT1 (string_length "uscratch"))) with | s_ => Some (s_) end + else None. + +Definition _s208_ (_s209_ : string) +: option string := + + let _s210_ := _s209_ in + if ((string_startswith _s210_ "utvec")) then + match (string_drop _s210_ (projT1 (string_length "utvec"))) with | s_ => Some (s_) end + else None. + +Definition _s204_ (_s205_ : string) +: option string := + + let _s206_ := _s205_ in + if ((string_startswith _s206_ "uie")) then + match (string_drop _s206_ (projT1 (string_length "uie"))) with | s_ => Some (s_) end + else None. + +Definition _s200_ (_s201_ : string) +: option string := + + let _s202_ := _s201_ in + if ((string_startswith _s202_ "ustatus")) then + match (string_drop _s202_ (projT1 (string_length "ustatus"))) with | s_ => Some (s_) end + else None. + +Definition csr_name_map_matches_prefix (arg_ : string) +: M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) := + + let _s203_ := arg_ in + (if ((match (_s200_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s200_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s204_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s204_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s208_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s208_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s212_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s212_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s216_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s216_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s220_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s220_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s224_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s224_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s228_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s228_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s232_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s232_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s236_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s236_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s240_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s240_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s244_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s244_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s248_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s248_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s252_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s252_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s256_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s256_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s260_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s260_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s264_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s264_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s268_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s268_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s272_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s272_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s276_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s276_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s280_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s280_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s284_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s284_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s288_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s288_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s292_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s292_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s296_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s296_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s300_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s300_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s304_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s304_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s308_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s308_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s312_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s312_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s316_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s316_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s320_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s320_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s324_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s324_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s328_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s328_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s332_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s332_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s336_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s336_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s340_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s340_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s344_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s344_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s348_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s348_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s352_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s352_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s356_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s356_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s360_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s360_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s364_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s364_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s368_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s368_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s372_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s372_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s376_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s376_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s380_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s380_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s384_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s384_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s388_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s388_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s392_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s392_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s396_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s396_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s400_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s400_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s404_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s404_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s408_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s408_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s412_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s412_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s416_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s416_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s420_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s420_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s424_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s424_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B1;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s428_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s428_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s432_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s432_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s436_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s436_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s440_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s440_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s444_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s444_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s448_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s448_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s452_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s452_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s456_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s456_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B1;B1;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s460_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s460_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s464_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s464_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s468_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s468_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s472_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s472_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1;B0;B1;B1;B1;B0;B0;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s476_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s476_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s480_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s480_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s484_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s484_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B1;B0] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s488_ _s203_) with | Some (s_) => true | _ => false end)) then + (match (_s488_ _s203_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B1;B1] : mword 12), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((mword 12 * {n : Z & ArithFact (n >= 0)})))) + : M (option ((mword 12 * {n : Z & ArithFact (n >= 0)}))). + +Definition csrAccess (csr : mword 12) : mword 2 := subrange_vec_dec csr 11 10. + +Definition csrPriv (csr : mword 12) : mword 2 := subrange_vec_dec csr 9 8. + +Definition is_CSR_defined (csr : mword 12) (p : Privilege) +: bool := + + let b__0 := csr in + if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B0;B1] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B1] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B1;B0;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B0] : mword 12))) then + false + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + orb (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2)) + (eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + eq_vec (privLevel_to_bits p) ((privLevel_to_bits Machine) : mword 2) + else false. + +Definition check_CSR_access (csrrw : mword 2) (csrpr : mword 2) (p : Privilege) (isWrite : bool) +: bool := + + andb (negb (andb (Bool.eqb isWrite true) (eq_vec csrrw (vec_of_bits [B1;B1] : mword 2)))) + (zopz0zKzJ_u (privLevel_to_bits p) csrpr). + +Definition check_TVM_SATP (csr : mword 12) (p : Privilege) +: M (bool) := + + (and_boolM + (returnm ((eq_vec csr (vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12)) + : bool)) + ((and_boolM + (returnm ((eq_vec (privLevel_to_bits p) ((privLevel_to_bits Supervisor) : mword 2)) + : bool)) + (read_reg mstatus_ref >>= fun w__0 : Mstatus => + returnm ((eq_vec (_get_Mstatus_TVM w__0) ((bool_to_bits true) : mword 1)) + : bool))) + : M (bool))) >>= fun w__2 : bool => + returnm ((negb w__2) + : bool). + +Definition check_Counteren (csr : mword 12) (p : Privilege) +: M (bool) := + + (match (csr, p) with + | (b__0, Supervisor) => + (if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + read_reg mcounteren_ref >>= fun w__0 : Counteren => + returnm ((eq_vec (_get_Counteren_CY w__0) ((bool_to_bits true) : mword 1)) + : bool) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + read_reg mcounteren_ref >>= fun w__1 : Counteren => + returnm ((eq_vec (_get_Counteren_TM w__1) ((bool_to_bits true) : mword 1)) + : bool) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + read_reg mcounteren_ref >>= fun w__2 : Counteren => + returnm ((eq_vec (_get_Counteren_IR w__2) ((bool_to_bits true) : mword 1)) + : bool) + else + returnm ((match (b__0, Supervisor) with + | (g__37, g__38) => + if ((andb + (zopz0zIzJ_u + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12) csr) + (zopz0zIzJ_u csr + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B1;B1;B1;B1;B1] : mword 12)))) + then + false + else true + end) + : bool)) + : M (bool) + | (b__3, User) => + (if ((eq_vec b__3 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + read_reg scounteren_ref >>= fun w__6 : Counteren => + returnm ((eq_vec (_get_Counteren_CY w__6) ((bool_to_bits true) : mword 1)) + : bool) + else if ((eq_vec b__3 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + read_reg scounteren_ref >>= fun w__7 : Counteren => + returnm ((eq_vec (_get_Counteren_TM w__7) ((bool_to_bits true) : mword 1)) + : bool) + else if ((eq_vec b__3 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + read_reg scounteren_ref >>= fun w__8 : Counteren => + returnm ((eq_vec (_get_Counteren_IR w__8) ((bool_to_bits true) : mword 1)) + : bool) + else + returnm ((match (b__3, User) with + | (g__37, g__38) => + if ((andb + (zopz0zIzJ_u + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12) csr) + (zopz0zIzJ_u csr + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B1;B1;B1;B1;B1] : mword 12)))) + then + false + else true + end) + : bool)) + : M (bool) + | (g__37, g__38) => + returnm ((if ((andb + (zopz0zIzJ_u (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12) + csr) + (zopz0zIzJ_u csr + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B1;B1;B1;B1;B1] : mword 12)))) then + false + else true) + : bool) + end) + : M (bool). + +Definition check_CSR (csr : mword 12) (p : Privilege) (isWrite : bool) +: M (bool) := + + (and_boolM (returnm ((is_CSR_defined csr p) : bool)) + ((and_boolM (returnm ((check_CSR_access (csrAccess csr) (csrPriv csr) p isWrite) : bool)) + ((and_boolM ((check_TVM_SATP csr p) : M (bool)) ((check_Counteren csr p) : M (bool))) + : M (bool))) + : M (bool))) + : M (bool). + +Axiom speculate_conditional : forall (_ : unit) , M (bool). + +Axiom load_reservation : forall (_ : mword 64) , unit. + +Axiom match_reservation : forall (_ : mword 64) , bool. + +Axiom cancel_reservation : forall (_ : unit) , unit. + +Definition exception_delegatee (e : ExceptionType) (p : Privilege) +: M (Privilege) := + + let 'idx := projT1 (num_of_ExceptionType e) in + read_reg medeleg_ref >>= fun w__0 : Medeleg => + let super := access_vec_dec (_get_Medeleg_bits w__0) idx in + read_reg sedeleg_ref >>= fun w__1 : Sedeleg => + let user := access_vec_dec (_get_Sedeleg_bits w__1) idx in + (and_boolM + (read_reg misa_ref >>= fun w__2 : Misa => + returnm ((eq_vec (_get_Misa_S w__2) ((bool_to_bits true) : mword 1)) + : bool)) ((bit_to_bool super) : M (bool))) >>= fun w__4 : bool => + let deleg := if (w__4) then Supervisor else Machine in + returnm ((if ((zopz0zI_u (privLevel_to_bits deleg) (privLevel_to_bits p))) then p + else deleg) + : Privilege). + +Definition findPendingInterrupt (ip : mword 64) +: option InterruptType := + + let ip := Mk_Minterrupts ip in + if ((eq_vec (_get_Minterrupts_MEI ip) ((bool_to_bits true) : mword 1))) then Some (I_M_External) + else if ((eq_vec (_get_Minterrupts_MSI ip) ((bool_to_bits true) : mword 1))) then + Some + (I_M_Software) + else if ((eq_vec (_get_Minterrupts_MTI ip) ((bool_to_bits true) : mword 1))) then + Some + (I_M_Timer) + else if ((eq_vec (_get_Minterrupts_SEI ip) ((bool_to_bits true) : mword 1))) then + Some + (I_S_External) + else if ((eq_vec (_get_Minterrupts_SSI ip) ((bool_to_bits true) : mword 1))) then + Some + (I_S_Software) + else if ((eq_vec (_get_Minterrupts_STI ip) ((bool_to_bits true) : mword 1))) then + Some + (I_S_Timer) + else if ((eq_vec (_get_Minterrupts_UEI ip) ((bool_to_bits true) : mword 1))) then + Some + (I_U_External) + else if ((eq_vec (_get_Minterrupts_USI ip) ((bool_to_bits true) : mword 1))) then + Some + (I_U_Software) + else if ((eq_vec (_get_Minterrupts_UTI ip) ((bool_to_bits true) : mword 1))) then + Some + (I_U_Timer) + else None. + +Definition curInterrupt +(priv : Privilege) (pend : Minterrupts) (enbl : Minterrupts) (delg : Minterrupts) +: M (option ((InterruptType * Privilege))) := + + let en_mip : xlenbits := and_vec (_get_Minterrupts_bits pend) (_get_Minterrupts_bits enbl) in + (if ((eq_vec en_mip (EXTZ 64 (vec_of_bits [B0] : mword 1)))) then + returnm (None + : option ((InterruptType * Privilege))) + else + (or_boolM + (returnm ((neq_vec (privLevel_to_bits priv) ((privLevel_to_bits Machine) : mword 2)) + : bool)) + ((and_boolM + (returnm ((eq_vec (privLevel_to_bits priv) ((privLevel_to_bits Machine) : mword 2)) + : bool)) + (read_reg mstatus_ref >>= fun w__0 : Mstatus => + returnm ((eq_vec (_get_Mstatus_MIE w__0) ((bool_to_bits true) : mword 1)) + : bool))) + : M (bool))) >>= fun eff_mie => + (or_boolM + (returnm ((eq_vec (privLevel_to_bits priv) ((privLevel_to_bits User) : mword 2)) + : bool)) + ((and_boolM + (returnm ((eq_vec (privLevel_to_bits priv) ((privLevel_to_bits Supervisor) : mword 2)) + : bool)) + (read_reg mstatus_ref >>= fun w__2 : Mstatus => + returnm ((eq_vec (_get_Mstatus_SIE w__2) ((bool_to_bits true) : mword 1)) + : bool))) + : M (bool))) >>= fun eff_sie => + let eff_mip := and_vec en_mip (not_vec (_get_Minterrupts_bits delg)) in + let eff_sip := and_vec en_mip (_get_Minterrupts_bits delg) in + (if ((andb eff_mie (neq_vec eff_mip (EXTZ 64 (vec_of_bits [B0] : mword 1))))) then + (match (findPendingInterrupt eff_mip) with + | Some (i) => + let r := (i, Machine) in + returnm ((Some + (r)) + : option ((InterruptType * Privilege))) + | None => + (internal_error + (String.append "non-zero eff_mip=" + (String.append (string_of_bits eff_mip) ", but nothing pending"))) + : M (option ((InterruptType * Privilege))) + end) + : M (option ((InterruptType * Privilege))) + else if ((andb eff_sie (neq_vec eff_sip (EXTZ 64 (vec_of_bits [B0] : mword 1))))) then + (match (findPendingInterrupt eff_sip) with + | Some (i) => + let r := (i, Supervisor) in + returnm ((Some + (r)) + : option ((InterruptType * Privilege))) + | None => + (internal_error + (String.append "non-zero eff_sip=" + (String.append (string_of_bits eff_sip) ", but nothing pending"))) + : M (option ((InterruptType * Privilege))) + end) + : M (option ((InterruptType * Privilege))) + else + let p := + if ((eq_vec (_get_Minterrupts_MTI pend) ((bool_to_bits true) : mword 1))) then "1" + else "0" in + let e := + if ((eq_vec (_get_Minterrupts_MTI enbl) ((bool_to_bits true) : mword 1))) then "1" + else "0" in + let d := + if ((eq_vec (_get_Minterrupts_MTI delg) ((bool_to_bits true) : mword 1))) then "1" + else "0" in + let '_ := + (print_endline + (String.append " MTI: pend=" + (String.append p + (String.append " enbl=" (String.append e (String.append " delg=" d)))))) + : unit in + let eff_mip := and_vec en_mip (not_vec (_get_Minterrupts_bits delg)) in + let eff_sip := and_vec en_mip (_get_Minterrupts_bits delg) in + read_reg mstatus_ref >>= fun w__8 : Mstatus => + read_reg mstatus_ref >>= fun w__9 : Mstatus => + read_reg mstatus_ref >>= fun w__10 : Mstatus => + let '_ := + (print_endline + (String.append "mstatus=" + (String.append (string_of_bits (_get_Mstatus_bits w__8)) + (String.append " mie,sie=" + (String.append (string_of_bits (_get_Mstatus_MIE w__9)) + (String.append "," + (String.append (string_of_bits (_get_Mstatus_SIE w__10)) + (String.append " en_mip=" + (String.append (string_of_bits en_mip) + (String.append " eff_mip=" + (String.append (string_of_bits eff_mip) + (String.append " eff_sip=" (string_of_bits eff_sip))))))))))))) + : unit in + returnm (None + : option ((InterruptType * Privilege)))) + : M (option ((InterruptType * Privilege)))) + : M (option ((InterruptType * Privilege))). + +Definition tval (excinfo : option (mword 64)) +: mword 64 := + + match excinfo with | Some (e) => e | None => EXTZ 64 (vec_of_bits [B0] : mword 1) end. + +Definition rvfi_trap '(tt : unit) : unit := tt. + +Definition handle_trap +(del_priv : Privilege) (intr : bool) (c : mword 4) (pc : mword 64) (info : option (mword 64)) +: M (mword 64) := + + let '_ := (rvfi_trap tt) : unit in + let '_ := + (print_endline + (String.append "handling " + (String.append (if (intr) then "int#" else "exc#") + (String.append (string_of_bits c) + (String.append " at priv " + (String.append ((privLevel_to_str del_priv) : string) + (String.append " with tval " (string_of_bits (tval info))))))))) + : unit in + (match del_priv with + | Machine => + (_set_Mcause_IsInterrupt mcause_ref ((bool_to_bits intr) : mword 1)) >> + (_set_Mcause_Cause mcause_ref (EXTZ 63 c)) >> + read_reg mstatus_ref >>= fun w__0 : Mstatus => + (_set_Mstatus_MPIE mstatus_ref (_get_Mstatus_MIE w__0)) >> + (_set_Mstatus_MIE mstatus_ref ((bool_to_bits false) : mword 1)) >> + read_reg cur_privilege_ref >>= fun w__1 : Privilege => + (_set_Mstatus_MPP mstatus_ref (privLevel_to_bits w__1)) >> + write_reg mtval_ref (tval info) >> + write_reg mepc_ref pc >> + write_reg cur_privilege_ref del_priv >> + read_reg mstatus_ref >>= fun w__2 : Mstatus => + read_reg mstatus_ref >>= fun w__3 : Mstatus => + let '_ := + (print_endline + (String.append "CSR mstatus <- " + (String.append (string_of_bits (_get_Mstatus_bits w__2)) + (String.append " (input: " + (String.append (string_of_bits (_get_Mstatus_bits w__3)) ")"))))) + : unit in + let '_ := (cancel_reservation tt) : unit in + read_reg mtvec_ref >>= fun w__4 : Mtvec => + read_reg mcause_ref >>= fun w__5 : Mcause => + (match (tvec_addr w__4 w__5) with + | Some (epc) => returnm (epc : mword 64) + | None => (internal_error "Invalid mtvec mode") : M (mword 64) + end) + : M (mword 64) + | Supervisor => + (_set_Mcause_IsInterrupt scause_ref ((bool_to_bits intr) : mword 1)) >> + (_set_Mcause_Cause scause_ref (EXTZ 63 c)) >> + read_reg mstatus_ref >>= fun w__8 : Mstatus => + (_set_Mstatus_SPIE mstatus_ref (_get_Mstatus_SIE w__8)) >> + (_set_Mstatus_SIE mstatus_ref ((bool_to_bits false) : mword 1)) >> + read_reg cur_privilege_ref >>= fun w__9 : Privilege => + (match w__9 with + | User => returnm ((bool_to_bits false) : mword 1) + | Supervisor => returnm ((bool_to_bits true) : mword 1) + | Machine => (internal_error "invalid privilege for s-mode trap") : M (mword 1) + end) >>= fun w__11 : mword 1 => + (_set_Mstatus_SPP mstatus_ref w__11) >> + write_reg stval_ref (tval info) >> + write_reg sepc_ref pc >> + write_reg cur_privilege_ref del_priv >> + read_reg mstatus_ref >>= fun w__12 : Mstatus => + read_reg mstatus_ref >>= fun w__13 : Mstatus => + let '_ := + (print_endline + (String.append "CSR mstatus <- " + (String.append (string_of_bits (_get_Mstatus_bits w__12)) + (String.append " (input: " + (String.append (string_of_bits (_get_Mstatus_bits w__13)) ")"))))) + : unit in + let '_ := (cancel_reservation tt) : unit in + read_reg stvec_ref >>= fun w__14 : Mtvec => + read_reg scause_ref >>= fun w__15 : Mcause => + (match (tvec_addr w__14 w__15) with + | Some (epc) => returnm (epc : mword 64) + | None => (internal_error "Invalid stvec mode") : M (mword 64) + end) + : M (mword 64) + | User => (internal_error "the N extension is currently unsupported") : M (mword 64) + end) + : M (mword 64). + +Definition handle_exception (cur_priv : Privilege) (ctl : ctl_result) (pc : mword 64) +: M (mword 64) := + + (match (cur_priv, ctl) with + | (_, CTL_TRAP (e)) => + (exception_delegatee e.(sync_exception_trap) cur_priv) >>= fun del_priv => + let '_ := + (print_endline + (String.append "trapping from " + (String.append ((privLevel_to_str cur_priv) : string) + (String.append " to " + (String.append ((privLevel_to_str del_priv) : string) + (String.append " to handle " + ((exceptionType_to_str e.(sync_exception_trap)) + : string))))))) + : unit in + (handle_trap del_priv false ((exceptionType_to_bits e.(sync_exception_trap)) : mword 4) pc + e.(sync_exception_excinfo)) + : M (mword 64) + | (_, CTL_MRET (tt)) => + read_reg cur_privilege_ref >>= fun prev_priv => + read_reg mstatus_ref >>= fun w__1 : Mstatus => + (_set_Mstatus_MIE mstatus_ref (_get_Mstatus_MPIE w__1)) >> + (_set_Mstatus_MPIE mstatus_ref ((bool_to_bits true) : mword 1)) >> + read_reg mstatus_ref >>= fun w__2 : Mstatus => + write_reg cur_privilege_ref (privLevel_of_bits (_get_Mstatus_MPP w__2)) >> + (_set_Mstatus_MPP mstatus_ref (privLevel_to_bits User)) >> + read_reg mstatus_ref >>= fun w__3 : Mstatus => + read_reg mstatus_ref >>= fun w__4 : Mstatus => + let '_ := + (print_endline + (String.append "CSR mstatus <- " + (String.append (string_of_bits (_get_Mstatus_bits w__3)) + (String.append " (input: " + (String.append (string_of_bits (_get_Mstatus_bits w__4)) ")"))))) + : unit in + read_reg cur_privilege_ref >>= fun w__5 : Privilege => + let '_ := + (print_endline + (String.append "ret-ing from " + (String.append ((privLevel_to_str prev_priv) : string) + (String.append " to " ((privLevel_to_str w__5) : string))))) + : unit in + let '_ := (cancel_reservation tt) : unit in + ((read_reg mepc_ref) : M (mword 64)) >>= fun w__6 : xlenbits => + (pc_alignment_mask tt) >>= fun w__7 : mword 64 => returnm ((and_vec w__6 w__7) : mword 64) + | (_, CTL_SRET (tt)) => + read_reg cur_privilege_ref >>= fun prev_priv => + read_reg mstatus_ref >>= fun w__8 : Mstatus => + (_set_Mstatus_SIE mstatus_ref (_get_Mstatus_SPIE w__8)) >> + (_set_Mstatus_SPIE mstatus_ref ((bool_to_bits true) : mword 1)) >> + read_reg mstatus_ref >>= fun w__9 : Mstatus => + write_reg + cur_privilege_ref + (if ((eq_vec (_get_Mstatus_SPP w__9) ((bool_to_bits true) : mword 1))) then Supervisor + else User) >> + (_set_Mstatus_SPP mstatus_ref ((bool_to_bits false) : mword 1)) >> + read_reg mstatus_ref >>= fun w__10 : Mstatus => + read_reg mstatus_ref >>= fun w__11 : Mstatus => + let '_ := + (print_endline + (String.append "CSR mstatus <- " + (String.append (string_of_bits (_get_Mstatus_bits w__10)) + (String.append " (input: " + (String.append (string_of_bits (_get_Mstatus_bits w__11)) ")"))))) + : unit in + read_reg cur_privilege_ref >>= fun w__12 : Privilege => + let '_ := + (print_endline + (String.append "ret-ing from " + (String.append ((privLevel_to_str prev_priv) : string) + (String.append " to " ((privLevel_to_str w__12) : string))))) + : unit in + let '_ := (cancel_reservation tt) : unit in + ((read_reg sepc_ref) : M (mword 64)) >>= fun w__13 : xlenbits => + (pc_alignment_mask tt) >>= fun w__14 : mword 64 => + returnm ((and_vec w__13 w__14) + : mword 64) + end) + : M (mword 64). + +Definition handle_mem_exception (addr : mword 64) (e : ExceptionType) +: M (unit) := + + let t : sync_exception := + {| sync_exception_trap := e; + sync_exception_excinfo := (Some (addr)) |} in + read_reg cur_privilege_ref >>= fun w__0 : Privilege => + ((read_reg PC_ref) : M (mword 64)) >>= fun w__1 : xlenbits => + (handle_exception w__0 (CTL_TRAP (t)) w__1) >>= fun w__2 : mword 64 => + write_reg nextPC_ref w__2 + : M (unit). + +Definition handle_interrupt (i : InterruptType) (del_priv : Privilege) +: M (unit) := + + ((read_reg PC_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + (handle_trap del_priv true ((interruptType_to_bits i) : mword 4) w__0 None) >>= fun w__1 : mword 64 => + write_reg nextPC_ref w__1 + : M (unit). + +Definition init_sys '(tt : unit) +: M (unit) := + + write_reg cur_privilege_ref Machine >> + write_reg mhartid_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) >> + (_set_Misa_MXL misa_ref (arch_to_bits RV64)) >> + (_set_Misa_A misa_ref ((bool_to_bits true) : mword 1)) >> + (_set_Misa_C misa_ref ((bool_to_bits true) : mword 1)) >> + (_set_Misa_I misa_ref ((bool_to_bits true) : mword 1)) >> + (_set_Misa_M misa_ref ((bool_to_bits true) : mword 1)) >> + (_set_Misa_U misa_ref ((bool_to_bits true) : mword 1)) >> + (_set_Misa_S misa_ref ((bool_to_bits true) : mword 1)) >> + read_reg misa_ref >>= fun w__0 : Misa => + (_set_Mstatus_SXL mstatus_ref (_get_Misa_MXL w__0)) >> + read_reg misa_ref >>= fun w__1 : Misa => + (_set_Mstatus_UXL mstatus_ref (_get_Misa_MXL w__1)) >> + (_set_Mstatus_SD mstatus_ref ((bool_to_bits false) : mword 1)) >> + (_set_Minterrupts_bits mip_ref (EXTZ 64 (vec_of_bits [B0] : mword 1))) >> + (_set_Minterrupts_bits mie_ref (EXTZ 64 (vec_of_bits [B0] : mword 1))) >> + (_set_Minterrupts_bits mideleg_ref (EXTZ 64 (vec_of_bits [B0] : mword 1))) >> + (_set_Medeleg_bits medeleg_ref (EXTZ 64 (vec_of_bits [B0] : mword 1))) >> + (_set_Mtvec_bits mtvec_ref (EXTZ 64 (vec_of_bits [B0] : mword 1))) >> + (_set_Mcause_bits mcause_ref (EXTZ 64 (vec_of_bits [B0] : mword 1))) >> + write_reg mepc_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) >> + write_reg mtval_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) >> + write_reg mscratch_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) >> + write_reg mcycle_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) >> + write_reg mtime_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) >> + (_set_Counteren_bits mcounteren_ref (EXTZ 32 (vec_of_bits [B0] : mword 1))) >> + write_reg minstret_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) >> + write_reg minstret_written_ref false >> + read_reg mstatus_ref >>= fun w__2 : Mstatus => + returnm ((print_endline + (String.append "CSR mstatus <- " + (String.append (string_of_bits (_get_Mstatus_bits w__2)) + (String.append " (input: " + (String.append + (string_of_bits ((EXTZ 64 (vec_of_bits [B0] : mword 1)) : xlenbits)) + ")"))))) + : unit). + +Axiom plat_ram_base : forall (_ : unit) , mword 64. + +Axiom plat_ram_size : forall (_ : unit) , mword 64. + +Axiom plat_enable_dirty_update : forall (_ : unit) , bool. + +Axiom plat_enable_misaligned_access : forall (_ : unit) , bool. + +Axiom plat_mtval_has_illegal_inst_bits : forall (_ : unit) , bool. + +Axiom plat_rom_base : forall (_ : unit) , mword 64. + +Axiom plat_rom_size : forall (_ : unit) , mword 64. + +Axiom plat_clint_base : forall (_ : unit) , mword 64. + +Axiom plat_clint_size : forall (_ : unit) , mword 64. + +Axiom plat_htif_tohost : forall (_ : unit) , mword 64. + +Definition phys_mem_segments '(tt : unit) +: list ((mword 64 * mword 64)) := + + (plat_rom_base tt, plat_rom_size tt) :: (plat_ram_base tt, plat_ram_size tt) :: []. + +Definition within_phys_mem (addr : mword 64) (width : Z) +: bool := + + let ram_base := plat_ram_base tt in + let rom_base := plat_rom_base tt in + let ram_size := plat_ram_size tt in + let rom_size := plat_rom_size tt in + if ((andb (zopz0zIzJ_u ram_base addr) + (zopz0zIzJ_u (add_vec_int addr width) (add_vec ram_base ram_size)))) then + true + else if ((andb (zopz0zIzJ_u rom_base addr) + (zopz0zIzJ_u (add_vec_int addr width) (add_vec rom_base rom_size)))) then + true + else + let '_ := + (print_endline + (String.append "within_phys_mem: " + (String.append (string_of_bits addr) " not within phys-mem:"))) + : unit in + let '_ := (print_endline (String.append " plat_rom_base: " (string_of_bits rom_base))) : unit in + let '_ := (print_endline (String.append " plat_rom_size: " (string_of_bits rom_size))) : unit in + let '_ := (print_endline (String.append " plat_ram_base: " (string_of_bits ram_base))) : unit in + let '_ := (print_endline (String.append " plat_ram_size: " (string_of_bits ram_size))) : unit in + false. + +Definition within_clint (addr : mword 64) (width : Z) +: bool := + + andb (zopz0zIzJ_u (plat_clint_base tt) addr) + (zopz0zIzJ_u (add_vec_int addr width) (add_vec (plat_clint_base tt) (plat_clint_size tt))). + +Definition within_htif_writable (addr : mword 64) (width : Z) +: bool := + + eq_vec (plat_htif_tohost tt) addr. + +Definition within_htif_readable (addr : mword 64) (width : Z) +: bool := + + eq_vec (plat_htif_tohost tt) addr. + +Axiom plat_insns_per_tick : forall (_ : unit) , Z. + +Definition MSIP_BASE : xlenbits := +(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64). +Hint Unfold MSIP_BASE : sail. +Definition MTIMECMP_BASE : xlenbits := +(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64). +Hint Unfold MTIMECMP_BASE : sail. +Definition MTIME_BASE : xlenbits := +(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B1;B0;B1;B1;B1;B1;B1;B1;B1;B1;B1;B1;B1;B0;B0; + B0] + : mword 64). +Hint Unfold MTIME_BASE : sail. +Definition clint_load (addr : mword 64) (width : Z) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + let addr := sub_vec addr (plat_clint_base tt) in + (if sumbool_of_bool ((andb (eq_vec addr MSIP_BASE) (orb (Z.eqb width 8) (Z.eqb width 4)))) then + read_reg mip_ref >>= fun w__0 : Minterrupts => + let '_ := + (print_endline + (String.append "clint[" + (String.append (string_of_bits addr) + (String.append "] -> " (string_of_bits (_get_Minterrupts_MSI w__0)))))) + : unit in + read_reg mip_ref >>= fun w__1 : Minterrupts => + returnm ((MemValue + (zero_extend (_get_Minterrupts_MSI w__1) (Z.mul 8 width))) + : MemoryOpResult (mword (8 * width))) + else if sumbool_of_bool ((andb (eq_vec addr MTIMECMP_BASE) (Z.eqb width 8))) then + ((read_reg mtimecmp_ref) : M (mword 64)) >>= fun w__2 : xlenbits => + let '_ := + (print_endline + (String.append "clint[" + (String.append (string_of_bits addr) (String.append "] -> " (string_of_bits w__2))))) + : unit in + ((read_reg mtimecmp_ref) : M (mword 64)) >>= fun w__3 : xlenbits => + returnm ((MemValue + (zero_extend w__3 _)) + : MemoryOpResult (mword (8 * width))) + else if sumbool_of_bool ((andb (eq_vec addr MTIME_BASE) (Z.eqb width 8))) then + ((read_reg mtime_ref) : M (mword 64)) >>= fun w__4 : xlenbits => + let '_ := + (print_endline + (String.append "clint[" + (String.append (string_of_bits addr) (String.append "] -> " (string_of_bits w__4))))) + : unit in + ((read_reg mtime_ref) : M (mword 64)) >>= fun w__5 : xlenbits => + returnm ((MemValue + (zero_extend w__5 _)) + : MemoryOpResult (mword (8 * width))) + else + let '_ := + (print_endline + (String.append "clint[" (String.append (string_of_bits addr) "] -> <not-mapped>"))) + : unit in + returnm ((MemException + (E_Load_Access_Fault)) + : MemoryOpResult (mword (8 * width)))) + : M (MemoryOpResult (mword (8 * width))). + +Definition clint_dispatch '(tt : unit) +: M (unit) := + + ((read_reg mtime_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + let '_ := (print_endline (String.append "clint::tick mtime <- " (string_of_bits w__0))) : unit in + (_set_Minterrupts_MTI mip_ref ((bool_to_bits false) : mword 1)) >> + ((read_reg mtimecmp_ref) : M (mword 64)) >>= fun w__1 : xlenbits => + ((read_reg mtime_ref) : M (mword 64)) >>= fun w__2 : xlenbits => + (if ((zopz0zIzJ_u w__1 w__2)) then + ((read_reg mtime_ref) : M (mword 64)) >>= fun w__3 : xlenbits => + let '_ := + (print_endline (String.append " clint timer pending at mtime " (string_of_bits w__3))) + : unit in + (_set_Minterrupts_MTI mip_ref ((bool_to_bits true) : mword 1)) + : M (unit) + else returnm (tt : unit)) + : M (unit). + +Definition clint_store (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + let addr := sub_vec addr (plat_clint_base tt) in + (if sumbool_of_bool ((andb (eq_vec addr MSIP_BASE) (orb (Z.eqb width 8) (Z.eqb width 4)))) then + (cast_unit_vec (access_vec_dec data 0)) >>= fun w__0 : mword 1 => + let '_ := + (print_endline + (String.append "clint[" + (String.append (string_of_bits addr) + (String.append "] <- " + (String.append (string_of_bits data) + (String.append " (mip.MSI <- " (String.append (string_of_bits w__0) ")"))))))) + : unit in + (cast_unit_vec (access_vec_dec data 0)) >>= fun w__1 : mword 1 => + (_set_Minterrupts_MSI mip_ref + ((bool_to_bits (eq_vec w__1 (vec_of_bits [B1] : mword 1))) + : mword 1)) >> + (clint_dispatch tt) >> returnm ((MemValue (true)) : MemoryOpResult bool) + else if sumbool_of_bool ((andb (eq_vec addr MTIMECMP_BASE) (Z.eqb width 8))) then + let '_ := + (print_endline + (String.append "clint[" + (String.append (string_of_bits addr) + (String.append "] <- " (String.append (string_of_bits data) " (mtimecmp)"))))) + : unit in + write_reg mtimecmp_ref (zero_extend data 64) >> + (clint_dispatch tt) >> returnm ((MemValue (true)) : MemoryOpResult bool) + else + let '_ := + (print_endline + (String.append "clint[" + (String.append (string_of_bits addr) + (String.append "] <- " (String.append (string_of_bits data) " (<unmapped>)"))))) + : unit in + returnm ((MemException + (E_SAMO_Access_Fault)) + : MemoryOpResult bool)) + : M (MemoryOpResult bool). + +Definition tick_clock '(tt : unit) +: M (unit) := + + ((read_reg mcycle_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + write_reg mcycle_ref (add_vec_int w__0 1) >> + ((read_reg mtime_ref) : M (mword 64)) >>= fun w__1 : xlenbits => + write_reg mtime_ref (add_vec_int w__1 1) >> (clint_dispatch tt) : M (unit). + +Axiom plat_term_write : forall (_ : mword 8) , unit. + +Axiom plat_term_read : forall (_ : unit) , mword 8. + +Definition Mk_htif_cmd (v : mword 64) +: htif_cmd := + + {| htif_cmd_htif_cmd_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_htif_cmd_bits (v : htif_cmd) +: mword 64 := + + subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 63 0. + +Definition _set_htif_cmd_bits (r_ref : register_ref regstate register_value htif_cmd) (v : mword 64) + +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + htif_cmd_htif_cmd_chunk_0 := + (update_subrange_vec_dec r.(htif_cmd_htif_cmd_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : htif_cmd in + write_reg r_ref r + : M (unit). + +Definition _update_htif_cmd_bits (v : htif_cmd) (x : mword 64) +: htif_cmd := + + {[ v with + htif_cmd_htif_cmd_chunk_0 := + (update_subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_htif_cmd_device (v : htif_cmd) +: mword 8 := + + subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 63 56. + +Definition _set_htif_cmd_device +(r_ref : register_ref regstate register_value htif_cmd) (v : mword 8) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + htif_cmd_htif_cmd_chunk_0 := + (update_subrange_vec_dec r.(htif_cmd_htif_cmd_chunk_0) 63 56 (subrange_vec_dec v 7 0)) ]} + : htif_cmd in + write_reg r_ref r + : M (unit). + +Definition _update_htif_cmd_device (v : htif_cmd) (x : mword 8) +: htif_cmd := + + {[ v with + htif_cmd_htif_cmd_chunk_0 := + (update_subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 63 56 (subrange_vec_dec x 7 0)) ]}. + +Definition _get_htif_cmd_cmd (v : htif_cmd) +: mword 8 := + + subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 55 48. + +Definition _set_htif_cmd_cmd (r_ref : register_ref regstate register_value htif_cmd) (v : mword 8) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + htif_cmd_htif_cmd_chunk_0 := + (update_subrange_vec_dec r.(htif_cmd_htif_cmd_chunk_0) 55 48 (subrange_vec_dec v 7 0)) ]} + : htif_cmd in + write_reg r_ref r + : M (unit). + +Definition _update_htif_cmd_cmd (v : htif_cmd) (x : mword 8) +: htif_cmd := + + {[ v with + htif_cmd_htif_cmd_chunk_0 := + (update_subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 55 48 (subrange_vec_dec x 7 0)) ]}. + +Definition _get_htif_cmd_payload (v : htif_cmd) +: mword 48 := + + subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 47 0. + +Definition _set_htif_cmd_payload +(r_ref : register_ref regstate register_value htif_cmd) (v : mword 48) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + htif_cmd_htif_cmd_chunk_0 := + (update_subrange_vec_dec r.(htif_cmd_htif_cmd_chunk_0) 47 0 (subrange_vec_dec v 47 0)) ]} + : htif_cmd in + write_reg r_ref r + : M (unit). + +Definition _update_htif_cmd_payload (v : htif_cmd) (x : mword 48) +: htif_cmd := + + {[ v with + htif_cmd_htif_cmd_chunk_0 := + (update_subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 47 0 (subrange_vec_dec x 47 0)) ]}. + +Definition htif_load (addr : mword 64) (width : Z) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + ((read_reg htif_tohost_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + let '_ := + (print_endline + (String.append "htif[" + (String.append (string_of_bits addr) (String.append "] -> " (string_of_bits w__0))))) + : unit in + (if sumbool_of_bool ((Z.eqb width 8)) then + ((read_reg htif_tohost_ref) : M (mword 64)) >>= fun w__1 : xlenbits => + returnm ((MemValue + (zero_extend w__1 _)) + : MemoryOpResult (mword (8 * width))) + else returnm ((MemException (E_Load_Access_Fault)) : MemoryOpResult (mword (8 * width)))) + : M (MemoryOpResult (mword (8 * width))). + +Definition htif_store (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact ((0 + 1) <= width /\ width <= 8)} +: M (MemoryOpResult bool) := + + let '_ := + (print_endline + (String.append "htif[" + (String.append (string_of_bits addr) (String.append "] <- " (string_of_bits data))))) + : unit in + let cbits : xlenbits := EXTZ 64 data in + write_reg htif_tohost_ref cbits >> + let cmd := Mk_htif_cmd cbits in + let b__0 := _get_htif_cmd_device cmd in + (if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] : mword 8))) then + let '_ := + (print_endline + (String.append "htif-syscall-proxy cmd: " (string_of_bits (_get_htif_cmd_payload cmd)))) + : unit in + (cast_unit_vec (access_vec_dec (_get_htif_cmd_payload cmd) 0)) >>= fun w__0 : mword 1 => + (if ((eq_vec w__0 (vec_of_bits [B1] : mword 1))) then + write_reg htif_done_ref true >> + write_reg + htif_exit_code_ref + ((shift_bits_right (zero_extend (_get_htif_cmd_payload cmd) xlen) + (vec_of_bits [B0;B1] : mword 2)) + : xlenbits) + : M (unit) + else returnm (tt : unit)) + : M (unit) + else + returnm ((if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B1] : mword 8))) then + let '_ := + (print_endline + (String.append "htif-term cmd: " (string_of_bits (_get_htif_cmd_payload cmd)))) + : unit in + let b__2 := _get_htif_cmd_cmd cmd in + if ((eq_vec b__2 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] : mword 8))) then tt + else if ((eq_vec b__2 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B1] : mword 8))) then + plat_term_write (subrange_vec_dec (_get_htif_cmd_payload cmd) 7 0) + else print_endline (String.append "Unknown term cmd: " (string_of_bits b__2)) + else print_endline (String.append "htif-???? cmd: " (string_of_bits data))) + : unit)) >> + returnm ((MemValue + (true)) + : MemoryOpResult bool). + +Definition htif_tick '(tt : unit) +: M (unit) := + + ((read_reg htif_tohost_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + let '_ := (print_endline (String.append "htif::tick " (string_of_bits w__0))) : unit in + write_reg htif_tohost_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) + : M (unit). + +Definition within_mmio_readable (addr : mword 64) (width : Z) +: bool := + + orb (within_clint addr width) (andb (within_htif_readable addr width) (Z.leb 1 width)). + +Definition within_mmio_writable (addr : mword 64) (width : Z) +: bool := + + orb (within_clint addr width) (andb (within_htif_writable addr width) (Z.leb width 8)). + +Definition mmio_read (addr : mword 64) (width : Z) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (if ((within_clint addr width)) then + (clint_load addr width) + : M (MemoryOpResult (mword (8 * width))) + else if sumbool_of_bool ((andb (within_htif_readable addr width) (Z.leb 1 width))) then + (htif_load addr width) + : M (MemoryOpResult (mword (8 * width))) + else returnm ((MemException (E_Load_Access_Fault)) : MemoryOpResult (mword (8 * width)))) + : M (MemoryOpResult (mword (8 * width))). + +Definition mmio_write (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + (if ((within_clint addr width)) then (clint_store addr width data) : M (MemoryOpResult bool) + else if sumbool_of_bool ((andb (within_htif_writable addr width) (Z.leb width 8))) then + (htif_store addr width data) + : M (MemoryOpResult bool) + else returnm ((MemException (E_SAMO_Access_Fault)) : MemoryOpResult bool)) + : M (MemoryOpResult bool). + +Definition init_platform '(tt : unit) +: M (unit) := + + write_reg htif_tohost_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) >> + write_reg htif_done_ref false >> + write_reg htif_exit_code_ref (EXTZ 64 (vec_of_bits [B0] : mword 1)) + : M (unit). + +Definition tick_platform '(tt : unit) +: M (unit) := + + let '_ := (cancel_reservation tt) : unit in + (htif_tick tt) + : M (unit). + +Definition handle_illegal '(tt : unit) +: M (unit) := + + (if ((plat_mtval_has_illegal_inst_bits tt)) then + ((read_reg instbits_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + returnm ((Some + (w__0)) + : option (mword 64)) + else returnm (None : option (mword 64))) >>= fun info => + let t : sync_exception := + {| sync_exception_trap := E_Illegal_Instr; + sync_exception_excinfo := info |} in + read_reg cur_privilege_ref >>= fun w__1 : Privilege => + ((read_reg PC_ref) : M (mword 64)) >>= fun w__2 : xlenbits => + (handle_exception w__1 (CTL_TRAP (t)) w__2) >>= fun w__3 : mword 64 => + write_reg nextPC_ref w__3 + : M (unit). + +Definition platform_wfi '(tt : unit) +: M (unit) := + + ((read_reg mtime_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + ((read_reg mtimecmp_ref) : M (mword 64)) >>= fun w__1 : xlenbits => + (if ((zopz0zI_u w__0 w__1)) then + ((read_reg mtimecmp_ref) : M (mword 64)) >>= fun w__2 : xlenbits => + write_reg mtime_ref w__2 >> + ((read_reg mtimecmp_ref) : M (mword 64)) >>= fun w__3 : xlenbits => + write_reg mcycle_ref w__3 + : M (unit) + else returnm (tt : unit)) + : M (unit). + +Definition is_aligned_addr (addr : mword 64) (width : Z) +: bool := + + Z.eqb (modulus (projT1 (uint addr)) width) 0. + +Definition phys_mem_read +(t : ReadType) (addr : mword 64) (width : Z) (aq : bool) (rl : bool) (res : bool) +`{ArithFact (width >= 0)} +: M (MemoryOpResult (mword (8 * width))) := + + (__RISCV_read addr width aq rl res) >>= fun w__0 : option (mword (8 * width)) => + returnm ((match (t, w__0) with + | (Instruction, None) => MemException (E_Fetch_Access_Fault) + | (Data, None) => MemException (E_Load_Access_Fault) + | (_, Some (v)) => + let '_ := + (print_endline + (String.append "mem[" + (String.append ((readType_to_str t) : string) + (String.append "," + (String.append (string_of_bits addr) + (String.append "] -> " (string_of_bits v))))))) + : unit in + MemValue + (v) + end) + : MemoryOpResult (mword (8 * width))). + +Definition checked_mem_read +(t : ReadType) (addr : mword 64) (width : Z) (aq : bool) (rl : bool) (res : bool) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (if ((andb (generic_eq ((readType_to_str t) : string) ((readType_to_str Data) : string)) + (within_mmio_readable addr width))) then + (mmio_read addr width) + : M (MemoryOpResult (mword (8 * width))) + else if ((within_phys_mem addr width)) then + (phys_mem_read t addr width aq rl res) + : M (MemoryOpResult (mword (8 * width))) + else returnm ((MemException (E_Load_Access_Fault)) : MemoryOpResult (mword (8 * width)))) + : M (MemoryOpResult (mword (8 * width))). + +Definition MEMr (addr : mword 64) (width : Z) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (checked_mem_read Data addr width false false false) + : M (MemoryOpResult (mword (8 * width))). + +Definition MEMr_acquire (addr : mword 64) (width : Z) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (checked_mem_read Data addr width true false false) + : M (MemoryOpResult (mword (8 * width))). + +Definition MEMr_strong_acquire (addr : mword 64) (width : Z) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (checked_mem_read Data addr width true true false) + : M (MemoryOpResult (mword (8 * width))). + +Definition MEMr_reserved (addr : mword 64) (width : Z) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (checked_mem_read Data addr width false false true) + : M (MemoryOpResult (mword (8 * width))). + +Definition MEMr_reserved_acquire (addr : mword 64) (width : Z) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (checked_mem_read Data addr width true false true) + : M (MemoryOpResult (mword (8 * width))). + +Definition MEMr_reserved_strong_acquire (addr : mword 64) (width : Z) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (checked_mem_read Data addr width true true true) + : M (MemoryOpResult (mword (8 * width))). + +Definition rvfi_read (addr : mword 64) (width : Z) (value : MemoryOpResult (mword (8 * width))) +`{ArithFact (width >= (0 + 1))} +: unit := + + tt. + +Definition mem_read (addr : mword 64) (width : Z) (aq : bool) (rl : bool) (res : bool) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult (mword (8 * width))) := + + (if ((andb (orb aq res) (negb (is_aligned_addr addr width)))) then + returnm ((MemException + (E_Load_Addr_Align)) + : MemoryOpResult (mword (8 * width))) + else + (match (aq, rl, res) with + | (false, false, false) => + (checked_mem_read Data addr width false false false) + : M (MemoryOpResult (mword (8 * width))) + | (true, false, false) => (MEMr_acquire addr width) : M (MemoryOpResult (mword (8 * width))) + | (false, false, true) => + (MEMr_reserved addr width) : M (MemoryOpResult (mword (8 * width))) + | (true, false, true) => + (MEMr_reserved_acquire addr width) : M (MemoryOpResult (mword (8 * width))) + | (false, true, false) => + (throw (Error_not_implemented ("load.rl"))) : M (MemoryOpResult (mword (8 * width))) + | (true, true, false) => + (MEMr_strong_acquire addr width) : M (MemoryOpResult (mword (8 * width))) + | (false, true, true) => + (throw (Error_not_implemented ("lr.rl"))) : M (MemoryOpResult (mword (8 * width))) + | (true, true, true) => + (MEMr_reserved_strong_acquire addr width) : M (MemoryOpResult (mword (8 * width))) + end) + : M (MemoryOpResult (mword (8 * width)))) >>= fun result : MemoryOpResult (bits (8 * width)) => + let '_ := (rvfi_read addr width result) : unit in + returnm (result + : MemoryOpResult (mword (8 * width))). + +Definition mem_write_ea (addr : mword 64) (width : Z) (aq : bool) (rl : bool) (con : bool) +: M (MemoryOpResult unit) := + + (if ((andb (orb rl con) (negb (is_aligned_addr addr width)))) then + returnm ((MemException + (E_SAMO_Addr_Align)) + : MemoryOpResult unit) + else + (match (aq, rl, con) with + | (false, false, false) => + (MEMea addr width) >> returnm ((MemValue (tt)) : MemoryOpResult unit) + | (false, true, false) => + (MEMea_release addr width) >> returnm ((MemValue (tt)) : MemoryOpResult unit) + | (false, false, true) => + (MEMea_conditional addr width) >> returnm ((MemValue (tt)) : MemoryOpResult unit) + | (false, true, true) => + (MEMea_conditional_release addr width) >> returnm ((MemValue (tt)) : MemoryOpResult unit) + | (true, false, false) => + (throw (Error_not_implemented ("store.aq"))) : M (MemoryOpResult unit) + | (true, true, false) => + (MEMea_strong_release addr width) >> returnm ((MemValue (tt)) : MemoryOpResult unit) + | (true, false, true) => (throw (Error_not_implemented ("sc.aq"))) : M (MemoryOpResult unit) + | (true, true, true) => + (MEMea_conditional_strong_release addr width) >> + returnm ((MemValue + (tt)) + : MemoryOpResult unit) + end) + : M (MemoryOpResult unit)) + : M (MemoryOpResult unit). + +Definition phys_mem_write (addr : mword 64) (width : Z) (data : mword (8 * width)) +: M (MemoryOpResult bool) := + + let '_ := + (print_endline + (String.append "mem[" + (String.append (string_of_bits addr) (String.append "] <- " (string_of_bits data))))) + : unit in + (__RISCV_write addr width data) >>= fun w__0 : bool => + returnm ((MemValue + (w__0)) + : MemoryOpResult bool). + +Definition checked_mem_write (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + (if ((within_mmio_writable addr width)) then + (mmio_write addr width data) + : M (MemoryOpResult bool) + else if ((within_phys_mem addr width)) then + (phys_mem_write addr width data) + : M (MemoryOpResult bool) + else returnm ((MemException (E_SAMO_Access_Fault)) : MemoryOpResult bool)) + : M (MemoryOpResult bool). + +Definition MEMval (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + (checked_mem_write addr width data) + : M (MemoryOpResult bool). + +Definition MEMval_release (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + (checked_mem_write addr width data) + : M (MemoryOpResult bool). + +Definition MEMval_strong_release (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + (checked_mem_write addr width data) + : M (MemoryOpResult bool). + +Definition MEMval_conditional (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + (checked_mem_write addr width data) + : M (MemoryOpResult bool). + +Definition MEMval_conditional_release (addr : mword 64) (width : Z) (data : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + (checked_mem_write addr width data) + : M (MemoryOpResult bool). + +Definition MEMval_conditional_strong_release +(addr : mword 64) (width : Z) (data : mword (8 * width)) `{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + (checked_mem_write addr width data) + : M (MemoryOpResult bool). + +Definition rvfi_write (addr : mword 64) (width : Z) (value : mword (8 * width)) +`{ArithFact (width >= (0 + 1))} +: unit := + + tt. + +Definition mem_write_value +(addr : mword 64) (width : Z) (value : mword (8 * width)) (aq : bool) (rl : bool) (con : bool) +`{ArithFact (width >= (0 + 1))} +: M (MemoryOpResult bool) := + + let '_ := (rvfi_write addr width value) : unit in + (if ((andb (orb rl con) (negb (is_aligned_addr addr width)))) then + returnm ((MemException + (E_SAMO_Addr_Align)) + : MemoryOpResult bool) + else + (match (aq, rl, con) with + | (false, false, false) => (checked_mem_write addr width value) : M (MemoryOpResult bool) + | (false, true, false) => (MEMval_release addr width value) : M (MemoryOpResult bool) + | (false, false, true) => (MEMval_conditional addr width value) : M (MemoryOpResult bool) + | (false, true, true) => + (MEMval_conditional_release addr width value) : M (MemoryOpResult bool) + | (true, false, false) => + (throw (Error_not_implemented ("store.aq"))) : M (MemoryOpResult bool) + | (true, true, false) => (MEMval_strong_release addr width value) : M (MemoryOpResult bool) + | (true, false, true) => (throw (Error_not_implemented ("sc.aq"))) : M (MemoryOpResult bool) + | (true, true, true) => + (MEMval_conditional_strong_release addr width value) : M (MemoryOpResult bool) + end) + : M (MemoryOpResult bool)) + : M (MemoryOpResult bool). + +Definition PAGESIZE_BITS := 12. +Hint Unfold PAGESIZE_BITS : sail. +Definition Mk_PTE_Bits (v : mword 8) +: PTE_Bits := + + {| PTE_Bits_PTE_Bits_chunk_0 := (subrange_vec_dec v 7 0) |}. + +Definition _get_PTE_Bits_bits (v : PTE_Bits) +: mword 8 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 7 0. + +Definition _set_PTE_Bits_bits (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 8) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 7 0 (subrange_vec_dec v 7 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_bits (v : PTE_Bits) (x : mword 8) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 7 0 (subrange_vec_dec x 7 0)) ]}. + +Definition _get_PTE_Bits_D (v : PTE_Bits) +: mword 1 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 7 7. + +Definition _set_PTE_Bits_D (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_D (v : PTE_Bits) (x : mword 1) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_PTE_Bits_A (v : PTE_Bits) +: mword 1 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 6 6. + +Definition _set_PTE_Bits_A (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 6 6 (subrange_vec_dec v 0 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_A (v : PTE_Bits) (x : mword 1) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 6 6 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_PTE_Bits_G (v : PTE_Bits) +: mword 1 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 5 5. + +Definition _set_PTE_Bits_G (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_G (v : PTE_Bits) (x : mword 1) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_PTE_Bits_U (v : PTE_Bits) +: mword 1 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 4 4. + +Definition _set_PTE_Bits_U (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_U (v : PTE_Bits) (x : mword 1) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_PTE_Bits_X (v : PTE_Bits) +: mword 1 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 3 3. + +Definition _set_PTE_Bits_X (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_X (v : PTE_Bits) (x : mword 1) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_PTE_Bits_W (v : PTE_Bits) +: mword 1 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 2 2. + +Definition _set_PTE_Bits_W (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_W (v : PTE_Bits) (x : mword 1) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_PTE_Bits_R (v : PTE_Bits) +: mword 1 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 1 1. + +Definition _set_PTE_Bits_R (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_R (v : PTE_Bits) (x : mword 1) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}. + +Definition _get_PTE_Bits_V (v : PTE_Bits) +: mword 1 := + + subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 0 0. + +Definition _set_PTE_Bits_V (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]} + : PTE_Bits in + write_reg r_ref r + : M (unit). + +Definition _update_PTE_Bits_V (v : PTE_Bits) (x : mword 1) +: PTE_Bits := + + {[ v with + PTE_Bits_PTE_Bits_chunk_0 := + (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}. + +Definition isPTEPtr (p : mword 8) +: bool := + + let a := Mk_PTE_Bits p in + andb (eq_vec (_get_PTE_Bits_R a) ((bool_to_bits false) : mword 1)) + (andb (eq_vec (_get_PTE_Bits_W a) ((bool_to_bits false) : mword 1)) + (eq_vec (_get_PTE_Bits_X a) ((bool_to_bits false) : mword 1))). + +Definition isInvalidPTE (p : mword 8) +: bool := + + let a := Mk_PTE_Bits p in + orb (eq_vec (_get_PTE_Bits_V a) ((bool_to_bits false) : mword 1)) + (andb (eq_vec (_get_PTE_Bits_W a) ((bool_to_bits true) : mword 1)) + (eq_vec (_get_PTE_Bits_R a) ((bool_to_bits false) : mword 1))). + +Definition checkPTEPermission +(ac : AccessType) (priv : Privilege) (mxr : bool) (do_sum : bool) (p : PTE_Bits) +: M (bool) := + + (match (ac, priv) with + | (Read, User) => + returnm ((andb (eq_vec (_get_PTE_Bits_U p) ((bool_to_bits true) : mword 1)) + (orb (eq_vec (_get_PTE_Bits_R p) ((bool_to_bits true) : mword 1)) + (andb (eq_vec (_get_PTE_Bits_X p) ((bool_to_bits true) : mword 1)) mxr))) + : bool) + | (Write, User) => + returnm ((andb (eq_vec (_get_PTE_Bits_U p) ((bool_to_bits true) : mword 1)) + (eq_vec (_get_PTE_Bits_W p) ((bool_to_bits true) : mword 1))) + : bool) + | (ReadWrite, User) => + returnm ((andb (eq_vec (_get_PTE_Bits_U p) ((bool_to_bits true) : mword 1)) + (andb (eq_vec (_get_PTE_Bits_W p) ((bool_to_bits true) : mword 1)) + (orb (eq_vec (_get_PTE_Bits_R p) ((bool_to_bits true) : mword 1)) + (andb (eq_vec (_get_PTE_Bits_X p) ((bool_to_bits true) : mword 1)) mxr)))) + : bool) + | (Execute, User) => + returnm ((andb (eq_vec (_get_PTE_Bits_U p) ((bool_to_bits true) : mword 1)) + (eq_vec (_get_PTE_Bits_X p) ((bool_to_bits true) : mword 1))) + : bool) + | (Read, Supervisor) => + returnm ((andb (orb (eq_vec (_get_PTE_Bits_U p) ((bool_to_bits false) : mword 1)) do_sum) + (orb (eq_vec (_get_PTE_Bits_R p) ((bool_to_bits true) : mword 1)) + (andb (eq_vec (_get_PTE_Bits_X p) ((bool_to_bits true) : mword 1)) mxr))) + : bool) + | (Write, Supervisor) => + returnm ((andb (orb (eq_vec (_get_PTE_Bits_U p) ((bool_to_bits false) : mword 1)) do_sum) + (eq_vec (_get_PTE_Bits_W p) ((bool_to_bits true) : mword 1))) + : bool) + | (ReadWrite, Supervisor) => + returnm ((andb (orb (eq_vec (_get_PTE_Bits_U p) ((bool_to_bits false) : mword 1)) do_sum) + (andb (eq_vec (_get_PTE_Bits_W p) ((bool_to_bits true) : mword 1)) + (orb (eq_vec (_get_PTE_Bits_R p) ((bool_to_bits true) : mword 1)) + (andb (eq_vec (_get_PTE_Bits_X p) ((bool_to_bits true) : mword 1)) mxr)))) + : bool) + | (Execute, Supervisor) => + returnm ((andb (eq_vec (_get_PTE_Bits_U p) ((bool_to_bits false) : mword 1)) + (eq_vec (_get_PTE_Bits_X p) ((bool_to_bits true) : mword 1))) + : bool) + | (_, Machine) => (internal_error "m-mode mem perm check") : M (bool) + end) + : M (bool). + +Definition update_PTE_Bits (p : PTE_Bits) (a : AccessType) +: option PTE_Bits := + + let update_d := + andb + (orb (generic_eq ((accessType_to_str a) : string) ((accessType_to_str Write) : string)) + (generic_eq ((accessType_to_str a) : string) ((accessType_to_str ReadWrite) : string))) + (eq_vec (_get_PTE_Bits_D p) ((bool_to_bits false) : mword 1)) in + let update_a := eq_vec (_get_PTE_Bits_A p) ((bool_to_bits false) : mword 1) in + if ((orb update_d update_a)) then + let np := _update_PTE_Bits_A p ((bool_to_bits true) : mword 1) in + let np := if (update_d) then _update_PTE_Bits_D np ((bool_to_bits true) : mword 1) else np in + Some + (np) + else None. + +Definition PTW_Error_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 4)} +: PTW_Error := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then PTW_Access + else if sumbool_of_bool ((Z.eqb p0_ 1)) then PTW_Invalid_PTE + else if sumbool_of_bool ((Z.eqb p0_ 2)) then PTW_No_Permission + else if sumbool_of_bool ((Z.eqb p0_ 3)) then PTW_Misaligned + else PTW_PTE_Update. + +Definition num_of_PTW_Error (arg_ : PTW_Error) +: {e : Z & ArithFact (0 <= e /\ e <= 4)} := + + build_ex(match arg_ with + | PTW_Access => 0 + | PTW_Invalid_PTE => 1 + | PTW_No_Permission => 2 + | PTW_Misaligned => 3 + | PTW_PTE_Update => 4 + end). + +Definition ptw_error_to_str (e : PTW_Error) +: string := + + match e with + | PTW_Access => "mem-access-error" + | PTW_Invalid_PTE => "invalid-pte" + | PTW_No_Permission => "no-permission" + | PTW_Misaligned => "misaligned-superpage" + | PTW_PTE_Update => "pte-update-needed" + end. + +Definition translationException (a : AccessType) (f : PTW_Error) +: ExceptionType := + + match (a, f) with + | (ReadWrite, PTW_Access) => E_SAMO_Access_Fault + | (ReadWrite, _) => E_SAMO_Page_Fault + | (Read, PTW_Access) => E_Load_Access_Fault + | (Read, _) => E_Load_Page_Fault + | (Write, PTW_Access) => E_SAMO_Access_Fault + | (Write, _) => E_SAMO_Page_Fault + | (Fetch, PTW_Access) => E_Fetch_Access_Fault + | (Fetch, _) => E_Fetch_Page_Fault + end. + +Definition SV39_LEVEL_BITS := 9. +Hint Unfold SV39_LEVEL_BITS : sail. +Definition SV39_LEVELS := 3. +Hint Unfold SV39_LEVELS : sail. +Definition PTE39_LOG_SIZE := 3. +Hint Unfold PTE39_LOG_SIZE : sail. +Definition PTE39_SIZE := 8. +Hint Unfold PTE39_SIZE : sail. +Definition Mk_SV39_Vaddr (v : mword 39) +: SV39_Vaddr := + + {| SV39_Vaddr_SV39_Vaddr_chunk_0 := (subrange_vec_dec v 38 0) |}. + +Definition _get_SV39_Vaddr_bits (v : SV39_Vaddr) +: mword 39 := + + subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 0. + +Definition _set_SV39_Vaddr_bits +(r_ref : register_ref regstate register_value SV39_Vaddr) (v : mword 39) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_Vaddr_SV39_Vaddr_chunk_0 := + (update_subrange_vec_dec r.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 0 (subrange_vec_dec v 38 0)) ]} + : SV39_Vaddr in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_Vaddr_bits (v : SV39_Vaddr) (x : mword 39) +: SV39_Vaddr := + + {[ v with + SV39_Vaddr_SV39_Vaddr_chunk_0 := + (update_subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 0 (subrange_vec_dec x 38 0)) ]}. + +Definition _get_SV39_Vaddr_VPNi (v : SV39_Vaddr) +: mword 27 := + + subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 12. + +Definition _set_SV39_Vaddr_VPNi +(r_ref : register_ref regstate register_value SV39_Vaddr) (v : mword 27) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_Vaddr_SV39_Vaddr_chunk_0 := + (update_subrange_vec_dec r.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 12 (subrange_vec_dec v 26 0)) ]} + : SV39_Vaddr in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_Vaddr_VPNi (v : SV39_Vaddr) (x : mword 27) +: SV39_Vaddr := + + {[ v with + SV39_Vaddr_SV39_Vaddr_chunk_0 := + (update_subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 12 (subrange_vec_dec x 26 0)) ]}. + +Definition _get_SV39_Vaddr_PgOfs (v : SV39_Vaddr) +: mword 12 := + + subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 11 0. + +Definition _set_SV39_Vaddr_PgOfs +(r_ref : register_ref regstate register_value SV39_Vaddr) (v : mword 12) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_Vaddr_SV39_Vaddr_chunk_0 := + (update_subrange_vec_dec r.(SV39_Vaddr_SV39_Vaddr_chunk_0) 11 0 (subrange_vec_dec v 11 0)) ]} + : SV39_Vaddr in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_Vaddr_PgOfs (v : SV39_Vaddr) (x : mword 12) +: SV39_Vaddr := + + {[ v with + SV39_Vaddr_SV39_Vaddr_chunk_0 := + (update_subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 11 0 (subrange_vec_dec x 11 0)) ]}. + +Definition Mk_SV39_Paddr (v : mword 56) +: SV39_Paddr := + + {| SV39_Paddr_SV39_Paddr_chunk_0 := (subrange_vec_dec v 55 0) |}. + +Definition _get_SV39_Paddr_bits (v : SV39_Paddr) +: mword 56 := + + subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 55 0. + +Definition _set_SV39_Paddr_bits +(r_ref : register_ref regstate register_value SV39_Paddr) (v : mword 56) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_Paddr_SV39_Paddr_chunk_0 := + (update_subrange_vec_dec r.(SV39_Paddr_SV39_Paddr_chunk_0) 55 0 (subrange_vec_dec v 55 0)) ]} + : SV39_Paddr in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_Paddr_bits (v : SV39_Paddr) (x : mword 56) +: SV39_Paddr := + + {[ v with + SV39_Paddr_SV39_Paddr_chunk_0 := + (update_subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 55 0 (subrange_vec_dec x 55 0)) ]}. + +Definition _get_SV39_Paddr_PPNi (v : SV39_Paddr) +: mword 44 := + + subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 55 12. + +Definition _set_SV39_Paddr_PPNi +(r_ref : register_ref regstate register_value SV39_Paddr) (v : mword 44) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_Paddr_SV39_Paddr_chunk_0 := + (update_subrange_vec_dec r.(SV39_Paddr_SV39_Paddr_chunk_0) 55 12 (subrange_vec_dec v 43 0)) ]} + : SV39_Paddr in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_Paddr_PPNi (v : SV39_Paddr) (x : mword 44) +: SV39_Paddr := + + {[ v with + SV39_Paddr_SV39_Paddr_chunk_0 := + (update_subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 55 12 (subrange_vec_dec x 43 0)) ]}. + +Definition _get_SV39_Paddr_PgOfs (v : SV39_Paddr) +: mword 12 := + + subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 11 0. + +Definition _set_SV39_Paddr_PgOfs +(r_ref : register_ref regstate register_value SV39_Paddr) (v : mword 12) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_Paddr_SV39_Paddr_chunk_0 := + (update_subrange_vec_dec r.(SV39_Paddr_SV39_Paddr_chunk_0) 11 0 (subrange_vec_dec v 11 0)) ]} + : SV39_Paddr in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_Paddr_PgOfs (v : SV39_Paddr) (x : mword 12) +: SV39_Paddr := + + {[ v with + SV39_Paddr_SV39_Paddr_chunk_0 := + (update_subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 11 0 (subrange_vec_dec x 11 0)) ]}. + +Definition Mk_SV39_PTE (v : mword 64) +: SV39_PTE := + + {| SV39_PTE_SV39_PTE_chunk_0 := (subrange_vec_dec v 63 0) |}. + +Definition _get_SV39_PTE_bits (v : SV39_PTE) +: mword 64 := + + subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 63 0. + +Definition _set_SV39_PTE_bits (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 64) + +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_PTE_SV39_PTE_chunk_0 := + (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]} + : SV39_PTE in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_PTE_bits (v : SV39_PTE) (x : mword 64) +: SV39_PTE := + + {[ v with + SV39_PTE_SV39_PTE_chunk_0 := + (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}. + +Definition _get_SV39_PTE_PPNi (v : SV39_PTE) +: mword 44 := + + subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 53 10. + +Definition _set_SV39_PTE_PPNi (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 44) + +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_PTE_SV39_PTE_chunk_0 := + (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 53 10 (subrange_vec_dec v 43 0)) ]} + : SV39_PTE in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_PTE_PPNi (v : SV39_PTE) (x : mword 44) +: SV39_PTE := + + {[ v with + SV39_PTE_SV39_PTE_chunk_0 := + (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 53 10 (subrange_vec_dec x 43 0)) ]}. + +Definition _get_SV39_PTE_RSW (v : SV39_PTE) +: mword 2 := + + subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 9 8. + +Definition _set_SV39_PTE_RSW (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 2) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_PTE_SV39_PTE_chunk_0 := + (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 9 8 (subrange_vec_dec v 1 0)) ]} + : SV39_PTE in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_PTE_RSW (v : SV39_PTE) (x : mword 2) +: SV39_PTE := + + {[ v with + SV39_PTE_SV39_PTE_chunk_0 := + (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 9 8 (subrange_vec_dec x 1 0)) ]}. + +Definition _get_SV39_PTE_BITS (v : SV39_PTE) +: mword 8 := + + subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 7 0. + +Definition _set_SV39_PTE_BITS (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 8) +: M (unit) := + + (reg_deref r_ref) >>= fun r => + let r := + {[ r with + SV39_PTE_SV39_PTE_chunk_0 := + (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 7 0 (subrange_vec_dec v 7 0)) ]} + : SV39_PTE in + write_reg r_ref r + : M (unit). + +Definition _update_SV39_PTE_BITS (v : SV39_PTE) (x : mword 8) +: SV39_PTE := + + {[ v with + SV39_PTE_SV39_PTE_chunk_0 := + (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 7 0 (subrange_vec_dec x 7 0)) ]}. + +Definition curAsid64 '(tt : unit) +: M (mword 16) := + + ((read_reg satp_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + let satp64 := Mk_Satp64 w__0 in + returnm ((_get_Satp64_Asid satp64) + : mword 16). + +Definition curPTB39 '(tt : unit) +: M (mword 56) := + + ((read_reg satp_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + let satp64 := Mk_Satp64 w__0 in + returnm ((EXTZ 56 (shiftl (_get_Satp64_PPN satp64) PAGESIZE_BITS)) + : mword 56). + +Fixpoint _rec_walk39 +(vaddr : mword 39) (ac : AccessType) (priv : Privilege) (mxr : bool) (do_sum : bool) +(ptb : mword 56) (level : Z) (global : bool) (_reclimit : Z) `{ArithFact (0 <= level)} +(_acc : Acc (Zwf 0) _reclimit) +{struct _acc} : M (PTW_Result) := + + assert_exp' (Z.geb _reclimit 0) "recursion limit reached" >>= fun _ => + let va := Mk_SV39_Vaddr vaddr in + let pt_ofs : paddr39 := + shiftl + (EXTZ 56 + (subrange_vec_dec (shiftr (_get_SV39_Vaddr_VPNi va) (Z.mul level SV39_LEVEL_BITS)) + (Z.sub SV39_LEVEL_BITS 1) 0)) PTE39_LOG_SIZE in + let pte_addr := add_vec ptb pt_ofs in + (phys_mem_read Data (EXTZ 64 pte_addr) 8 false false false) >>= fun w__0 : MemoryOpResult (mword (8 * 8)) => + (match w__0 with + | MemException (_) => returnm ((PTW_Failure (PTW_Access)) : PTW_Result ) + | MemValue (v) => + let pte := Mk_SV39_PTE v in + let pbits := _get_SV39_PTE_BITS pte in + let pattr := Mk_PTE_Bits pbits in + let is_global := orb global (eq_vec (_get_PTE_Bits_G pattr) ((bool_to_bits true) : mword 1)) in + (if ((isInvalidPTE pbits)) then returnm ((PTW_Failure (PTW_Invalid_PTE)) : PTW_Result ) + else if ((isPTEPtr pbits)) then + (if sumbool_of_bool ((Z.eqb level 0)) then + returnm ((PTW_Failure + (PTW_Invalid_PTE)) + : PTW_Result ) + else + (_rec_walk39 vaddr ac priv mxr do_sum + (EXTZ 56 (shiftl (_get_SV39_PTE_PPNi pte) PAGESIZE_BITS)) _ is_global + (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (PTW_Result)) + : M (PTW_Result) + else + (checkPTEPermission ac priv mxr do_sum pattr) >>= fun w__3 : bool => + returnm ((if ((negb w__3)) then PTW_Failure (PTW_No_Permission) + else if sumbool_of_bool ((Z.gtb level 0)) then + let mask := + sub_vec_int + (shiftl + (xor_vec (_get_SV39_PTE_PPNi pte) + (xor_vec (_get_SV39_PTE_PPNi pte) + (EXTZ 44 (vec_of_bits [B1] : mword 1)))) + (Z.mul level SV39_LEVEL_BITS)) 1 in + if ((neq_vec (and_vec (_get_SV39_PTE_PPNi pte) mask) + (EXTZ 44 (vec_of_bits [B0] : mword 1)))) then + PTW_Failure + (PTW_Misaligned) + else + let ppn := + or_vec (_get_SV39_PTE_PPNi pte) + (and_vec (EXTZ 44 (_get_SV39_Vaddr_VPNi va)) mask) in + PTW_Success + ((concat_vec ppn (_get_SV39_Vaddr_PgOfs va), pte, pte_addr, build_ex level, is_global)) + else + PTW_Success + ((concat_vec (_get_SV39_PTE_PPNi pte) (_get_SV39_Vaddr_PgOfs va), pte, pte_addr, build_ex level, is_global))) + : PTW_Result)) + : M (PTW_Result) + end) + : M (PTW_Result). + +Definition walk39 +(_arg0 : mword 39) (_arg1 : AccessType) (_arg2 : Privilege) (_arg3 : bool) (_arg4 : bool) +(_arg5 : mword 56) (level : Z) (_arg7 : bool) `{ArithFact (0 <= level)} +: M (PTW_Result) := + + (_rec_walk39 _arg0 _arg1 _arg2 _arg3 _arg4 _arg5 level _arg7 (level : Z) (Zwf_guarded _)) + : M (PTW_Result). + +Definition make_TLB39_Entry +(asid : mword 16) (global : bool) (vAddr : mword 39) (pAddr : mword 56) (pte : SV39_PTE) (level : Z) +(pteAddr : mword 56) `{ArithFact (0 <= level)} +: M (TLB39_Entry) := + + let 'shift := + projT1 (build_ex (Z.add PAGESIZE_BITS (Z.mul level SV39_LEVEL_BITS)) + : {n : Z & ArithFact (n >= 0)}) in + let vAddrMask : vaddr39 := + sub_vec_int + (shiftl (xor_vec vAddr (xor_vec vAddr (EXTZ 39 (vec_of_bits [B1] : mword 1)))) shift) 1 in + let vMatchMask : vaddr39 := not_vec vAddrMask in + ((read_reg mcycle_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + returnm (({| TLB39_Entry_asid := asid; + TLB39_Entry_global := global; + TLB39_Entry_pte := pte; + TLB39_Entry_pteAddr := pteAddr; + TLB39_Entry_vAddrMask := vAddrMask; + TLB39_Entry_vMatchMask := vMatchMask; + TLB39_Entry_vAddr := (and_vec vAddr vMatchMask); + TLB39_Entry_pAddr := (shiftl (shiftr pAddr shift) shift); + TLB39_Entry_age := w__0 |}) + : TLB39_Entry). + +Definition lookupTLB39 (asid : mword 16) (vaddr : mword 39) +: M (option ((Z * TLB39_Entry))) := + + read_reg tlb39_ref >>= fun w__0 : option TLB39_Entry => + returnm ((match w__0 with + | None => None + | Some (e) => + if ((andb (orb e.(TLB39_Entry_global) (eq_vec e.(TLB39_Entry_asid) asid)) + (eq_vec e.(TLB39_Entry_vAddr) (and_vec e.(TLB39_Entry_vMatchMask) vaddr)))) + then + Some + ((0, e)) + else None + end) + : option ((Z * TLB39_Entry))). + +Definition addToTLB39 +(asid : mword 16) (vAddr : mword 39) (pAddr : mword 56) (pte : SV39_PTE) (pteAddr : mword 56) +(level : Z) (global : bool) `{ArithFact (0 <= level)} +: M (unit) := + + (make_TLB39_Entry asid global vAddr pAddr pte level pteAddr) >>= fun ent => + write_reg tlb39_ref (Some (ent)) + : M (unit). + +Definition writeTLB39 (idx : Z) (ent : TLB39_Entry) +: M (unit) := + + write_reg tlb39_ref (Some (ent)) + : M (unit). + +Definition flushTLB (asid : option (mword 16)) (addr : option (mword 39)) +: M (unit) := + + read_reg tlb39_ref >>= fun w__0 : option TLB39_Entry => + let ent : option TLB39_Entry := + match (w__0, asid, addr) with + | (None, _, _) => None + | (Some (e), None, None) => None + | (Some (e), None, Some (a)) => + if ((eq_vec e.(TLB39_Entry_vAddr) (and_vec e.(TLB39_Entry_vMatchMask) a))) then None + else Some (e) + | (Some (e), Some (i), None) => + if ((andb (eq_vec e.(TLB39_Entry_asid) i) (negb e.(TLB39_Entry_global)))) then None + else Some (e) + | (Some (e), Some (i), Some (a)) => + if ((andb (eq_vec e.(TLB39_Entry_asid) i) + (andb (eq_vec e.(TLB39_Entry_vAddr) (and_vec a e.(TLB39_Entry_vMatchMask))) + (negb e.(TLB39_Entry_global))))) then + None + else Some (e) + end in + write_reg tlb39_ref ent + : M (unit). + +Definition translate39 +(vAddr : mword 39) (ac : AccessType) (priv : Privilege) (mxr : bool) (do_sum : bool) (level : Z) +`{ArithFact (0 <= level)} +: M (TR39_Result) := + + (curAsid64 tt) >>= fun asid => + (lookupTLB39 asid vAddr) >>= fun w__0 : option ((Z * TLB39_Entry)) => + (match w__0 with + | Some (idx,ent) => + let pteBits := Mk_PTE_Bits (_get_SV39_PTE_BITS ent.(TLB39_Entry_pte)) in + (checkPTEPermission ac priv mxr do_sum pteBits) >>= fun w__1 : bool => + (if ((negb w__1)) then returnm ((TR39_Failure (PTW_No_Permission)) : TR39_Result ) + else + (match (update_PTE_Bits pteBits ac) with + | None => + returnm ((TR39_Address + (or_vec ent.(TLB39_Entry_pAddr) + (EXTZ 56 (and_vec vAddr ent.(TLB39_Entry_vAddrMask))))) + : TR39_Result ) + | Some (pbits) => + (if ((negb (plat_enable_dirty_update tt))) then + returnm ((TR39_Failure + (PTW_PTE_Update)) + : TR39_Result ) + else + let n_ent : TLB39_Entry := ent in + let n_ent := + {[ n_ent with + TLB39_Entry_pte := + (_update_SV39_PTE_BITS ent.(TLB39_Entry_pte) (_get_PTE_Bits_bits pbits)) ]} + : TLB39_Entry in + (writeTLB39 idx n_ent) >> + (checked_mem_write (EXTZ 64 ent.(TLB39_Entry_pteAddr)) 8 + (_get_SV39_PTE_bits ent.(TLB39_Entry_pte))) >>= fun w__2 : MemoryOpResult bool => + (match w__2 with + | MemValue (_) => returnm (tt : unit) + | MemException (e) => + (internal_error "invalid physical address in TLB") : M (unit) + end) >> + returnm ((TR39_Address + (or_vec ent.(TLB39_Entry_pAddr) + (EXTZ 56 (and_vec vAddr ent.(TLB39_Entry_vAddrMask))))) + : TR39_Result)) + : M (TR39_Result) + end) + : M (TR39_Result)) + : M (TR39_Result) + | None => + (curPTB39 tt) >>= fun w__6 : mword 56 => + (walk39 vAddr ac priv mxr do_sum w__6 level false) >>= fun w__7 : PTW_Result => + (match w__7 with + | PTW_Failure (f) => returnm ((TR39_Failure (f)) : TR39_Result ) + | PTW_Success (pAddr,pte,pteAddr,(existT _ level _),global) => + (match (update_PTE_Bits (Mk_PTE_Bits (_get_SV39_PTE_BITS pte)) ac) with + | None => + (addToTLB39 asid vAddr pAddr pte pteAddr level global) >> + returnm ((TR39_Address + (pAddr)) + : TR39_Result ) + | Some (pbits) => + (if ((negb (plat_enable_dirty_update tt))) then + returnm ((TR39_Failure + (PTW_PTE_Update)) + : TR39_Result ) + else + let w_pte : SV39_PTE := _update_SV39_PTE_BITS pte (_get_PTE_Bits_bits pbits) in + (checked_mem_write (EXTZ 64 pteAddr) 8 (_get_SV39_PTE_bits w_pte)) >>= fun w__8 : MemoryOpResult bool => + (match w__8 with + | MemValue (_) => + (addToTLB39 asid vAddr pAddr w_pte pteAddr level global) >> + returnm ((TR39_Address + (pAddr)) + : TR39_Result ) + | MemException (e) => returnm ((TR39_Failure (PTW_Access)) : TR39_Result ) + end) + : M (TR39_Result)) + : M (TR39_Result) + end) + : M (TR39_Result) + end) + : M (TR39_Result) + end) + : M (TR39_Result). + +Definition translationMode (priv : Privilege) +: M (SATPMode) := + + (if ((eq_vec (privLevel_to_bits priv) ((privLevel_to_bits Machine) : mword 2))) then + returnm (Sbare + : SATPMode) + else + read_reg mstatus_ref >>= fun w__0 : Mstatus => + let arch := architecture (_get_Mstatus_SXL w__0) in + (match arch with + | Some (RV64) => + ((read_reg satp_ref) : M (mword 64)) >>= fun w__1 : xlenbits => + let mbits : satp_mode := _get_Satp64_Mode (Mk_Satp64 w__1) in + (match (satpMode_of_bits RV64 mbits) with + | Some (m) => returnm (m : SATPMode) + | None => (internal_error "invalid RV64 translation mode in satp") : M (SATPMode) + end) + : M (SATPMode) + | _ => (internal_error "unsupported address translation arch") : M (SATPMode) + end) + : M (SATPMode)) + : M (SATPMode). + +Definition translateAddr (vAddr : mword 64) (ac : AccessType) (rt : ReadType) +: M (TR_Result) := + + (match rt with + | Instruction => read_reg cur_privilege_ref : M (Privilege) + | Data => + read_reg mstatus_ref >>= fun w__1 : Mstatus => + (if ((eq_vec (_get_Mstatus_MPRV w__1) ((bool_to_bits true) : mword 1))) then + read_reg mstatus_ref >>= fun w__2 : Mstatus => + returnm ((privLevel_of_bits (_get_Mstatus_MPP w__2)) + : Privilege) + else read_reg cur_privilege_ref : M (Privilege)) + : M (Privilege) + end) >>= fun effPriv : Privilege => + read_reg mstatus_ref >>= fun w__5 : Mstatus => + let mxr : bool := eq_vec (_get_Mstatus_MXR w__5) ((bool_to_bits true) : mword 1) in + read_reg mstatus_ref >>= fun w__6 : Mstatus => + let do_sum : bool := eq_vec (_get_Mstatus_SUM w__6) ((bool_to_bits true) : mword 1) in + (translationMode effPriv) >>= fun mode : SATPMode => + (match mode with + | Sbare => returnm ((TR_Address (vAddr)) : TR_Result ) + | SV39 => + (translate39 (subrange_vec_dec vAddr 38 0) ac effPriv mxr do_sum (Z.sub SV39_LEVELS 1)) >>= fun w__7 : TR39_Result => + returnm ((match w__7 with + | TR39_Address (pa) => TR_Address (EXTZ 64 pa) + | TR39_Failure (f) => TR_Failure (translationException ac f) + end) + : TR_Result) + end) + : M (TR_Result). + +Definition encdec_uop_forwards (arg_ : uop) +: mword 7 := + + match arg_ with + | RISCV_LUI => (vec_of_bits [B0;B1;B1;B0;B1;B1;B1] : mword 7) + | RISCV_AUIPC => (vec_of_bits [B0;B0;B1;B0;B1;B1;B1] : mword 7) + end. + +Definition encdec_uop_backwards (arg_ : mword 7) +: uop := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B0;B1;B1;B1] : mword 7))) then RISCV_LUI + else RISCV_AUIPC. + +Definition encdec_uop_forwards_matches (arg_ : uop) +: bool := + + match arg_ with | RISCV_LUI => true | RISCV_AUIPC => true end. + +Definition encdec_uop_backwards_matches (arg_ : mword 7) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B0;B1;B1;B1] : mword 7))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B0;B1;B1;B1] : mword 7))) then true + else false. + +Definition utype_mnemonic_forwards (arg_ : uop) +: string := + + match arg_ with | RISCV_LUI => "lui" | RISCV_AUIPC => "auipc" end. + +Definition utype_mnemonic_backwards (arg_ : string) +: uop := + + let p0_ := arg_ in + if ((generic_eq p0_ "lui")) then RISCV_LUI + else RISCV_AUIPC. + +Definition utype_mnemonic_forwards_matches (arg_ : uop) +: bool := + + match arg_ with | RISCV_LUI => true | RISCV_AUIPC => true end. + +Definition utype_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "lui")) then true + else if ((generic_eq p0_ "auipc")) then true + else false. + +Definition _s496_ (_s497_ : string) +: option string := + + let _s498_ := _s497_ in + if ((string_startswith _s498_ "auipc")) then + match (string_drop _s498_ (projT1 (string_length "auipc"))) with | s_ => Some (s_) end + else None. + +Definition _s492_ (_s493_ : string) +: option string := + + let _s494_ := _s493_ in + if ((string_startswith _s494_ "lui")) then + match (string_drop _s494_ (projT1 (string_length "lui"))) with | s_ => Some (s_) end + else None. + +Definition utype_mnemonic_matches_prefix (arg_ : string) +: M (option ((uop * {n : Z & ArithFact (n >= 0)}))) := + + let _s495_ := arg_ in + (if ((match (_s492_ _s495_) with | Some (s_) => true | _ => false end)) then + (match (_s492_ _s495_) with + | Some (s_) => + returnm ((Some + ((RISCV_LUI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((uop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((uop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((uop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s496_ _s495_) with | Some (s_) => true | _ => false end)) then + (match (_s496_ _s495_) with + | Some (s_) => + returnm ((Some + ((RISCV_AUIPC, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((uop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((uop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((uop * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((uop * {n : Z & ArithFact (n >= 0)})))) + : M (option ((uop * {n : Z & ArithFact (n >= 0)}))). + +Definition encdec_bop_forwards (arg_ : bop) +: mword 3 := + + match arg_ with + | RISCV_BEQ => (vec_of_bits [B0;B0;B0] : mword 3) + | RISCV_BNE => (vec_of_bits [B0;B0;B1] : mword 3) + | RISCV_BLT => (vec_of_bits [B1;B0;B0] : mword 3) + | RISCV_BGE => (vec_of_bits [B1;B0;B1] : mword 3) + | RISCV_BLTU => (vec_of_bits [B1;B1;B0] : mword 3) + | RISCV_BGEU => (vec_of_bits [B1;B1;B1] : mword 3) + end. + +Definition encdec_bop_backwards (arg_ : mword 3) +: bop := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0] : mword 3))) then RISCV_BEQ + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1] : mword 3))) then RISCV_BNE + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B0] : mword 3))) then RISCV_BLT + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1] : mword 3))) then RISCV_BGE + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0] : mword 3))) then RISCV_BLTU + else RISCV_BGEU. + +Definition encdec_bop_forwards_matches (arg_ : bop) +: bool := + + match arg_ with + | RISCV_BEQ => true + | RISCV_BNE => true + | RISCV_BLT => true + | RISCV_BGE => true + | RISCV_BLTU => true + | RISCV_BGEU => true + end. + +Definition encdec_bop_backwards_matches (arg_ : mword 3) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1] : mword 3))) then true + else false. + +Definition btype_mnemonic_forwards (arg_ : bop) +: string := + + match arg_ with + | RISCV_BEQ => "beq" + | RISCV_BNE => "bne" + | RISCV_BLT => "blt" + | RISCV_BGE => "bge" + | RISCV_BLTU => "bltu" + | RISCV_BGEU => "bgeu" + end. + +Definition btype_mnemonic_backwards (arg_ : string) +: bop := + + let p0_ := arg_ in + if ((generic_eq p0_ "beq")) then RISCV_BEQ + else if ((generic_eq p0_ "bne")) then RISCV_BNE + else if ((generic_eq p0_ "blt")) then RISCV_BLT + else if ((generic_eq p0_ "bge")) then RISCV_BGE + else if ((generic_eq p0_ "bltu")) then RISCV_BLTU + else RISCV_BGEU. + +Definition btype_mnemonic_forwards_matches (arg_ : bop) +: bool := + + match arg_ with + | RISCV_BEQ => true + | RISCV_BNE => true + | RISCV_BLT => true + | RISCV_BGE => true + | RISCV_BLTU => true + | RISCV_BGEU => true + end. + +Definition btype_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "beq")) then true + else if ((generic_eq p0_ "bne")) then true + else if ((generic_eq p0_ "blt")) then true + else if ((generic_eq p0_ "bge")) then true + else if ((generic_eq p0_ "bltu")) then true + else if ((generic_eq p0_ "bgeu")) then true + else false. + +Definition _s520_ (_s521_ : string) +: option string := + + let _s522_ := _s521_ in + if ((string_startswith _s522_ "bgeu")) then + match (string_drop _s522_ (projT1 (string_length "bgeu"))) with | s_ => Some (s_) end + else None. + +Definition _s516_ (_s517_ : string) +: option string := + + let _s518_ := _s517_ in + if ((string_startswith _s518_ "bltu")) then + match (string_drop _s518_ (projT1 (string_length "bltu"))) with | s_ => Some (s_) end + else None. + +Definition _s512_ (_s513_ : string) +: option string := + + let _s514_ := _s513_ in + if ((string_startswith _s514_ "bge")) then + match (string_drop _s514_ (projT1 (string_length "bge"))) with | s_ => Some (s_) end + else None. + +Definition _s508_ (_s509_ : string) +: option string := + + let _s510_ := _s509_ in + if ((string_startswith _s510_ "blt")) then + match (string_drop _s510_ (projT1 (string_length "blt"))) with | s_ => Some (s_) end + else None. + +Definition _s504_ (_s505_ : string) +: option string := + + let _s506_ := _s505_ in + if ((string_startswith _s506_ "bne")) then + match (string_drop _s506_ (projT1 (string_length "bne"))) with | s_ => Some (s_) end + else None. + +Definition _s500_ (_s501_ : string) +: option string := + + let _s502_ := _s501_ in + if ((string_startswith _s502_ "beq")) then + match (string_drop _s502_ (projT1 (string_length "beq"))) with | s_ => Some (s_) end + else None. + +Definition btype_mnemonic_matches_prefix (arg_ : string) +: M (option ((bop * {n : Z & ArithFact (n >= 0)}))) := + + let _s503_ := arg_ in + (if ((match (_s500_ _s503_) with | Some (s_) => true | _ => false end)) then + (match (_s500_ _s503_) with + | Some (s_) => + returnm ((Some + ((RISCV_BEQ, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s504_ _s503_) with | Some (s_) => true | _ => false end)) then + (match (_s504_ _s503_) with + | Some (s_) => + returnm ((Some + ((RISCV_BNE, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s508_ _s503_) with | Some (s_) => true | _ => false end)) then + (match (_s508_ _s503_) with + | Some (s_) => + returnm ((Some + ((RISCV_BLT, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s512_ _s503_) with | Some (s_) => true | _ => false end)) then + (match (_s512_ _s503_) with + | Some (s_) => + returnm ((Some + ((RISCV_BGE, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s516_ _s503_) with | Some (s_) => true | _ => false end)) then + (match (_s516_ _s503_) with + | Some (s_) => + returnm ((Some + ((RISCV_BLTU, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s520_ _s503_) with | Some (s_) => true | _ => false end)) then + (match (_s520_ _s503_) with + | Some (s_) => + returnm ((Some + ((RISCV_BGEU, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bop * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((bop * {n : Z & ArithFact (n >= 0)})))) + : M (option ((bop * {n : Z & ArithFact (n >= 0)}))). + +Definition encdec_iop_forwards (arg_ : iop) +: mword 3 := + + match arg_ with + | RISCV_ADDI => (vec_of_bits [B0;B0;B0] : mword 3) + | RISCV_SLTI => (vec_of_bits [B0;B1;B0] : mword 3) + | RISCV_SLTIU => (vec_of_bits [B0;B1;B1] : mword 3) + | RISCV_XORI => (vec_of_bits [B1;B0;B0] : mword 3) + | RISCV_ORI => (vec_of_bits [B1;B1;B0] : mword 3) + | RISCV_ANDI => (vec_of_bits [B1;B1;B1] : mword 3) + end. + +Definition encdec_iop_backwards (arg_ : mword 3) +: iop := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0] : mword 3))) then RISCV_ADDI + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B0] : mword 3))) then RISCV_SLTI + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1] : mword 3))) then RISCV_SLTIU + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B0] : mword 3))) then RISCV_XORI + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0] : mword 3))) then RISCV_ORI + else RISCV_ANDI. + +Definition encdec_iop_forwards_matches (arg_ : iop) +: bool := + + match arg_ with + | RISCV_ADDI => true + | RISCV_SLTI => true + | RISCV_SLTIU => true + | RISCV_XORI => true + | RISCV_ORI => true + | RISCV_ANDI => true + end. + +Definition encdec_iop_backwards_matches (arg_ : mword 3) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1] : mword 3))) then true + else false. + +Definition itype_mnemonic_forwards (arg_ : iop) +: string := + + match arg_ with + | RISCV_ADDI => "addi" + | RISCV_SLTI => "slti" + | RISCV_SLTIU => "sltiu" + | RISCV_XORI => "xori" + | RISCV_ORI => "ori" + | RISCV_ANDI => "andi" + end. + +Definition itype_mnemonic_backwards (arg_ : string) +: iop := + + let p0_ := arg_ in + if ((generic_eq p0_ "addi")) then RISCV_ADDI + else if ((generic_eq p0_ "slti")) then RISCV_SLTI + else if ((generic_eq p0_ "sltiu")) then RISCV_SLTIU + else if ((generic_eq p0_ "xori")) then RISCV_XORI + else if ((generic_eq p0_ "ori")) then RISCV_ORI + else RISCV_ANDI. + +Definition itype_mnemonic_forwards_matches (arg_ : iop) +: bool := + + match arg_ with + | RISCV_ADDI => true + | RISCV_SLTI => true + | RISCV_SLTIU => true + | RISCV_XORI => true + | RISCV_ORI => true + | RISCV_ANDI => true + end. + +Definition itype_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "addi")) then true + else if ((generic_eq p0_ "slti")) then true + else if ((generic_eq p0_ "sltiu")) then true + else if ((generic_eq p0_ "xori")) then true + else if ((generic_eq p0_ "ori")) then true + else if ((generic_eq p0_ "andi")) then true + else false. + +Definition _s544_ (_s545_ : string) +: option string := + + let _s546_ := _s545_ in + if ((string_startswith _s546_ "andi")) then + match (string_drop _s546_ (projT1 (string_length "andi"))) with | s_ => Some (s_) end + else None. + +Definition _s540_ (_s541_ : string) +: option string := + + let _s542_ := _s541_ in + if ((string_startswith _s542_ "ori")) then + match (string_drop _s542_ (projT1 (string_length "ori"))) with | s_ => Some (s_) end + else None. + +Definition _s536_ (_s537_ : string) +: option string := + + let _s538_ := _s537_ in + if ((string_startswith _s538_ "xori")) then + match (string_drop _s538_ (projT1 (string_length "xori"))) with | s_ => Some (s_) end + else None. + +Definition _s532_ (_s533_ : string) +: option string := + + let _s534_ := _s533_ in + if ((string_startswith _s534_ "sltiu")) then + match (string_drop _s534_ (projT1 (string_length "sltiu"))) with | s_ => Some (s_) end + else None. + +Definition _s528_ (_s529_ : string) +: option string := + + let _s530_ := _s529_ in + if ((string_startswith _s530_ "slti")) then + match (string_drop _s530_ (projT1 (string_length "slti"))) with | s_ => Some (s_) end + else None. + +Definition _s524_ (_s525_ : string) +: option string := + + let _s526_ := _s525_ in + if ((string_startswith _s526_ "addi")) then + match (string_drop _s526_ (projT1 (string_length "addi"))) with | s_ => Some (s_) end + else None. + +Definition itype_mnemonic_matches_prefix (arg_ : string) +: M (option ((iop * {n : Z & ArithFact (n >= 0)}))) := + + let _s527_ := arg_ in + (if ((match (_s524_ _s527_) with | Some (s_) => true | _ => false end)) then + (match (_s524_ _s527_) with + | Some (s_) => + returnm ((Some + ((RISCV_ADDI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((iop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s528_ _s527_) with | Some (s_) => true | _ => false end)) then + (match (_s528_ _s527_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLTI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((iop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s532_ _s527_) with | Some (s_) => true | _ => false end)) then + (match (_s532_ _s527_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLTIU, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((iop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s536_ _s527_) with | Some (s_) => true | _ => false end)) then + (match (_s536_ _s527_) with + | Some (s_) => + returnm ((Some + ((RISCV_XORI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((iop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s540_ _s527_) with | Some (s_) => true | _ => false end)) then + (match (_s540_ _s527_) with + | Some (s_) => + returnm ((Some + ((RISCV_ORI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((iop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s544_ _s527_) with | Some (s_) => true | _ => false end)) then + (match (_s544_ _s527_) with + | Some (s_) => + returnm ((Some + ((RISCV_ANDI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((iop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((iop * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((iop * {n : Z & ArithFact (n >= 0)})))) + : M (option ((iop * {n : Z & ArithFact (n >= 0)}))). + +Definition encdec_sop_forwards (arg_ : sop) +: mword 3 := + + match arg_ with + | RISCV_SLLI => (vec_of_bits [B0;B0;B1] : mword 3) + | RISCV_SRLI => (vec_of_bits [B1;B0;B1] : mword 3) + | RISCV_SRAI => (vec_of_bits [B1;B0;B1] : mword 3) + end. + +Definition encdec_sop_backwards (arg_ : mword 3) +: sop := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B1] : mword 3))) then RISCV_SLLI + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1] : mword 3))) then RISCV_SRLI + else RISCV_SRAI. + +Definition encdec_sop_forwards_matches (arg_ : sop) +: bool := + + match arg_ with | RISCV_SLLI => true | RISCV_SRLI => true | RISCV_SRAI => true end. + +Definition encdec_sop_backwards_matches (arg_ : mword 3) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0;B1] : mword 3))) then true + else false. + +Definition shiftiop_mnemonic_forwards (arg_ : sop) +: string := + + match arg_ with | RISCV_SLLI => "slli" | RISCV_SRLI => "srli" | RISCV_SRAI => "srai" end. + +Definition shiftiop_mnemonic_backwards (arg_ : string) +: sop := + + let p0_ := arg_ in + if ((generic_eq p0_ "slli")) then RISCV_SLLI + else if ((generic_eq p0_ "srli")) then RISCV_SRLI + else RISCV_SRAI. + +Definition shiftiop_mnemonic_forwards_matches (arg_ : sop) +: bool := + + match arg_ with | RISCV_SLLI => true | RISCV_SRLI => true | RISCV_SRAI => true end. + +Definition shiftiop_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "slli")) then true + else if ((generic_eq p0_ "srli")) then true + else if ((generic_eq p0_ "srai")) then true + else false. + +Definition _s556_ (_s557_ : string) +: option string := + + let _s558_ := _s557_ in + if ((string_startswith _s558_ "srai")) then + match (string_drop _s558_ (projT1 (string_length "srai"))) with | s_ => Some (s_) end + else None. + +Definition _s552_ (_s553_ : string) +: option string := + + let _s554_ := _s553_ in + if ((string_startswith _s554_ "srli")) then + match (string_drop _s554_ (projT1 (string_length "srli"))) with | s_ => Some (s_) end + else None. + +Definition _s548_ (_s549_ : string) +: option string := + + let _s550_ := _s549_ in + if ((string_startswith _s550_ "slli")) then + match (string_drop _s550_ (projT1 (string_length "slli"))) with | s_ => Some (s_) end + else None. + +Definition shiftiop_mnemonic_matches_prefix (arg_ : string) +: M (option ((sop * {n : Z & ArithFact (n >= 0)}))) := + + let _s551_ := arg_ in + (if ((match (_s548_ _s551_) with | Some (s_) => true | _ => false end)) then + (match (_s548_ _s551_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLLI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s552_ _s551_) with | Some (s_) => true | _ => false end)) then + (match (_s552_ _s551_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRLI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s556_ _s551_) with | Some (s_) => true | _ => false end)) then + (match (_s556_ _s551_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRAI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((sop * {n : Z & ArithFact (n >= 0)})))) + : M (option ((sop * {n : Z & ArithFact (n >= 0)}))). + +Definition rtype_mnemonic_forwards (arg_ : rop) +: string := + + match arg_ with + | RISCV_ADD => "add" + | RISCV_SUB => "sub" + | RISCV_SLL => "sll" + | RISCV_SLT => "slt" + | RISCV_SLTU => "sltu" + | RISCV_XOR => "xor" + | RISCV_SRL => "srl" + | RISCV_SRA => "sra" + | RISCV_OR => "or" + | RISCV_AND => "and" + end. + +Definition rtype_mnemonic_backwards (arg_ : string) +: rop := + + let p0_ := arg_ in + if ((generic_eq p0_ "add")) then RISCV_ADD + else if ((generic_eq p0_ "sub")) then RISCV_SUB + else if ((generic_eq p0_ "sll")) then RISCV_SLL + else if ((generic_eq p0_ "slt")) then RISCV_SLT + else if ((generic_eq p0_ "sltu")) then RISCV_SLTU + else if ((generic_eq p0_ "xor")) then RISCV_XOR + else if ((generic_eq p0_ "srl")) then RISCV_SRL + else if ((generic_eq p0_ "sra")) then RISCV_SRA + else if ((generic_eq p0_ "or")) then RISCV_OR + else RISCV_AND. + +Definition rtype_mnemonic_forwards_matches (arg_ : rop) +: bool := + + match arg_ with + | RISCV_ADD => true + | RISCV_SUB => true + | RISCV_SLL => true + | RISCV_SLT => true + | RISCV_SLTU => true + | RISCV_XOR => true + | RISCV_SRL => true + | RISCV_SRA => true + | RISCV_OR => true + | RISCV_AND => true + end. + +Definition rtype_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "add")) then true + else if ((generic_eq p0_ "sub")) then true + else if ((generic_eq p0_ "sll")) then true + else if ((generic_eq p0_ "slt")) then true + else if ((generic_eq p0_ "sltu")) then true + else if ((generic_eq p0_ "xor")) then true + else if ((generic_eq p0_ "srl")) then true + else if ((generic_eq p0_ "sra")) then true + else if ((generic_eq p0_ "or")) then true + else if ((generic_eq p0_ "and")) then true + else false. + +Definition _s596_ (_s597_ : string) +: option string := + + let _s598_ := _s597_ in + if ((string_startswith _s598_ "and")) then + match (string_drop _s598_ (projT1 (string_length "and"))) with | s_ => Some (s_) end + else None. + +Definition _s592_ (_s593_ : string) +: option string := + + let _s594_ := _s593_ in + if ((string_startswith _s594_ "or")) then + match (string_drop _s594_ (projT1 (string_length "or"))) with | s_ => Some (s_) end + else None. + +Definition _s588_ (_s589_ : string) +: option string := + + let _s590_ := _s589_ in + if ((string_startswith _s590_ "sra")) then + match (string_drop _s590_ (projT1 (string_length "sra"))) with | s_ => Some (s_) end + else None. + +Definition _s584_ (_s585_ : string) +: option string := + + let _s586_ := _s585_ in + if ((string_startswith _s586_ "srl")) then + match (string_drop _s586_ (projT1 (string_length "srl"))) with | s_ => Some (s_) end + else None. + +Definition _s580_ (_s581_ : string) +: option string := + + let _s582_ := _s581_ in + if ((string_startswith _s582_ "xor")) then + match (string_drop _s582_ (projT1 (string_length "xor"))) with | s_ => Some (s_) end + else None. + +Definition _s576_ (_s577_ : string) +: option string := + + let _s578_ := _s577_ in + if ((string_startswith _s578_ "sltu")) then + match (string_drop _s578_ (projT1 (string_length "sltu"))) with | s_ => Some (s_) end + else None. + +Definition _s572_ (_s573_ : string) +: option string := + + let _s574_ := _s573_ in + if ((string_startswith _s574_ "slt")) then + match (string_drop _s574_ (projT1 (string_length "slt"))) with | s_ => Some (s_) end + else None. + +Definition _s568_ (_s569_ : string) +: option string := + + let _s570_ := _s569_ in + if ((string_startswith _s570_ "sll")) then + match (string_drop _s570_ (projT1 (string_length "sll"))) with | s_ => Some (s_) end + else None. + +Definition _s564_ (_s565_ : string) +: option string := + + let _s566_ := _s565_ in + if ((string_startswith _s566_ "sub")) then + match (string_drop _s566_ (projT1 (string_length "sub"))) with | s_ => Some (s_) end + else None. + +Definition _s560_ (_s561_ : string) +: option string := + + let _s562_ := _s561_ in + if ((string_startswith _s562_ "add")) then + match (string_drop _s562_ (projT1 (string_length "add"))) with | s_ => Some (s_) end + else None. + +Definition rtype_mnemonic_matches_prefix (arg_ : string) +: M (option ((rop * {n : Z & ArithFact (n >= 0)}))) := + + let _s563_ := arg_ in + (if ((match (_s560_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s560_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_ADD, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s564_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s564_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_SUB, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s568_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s568_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLL, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s572_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s572_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLT, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s576_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s576_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLTU, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s580_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s580_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_XOR, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s584_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s584_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRL, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s588_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s588_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRA, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s592_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s592_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_OR, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s596_ _s563_) with | Some (s_) => true | _ => false end)) then + (match (_s596_ _s563_) with + | Some (s_) => + returnm ((Some + ((RISCV_AND, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((rop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((rop * {n : Z & ArithFact (n >= 0)})))) + : M (option ((rop * {n : Z & ArithFact (n >= 0)}))). + +Definition extend_value {n : Z} (is_unsigned : bool) (value : MemoryOpResult (mword (8 * n))) +`{ArithFact ((0 + 1) <= n /\ n <= 8)} +: MemoryOpResult (mword 64) := + + match value with + | MemValue (v) => MemValue (if (is_unsigned) then EXTZ 64 v else (EXTS 64 v) : xlenbits) + | MemException (e) => MemException (e) + end. + +Definition process_load {n : Z} +(rd : mword 5) (addr : mword 64) (value : MemoryOpResult (mword (8 * n))) (is_unsigned : bool) +`{ArithFact ((0 + 1) <= n /\ n <= 8)} +: M (bool) := + + (match (extend_value is_unsigned value) with + | MemValue (result) => (wX (projT1 (regbits_to_regno rd)) result) >> returnm (true : bool) + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + end) + : M (bool). + +Definition check_misaligned (vaddr : mword 64) (width : word_width) +: M (bool) := + + (if ((plat_enable_misaligned_access tt)) then returnm (false : bool) + else + (match width with + | BYTE => returnm (false : bool) + | HALF => + (bit_to_bool (access_vec_dec vaddr 0)) >>= fun w__0 : bool => + returnm ((Bool.eqb (w__0 : bool) true) + : bool) + | WORD => + (or_boolM + ((bit_to_bool (access_vec_dec vaddr 0)) >>= fun w__1 : bool => + returnm ((Bool.eqb (w__1 : bool) true) + : bool)) + ((bit_to_bool (access_vec_dec vaddr 1)) >>= fun w__2 : bool => + returnm ((Bool.eqb (w__2 : bool) true) + : bool))) + : M (bool) + | DOUBLE => + (or_boolM + ((bit_to_bool (access_vec_dec vaddr 0)) >>= fun w__4 : bool => + returnm ((Bool.eqb (w__4 : bool) true) + : bool)) + ((or_boolM + ((bit_to_bool (access_vec_dec vaddr 1)) >>= fun w__5 : bool => + returnm ((Bool.eqb (w__5 : bool) true) + : bool)) + ((bit_to_bool (access_vec_dec vaddr 2)) >>= fun w__6 : bool => + returnm ((Bool.eqb (w__6 : bool) true) + : bool))) + : M (bool))) + : M (bool) + end) + : M (bool)) + : M (bool). + +Definition maybe_aq_forwards (arg_ : bool) +: string := + + match arg_ with | true => ".aq" | false => "" end. + +Definition maybe_aq_backwards (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ ".aq")) then true + else false. + +Definition maybe_aq_forwards_matches (arg_ : bool) +: bool := + + match arg_ with | true => true | false => true end. + +Definition maybe_aq_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ ".aq")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s604_ (_s605_ : string) +: option string := + + let _s606_ := _s605_ in + if ((string_startswith _s606_ "")) then + match (string_drop _s606_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s600_ (_s601_ : string) +: option string := + + let _s602_ := _s601_ in + if ((string_startswith _s602_ ".aq")) then + match (string_drop _s602_ (projT1 (string_length ".aq"))) with | s_ => Some (s_) end + else None. + +Definition maybe_aq_matches_prefix (arg_ : string) +: M (option ((bool * {n : Z & ArithFact (n >= 0)}))) := + + let _s603_ := arg_ in + (if ((match (_s600_ _s603_) with | Some (s_) => true | _ => false end)) then + (match (_s600_ _s603_) with + | Some (s_) => + returnm ((Some + ((true, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s604_ _s603_) with | Some (s_) => true | _ => false end)) then + (match (_s604_ _s603_) with + | Some (s_) => + returnm ((Some + ((false, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((bool * {n : Z & ArithFact (n >= 0)})))) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))). + +Definition maybe_rl_forwards (arg_ : bool) +: string := + + match arg_ with | true => ".rl" | false => "" end. + +Definition maybe_rl_backwards (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ ".rl")) then true + else false. + +Definition maybe_rl_forwards_matches (arg_ : bool) +: bool := + + match arg_ with | true => true | false => true end. + +Definition maybe_rl_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ ".rl")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s612_ (_s613_ : string) +: option string := + + let _s614_ := _s613_ in + if ((string_startswith _s614_ "")) then + match (string_drop _s614_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s608_ (_s609_ : string) +: option string := + + let _s610_ := _s609_ in + if ((string_startswith _s610_ ".rl")) then + match (string_drop _s610_ (projT1 (string_length ".rl"))) with | s_ => Some (s_) end + else None. + +Definition maybe_rl_matches_prefix (arg_ : string) +: M (option ((bool * {n : Z & ArithFact (n >= 0)}))) := + + let _s611_ := arg_ in + (if ((match (_s608_ _s611_) with | Some (s_) => true | _ => false end)) then + (match (_s608_ _s611_) with + | Some (s_) => + returnm ((Some + ((true, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s612_ _s611_) with | Some (s_) => true | _ => false end)) then + (match (_s612_ _s611_) with + | Some (s_) => + returnm ((Some + ((false, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((bool * {n : Z & ArithFact (n >= 0)})))) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))). + +Definition maybe_u_forwards (arg_ : bool) +: string := + + match arg_ with | true => "u" | false => "" end. + +Definition maybe_u_backwards (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "u")) then true + else false. + +Definition maybe_u_forwards_matches (arg_ : bool) +: bool := + + match arg_ with | true => true | false => true end. + +Definition maybe_u_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "u")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s620_ (_s621_ : string) +: option string := + + let _s622_ := _s621_ in + if ((string_startswith _s622_ "")) then + match (string_drop _s622_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s616_ (_s617_ : string) +: option string := + + let _s618_ := _s617_ in + if ((string_startswith _s618_ "u")) then + match (string_drop _s618_ (projT1 (string_length "u"))) with | s_ => Some (s_) end + else None. + +Definition maybe_u_matches_prefix (arg_ : string) +: M (option ((bool * {n : Z & ArithFact (n >= 0)}))) := + + let _s619_ := arg_ in + (if ((match (_s616_ _s619_) with | Some (s_) => true | _ => false end)) then + (match (_s616_ _s619_) with + | Some (s_) => + returnm ((Some + ((true, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s620_ _s619_) with | Some (s_) => true | _ => false end)) then + (match (_s620_ _s619_) with + | Some (s_) => + returnm ((Some + ((false, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((bool * {n : Z & ArithFact (n >= 0)})))) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))). + +Definition shiftw_mnemonic_forwards (arg_ : sop) +: string := + + match arg_ with | RISCV_SLLI => "slli" | RISCV_SRLI => "srli" | RISCV_SRAI => "srai" end. + +Definition shiftw_mnemonic_backwards (arg_ : string) +: sop := + + let p0_ := arg_ in + if ((generic_eq p0_ "slli")) then RISCV_SLLI + else if ((generic_eq p0_ "srli")) then RISCV_SRLI + else RISCV_SRAI. + +Definition shiftw_mnemonic_forwards_matches (arg_ : sop) +: bool := + + match arg_ with | RISCV_SLLI => true | RISCV_SRLI => true | RISCV_SRAI => true end. + +Definition shiftw_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "slli")) then true + else if ((generic_eq p0_ "srli")) then true + else if ((generic_eq p0_ "srai")) then true + else false. + +Definition _s632_ (_s633_ : string) +: option string := + + let _s634_ := _s633_ in + if ((string_startswith _s634_ "srai")) then + match (string_drop _s634_ (projT1 (string_length "srai"))) with | s_ => Some (s_) end + else None. + +Definition _s628_ (_s629_ : string) +: option string := + + let _s630_ := _s629_ in + if ((string_startswith _s630_ "srli")) then + match (string_drop _s630_ (projT1 (string_length "srli"))) with | s_ => Some (s_) end + else None. + +Definition _s624_ (_s625_ : string) +: option string := + + let _s626_ := _s625_ in + if ((string_startswith _s626_ "slli")) then + match (string_drop _s626_ (projT1 (string_length "slli"))) with | s_ => Some (s_) end + else None. + +Definition shiftw_mnemonic_matches_prefix (arg_ : string) +: M (option ((sop * {n : Z & ArithFact (n >= 0)}))) := + + let _s627_ := arg_ in + (if ((match (_s624_ _s627_) with | Some (s_) => true | _ => false end)) then + (match (_s624_ _s627_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLLI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s628_ _s627_) with | Some (s_) => true | _ => false end)) then + (match (_s628_ _s627_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRLI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s632_ _s627_) with | Some (s_) => true | _ => false end)) then + (match (_s632_ _s627_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRAI, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sop * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((sop * {n : Z & ArithFact (n >= 0)})))) + : M (option ((sop * {n : Z & ArithFact (n >= 0)}))). + +Definition rtypew_mnemonic_forwards (arg_ : ropw) +: string := + + match arg_ with + | RISCV_ADDW => "addw" + | RISCV_SUBW => "subw" + | RISCV_SLLW => "sllw" + | RISCV_SRLW => "srlw" + | RISCV_SRAW => "sraw" + end. + +Definition rtypew_mnemonic_backwards (arg_ : string) +: ropw := + + let p0_ := arg_ in + if ((generic_eq p0_ "addw")) then RISCV_ADDW + else if ((generic_eq p0_ "subw")) then RISCV_SUBW + else if ((generic_eq p0_ "sllw")) then RISCV_SLLW + else if ((generic_eq p0_ "srlw")) then RISCV_SRLW + else RISCV_SRAW. + +Definition rtypew_mnemonic_forwards_matches (arg_ : ropw) +: bool := + + match arg_ with + | RISCV_ADDW => true + | RISCV_SUBW => true + | RISCV_SLLW => true + | RISCV_SRLW => true + | RISCV_SRAW => true + end. + +Definition rtypew_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "addw")) then true + else if ((generic_eq p0_ "subw")) then true + else if ((generic_eq p0_ "sllw")) then true + else if ((generic_eq p0_ "srlw")) then true + else if ((generic_eq p0_ "sraw")) then true + else false. + +Definition _s652_ (_s653_ : string) +: option string := + + let _s654_ := _s653_ in + if ((string_startswith _s654_ "sraw")) then + match (string_drop _s654_ (projT1 (string_length "sraw"))) with | s_ => Some (s_) end + else None. + +Definition _s648_ (_s649_ : string) +: option string := + + let _s650_ := _s649_ in + if ((string_startswith _s650_ "srlw")) then + match (string_drop _s650_ (projT1 (string_length "srlw"))) with | s_ => Some (s_) end + else None. + +Definition _s644_ (_s645_ : string) +: option string := + + let _s646_ := _s645_ in + if ((string_startswith _s646_ "sllw")) then + match (string_drop _s646_ (projT1 (string_length "sllw"))) with | s_ => Some (s_) end + else None. + +Definition _s640_ (_s641_ : string) +: option string := + + let _s642_ := _s641_ in + if ((string_startswith _s642_ "subw")) then + match (string_drop _s642_ (projT1 (string_length "subw"))) with | s_ => Some (s_) end + else None. + +Definition _s636_ (_s637_ : string) +: option string := + + let _s638_ := _s637_ in + if ((string_startswith _s638_ "addw")) then + match (string_drop _s638_ (projT1 (string_length "addw"))) with | s_ => Some (s_) end + else None. + +Definition rtypew_mnemonic_matches_prefix (arg_ : string) +: M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) := + + let _s639_ := arg_ in + (if ((match (_s636_ _s639_) with | Some (s_) => true | _ => false end)) then + (match (_s636_ _s639_) with + | Some (s_) => + returnm ((Some + ((RISCV_ADDW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((ropw * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s640_ _s639_) with | Some (s_) => true | _ => false end)) then + (match (_s640_ _s639_) with + | Some (s_) => + returnm ((Some + ((RISCV_SUBW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((ropw * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s644_ _s639_) with | Some (s_) => true | _ => false end)) then + (match (_s644_ _s639_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLLW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((ropw * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s648_ _s639_) with | Some (s_) => true | _ => false end)) then + (match (_s648_ _s639_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRLW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((ropw * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s652_ _s639_) with | Some (s_) => true | _ => false end)) then + (match (_s652_ _s639_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRAW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((ropw * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((ropw * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ropw * {n : Z & ArithFact (n >= 0)}))). + +Definition shiftiwop_mnemonic_forwards (arg_ : sopw) +: string := + + match arg_ with | RISCV_SLLIW => "slliw" | RISCV_SRLIW => "srliw" | RISCV_SRAIW => "sraiw" end. + +Definition shiftiwop_mnemonic_backwards (arg_ : string) +: sopw := + + let p0_ := arg_ in + if ((generic_eq p0_ "slliw")) then RISCV_SLLIW + else if ((generic_eq p0_ "srliw")) then RISCV_SRLIW + else RISCV_SRAIW. + +Definition shiftiwop_mnemonic_forwards_matches (arg_ : sopw) +: bool := + + match arg_ with | RISCV_SLLIW => true | RISCV_SRLIW => true | RISCV_SRAIW => true end. + +Definition shiftiwop_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "slliw")) then true + else if ((generic_eq p0_ "srliw")) then true + else if ((generic_eq p0_ "sraiw")) then true + else false. + +Definition _s664_ (_s665_ : string) +: option string := + + let _s666_ := _s665_ in + if ((string_startswith _s666_ "sraiw")) then + match (string_drop _s666_ (projT1 (string_length "sraiw"))) with | s_ => Some (s_) end + else None. + +Definition _s660_ (_s661_ : string) +: option string := + + let _s662_ := _s661_ in + if ((string_startswith _s662_ "srliw")) then + match (string_drop _s662_ (projT1 (string_length "srliw"))) with | s_ => Some (s_) end + else None. + +Definition _s656_ (_s657_ : string) +: option string := + + let _s658_ := _s657_ in + if ((string_startswith _s658_ "slliw")) then + match (string_drop _s658_ (projT1 (string_length "slliw"))) with | s_ => Some (s_) end + else None. + +Definition shiftiwop_mnemonic_matches_prefix (arg_ : string) +: M (option ((sopw * {n : Z & ArithFact (n >= 0)}))) := + + let _s659_ := arg_ in + (if ((match (_s656_ _s659_) with | Some (s_) => true | _ => false end)) then + (match (_s656_ _s659_) with + | Some (s_) => + returnm ((Some + ((RISCV_SLLIW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sopw * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sopw * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sopw * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s660_ _s659_) with | Some (s_) => true | _ => false end)) then + (match (_s660_ _s659_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRLIW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sopw * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sopw * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sopw * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s664_ _s659_) with | Some (s_) => true | _ => false end)) then + (match (_s664_ _s659_) with + | Some (s_) => + returnm ((Some + ((RISCV_SRAIW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((sopw * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((sopw * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((sopw * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((sopw * {n : Z & ArithFact (n >= 0)})))) + : M (option ((sopw * {n : Z & ArithFact (n >= 0)}))). + +Definition encdec_mul_op_forwards (arg_ : (bool * bool * bool)) +: M (mword 3) := + + (match arg_ with + | (false, true, true) => returnm ((vec_of_bits [B0;B0;B0] : mword 3) : mword 3) + | (true, true, true) => returnm ((vec_of_bits [B0;B0;B1] : mword 3) : mword 3) + | (true, true, false) => returnm ((vec_of_bits [B0;B1;B0] : mword 3) : mword 3) + | (true, false, false) => returnm ((vec_of_bits [B0;B1;B1] : mword 3) : mword 3) + | _ => exit tt : M (mword 3) + end) + : M (mword 3). + +Definition encdec_mul_op_backwards (arg_ : mword 3) +: (bool * bool * bool) := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0] : mword 3))) then (false, true, true) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1] : mword 3))) then (true, true, true) + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B0] : mword 3))) then (true, true, false) + else (true, false, false). + +Definition encdec_mul_op_forwards_matches (arg_ : (bool * bool * bool)) +: bool := + + match arg_ with + | (false, true, true) => true + | (true, true, true) => true + | (true, true, false) => true + | (true, false, false) => true + | _ => false + end. + +Definition encdec_mul_op_backwards_matches (arg_ : mword 3) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B0;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B0] : mword 3))) then true + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1] : mword 3))) then true + else false. + +Definition mul_mnemonic_forwards (arg_ : (bool * bool * bool)) +: M (string) := + + (match arg_ with + | (false, true, true) => returnm ("mul" : string) + | (true, true, true) => returnm ("mulh" : string) + | (true, true, false) => returnm ("mulhsu" : string) + | (true, false, false) => returnm ("mulhu" : string) + | _ => exit tt : M (string) + end) + : M (string). + +Definition mul_mnemonic_backwards (arg_ : string) +: (bool * bool * bool) := + + let p0_ := arg_ in + if ((generic_eq p0_ "mul")) then (false, true, true) + else if ((generic_eq p0_ "mulh")) then (true, true, true) + else if ((generic_eq p0_ "mulhsu")) then (true, true, false) + else (true, false, false). + +Definition mul_mnemonic_forwards_matches (arg_ : (bool * bool * bool)) +: bool := + + match arg_ with + | (false, true, true) => true + | (true, true, true) => true + | (true, true, false) => true + | (true, false, false) => true + | _ => false + end. + +Definition mul_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "mul")) then true + else if ((generic_eq p0_ "mulh")) then true + else if ((generic_eq p0_ "mulhsu")) then true + else if ((generic_eq p0_ "mulhu")) then true + else false. + +Definition _s680_ (_s681_ : string) +: option string := + + let _s682_ := _s681_ in + if ((string_startswith _s682_ "mulhu")) then + match (string_drop _s682_ (projT1 (string_length "mulhu"))) with | s_ => Some (s_) end + else None. + +Definition _s676_ (_s677_ : string) +: option string := + + let _s678_ := _s677_ in + if ((string_startswith _s678_ "mulhsu")) then + match (string_drop _s678_ (projT1 (string_length "mulhsu"))) with | s_ => Some (s_) end + else None. + +Definition _s672_ (_s673_ : string) +: option string := + + let _s674_ := _s673_ in + if ((string_startswith _s674_ "mulh")) then + match (string_drop _s674_ (projT1 (string_length "mulh"))) with | s_ => Some (s_) end + else None. + +Definition _s668_ (_s669_ : string) +: option string := + + let _s670_ := _s669_ in + if ((string_startswith _s670_ "mul")) then + match (string_drop _s670_ (projT1 (string_length "mul"))) with | s_ => Some (s_) end + else None. + +Definition mul_mnemonic_matches_prefix (arg_ : string) +: M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) := + + let _s671_ := arg_ in + (if ((match (_s668_ _s671_) with | Some (s_) => true | _ => false end)) then + (match (_s668_ _s671_) with + | Some (s_) => + returnm ((Some + (((false, true, true), build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s672_ _s671_) with | Some (s_) => true | _ => false end)) then + (match (_s672_ _s671_) with + | Some (s_) => + returnm ((Some + (((true, true, true), build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s676_ _s671_) with | Some (s_) => true | _ => false end)) then + (match (_s676_ _s671_) with + | Some (s_) => + returnm ((Some + (((true, true, false), build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s680_ _s671_) with | Some (s_) => true | _ => false end)) then + (match (_s680_ _s671_) with + | Some (s_) => + returnm ((Some + (((true, false, false), build_ex (projT1 (sub_nat + (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)})))) + : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >= 0)}))). + +Definition maybe_not_u_forwards (arg_ : bool) +: string := + + match arg_ with | false => "u" | true => "" end. + +Definition maybe_not_u_backwards (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "u")) then false + else true. + +Definition maybe_not_u_forwards_matches (arg_ : bool) +: bool := + + match arg_ with | false => true | true => true end. + +Definition maybe_not_u_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "u")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s688_ (_s689_ : string) +: option string := + + let _s690_ := _s689_ in + if ((string_startswith _s690_ "")) then + match (string_drop _s690_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s684_ (_s685_ : string) +: option string := + + let _s686_ := _s685_ in + if ((string_startswith _s686_ "u")) then + match (string_drop _s686_ (projT1 (string_length "u"))) with | s_ => Some (s_) end + else None. + +Definition maybe_not_u_matches_prefix (arg_ : string) +: M (option ((bool * {n : Z & ArithFact (n >= 0)}))) := + + let _s687_ := arg_ in + (if ((match (_s684_ _s687_) with | Some (s_) => true | _ => false end)) then + (match (_s684_ _s687_) with + | Some (s_) => + returnm ((Some + ((false, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s688_ _s687_) with | Some (s_) => true | _ => false end)) then + (match (_s688_ _s687_) with + | Some (s_) => + returnm ((Some + ((true, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((bool * {n : Z & ArithFact (n >= 0)})))) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))). + +Definition bit_maybe_r_forwards (arg_ : mword 1) +: string := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then "r" + else "". + +Definition bit_maybe_r_backwards (arg_ : string) +: mword 1 := + + let p0_ := arg_ in + if ((generic_eq p0_ "r")) then (vec_of_bits [B1] : mword 1) + else (vec_of_bits [B0] : mword 1). + +Definition bit_maybe_r_forwards_matches (arg_ : mword 1) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then true + else if ((eq_vec b__0 (vec_of_bits [B0] : mword 1))) then true + else false. + +Definition bit_maybe_r_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "r")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s696_ (_s697_ : string) +: option string := + + let _s698_ := _s697_ in + if ((string_startswith _s698_ "")) then + match (string_drop _s698_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s692_ (_s693_ : string) +: option string := + + let _s694_ := _s693_ in + if ((string_startswith _s694_ "r")) then + match (string_drop _s694_ (projT1 (string_length "r"))) with | s_ => Some (s_) end + else None. + +Definition bit_maybe_r_matches_prefix (arg_ : string) +: M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) := + + let _s695_ := arg_ in + (if ((match (_s692_ _s695_) with | Some (s_) => true | _ => false end)) then + (match (_s692_ _s695_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1] : mword 1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length s_))))))) + : option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s696_ _s695_) with | Some (s_) => true | _ => false end)) then + (match (_s696_ _s695_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0] : mword 1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length s_))))))) + : option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((mword 1 * {n : Z & ArithFact (n >= 0)})))) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))). + +Definition bit_maybe_w_forwards (arg_ : mword 1) +: string := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then "w" + else "". + +Definition bit_maybe_w_backwards (arg_ : string) +: mword 1 := + + let p0_ := arg_ in + if ((generic_eq p0_ "w")) then (vec_of_bits [B1] : mword 1) + else (vec_of_bits [B0] : mword 1). + +Definition bit_maybe_w_forwards_matches (arg_ : mword 1) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then true + else if ((eq_vec b__0 (vec_of_bits [B0] : mword 1))) then true + else false. + +Definition bit_maybe_w_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "w")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s704_ (_s705_ : string) +: option string := + + let _s706_ := _s705_ in + if ((string_startswith _s706_ "")) then + match (string_drop _s706_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s700_ (_s701_ : string) +: option string := + + let _s702_ := _s701_ in + if ((string_startswith _s702_ "w")) then + match (string_drop _s702_ (projT1 (string_length "w"))) with | s_ => Some (s_) end + else None. + +Definition bit_maybe_w_matches_prefix (arg_ : string) +: M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) := + + let _s703_ := arg_ in + (if ((match (_s700_ _s703_) with | Some (s_) => true | _ => false end)) then + (match (_s700_ _s703_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1] : mword 1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length s_))))))) + : option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s704_ _s703_) with | Some (s_) => true | _ => false end)) then + (match (_s704_ _s703_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0] : mword 1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length s_))))))) + : option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((mword 1 * {n : Z & ArithFact (n >= 0)})))) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))). + +Definition bit_maybe_i_forwards (arg_ : mword 1) +: string := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then "i" + else "". + +Definition bit_maybe_i_backwards (arg_ : string) +: mword 1 := + + let p0_ := arg_ in + if ((generic_eq p0_ "i")) then (vec_of_bits [B1] : mword 1) + else (vec_of_bits [B0] : mword 1). + +Definition bit_maybe_i_forwards_matches (arg_ : mword 1) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then true + else if ((eq_vec b__0 (vec_of_bits [B0] : mword 1))) then true + else false. + +Definition bit_maybe_i_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "i")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s712_ (_s713_ : string) +: option string := + + let _s714_ := _s713_ in + if ((string_startswith _s714_ "")) then + match (string_drop _s714_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s708_ (_s709_ : string) +: option string := + + let _s710_ := _s709_ in + if ((string_startswith _s710_ "i")) then + match (string_drop _s710_ (projT1 (string_length "i"))) with | s_ => Some (s_) end + else None. + +Definition bit_maybe_i_matches_prefix (arg_ : string) +: M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) := + + let _s711_ := arg_ in + (if ((match (_s708_ _s711_) with | Some (s_) => true | _ => false end)) then + (match (_s708_ _s711_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1] : mword 1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length s_))))))) + : option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s712_ _s711_) with | Some (s_) => true | _ => false end)) then + (match (_s712_ _s711_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0] : mword 1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length s_))))))) + : option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((mword 1 * {n : Z & ArithFact (n >= 0)})))) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))). + +Definition bit_maybe_o_forwards (arg_ : mword 1) +: string := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then "o" + else "". + +Definition bit_maybe_o_backwards (arg_ : string) +: mword 1 := + + let p0_ := arg_ in + if ((generic_eq p0_ "o")) then (vec_of_bits [B1] : mword 1) + else (vec_of_bits [B0] : mword 1). + +Definition bit_maybe_o_forwards_matches (arg_ : mword 1) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B1] : mword 1))) then true + else if ((eq_vec b__0 (vec_of_bits [B0] : mword 1))) then true + else false. + +Definition bit_maybe_o_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "o")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s720_ (_s721_ : string) +: option string := + + let _s722_ := _s721_ in + if ((string_startswith _s722_ "")) then + match (string_drop _s722_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s716_ (_s717_ : string) +: option string := + + let _s718_ := _s717_ in + if ((string_startswith _s718_ "o")) then + match (string_drop _s718_ (projT1 (string_length "o"))) with | s_ => Some (s_) end + else None. + +Definition bit_maybe_o_matches_prefix (arg_ : string) +: M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) := + + let _s719_ := arg_ in + (if ((match (_s716_ _s719_) with | Some (s_) => true | _ => false end)) then + (match (_s716_ _s719_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B1] : mword 1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length s_))))))) + : option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s720_ _s719_) with | Some (s_) => true | _ => false end)) then + (match (_s720_ _s719_) with + | Some (s_) => + returnm ((Some + (((vec_of_bits [B0] : mword 1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length s_))))))) + : option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((mword 1 * {n : Z & ArithFact (n >= 0)})))) + : M (option ((mword 1 * {n : Z & ArithFact (n >= 0)}))). + +Definition fence_bits_forwards (arg_ : mword 4) +: string := + + match arg_ with + | v__0 => + let i : bits 1 := subrange_vec_dec v__0 3 3 in + let w : bits 1 := subrange_vec_dec v__0 0 0 in + let r : bits 1 := subrange_vec_dec v__0 1 1 in + let o : bits 1 := subrange_vec_dec v__0 2 2 in + let i : bits 1 := subrange_vec_dec v__0 3 3 in + string_append (bit_maybe_i_forwards i) + (string_append (bit_maybe_o_forwards o) + (string_append (bit_maybe_r_forwards r) (string_append (bit_maybe_w_forwards w) ""))) + end. + +Definition _s724_ (_s725_ : string) +: M (option ((mword 1 * mword 1 * mword 1 * mword 1))) := + + (match _s725_ with + | _s726_ => + (bit_maybe_i_matches_prefix _s726_) >>= fun w__0 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (i,(existT _ _s727_ _)) => + (match (string_drop _s726_ _s727_) with + | _s728_ => + (bit_maybe_o_matches_prefix _s728_) >>= fun w__1 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (o,(existT _ _s729_ _)) => + (match (string_drop _s728_ _s729_) with + | _s730_ => + (bit_maybe_r_matches_prefix _s730_) >>= fun w__2 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (r,(existT _ _s731_ _)) => + (match (string_drop _s730_ _s731_) with + | _s732_ => + (bit_maybe_w_matches_prefix _s732_) >>= fun w__3 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (w,(existT _ _s733_ _)) => + let p0_ := string_drop _s732_ _s733_ in + if ((generic_eq p0_ "")) then Some ((i, o, r, w)) + else None + | _ => None + end) + : option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + | _ => returnm (None : option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + | _ => returnm (None : option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + | _ => returnm (None : option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))). + +Definition fence_bits_backwards (arg_ : string) +: M (mword 4) := + + let _s734_ := arg_ in + (_s724_ _s734_) >>= fun w__0 : option ((mword 1 * mword 1 * mword 1 * mword 1)) => + (match w__0 with + | Some (i,o,r,w) => + returnm ((concat_vec (i : bits 1) + (concat_vec (o : bits 1) (concat_vec (r : bits 1) (w : bits 1)))) + : mword (1 + (1 + (1 + 1)))) + | _ => exit tt : M (mword 4) + end) + : M (mword 4). + +Definition fence_bits_forwards_matches (arg_ : mword 4) +: bool := + + match arg_ with | v__1 => true end. + +Definition _s735_ (_s736_ : string) +: M (option ((mword 1 * mword 1 * mword 1 * mword 1))) := + + (match _s736_ with + | _s737_ => + (bit_maybe_i_matches_prefix _s737_) >>= fun w__0 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (i,(existT _ _s738_ _)) => + (match (string_drop _s737_ _s738_) with + | _s739_ => + (bit_maybe_o_matches_prefix _s739_) >>= fun w__1 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (o,(existT _ _s740_ _)) => + (match (string_drop _s739_ _s740_) with + | _s741_ => + (bit_maybe_r_matches_prefix _s741_) >>= fun w__2 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (r,(existT _ _s742_ _)) => + (match (string_drop _s741_ _s742_) with + | _s743_ => + (bit_maybe_w_matches_prefix _s743_) >>= fun w__3 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (w,(existT _ _s744_ _)) => + let p0_ := string_drop _s743_ _s744_ in + if ((generic_eq p0_ "")) then Some ((i, o, r, w)) + else None + | _ => None + end) + : option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + | _ => returnm (None : option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + | _ => returnm (None : option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + | _ => returnm (None : option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1))). + +Definition fence_bits_backwards_matches (arg_ : string) +: M (bool) := + + let _s745_ := arg_ in + (_s735_ _s745_) >>= fun w__0 : option ((mword 1 * mword 1 * mword 1 * mword 1)) => + (if ((match w__0 with | Some (i,o,r,w) => true | _ => false end)) then + (_s735_ _s745_) >>= fun w__1 : option ((mword 1 * mword 1 * mword 1 * mword 1)) => + (match w__1 with | Some (i,o,r,w) => returnm (true : bool) | _ => exit tt : M (bool) end) + : M (bool) + else returnm (false : bool)) + : M (bool). + +Definition _s746_ (_s747_ : string) +: M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) := + + (match _s747_ with + | _s748_ => + (bit_maybe_i_matches_prefix _s748_) >>= fun w__0 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (i,(existT _ _s749_ _)) => + (match (string_drop _s748_ _s749_) with + | _s750_ => + (bit_maybe_o_matches_prefix _s750_) >>= fun w__1 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (o,(existT _ _s751_ _)) => + (match (string_drop _s750_ _s751_) with + | _s752_ => + (bit_maybe_r_matches_prefix _s752_) >>= fun w__2 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (r,(existT _ _s753_ _)) => + (match (string_drop _s752_ _s753_) with + | _s754_ => + (bit_maybe_w_matches_prefix _s754_) >>= fun w__3 : option ((mword 1 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (w,(existT _ _s755_ _)) => + match (string_drop _s754_ _s755_) with + | s_ => Some ((i, o, r, w, s_)) + end + | _ => None + end) + : option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + | _ => + returnm (None + : option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + | _ => returnm (None : option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + | _ => returnm (None : option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) + end) + : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))). + +Definition fence_bits_matches_prefix (arg_ : string) +: M (option ((mword 4 * {n : Z & ArithFact (n >= 0)}))) := + + let _s756_ := arg_ in + (_s746_ _s756_) >>= fun w__0 : option ((mword 1 * mword 1 * mword 1 * mword 1 * string)) => + (if ((match w__0 with | Some (i,o,r,w,s_) => true | _ => false end)) then + (_s746_ _s756_) >>= fun w__1 : option ((mword 1 * mword 1 * mword 1 * mword 1 * string)) => + (match w__1 with + | Some (i,o,r,w,s_) => + returnm ((Some + ((concat_vec (i : bits 1) + (concat_vec (o : bits 1) (concat_vec (r : bits 1) (w : bits 1))), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((mword 4 * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((mword 4 * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((mword 4 * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((mword 4 * {n : Z & ArithFact (n >= 0)})))) + : M (option ((mword 4 * {n : Z & ArithFact (n >= 0)}))). + +Definition aqrl_str (aq : bool) (rl : bool) +: string := + + match (aq, rl) with + | (false, false) => "" + | (false, true) => ".rl" + | (true, false) => ".aq" + | (true, true) => ".aqrl" + end. + +Definition lrsc_width_str (width : word_width) +: string := + + match width with | BYTE => ".b" | HALF => ".h" | WORD => ".w" | DOUBLE => ".d" end. + +Definition process_loadres {n : Z} +(rd : mword 5) (addr : mword 64) (value : MemoryOpResult (mword (8 * n))) (is_unsigned : bool) +`{ArithFact ((0 + 1) <= n /\ n <= 8)} +: M (bool) := + + (match (extend_value is_unsigned value) with + | MemValue (result) => + let '_ := (load_reservation addr) : unit in + (wX (projT1 (regbits_to_regno rd)) result) >> returnm (true : bool) + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + end) + : M (bool). + +Definition encdec_amoop_forwards (arg_ : amoop) +: mword 5 := + + match arg_ with + | AMOSWAP => (vec_of_bits [B0;B0;B0;B0;B1] : mword 5) + | AMOADD => (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + | AMOXOR => (vec_of_bits [B0;B0;B1;B0;B0] : mword 5) + | AMOAND => (vec_of_bits [B0;B1;B1;B0;B0] : mword 5) + | AMOOR => (vec_of_bits [B0;B1;B0;B0;B0] : mword 5) + | AMOMIN => (vec_of_bits [B1;B0;B0;B0;B0] : mword 5) + | AMOMAX => (vec_of_bits [B1;B0;B1;B0;B0] : mword 5) + | AMOMINU => (vec_of_bits [B1;B1;B0;B0;B0] : mword 5) + | AMOMAXU => (vec_of_bits [B1;B1;B1;B0;B0] : mword 5) + end. + +Definition encdec_amoop_backwards (arg_ : mword 5) +: amoop := + + let b__0 := arg_ in + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B1] : mword 5))))) + then + AMOSWAP + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B0] : mword 5))))) + then + AMOADD + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B0;B0] : mword 5))))) + then + AMOXOR + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B0;B0] : mword 5))))) + then + AMOAND + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B0;B0] : mword 5))))) + then + AMOOR + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B0;B0] : mword 5))))) + then + AMOMIN + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B0;B0] : mword 5))))) + then + AMOMAX + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B0;B0] : mword 5))))) + then + AMOMINU + else AMOMAXU. + +Definition encdec_amoop_forwards_matches (arg_ : amoop) +: bool := + + match arg_ with + | AMOSWAP => true + | AMOADD => true + | AMOXOR => true + | AMOAND => true + | AMOOR => true + | AMOMIN => true + | AMOMAX => true + | AMOMINU => true + | AMOMAXU => true + end. + +Definition encdec_amoop_backwards_matches (arg_ : mword 5) +: bool := + + let b__0 := arg_ in + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B1] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B0;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B0;B1;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B1;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B0;B1;B0;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B0;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B0;B1;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B0;B0;B0] : mword 5))))) + then + true + else if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno b__0)) + (projT1 (regbits_to_regno (vec_of_bits [B1;B1;B1;B0;B0] : mword 5))))) + then + true + else false. + +Definition amo_mnemonic_forwards (arg_ : amoop) +: string := + + match arg_ with + | AMOSWAP => "amoswap" + | AMOADD => "amoadd" + | AMOXOR => "amoxor" + | AMOAND => "amoand" + | AMOOR => "amoor" + | AMOMIN => "amomin" + | AMOMAX => "amomax" + | AMOMINU => "amominu" + | AMOMAXU => "amomaxu" + end. + +Definition amo_mnemonic_backwards (arg_ : string) +: amoop := + + let p0_ := arg_ in + if ((generic_eq p0_ "amoswap")) then AMOSWAP + else if ((generic_eq p0_ "amoadd")) then AMOADD + else if ((generic_eq p0_ "amoxor")) then AMOXOR + else if ((generic_eq p0_ "amoand")) then AMOAND + else if ((generic_eq p0_ "amoor")) then AMOOR + else if ((generic_eq p0_ "amomin")) then AMOMIN + else if ((generic_eq p0_ "amomax")) then AMOMAX + else if ((generic_eq p0_ "amominu")) then AMOMINU + else AMOMAXU. + +Definition amo_mnemonic_forwards_matches (arg_ : amoop) +: bool := + + match arg_ with + | AMOSWAP => true + | AMOADD => true + | AMOXOR => true + | AMOAND => true + | AMOOR => true + | AMOMIN => true + | AMOMAX => true + | AMOMINU => true + | AMOMAXU => true + end. + +Definition amo_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "amoswap")) then true + else if ((generic_eq p0_ "amoadd")) then true + else if ((generic_eq p0_ "amoxor")) then true + else if ((generic_eq p0_ "amoand")) then true + else if ((generic_eq p0_ "amoor")) then true + else if ((generic_eq p0_ "amomin")) then true + else if ((generic_eq p0_ "amomax")) then true + else if ((generic_eq p0_ "amominu")) then true + else if ((generic_eq p0_ "amomaxu")) then true + else false. + +Definition _s789_ (_s790_ : string) +: option string := + + let _s791_ := _s790_ in + if ((string_startswith _s791_ "amomaxu")) then + match (string_drop _s791_ (projT1 (string_length "amomaxu"))) with | s_ => Some (s_) end + else None. + +Definition _s785_ (_s786_ : string) +: option string := + + let _s787_ := _s786_ in + if ((string_startswith _s787_ "amominu")) then + match (string_drop _s787_ (projT1 (string_length "amominu"))) with | s_ => Some (s_) end + else None. + +Definition _s781_ (_s782_ : string) +: option string := + + let _s783_ := _s782_ in + if ((string_startswith _s783_ "amomax")) then + match (string_drop _s783_ (projT1 (string_length "amomax"))) with | s_ => Some (s_) end + else None. + +Definition _s777_ (_s778_ : string) +: option string := + + let _s779_ := _s778_ in + if ((string_startswith _s779_ "amomin")) then + match (string_drop _s779_ (projT1 (string_length "amomin"))) with | s_ => Some (s_) end + else None. + +Definition _s773_ (_s774_ : string) +: option string := + + let _s775_ := _s774_ in + if ((string_startswith _s775_ "amoor")) then + match (string_drop _s775_ (projT1 (string_length "amoor"))) with | s_ => Some (s_) end + else None. + +Definition _s769_ (_s770_ : string) +: option string := + + let _s771_ := _s770_ in + if ((string_startswith _s771_ "amoand")) then + match (string_drop _s771_ (projT1 (string_length "amoand"))) with | s_ => Some (s_) end + else None. + +Definition _s765_ (_s766_ : string) +: option string := + + let _s767_ := _s766_ in + if ((string_startswith _s767_ "amoxor")) then + match (string_drop _s767_ (projT1 (string_length "amoxor"))) with | s_ => Some (s_) end + else None. + +Definition _s761_ (_s762_ : string) +: option string := + + let _s763_ := _s762_ in + if ((string_startswith _s763_ "amoadd")) then + match (string_drop _s763_ (projT1 (string_length "amoadd"))) with | s_ => Some (s_) end + else None. + +Definition _s757_ (_s758_ : string) +: option string := + + let _s759_ := _s758_ in + if ((string_startswith _s759_ "amoswap")) then + match (string_drop _s759_ (projT1 (string_length "amoswap"))) with | s_ => Some (s_) end + else None. + +Definition amo_mnemonic_matches_prefix (arg_ : string) +: M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) := + + let _s760_ := arg_ in + (if ((match (_s757_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s757_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOSWAP, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s761_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s761_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOADD, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s765_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s765_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOXOR, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s769_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s769_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOAND, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s773_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s773_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOOR, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s777_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s777_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOMIN, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s781_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s781_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOMAX, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s785_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s785_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOMINU, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s789_ _s760_) with | Some (s_) => true | _ => false end)) then + (match (_s789_ _s760_) with + | Some (s_) => + returnm ((Some + ((AMOMAXU, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((amoop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((amoop * {n : Z & ArithFact (n >= 0)})))) + : M (option ((amoop * {n : Z & ArithFact (n >= 0)}))). + +Definition encdec_csrop_forwards (arg_ : csrop) +: mword 2 := + + match arg_ with + | CSRRW => (vec_of_bits [B0;B1] : mword 2) + | CSRRS => (vec_of_bits [B1;B0] : mword 2) + | CSRRC => (vec_of_bits [B1;B1] : mword 2) + end. + +Definition encdec_csrop_backwards (arg_ : mword 2) +: csrop := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B1] : mword 2))) then CSRRW + else if ((eq_vec b__0 (vec_of_bits [B1;B0] : mword 2))) then CSRRS + else CSRRC. + +Definition encdec_csrop_forwards_matches (arg_ : csrop) +: bool := + + match arg_ with | CSRRW => true | CSRRS => true | CSRRC => true end. + +Definition encdec_csrop_backwards_matches (arg_ : mword 2) +: bool := + + let b__0 := arg_ in + if ((eq_vec b__0 (vec_of_bits [B0;B1] : mword 2))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B0] : mword 2))) then true + else if ((eq_vec b__0 (vec_of_bits [B1;B1] : mword 2))) then true + else false. + +Definition readCSR (csr : mword 12) +: M (mword 64) := + + let b__0 := csr in + (if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B0;B1] : mword 12))) then + ((read_reg mvendorid_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B0] : mword 12))) then + ((read_reg marchid_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B0;B1;B1] : mword 12))) then + ((read_reg mimpid_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B1;B1;B0;B0;B0;B1;B0;B1;B0;B0] : mword 12))) then + ((read_reg mhartid_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + read_reg mstatus_ref >>= fun w__4 : Mstatus => returnm ((_get_Mstatus_bits w__4) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + read_reg misa_ref >>= fun w__5 : Misa => returnm ((_get_Misa_bits w__5) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + read_reg medeleg_ref >>= fun w__6 : Medeleg => returnm ((_get_Medeleg_bits w__6) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + read_reg mideleg_ref >>= fun w__7 : Minterrupts => + returnm ((_get_Minterrupts_bits w__7) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + read_reg mie_ref >>= fun w__8 : Minterrupts => + returnm ((_get_Minterrupts_bits w__8) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + read_reg mtvec_ref >>= fun w__9 : Mtvec => returnm ((_get_Mtvec_bits w__9) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + read_reg mcounteren_ref >>= fun w__10 : Counteren => + returnm ((EXTZ 64 (_get_Counteren_bits w__10)) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + ((read_reg mscratch_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + ((read_reg mepc_ref) : M (mword 64)) >>= fun w__12 : xlenbits => + (pc_alignment_mask tt) >>= fun w__13 : mword 64 => returnm ((and_vec w__12 w__13) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + read_reg mcause_ref >>= fun w__14 : Mcause => returnm ((_get_Mcause_bits w__14) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + ((read_reg mtval_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + read_reg mip_ref >>= fun w__16 : Minterrupts => + returnm ((_get_Minterrupts_bits w__16) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + ((read_reg pmpcfg0_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B0] : mword 12))) then + ((read_reg pmpaddr0_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + read_reg mstatus_ref >>= fun w__19 : Mstatus => + returnm ((_get_Sstatus_bits (lower_mstatus w__19)) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + read_reg sedeleg_ref >>= fun w__20 : Sedeleg => + returnm ((_get_Sedeleg_bits w__20) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + read_reg sideleg_ref >>= fun w__21 : Sinterrupts => + returnm ((_get_Sinterrupts_bits w__21) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + read_reg mie_ref >>= fun w__22 : Minterrupts => + read_reg mideleg_ref >>= fun w__23 : Minterrupts => + returnm ((_get_Sinterrupts_bits (lower_mie w__22 w__23)) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + read_reg stvec_ref >>= fun w__24 : Mtvec => returnm ((_get_Mtvec_bits w__24) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + read_reg scounteren_ref >>= fun w__25 : Counteren => + returnm ((EXTZ 64 (_get_Counteren_bits w__25)) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + ((read_reg sscratch_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + ((read_reg sepc_ref) : M (mword 64)) >>= fun w__27 : xlenbits => + (pc_alignment_mask tt) >>= fun w__28 : mword 64 => returnm ((and_vec w__27 w__28) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + read_reg scause_ref >>= fun w__29 : Mcause => returnm ((_get_Mcause_bits w__29) : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + ((read_reg stval_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + read_reg mip_ref >>= fun w__31 : Minterrupts => + read_reg mideleg_ref >>= fun w__32 : Minterrupts => + returnm ((_get_Sinterrupts_bits (lower_mip w__31 w__32)) + : mword 64) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + ((read_reg satp_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + ((read_reg mcycle_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + ((read_reg mtime_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + ((read_reg minstret_ref) : M (mword 64)) + : M (xlenbits) + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + ((read_reg tselect_ref) : M (mword 64)) >>= fun w__37 : xlenbits => + returnm ((not_vec w__37) + : mword 64) + else + let '_ := (print_bits "unhandled read to CSR " csr) : unit in + returnm ((vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) + : mword 64)) >>= fun res : xlenbits => + let '_ := + (print_endline + (String.append "CSR " + (String.append ((csr_name csr) : string) (String.append " -> " (string_of_bits res))))) + : unit in + returnm (res + : mword 64). + +Definition writeCSR (csr : mword 12) (value : mword 64) +: M (unit) := + + let b__0 := csr in + (if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + read_reg mstatus_ref >>= fun w__0 : Mstatus => + write_reg mstatus_ref (legalize_mstatus w__0 value) >> + read_reg mstatus_ref >>= fun w__1 : Mstatus => + returnm ((Some + (_get_Mstatus_bits w__1)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12))) then + read_reg misa_ref >>= fun w__2 : Misa => + (legalize_misa w__2 value) >>= fun w__3 : Misa => + write_reg misa_ref w__3 >> + read_reg misa_ref >>= fun w__4 : Misa => + returnm ((Some + (_get_Misa_bits w__4)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + read_reg medeleg_ref >>= fun w__5 : Medeleg => + write_reg medeleg_ref (legalize_medeleg w__5 value) >> + read_reg medeleg_ref >>= fun w__6 : Medeleg => + returnm ((Some + (_get_Medeleg_bits w__6)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + read_reg mideleg_ref >>= fun w__7 : Minterrupts => + write_reg mideleg_ref (legalize_mideleg w__7 value) >> + read_reg mideleg_ref >>= fun w__8 : Minterrupts => + returnm ((Some + (_get_Minterrupts_bits w__8)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + read_reg mie_ref >>= fun w__9 : Minterrupts => + write_reg mie_ref (legalize_mie w__9 value) >> + read_reg mie_ref >>= fun w__10 : Minterrupts => + returnm ((Some + (_get_Minterrupts_bits w__10)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + read_reg mtvec_ref >>= fun w__11 : Mtvec => + write_reg mtvec_ref (legalize_tvec w__11 value) >> + read_reg mtvec_ref >>= fun w__12 : Mtvec => + returnm ((Some + (_get_Mtvec_bits w__12)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + read_reg mcounteren_ref >>= fun w__13 : Counteren => + (legalize_mcounteren w__13 value) >>= fun w__14 : Counteren => + write_reg mcounteren_ref w__14 >> + read_reg mcounteren_ref >>= fun w__15 : Counteren => + returnm ((Some + (EXTZ 64 (_get_Counteren_bits w__15))) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + write_reg mscratch_ref value >> + ((read_reg mscratch_ref) : M (mword 64)) >>= fun w__16 : xlenbits => + returnm ((Some + (w__16)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + (legalize_xepc value) >>= fun w__17 : mword 64 => + write_reg mepc_ref w__17 >> + ((read_reg mepc_ref) : M (mword 64)) >>= fun w__18 : xlenbits => + returnm ((Some + (w__18)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + (_set_Mcause_bits mcause_ref value) >> + read_reg mcause_ref >>= fun w__19 : Mcause => + returnm ((Some + (_get_Mcause_bits w__19)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + write_reg mtval_ref value >> + ((read_reg mtval_ref) : M (mword 64)) >>= fun w__20 : xlenbits => + returnm ((Some + (w__20)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + read_reg mip_ref >>= fun w__21 : Minterrupts => + write_reg mip_ref (legalize_mip w__21 value) >> + read_reg mip_ref >>= fun w__22 : Minterrupts => + returnm ((Some + (_get_Minterrupts_bits w__22)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + write_reg pmpcfg0_ref value >> + ((read_reg pmpcfg0_ref) : M (mword 64)) >>= fun w__23 : xlenbits => + returnm ((Some + (w__23)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B1;B1;B1;B0;B1;B1;B0;B0;B0;B0] : mword 12))) then + write_reg pmpaddr0_ref value >> + ((read_reg pmpaddr0_ref) : M (mword 64)) >>= fun w__24 : xlenbits => + returnm ((Some + (w__24)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + read_reg mstatus_ref >>= fun w__25 : Mstatus => + write_reg mstatus_ref (legalize_sstatus w__25 value) >> + read_reg mstatus_ref >>= fun w__26 : Mstatus => + returnm ((Some + (_get_Mstatus_bits w__26)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + read_reg sedeleg_ref >>= fun w__27 : Sedeleg => + write_reg sedeleg_ref (legalize_sedeleg w__27 value) >> + read_reg sedeleg_ref >>= fun w__28 : Sedeleg => + returnm ((Some + (_get_Sedeleg_bits w__28)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B1] : mword 12))) then + (_set_Sinterrupts_bits sideleg_ref value) >> + read_reg sideleg_ref >>= fun w__29 : Sinterrupts => + returnm ((Some + (_get_Sinterrupts_bits w__29)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B0] : mword 12))) then + read_reg mie_ref >>= fun w__30 : Minterrupts => + read_reg mideleg_ref >>= fun w__31 : Minterrupts => + write_reg mie_ref (legalize_sie w__30 w__31 value) >> + read_reg mie_ref >>= fun w__32 : Minterrupts => + returnm ((Some + (_get_Minterrupts_bits w__32)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12))) then + read_reg stvec_ref >>= fun w__33 : Mtvec => + write_reg stvec_ref (legalize_tvec w__33 value) >> + read_reg stvec_ref >>= fun w__34 : Mtvec => + returnm ((Some + (_get_Mtvec_bits w__34)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B1;B0] : mword 12))) then + read_reg scounteren_ref >>= fun w__35 : Counteren => + (legalize_scounteren w__35 value) >>= fun w__36 : Counteren => + write_reg scounteren_ref w__36 >> + read_reg scounteren_ref >>= fun w__37 : Counteren => + returnm ((Some + (EXTZ 64 (_get_Counteren_bits w__37))) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0] : mword 12))) then + write_reg sscratch_ref value >> + ((read_reg sscratch_ref) : M (mword 64)) >>= fun w__38 : xlenbits => + returnm ((Some + (w__38)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B1] : mword 12))) then + (legalize_xepc value) >>= fun w__39 : mword 64 => + write_reg sepc_ref w__39 >> + ((read_reg sepc_ref) : M (mword 64)) >>= fun w__40 : xlenbits => + returnm ((Some + (w__40)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B0] : mword 12))) then + (_set_Mcause_bits scause_ref value) >> + read_reg scause_ref >>= fun w__41 : Mcause => + returnm ((Some + (_get_Mcause_bits w__41)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B1;B1] : mword 12))) then + write_reg stval_ref value >> + ((read_reg stval_ref) : M (mword 64)) >>= fun w__42 : xlenbits => + returnm ((Some + (w__42)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B0;B1;B0;B0;B0;B1;B0;B0] : mword 12))) then + read_reg mip_ref >>= fun w__43 : Minterrupts => + read_reg mideleg_ref >>= fun w__44 : Minterrupts => + write_reg mip_ref (legalize_sip w__43 w__44 value) >> + read_reg mip_ref >>= fun w__45 : Minterrupts => + returnm ((Some + (_get_Minterrupts_bits w__45)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + (cur_Architecture tt) >>= fun w__46 : Architecture => + ((read_reg satp_ref) : M (mword 64)) >>= fun w__47 : xlenbits => + write_reg satp_ref (legalize_satp w__46 w__47 value) >> + ((read_reg satp_ref) : M (mword 64)) >>= fun w__48 : xlenbits => + returnm ((Some + (w__48)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B0;B1;B1;B1;B1;B0;B1;B0;B0;B0;B0;B0] : mword 12))) then + write_reg tselect_ref value >> + ((read_reg tselect_ref) : M (mword 64)) >>= fun w__49 : xlenbits => + returnm ((Some + (w__49)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12))) then + write_reg mcycle_ref value >> + ((read_reg mcycle_ref) : M (mword 64)) >>= fun w__50 : xlenbits => + returnm ((Some + (w__50)) + : option (mword 64)) + else if ((eq_vec b__0 (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 12))) then + write_reg minstret_ref value >> + write_reg minstret_written_ref true >> + ((read_reg minstret_ref) : M (mword 64)) >>= fun w__51 : xlenbits => + returnm ((Some + (w__51)) + : option (mword 64)) + else returnm (None : option (mword 64))) >>= fun res : option xlenbits => + returnm ((match res with + | Some (v) => + print_endline + (String.append "CSR " + (String.append ((csr_name csr) : string) + (String.append " <- " + (String.append (string_of_bits v) + (String.append " (input: " (String.append (string_of_bits value) ")")))))) + | None => print_bits "unhandled write to CSR " csr + end) + : unit). + +Definition maybe_i_forwards (arg_ : bool) +: string := + + match arg_ with | true => "i" | false => "" end. + +Definition maybe_i_backwards (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "i")) then true + else false. + +Definition maybe_i_forwards_matches (arg_ : bool) +: bool := + + match arg_ with | true => true | false => true end. + +Definition maybe_i_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "i")) then true + else if ((generic_eq p0_ "")) then true + else false. + +Definition _s797_ (_s798_ : string) +: option string := + + let _s799_ := _s798_ in + if ((string_startswith _s799_ "")) then + match (string_drop _s799_ (projT1 (string_length ""))) with | s_ => Some (s_) end + else None. + +Definition _s793_ (_s794_ : string) +: option string := + + let _s795_ := _s794_ in + if ((string_startswith _s795_ "i")) then + match (string_drop _s795_ (projT1 (string_length "i"))) with | s_ => Some (s_) end + else None. + +Definition maybe_i_matches_prefix (arg_ : string) +: M (option ((bool * {n : Z & ArithFact (n >= 0)}))) := + + let _s796_ := arg_ in + (if ((match (_s793_ _s796_) with | Some (s_) => true | _ => false end)) then + (match (_s793_ _s796_) with + | Some (s_) => + returnm ((Some + ((true, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s797_ _s796_) with | Some (s_) => true | _ => false end)) then + (match (_s797_ _s796_) with + | Some (s_) => + returnm ((Some + ((false, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((bool * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((bool * {n : Z & ArithFact (n >= 0)})))) + : M (option ((bool * {n : Z & ArithFact (n >= 0)}))). + +Definition csr_mnemonic_forwards (arg_ : csrop) +: string := + + match arg_ with | CSRRW => "csrrw" | CSRRS => "csrrs" | CSRRC => "csrrc" end. + +Definition csr_mnemonic_backwards (arg_ : string) +: csrop := + + let p0_ := arg_ in + if ((generic_eq p0_ "csrrw")) then CSRRW + else if ((generic_eq p0_ "csrrs")) then CSRRS + else CSRRC. + +Definition csr_mnemonic_forwards_matches (arg_ : csrop) +: bool := + + match arg_ with | CSRRW => true | CSRRS => true | CSRRC => true end. + +Definition csr_mnemonic_backwards_matches (arg_ : string) +: bool := + + let p0_ := arg_ in + if ((generic_eq p0_ "csrrw")) then true + else if ((generic_eq p0_ "csrrs")) then true + else if ((generic_eq p0_ "csrrc")) then true + else false. + +Definition _s809_ (_s810_ : string) +: option string := + + let _s811_ := _s810_ in + if ((string_startswith _s811_ "csrrc")) then + match (string_drop _s811_ (projT1 (string_length "csrrc"))) with | s_ => Some (s_) end + else None. + +Definition _s805_ (_s806_ : string) +: option string := + + let _s807_ := _s806_ in + if ((string_startswith _s807_ "csrrs")) then + match (string_drop _s807_ (projT1 (string_length "csrrs"))) with | s_ => Some (s_) end + else None. + +Definition _s801_ (_s802_ : string) +: option string := + + let _s803_ := _s802_ in + if ((string_startswith _s803_ "csrrw")) then + match (string_drop _s803_ (projT1 (string_length "csrrw"))) with | s_ => Some (s_) end + else None. + +Definition csr_mnemonic_matches_prefix (arg_ : string) +: M (option ((csrop * {n : Z & ArithFact (n >= 0)}))) := + + let _s804_ := arg_ in + (if ((match (_s801_ _s804_) with | Some (s_) => true | _ => false end)) then + (match (_s801_ _s804_) with + | Some (s_) => + returnm ((Some + ((CSRRW, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((csrop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((csrop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((csrop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s805_ _s804_) with | Some (s_) => true | _ => false end)) then + (match (_s805_ _s804_) with + | Some (s_) => + returnm ((Some + ((CSRRS, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((csrop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((csrop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((csrop * {n : Z & ArithFact (n >= 0)}))) + else if ((match (_s809_ _s804_) with | Some (s_) => true | _ => false end)) then + (match (_s809_ _s804_) with + | Some (s_) => + returnm ((Some + ((CSRRC, build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((csrop * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((csrop * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((csrop * {n : Z & ArithFact (n >= 0)}))) + else returnm (None : option ((csrop * {n : Z & ArithFact (n >= 0)})))) + : M (option ((csrop * {n : Z & ArithFact (n >= 0)}))). + +Definition encdec_forwards (arg_ : ast) +: M (mword 32) := + + (match arg_ with + | UTYPE (imm,rd,op) => + returnm ((concat_vec (imm : mword 20) (concat_vec (rd : mword 5) (encdec_uop_forwards op))) + : mword (20 + (5 + 7))) + | RISCV_JAL (v__2,rd) => + let imm_19 : bits 1 := subrange_vec_dec v__2 20 20 in + let imm_8 : bits 1 := subrange_vec_dec v__2 11 11 in + let imm_7_0 : bits 8 := subrange_vec_dec v__2 19 12 in + let imm_19 : bits 1 := subrange_vec_dec v__2 20 20 in + let imm_18_13 : bits 6 := subrange_vec_dec v__2 10 5 in + let imm_12_9 : bits 4 := subrange_vec_dec v__2 4 1 in + returnm ((concat_vec (imm_19 : bits 1) + (concat_vec (imm_18_13 : bits 6) + (concat_vec (imm_12_9 : bits 4) + (concat_vec (imm_8 : bits 1) + (concat_vec (imm_7_0 : bits 8) + (concat_vec (rd : mword 5) + (vec_of_bits [B1;B1;B0;B1;B1;B1;B1] : mword 7))))))) + : mword 32) + | RISCV_JALR (imm,rs1,rd) => + returnm ((concat_vec (imm : mword 12) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (rd : mword 5) (vec_of_bits [B1;B1;B0;B0;B1;B1;B1] : mword 7))))) + : mword (12 + (5 + (3 + (5 + 7))))) + | BTYPE (v__4,rs2,rs1,op) => + let imm7_6 : bits 1 := subrange_vec_dec v__4 12 12 in + let imm7_6 : bits 1 := subrange_vec_dec v__4 12 12 in + let imm7_5_0 : bits 6 := subrange_vec_dec v__4 10 5 in + let imm5_4_1 : bits 4 := subrange_vec_dec v__4 4 1 in + let imm5_0 : bits 1 := subrange_vec_dec v__4 11 11 in + returnm ((concat_vec (imm7_6 : bits 1) + (concat_vec (imm7_5_0 : bits 6) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (encdec_bop_forwards op) + (concat_vec (imm5_4_1 : bits 4) + (concat_vec (imm5_0 : bits 1) + (vec_of_bits [B1;B1;B0;B0;B0;B1;B1] : mword 7)))))))) + : mword 32) + | ITYPE (imm,rs1,rd,op) => + returnm ((concat_vec (imm : mword 12) + (concat_vec (rs1 : mword 5) + (concat_vec (encdec_iop_forwards op) + (concat_vec (rd : mword 5) (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword 7))))) + : mword (12 + (5 + (3 + (5 + 7))))) + | SHIFTIOP (shamt,rs1,rd,RISCV_SLLI) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword 6) + (concat_vec (shamt : mword 6) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (6 + (6 + (5 + (3 + (5 + 7)))))) + | SHIFTIOP (shamt,rs1,rd,RISCV_SRLI) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword 6) + (concat_vec (shamt : mword 6) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (6 + (6 + (5 + (3 + (5 + 7)))))) + | SHIFTIOP (shamt,rs1,rd,RISCV_SRAI) => + returnm ((concat_vec (vec_of_bits [B0;B1;B0;B0;B0;B0] : mword 6) + (concat_vec (shamt : mword 6) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (6 + (6 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_ADD) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_SUB) => + returnm ((concat_vec (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_SLL) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_SLT) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B1;B0] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_SLTU) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B1;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_XOR) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_SRL) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_SRA) => + returnm ((concat_vec (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_OR) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B1;B0] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPE (rs2,rs1,rd,RISCV_AND) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B1;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | LOAD (imm,rs1,rd,is_unsigned,size,false,false) => + returnm ((concat_vec (imm : mword 12) + (concat_vec (rs1 : mword 5) + (concat_vec (bool_bits_forwards is_unsigned) + (concat_vec (size_bits_forwards size) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B0;B0;B0;B1;B1] : mword 7)))))) + : mword (12 + (5 + (1 + (2 + (5 + 7)))))) + | STORE (v__6,rs2,rs1,size,false,false) => + let imm7 : bits 7 := subrange_vec_dec v__6 11 5 in + let imm7 : bits 7 := subrange_vec_dec v__6 11 5 in + let imm5 : bits 5 := subrange_vec_dec v__6 4 0 in + returnm ((concat_vec (imm7 : bits 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (size_bits_forwards size) + (concat_vec (imm5 : bits 5) + (vec_of_bits [B0;B1;B0;B0;B0;B1;B1] : mword 7))))))) + : mword 32) + | ADDIW (imm,rs1,rd) => + returnm ((concat_vec (imm : mword 12) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (rd : mword 5) (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword 7))))) + : mword (12 + (5 + (3 + (5 + 7))))) + | SHIFTW (shamt,rs1,rd,RISCV_SLLI) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (shamt : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | SHIFTW (shamt,rs1,rd,RISCV_SRLI) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (shamt : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | SHIFTW (shamt,rs1,rd,RISCV_SRAI) => + returnm ((concat_vec (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (shamt : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPEW (rs2,rs1,rd,RISCV_ADDW) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPEW (rs2,rs1,rd,RISCV_SUBW) => + returnm ((concat_vec (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPEW (rs2,rs1,rd,RISCV_SLLW) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPEW (rs2,rs1,rd,RISCV_SRLW) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | RTYPEW (rs2,rs1,rd,RISCV_SRAW) => + returnm ((concat_vec (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | SHIFTIWOP (shamt,rs1,rd,RISCV_SLLIW) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (shamt : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | SHIFTIWOP (shamt,rs1,rd,RISCV_SRLIW) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (shamt : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | SHIFTIWOP (shamt,rs1,rd,RISCV_SRAIW) => + returnm ((concat_vec (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword 7) + (concat_vec (shamt : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | MUL (rs2,rs1,rd,high,signed1,signed2) => + (encdec_mul_op_forwards (high, signed1, signed2)) >>= fun w__0 : mword 3 => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (w__0 : bits 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | DIV (rs2,rs1,rd,s) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0] : mword 2) + (concat_vec (bool_not_bits_forwards s) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7))))))) + : mword (7 + (5 + (5 + (2 + (1 + (5 + 7))))))) + | REM (rs2,rs1,rd,s) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (bool_not_bits_forwards s) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword 7))))))) + : mword (7 + (5 + (5 + (2 + (1 + (5 + 7))))))) + | MULW (rs2,rs1,rd) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | DIVW (rs2,rs1,rd,s) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B0] : mword 2) + (concat_vec (bool_not_bits_forwards s) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword 7))))))) + : mword (7 + (5 + (5 + (2 + (1 + (5 + 7))))))) + | REMW (rs2,rs1,rd,s) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (bool_not_bits_forwards s) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword 7))))))) + : mword (7 + (5 + (5 + (2 + (1 + (5 + 7))))))) + | FENCE (pred,succ) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0] : mword 4) + (concat_vec (pred : mword 4) + (concat_vec (succ : mword 4) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B0;B0;B0;B1;B1;B1;B1] : mword 7))))))) + : mword (4 + (4 + (4 + (5 + (3 + (5 + 7))))))) + | FENCE_TSO (pred,succ) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0;B0] : mword 4) + (concat_vec (pred : mword 4) + (concat_vec (succ : mword 4) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B0;B0;B0;B1;B1;B1;B1] : mword 7))))))) + : mword (4 + (4 + (4 + (5 + (3 + (5 + 7))))))) + | FENCEI (tt) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B1] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B0;B0;B0;B1;B1;B1;B1] : mword 7))))) + : mword (12 + (5 + (3 + (5 + 7))))) + | ECALL (tt) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword 7))))) + : mword (12 + (5 + (3 + (5 + 7))))) + | MRET (tt) => + returnm ((concat_vec (vec_of_bits [B0;B0;B1;B1;B0;B0;B0] : mword 7) + (concat_vec (vec_of_bits [B0;B0;B0;B1;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | SRET (tt) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B1;B0;B0;B0] : mword 7) + (concat_vec (vec_of_bits [B0;B0;B0;B1;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | EBREAK (tt) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 12) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword 7))))) + : mword (12 + (5 + (3 + (5 + 7))))) + | WFI (tt) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1] : mword 12) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword 7))))) + : mword (12 + (5 + (3 + (5 + 7))))) + | SFENCE_VMA (rs1,rs2) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B1;B0;B0;B1] : mword 7) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (7 + (5 + (5 + (3 + (5 + 7)))))) + | LOADRES (aq,rl,rs1,size,rd) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B1;B0] : mword 5) + (concat_vec (bool_bits_forwards aq) + (concat_vec (bool_bits_forwards rl) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (size_bits_forwards size) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword 7))))))))) + : mword (5 + (1 + (1 + (5 + (5 + (1 + (2 + (5 + 7))))))))) + | STORECON (aq,rl,rs2,rs1,size,rd) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0;B1;B1] : mword 5) + (concat_vec (bool_bits_forwards aq) + (concat_vec (bool_bits_forwards rl) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (size_bits_forwards size) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword 7))))))))) + : mword (5 + (1 + (1 + (5 + (5 + (1 + (2 + (5 + 7))))))))) + | AMO (op,aq,rl,rs2,rs1,size,rd) => + returnm ((concat_vec (encdec_amoop_forwards op) + (concat_vec (bool_bits_forwards aq) + (concat_vec (bool_bits_forwards rl) + (concat_vec (rs2 : mword 5) + (concat_vec (rs1 : mword 5) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (size_bits_forwards size) + (concat_vec (rd : mword 5) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword 7))))))))) + : mword (5 + (1 + (1 + (5 + (5 + (1 + (2 + (5 + 7))))))))) + | CSR (csr,rs1,rd,is_imm,op) => + returnm ((concat_vec (csr : mword 12) + (concat_vec (rs1 : mword 5) + (concat_vec (bool_bits_forwards is_imm) + (concat_vec (encdec_csrop_forwards op) + (concat_vec (rd : mword 5) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword 7)))))) + : mword (12 + (5 + (1 + (2 + (5 + 7)))))) + | STOP_FETCHING (tt) => + returnm ((concat_vec + (vec_of_bits [B1;B1;B1;B1;B1;B0;B1;B0;B1;B1;B0;B1;B1;B1;B1;B0] : mword 16) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] : mword 8) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (vec_of_bits [B0;B0] : mword 2) + (concat_vec (vec_of_bits [B0;B1;B0] : mword 3) + (vec_of_bits [B1;B1] : mword 2)))))) + : mword (16 + (8 + (1 + (2 + (3 + 2)))))) + | THREAD_START (tt) => + returnm ((concat_vec + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B1;B1;B0;B1;B1;B1;B1;B0] : mword 16) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] : mword 8) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (vec_of_bits [B0;B0] : mword 2) + (concat_vec (vec_of_bits [B0;B1;B0] : mword 3) + (vec_of_bits [B1;B1] : mword 2)))))) + : mword (16 + (8 + (1 + (2 + (3 + 2)))))) + | ILLEGAL (s) => returnm (s : mword 32) + | _ => exit tt : M (mword 32) + end) + : M (mword 32). + +Definition encdec_backwards (arg_ : mword 32) +: ast := + + let v__7 := arg_ in + if ((let _mappingpatterns_23_ : mword 7 := subrange_vec_dec v__7 6 0 in + andb (encdec_uop_backwards_matches _mappingpatterns_23_) + (if ((encdec_uop_backwards_matches _mappingpatterns_23_)) then + let op := encdec_uop_backwards _mappingpatterns_23_ in + true + else false))) then + let imm : mword 20 := subrange_vec_dec v__7 31 12 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let imm : mword 20 := subrange_vec_dec v__7 31 12 in + let _mappingpatterns_23_ : mword 7 := subrange_vec_dec v__7 6 0 in + let op := encdec_uop_backwards _mappingpatterns_23_ in + UTYPE + ((imm, rd, op)) + else if ((eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B1;B1;B0;B1;B1;B1;B1] : mword (6 - 0 + 1)))) then + let imm_19 : bits 1 := subrange_vec_dec v__7 31 31 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let imm_8 : bits 1 := subrange_vec_dec v__7 20 20 in + let imm_7_0 : bits 8 := subrange_vec_dec v__7 19 12 in + let imm_19 : bits 1 := subrange_vec_dec v__7 31 31 in + let imm_18_13 : bits 6 := subrange_vec_dec v__7 30 25 in + let imm_12_9 : bits 4 := subrange_vec_dec v__7 24 21 in + RISCV_JAL + ((concat_vec (imm_19 : bits 1) + (concat_vec (imm_7_0 : bits 8) + (concat_vec (imm_8 : bits 1) + (concat_vec (imm_18_13 : bits 6) + (concat_vec (imm_12_9 : bits 4) (vec_of_bits [B0] : mword 1))))), rd)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 14 12) (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B1;B1;B0;B0;B1;B1;B1] : mword (6 - 0 + 1))))) then + let imm : mword 12 := subrange_vec_dec v__7 31 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let imm : mword 12 := subrange_vec_dec v__7 31 20 in + RISCV_JALR + ((imm, rs1, rd)) + else if ((andb + (let _mappingpatterns_24_ : mword 3 := subrange_vec_dec v__7 14 12 in + andb (encdec_bop_backwards_matches _mappingpatterns_24_) + (if ((encdec_bop_backwards_matches _mappingpatterns_24_)) then + let op := encdec_bop_backwards _mappingpatterns_24_ in + true + else false)) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B1;B1;B0;B0;B0;B1;B1] : mword (6 - 0 + 1))))) then + let imm7_6 : bits 1 := subrange_vec_dec v__7 31 31 in + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let imm7_6 : bits 1 := subrange_vec_dec v__7 31 31 in + let imm7_5_0 : bits 6 := subrange_vec_dec v__7 30 25 in + let imm5_4_1 : bits 4 := subrange_vec_dec v__7 11 8 in + let imm5_0 : bits 1 := subrange_vec_dec v__7 7 7 in + let _mappingpatterns_24_ : mword 3 := subrange_vec_dec v__7 14 12 in + let op := encdec_bop_backwards _mappingpatterns_24_ in + BTYPE + ((concat_vec (imm7_6 : bits 1) + (concat_vec (imm5_0 : bits 1) + (concat_vec (imm7_5_0 : bits 6) + (concat_vec (imm5_4_1 : bits 4) (vec_of_bits [B0] : mword 1)))), rs2, rs1, op)) + else if ((andb + (let _mappingpatterns_25_ : mword 3 := subrange_vec_dec v__7 14 12 in + andb (encdec_iop_backwards_matches _mappingpatterns_25_) + (if ((encdec_iop_backwards_matches _mappingpatterns_25_)) then + let op := encdec_iop_backwards _mappingpatterns_25_ in + true + else false)) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword (6 - 0 + 1))))) then + let imm : mword 12 := subrange_vec_dec v__7 31 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let imm : mword 12 := subrange_vec_dec v__7 31 20 in + let _mappingpatterns_25_ : mword 3 := subrange_vec_dec v__7 14 12 in + let op := encdec_iop_backwards _mappingpatterns_25_ in + ITYPE + ((imm, rs1, rd, op)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 26) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (31 - 26 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 6 := subrange_vec_dec v__7 25 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTIOP + ((shamt, rs1, rd, RISCV_SLLI)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 26) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (31 - 26 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 6 := subrange_vec_dec v__7 25 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTIOP + ((shamt, rs1, rd, RISCV_SRLI)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 26) + (vec_of_bits [B0;B1;B0;B0;B0;B0] : mword (31 - 26 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 6 := subrange_vec_dec v__7 25 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTIOP + ((shamt, rs1, rd, RISCV_SRAI)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_ADD)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_SUB)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_SLL)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B1;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_SLT)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B1;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_SLTU)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_XOR)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_SRL)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_SRA)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B1;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_OR)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B1;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPE + ((rs2, rs1, rd, RISCV_AND)) + else if ((andb + (let _mappingpatterns_27_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_26_ : mword 1 := subrange_vec_dec v__7 14 14 in + andb (size_bits_backwards_matches _mappingpatterns_27_) + (if ((size_bits_backwards_matches _mappingpatterns_27_)) then + let size := size_bits_backwards _mappingpatterns_27_ in + andb (bool_bits_backwards_matches _mappingpatterns_26_) + (if ((bool_bits_backwards_matches _mappingpatterns_26_)) then + let is_unsigned := bool_bits_backwards _mappingpatterns_26_ in + orb (neq_vec (size_bits_forwards size) (vec_of_bits [B1;B1] : mword 2)) + (negb is_unsigned) + else false) + else false)) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B0;B0;B0;B1;B1] : mword (6 - 0 + 1))))) then + let imm : mword 12 := subrange_vec_dec v__7 31 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let imm : mword 12 := subrange_vec_dec v__7 31 20 in + let _mappingpatterns_27_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_26_ : mword 1 := subrange_vec_dec v__7 14 14 in + let size := size_bits_backwards _mappingpatterns_27_ in + let is_unsigned := bool_bits_backwards _mappingpatterns_26_ in + LOAD + ((imm, rs1, rd, is_unsigned, size, false, false)) + else if ((andb + (let _mappingpatterns_28_ : mword 2 := subrange_vec_dec v__7 13 12 in + andb (size_bits_backwards_matches _mappingpatterns_28_) + (if ((size_bits_backwards_matches _mappingpatterns_28_)) then + let size := size_bits_backwards _mappingpatterns_28_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__7 14 14) (vec_of_bits [B0] : mword (14 - 14 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B0;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let imm7 : bits 7 := subrange_vec_dec v__7 31 25 in + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let imm7 : bits 7 := subrange_vec_dec v__7 31 25 in + let imm5 : bits 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_28_ : mword 2 := subrange_vec_dec v__7 13 12 in + let size := size_bits_backwards _mappingpatterns_28_ in + STORE + ((concat_vec (imm7 : bits 7) (imm5 : bits 5), rs2, rs1, size, false, false)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 14 12) (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1))))) then + let imm : mword 12 := subrange_vec_dec v__7 31 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let imm : mword 12 := subrange_vec_dec v__7 31 20 in + ADDIW + ((imm, rs1, rd)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTW + ((shamt, rs1, rd, RISCV_SLLI)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTW + ((shamt, rs1, rd, RISCV_SRLI)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTW + ((shamt, rs1, rd, RISCV_SRAI)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPEW + ((rs2, rs1, rd, RISCV_ADDW)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPEW + ((rs2, rs1, rd, RISCV_SUBW)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPEW + ((rs2, rs1, rd, RISCV_SLLW)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPEW + ((rs2, rs1, rd, RISCV_SRLW)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + RTYPEW + ((rs2, rs1, rd, RISCV_SRAW)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTIWOP + ((shamt, rs1, rd, RISCV_SLLIW)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTIWOP + ((shamt, rs1, rd, RISCV_SRLIW)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let shamt : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + SHIFTIWOP + ((shamt, rs1, rd, RISCV_SRAIW)) + else if ((andb + (let _mappingpatterns_29_ : bits 3 := subrange_vec_dec v__7 14 12 in + andb (encdec_mul_op_backwards_matches _mappingpatterns_29_) + (if ((encdec_mul_op_backwards_matches _mappingpatterns_29_)) then + let '(high, signed1, signed2) := encdec_mul_op_backwards _mappingpatterns_29_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_29_ : bits 3 := subrange_vec_dec v__7 14 12 in + let '(high, signed1, signed2) := encdec_mul_op_backwards _mappingpatterns_29_ in + MUL + ((rs2, rs1, rd, high, signed1, signed2)) + else if ((andb + (let _mappingpatterns_30_ : mword 1 := subrange_vec_dec v__7 12 12 in + andb (bool_not_bits_backwards_matches _mappingpatterns_30_) + (if ((bool_not_bits_backwards_matches _mappingpatterns_30_)) then + let s := bool_not_bits_backwards _mappingpatterns_30_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 13) + (vec_of_bits [B1;B0] : mword (14 - 13 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1))))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_30_ : mword 1 := subrange_vec_dec v__7 12 12 in + let s := bool_not_bits_backwards _mappingpatterns_30_ in + DIV + ((rs2, rs1, rd, s)) + else if ((andb + (let _mappingpatterns_31_ : mword 1 := subrange_vec_dec v__7 12 12 in + andb (bool_not_bits_backwards_matches _mappingpatterns_31_) + (if ((bool_not_bits_backwards_matches _mappingpatterns_31_)) then + let s := bool_not_bits_backwards _mappingpatterns_31_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 13) + (vec_of_bits [B1;B1] : mword (14 - 13 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1))))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_31_ : mword 1 := subrange_vec_dec v__7 12 12 in + let s := bool_not_bits_backwards _mappingpatterns_31_ in + REM + ((rs2, rs1, rd, s)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + MULW + ((rs2, rs1, rd)) + else if ((andb + (let _mappingpatterns_32_ : mword 1 := subrange_vec_dec v__7 12 12 in + andb (bool_not_bits_backwards_matches _mappingpatterns_32_) + (if ((bool_not_bits_backwards_matches _mappingpatterns_32_)) then + let s := bool_not_bits_backwards _mappingpatterns_32_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 13) + (vec_of_bits [B1;B0] : mword (14 - 13 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1))))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_32_ : mword 1 := subrange_vec_dec v__7 12 12 in + let s := bool_not_bits_backwards _mappingpatterns_32_ in + DIVW + ((rs2, rs1, rd, s)) + else if ((andb + (let _mappingpatterns_33_ : mword 1 := subrange_vec_dec v__7 12 12 in + andb (bool_not_bits_backwards_matches _mappingpatterns_33_) + (if ((bool_not_bits_backwards_matches _mappingpatterns_33_)) then + let s := bool_not_bits_backwards _mappingpatterns_33_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__7 14 13) + (vec_of_bits [B1;B1] : mword (14 - 13 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1))))))) then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_33_ : mword 1 := subrange_vec_dec v__7 12 12 in + let s := bool_not_bits_backwards _mappingpatterns_33_ in + REMW + ((rs2, rs1, rd, s)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 28) + (vec_of_bits [B0;B0;B0;B0] : mword (31 - 28 + 1))) + (eq_vec (subrange_vec_dec v__7 19 0) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1;B1;B1] + : mword (19 - 0 + 1))))) then + let succ : mword 4 := subrange_vec_dec v__7 23 20 in + let pred : mword 4 := subrange_vec_dec v__7 27 24 in + FENCE + ((pred, succ)) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 28) + (vec_of_bits [B1;B0;B0;B0] : mword (31 - 28 + 1))) + (eq_vec (subrange_vec_dec v__7 19 0) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1;B1;B1] + : mword (19 - 0 + 1))))) then + let succ : mword 4 := subrange_vec_dec v__7 23 20 in + let pred : mword 4 := subrange_vec_dec v__7 27 24 in + FENCE_TSO + ((pred, succ)) + else if ((eq_vec v__7 + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0; + B0;B0;B0;B0;B0;B0;B0;B1;B1;B1;B1] + : mword 32))) then + FENCEI + (tt) + else if ((eq_vec v__7 + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + ECALL + (tt) + else if ((eq_vec v__7 + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + MRET + (tt) + else if ((eq_vec v__7 + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + SRET + (tt) + else if ((eq_vec v__7 + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + EBREAK + (tt) + else if ((eq_vec v__7 + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + WFI + (tt) + else if ((andb + (eq_vec (subrange_vec_dec v__7 31 25) + (vec_of_bits [B0;B0;B0;B1;B0;B0;B1] : mword (31 - 25 + 1))) + (eq_vec (subrange_vec_dec v__7 14 0) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] : mword (14 - 0 + 1))))) + then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + SFENCE_VMA + ((rs1, rs2)) + else if sumbool_of_bool ((andb + (let _mappingpatterns_36_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_35_ : mword 1 := subrange_vec_dec v__7 25 25 in + let _mappingpatterns_34_ : mword 1 := subrange_vec_dec v__7 26 26 in + andb (size_bits_backwards_matches _mappingpatterns_36_) + (if ((size_bits_backwards_matches _mappingpatterns_36_)) then + let size := size_bits_backwards _mappingpatterns_36_ in + andb (bool_bits_backwards_matches _mappingpatterns_35_) + (if ((bool_bits_backwards_matches _mappingpatterns_35_)) then + let rl := bool_bits_backwards _mappingpatterns_35_ in + andb (bool_bits_backwards_matches _mappingpatterns_34_) + (if ((bool_bits_backwards_matches _mappingpatterns_34_)) + then + let aq := bool_bits_backwards _mappingpatterns_34_ in + true + else false) + else false) + else false)) + (andb + (Z.eqb (projT1 (regbits_to_regno (subrange_vec_dec v__7 31 27))) + (projT1 (regbits_to_regno + (vec_of_bits [B0;B0;B0;B1;B0] : mword 5)))) + (andb + (Z.eqb + (projT1 (regbits_to_regno (subrange_vec_dec v__7 24 20))) + (projT1 (regbits_to_regno + (vec_of_bits [B0;B0;B0;B0;B0] : mword 5)))) + (andb + (eq_vec (subrange_vec_dec v__7 14 14) + (vec_of_bits [B0] : mword (14 - 14 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword (6 - 0 + 1)))))))) + then + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_36_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_35_ : mword 1 := subrange_vec_dec v__7 25 25 in + let _mappingpatterns_34_ : mword 1 := subrange_vec_dec v__7 26 26 in + let size := size_bits_backwards _mappingpatterns_36_ in + let rl := bool_bits_backwards _mappingpatterns_35_ in + let aq := bool_bits_backwards _mappingpatterns_34_ in + LOADRES + ((aq, rl, rs1, size, rd)) + else if sumbool_of_bool ((andb + (let _mappingpatterns_39_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_38_ : mword 1 := subrange_vec_dec v__7 25 25 in + let _mappingpatterns_37_ : mword 1 := subrange_vec_dec v__7 26 26 in + andb (size_bits_backwards_matches _mappingpatterns_39_) + (if ((size_bits_backwards_matches _mappingpatterns_39_)) then + let size := size_bits_backwards _mappingpatterns_39_ in + andb (bool_bits_backwards_matches _mappingpatterns_38_) + (if ((bool_bits_backwards_matches _mappingpatterns_38_)) then + let rl := bool_bits_backwards _mappingpatterns_38_ in + andb (bool_bits_backwards_matches _mappingpatterns_37_) + (if ((bool_bits_backwards_matches _mappingpatterns_37_)) + then + let aq := bool_bits_backwards _mappingpatterns_37_ in + true + else false) + else false) + else false)) + (andb + (Z.eqb (projT1 (regbits_to_regno (subrange_vec_dec v__7 31 27))) + (projT1 (regbits_to_regno + (vec_of_bits [B0;B0;B0;B1;B1] : mword 5)))) + (andb + (eq_vec (subrange_vec_dec v__7 14 14) + (vec_of_bits [B0] : mword (14 - 14 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword (6 - 0 + 1))))))) + then + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_39_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_38_ : mword 1 := subrange_vec_dec v__7 25 25 in + let _mappingpatterns_37_ : mword 1 := subrange_vec_dec v__7 26 26 in + let size := size_bits_backwards _mappingpatterns_39_ in + let rl := bool_bits_backwards _mappingpatterns_38_ in + let aq := bool_bits_backwards _mappingpatterns_37_ in + STORECON + ((aq, rl, rs2, rs1, size, rd)) + else if ((andb + (let _mappingpatterns_40_ : mword 5 := subrange_vec_dec v__7 31 27 in + let _mappingpatterns_43_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_42_ : mword 1 := subrange_vec_dec v__7 25 25 in + let _mappingpatterns_41_ : mword 1 := subrange_vec_dec v__7 26 26 in + let _mappingpatterns_40_ : mword 5 := subrange_vec_dec v__7 31 27 in + andb (size_bits_backwards_matches _mappingpatterns_43_) + (if ((size_bits_backwards_matches _mappingpatterns_43_)) then + let size := size_bits_backwards _mappingpatterns_43_ in + andb (bool_bits_backwards_matches _mappingpatterns_42_) + (if ((bool_bits_backwards_matches _mappingpatterns_42_)) then + let rl := bool_bits_backwards _mappingpatterns_42_ in + andb (bool_bits_backwards_matches _mappingpatterns_41_) + (if ((bool_bits_backwards_matches _mappingpatterns_41_)) then + let aq := bool_bits_backwards _mappingpatterns_41_ in + andb (encdec_amoop_backwards_matches _mappingpatterns_40_) + (if ((encdec_amoop_backwards_matches _mappingpatterns_40_)) then + let op := encdec_amoop_backwards _mappingpatterns_40_ in + true + else false) + else false) + else false) + else false)) + (andb + (eq_vec (subrange_vec_dec v__7 14 14) (vec_of_bits [B0] : mword (14 - 14 + 1))) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword (6 - 0 + 1)))))) then + let _mappingpatterns_40_ : mword 5 := subrange_vec_dec v__7 31 27 in + let rs2 : mword 5 := subrange_vec_dec v__7 24 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let _mappingpatterns_43_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_42_ : mword 1 := subrange_vec_dec v__7 25 25 in + let _mappingpatterns_41_ : mword 1 := subrange_vec_dec v__7 26 26 in + let _mappingpatterns_40_ : mword 5 := subrange_vec_dec v__7 31 27 in + let size := size_bits_backwards _mappingpatterns_43_ in + let rl := bool_bits_backwards _mappingpatterns_42_ in + let aq := bool_bits_backwards _mappingpatterns_41_ in + let op := encdec_amoop_backwards _mappingpatterns_40_ in + AMO + ((op, aq, rl, rs2, rs1, size, rd)) + else if ((andb + (let _mappingpatterns_45_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_44_ : mword 1 := subrange_vec_dec v__7 14 14 in + andb (encdec_csrop_backwards_matches _mappingpatterns_45_) + (if ((encdec_csrop_backwards_matches _mappingpatterns_45_)) then + let op := encdec_csrop_backwards _mappingpatterns_45_ in + andb (bool_bits_backwards_matches _mappingpatterns_44_) + (if ((bool_bits_backwards_matches _mappingpatterns_44_)) then + let is_imm := bool_bits_backwards _mappingpatterns_44_ in + true + else false) + else false)) + (eq_vec (subrange_vec_dec v__7 6 0) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1))))) then + let csr : mword 12 := subrange_vec_dec v__7 31 20 in + let rs1 : mword 5 := subrange_vec_dec v__7 19 15 in + let rd : mword 5 := subrange_vec_dec v__7 11 7 in + let csr : mword 12 := subrange_vec_dec v__7 31 20 in + let _mappingpatterns_45_ : mword 2 := subrange_vec_dec v__7 13 12 in + let _mappingpatterns_44_ : mword 1 := subrange_vec_dec v__7 14 14 in + let op := encdec_csrop_backwards _mappingpatterns_45_ in + let is_imm := bool_bits_backwards _mappingpatterns_44_ in + CSR + ((csr, rs1, rd, is_imm, op)) + else if ((eq_vec v__7 + (vec_of_bits [B1;B1;B1;B1;B1;B0;B1;B0;B1;B1;B0;B1;B1;B1;B1;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B1;B0;B1;B1] + : mword 32))) then + STOP_FETCHING + (tt) + else if ((eq_vec v__7 + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B1;B1;B0;B1;B1;B1;B1;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B1;B0;B1;B1] + : mword 32))) then + THREAD_START + (tt) + else ILLEGAL (v__7). + +Definition encdec_forwards_matches (arg_ : ast) +: bool := + + match arg_ with + | UTYPE (imm,rd,op) => true + | RISCV_JAL (v__227,rd) => + if ((eq_vec (subrange_vec_dec v__227 0 0) (vec_of_bits [B0] : mword (0 - 0 + 1)))) then true + else + let g__36 := RISCV_JAL ((v__227, rd)) in + false + | RISCV_JALR (imm,rs1,rd) => true + | BTYPE (v__229,rs2,rs1,op) => + if ((eq_vec (subrange_vec_dec v__229 0 0) (vec_of_bits [B0] : mword (0 - 0 + 1)))) then true + else + let g__36 := BTYPE ((v__229, rs2, rs1, op)) in + false + | ITYPE (imm,rs1,rd,op) => true + | SHIFTIOP (shamt,rs1,rd,RISCV_SLLI) => true + | SHIFTIOP (shamt,rs1,rd,RISCV_SRLI) => true + | SHIFTIOP (shamt,rs1,rd,RISCV_SRAI) => true + | RTYPE (rs2,rs1,rd,RISCV_ADD) => true + | RTYPE (rs2,rs1,rd,RISCV_SUB) => true + | RTYPE (rs2,rs1,rd,RISCV_SLL) => true + | RTYPE (rs2,rs1,rd,RISCV_SLT) => true + | RTYPE (rs2,rs1,rd,RISCV_SLTU) => true + | RTYPE (rs2,rs1,rd,RISCV_XOR) => true + | RTYPE (rs2,rs1,rd,RISCV_SRL) => true + | RTYPE (rs2,rs1,rd,RISCV_SRA) => true + | RTYPE (rs2,rs1,rd,RISCV_OR) => true + | RTYPE (rs2,rs1,rd,RISCV_AND) => true + | LOAD (imm,rs1,rd,is_unsigned,size,false,false) => + if ((orb (neq_vec (size_bits_forwards size) (vec_of_bits [B1;B1] : mword 2)) + (negb is_unsigned))) then + true + else + let g__36 := LOAD ((imm, rs1, rd, is_unsigned, size, false, false)) in + false + | STORE (v__231,rs2,rs1,size,false,false) => true + | ADDIW (imm,rs1,rd) => true + | SHIFTW (shamt,rs1,rd,RISCV_SLLI) => true + | SHIFTW (shamt,rs1,rd,RISCV_SRLI) => true + | SHIFTW (shamt,rs1,rd,RISCV_SRAI) => true + | RTYPEW (rs2,rs1,rd,RISCV_ADDW) => true + | RTYPEW (rs2,rs1,rd,RISCV_SUBW) => true + | RTYPEW (rs2,rs1,rd,RISCV_SLLW) => true + | RTYPEW (rs2,rs1,rd,RISCV_SRLW) => true + | RTYPEW (rs2,rs1,rd,RISCV_SRAW) => true + | SHIFTIWOP (shamt,rs1,rd,RISCV_SLLIW) => true + | SHIFTIWOP (shamt,rs1,rd,RISCV_SRLIW) => true + | SHIFTIWOP (shamt,rs1,rd,RISCV_SRAIW) => true + | MUL (rs2,rs1,rd,high,signed1,signed2) => true + | DIV (rs2,rs1,rd,s) => true + | REM (rs2,rs1,rd,s) => true + | MULW (rs2,rs1,rd) => true + | DIVW (rs2,rs1,rd,s) => true + | REMW (rs2,rs1,rd,s) => true + | FENCE (pred,succ) => true + | FENCE_TSO (pred,succ) => true + | FENCEI (tt) => true + | ECALL (tt) => true + | MRET (tt) => true + | SRET (tt) => true + | EBREAK (tt) => true + | WFI (tt) => true + | SFENCE_VMA (rs1,rs2) => true + | LOADRES (aq,rl,rs1,size,rd) => true + | STORECON (aq,rl,rs2,rs1,size,rd) => true + | AMO (op,aq,rl,rs2,rs1,size,rd) => true + | CSR (csr,rs1,rd,is_imm,op) => true + | STOP_FETCHING (tt) => true + | THREAD_START (tt) => true + | ILLEGAL (s) => true + | g__36 => false + end. + +Definition encdec_backwards_matches (arg_ : mword 32) +: bool := + + let v__232 := arg_ in + if ((let _mappingpatterns_0_ : mword 7 := subrange_vec_dec v__232 6 0 in + andb (encdec_uop_backwards_matches _mappingpatterns_0_) + (if ((encdec_uop_backwards_matches _mappingpatterns_0_)) then + let op := encdec_uop_backwards _mappingpatterns_0_ in + true + else false))) then + let _mappingpatterns_0_ : mword 7 := subrange_vec_dec v__232 6 0 in + let op := encdec_uop_backwards _mappingpatterns_0_ in + true + else if ((eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B1;B1;B0;B1;B1;B1;B1] : mword (6 - 0 + 1)))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B1;B1;B0;B0;B1;B1;B1] : mword (6 - 0 + 1))))) then + true + else if ((andb + (let _mappingpatterns_1_ : mword 3 := subrange_vec_dec v__232 14 12 in + andb (encdec_bop_backwards_matches _mappingpatterns_1_) + (if ((encdec_bop_backwards_matches _mappingpatterns_1_)) then + let op := encdec_bop_backwards _mappingpatterns_1_ in + true + else false)) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B1;B1;B0;B0;B0;B1;B1] : mword (6 - 0 + 1))))) then + let _mappingpatterns_1_ : mword 3 := subrange_vec_dec v__232 14 12 in + let op := encdec_bop_backwards _mappingpatterns_1_ in + true + else if ((andb + (let _mappingpatterns_2_ : mword 3 := subrange_vec_dec v__232 14 12 in + andb (encdec_iop_backwards_matches _mappingpatterns_2_) + (if ((encdec_iop_backwards_matches _mappingpatterns_2_)) then + let op := encdec_iop_backwards _mappingpatterns_2_ in + true + else false)) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword (6 - 0 + 1))))) then + let _mappingpatterns_2_ : mword 3 := subrange_vec_dec v__232 14 12 in + let op := encdec_iop_backwards _mappingpatterns_2_ in + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 26) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (31 - 26 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 26) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (31 - 26 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 26) + (vec_of_bits [B0;B1;B0;B0;B0;B0] : mword (31 - 26 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B1;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B1;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B1;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B1;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (let _mappingpatterns_4_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_3_ : mword 1 := subrange_vec_dec v__232 14 14 in + andb (size_bits_backwards_matches _mappingpatterns_4_) + (if ((size_bits_backwards_matches _mappingpatterns_4_)) then + let size := size_bits_backwards _mappingpatterns_4_ in + andb (bool_bits_backwards_matches _mappingpatterns_3_) + (if ((bool_bits_backwards_matches _mappingpatterns_3_)) then + let is_unsigned := bool_bits_backwards _mappingpatterns_3_ in + orb (neq_vec (size_bits_forwards size) (vec_of_bits [B1;B1] : mword 2)) + (negb is_unsigned) + else false) + else false)) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B0;B0;B0;B1;B1] : mword (6 - 0 + 1))))) then + let _mappingpatterns_4_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_3_ : mword 1 := subrange_vec_dec v__232 14 14 in + let size := size_bits_backwards _mappingpatterns_4_ in + let is_unsigned := bool_bits_backwards _mappingpatterns_3_ in + true + else if ((andb + (let _mappingpatterns_5_ : mword 2 := subrange_vec_dec v__232 13 12 in + andb (size_bits_backwards_matches _mappingpatterns_5_) + (if ((size_bits_backwards_matches _mappingpatterns_5_)) then + let size := size_bits_backwards _mappingpatterns_5_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__232 14 14) (vec_of_bits [B0] : mword (14 - 14 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B0;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let _mappingpatterns_5_ : mword 2 := subrange_vec_dec v__232 13 12 in + let size := size_bits_backwards _mappingpatterns_5_ in + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B1;B0;B0;B0;B0;B0] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B1;B0;B1] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B0;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (let _mappingpatterns_6_ : bits 3 := subrange_vec_dec v__232 14 12 in + andb (encdec_mul_op_backwards_matches _mappingpatterns_6_) + (if ((encdec_mul_op_backwards_matches _mappingpatterns_6_)) then + let '(high, signed1, signed2) := encdec_mul_op_backwards _mappingpatterns_6_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1)))))) then + let _mappingpatterns_6_ : bits 3 := subrange_vec_dec v__232 14 12 in + let '(high, signed1, signed2) := encdec_mul_op_backwards _mappingpatterns_6_ in + true + else if ((andb + (let _mappingpatterns_7_ : mword 1 := subrange_vec_dec v__232 12 12 in + andb (bool_not_bits_backwards_matches _mappingpatterns_7_) + (if ((bool_not_bits_backwards_matches _mappingpatterns_7_)) then + let s := bool_not_bits_backwards _mappingpatterns_7_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 13) + (vec_of_bits [B1;B0] : mword (14 - 13 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1))))))) then + let _mappingpatterns_7_ : mword 1 := subrange_vec_dec v__232 12 12 in + let s := bool_not_bits_backwards _mappingpatterns_7_ in + true + else if ((andb + (let _mappingpatterns_8_ : mword 1 := subrange_vec_dec v__232 12 12 in + andb (bool_not_bits_backwards_matches _mappingpatterns_8_) + (if ((bool_not_bits_backwards_matches _mappingpatterns_8_)) then + let s := bool_not_bits_backwards _mappingpatterns_8_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 13) + (vec_of_bits [B1;B1] : mword (14 - 13 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1))))))) then + let _mappingpatterns_8_ : mword 1 := subrange_vec_dec v__232 12 12 in + let s := bool_not_bits_backwards _mappingpatterns_8_ in + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 12) + (vec_of_bits [B0;B0;B0] : mword (14 - 12 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (let _mappingpatterns_9_ : mword 1 := subrange_vec_dec v__232 12 12 in + andb (bool_not_bits_backwards_matches _mappingpatterns_9_) + (if ((bool_not_bits_backwards_matches _mappingpatterns_9_)) then + let s := bool_not_bits_backwards _mappingpatterns_9_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 13) + (vec_of_bits [B1;B0] : mword (14 - 13 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1))))))) then + let _mappingpatterns_9_ : mword 1 := subrange_vec_dec v__232 12 12 in + let s := bool_not_bits_backwards _mappingpatterns_9_ in + true + else if ((andb + (let _mappingpatterns_10_ : mword 1 := subrange_vec_dec v__232 12 12 in + andb (bool_not_bits_backwards_matches _mappingpatterns_10_) + (if ((bool_not_bits_backwards_matches _mappingpatterns_10_)) then + let s := bool_not_bits_backwards _mappingpatterns_10_ in + true + else false)) + (andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B1] : mword (31 - 25 + 1))) + (andb + (eq_vec (subrange_vec_dec v__232 14 13) + (vec_of_bits [B1;B1] : mword (14 - 13 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B1;B1;B0;B1;B1] : mword (6 - 0 + 1))))))) then + let _mappingpatterns_10_ : mword 1 := subrange_vec_dec v__232 12 12 in + let s := bool_not_bits_backwards _mappingpatterns_10_ in + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 28) + (vec_of_bits [B0;B0;B0;B0] : mword (31 - 28 + 1))) + (eq_vec (subrange_vec_dec v__232 19 0) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1;B1;B1] + : mword (19 - 0 + 1))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 28) + (vec_of_bits [B1;B0;B0;B0] : mword (31 - 28 + 1))) + (eq_vec (subrange_vec_dec v__232 19 0) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B1;B1;B1] + : mword (19 - 0 + 1))))) then + true + else if ((eq_vec v__232 + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0; + B0;B0;B0;B0;B0;B0;B0;B1;B1;B1;B1] + : mword 32))) then + true + else if ((eq_vec v__232 + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + true + else if ((eq_vec v__232 + (vec_of_bits [B0;B0;B1;B1;B0;B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + true + else if ((eq_vec v__232 + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + true + else if ((eq_vec v__232 + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + true + else if ((eq_vec v__232 + (vec_of_bits [B0;B0;B0;B1;B0;B0;B0;B0;B0;B1;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] + : mword 32))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__232 31 25) + (vec_of_bits [B0;B0;B0;B1;B0;B0;B1] : mword (31 - 25 + 1))) + (eq_vec (subrange_vec_dec v__232 14 0) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B1;B1;B1;B0;B0;B1;B1] : mword (14 - 0 + 1))))) + then + true + else if sumbool_of_bool ((andb + (let _mappingpatterns_13_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_12_ : mword 1 := subrange_vec_dec v__232 25 25 in + let _mappingpatterns_11_ : mword 1 := subrange_vec_dec v__232 26 26 in + andb (size_bits_backwards_matches _mappingpatterns_13_) + (if ((size_bits_backwards_matches _mappingpatterns_13_)) then + let size := size_bits_backwards _mappingpatterns_13_ in + andb (bool_bits_backwards_matches _mappingpatterns_12_) + (if ((bool_bits_backwards_matches _mappingpatterns_12_)) then + let rl := bool_bits_backwards _mappingpatterns_12_ in + andb (bool_bits_backwards_matches _mappingpatterns_11_) + (if ((bool_bits_backwards_matches _mappingpatterns_11_)) + then + let aq := bool_bits_backwards _mappingpatterns_11_ in + true + else false) + else false) + else false)) + (andb + (Z.eqb (projT1 (regbits_to_regno (subrange_vec_dec v__232 31 27))) + (projT1 (regbits_to_regno + (vec_of_bits [B0;B0;B0;B1;B0] : mword 5)))) + (andb + (Z.eqb + (projT1 (regbits_to_regno (subrange_vec_dec v__232 24 20))) + (projT1 (regbits_to_regno + (vec_of_bits [B0;B0;B0;B0;B0] : mword 5)))) + (andb + (eq_vec (subrange_vec_dec v__232 14 14) + (vec_of_bits [B0] : mword (14 - 14 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword (6 - 0 + 1)))))))) + then + let _mappingpatterns_13_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_12_ : mword 1 := subrange_vec_dec v__232 25 25 in + let _mappingpatterns_11_ : mword 1 := subrange_vec_dec v__232 26 26 in + let size := size_bits_backwards _mappingpatterns_13_ in + let rl := bool_bits_backwards _mappingpatterns_12_ in + let aq := bool_bits_backwards _mappingpatterns_11_ in + true + else if sumbool_of_bool ((andb + (let _mappingpatterns_16_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_15_ : mword 1 := subrange_vec_dec v__232 25 25 in + let _mappingpatterns_14_ : mword 1 := subrange_vec_dec v__232 26 26 in + andb (size_bits_backwards_matches _mappingpatterns_16_) + (if ((size_bits_backwards_matches _mappingpatterns_16_)) then + let size := size_bits_backwards _mappingpatterns_16_ in + andb (bool_bits_backwards_matches _mappingpatterns_15_) + (if ((bool_bits_backwards_matches _mappingpatterns_15_)) then + let rl := bool_bits_backwards _mappingpatterns_15_ in + andb (bool_bits_backwards_matches _mappingpatterns_14_) + (if ((bool_bits_backwards_matches _mappingpatterns_14_)) + then + let aq := bool_bits_backwards _mappingpatterns_14_ in + true + else false) + else false) + else false)) + (andb + (Z.eqb (projT1 (regbits_to_regno (subrange_vec_dec v__232 31 27))) + (projT1 (regbits_to_regno + (vec_of_bits [B0;B0;B0;B1;B1] : mword 5)))) + (andb + (eq_vec (subrange_vec_dec v__232 14 14) + (vec_of_bits [B0] : mword (14 - 14 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword (6 - 0 + 1))))))) + then + let _mappingpatterns_16_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_15_ : mword 1 := subrange_vec_dec v__232 25 25 in + let _mappingpatterns_14_ : mword 1 := subrange_vec_dec v__232 26 26 in + let size := size_bits_backwards _mappingpatterns_16_ in + let rl := bool_bits_backwards _mappingpatterns_15_ in + let aq := bool_bits_backwards _mappingpatterns_14_ in + true + else if ((andb + (let _mappingpatterns_17_ : mword 5 := subrange_vec_dec v__232 31 27 in + let _mappingpatterns_20_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_19_ : mword 1 := subrange_vec_dec v__232 25 25 in + let _mappingpatterns_18_ : mword 1 := subrange_vec_dec v__232 26 26 in + let _mappingpatterns_17_ : mword 5 := subrange_vec_dec v__232 31 27 in + andb (size_bits_backwards_matches _mappingpatterns_20_) + (if ((size_bits_backwards_matches _mappingpatterns_20_)) then + let size := size_bits_backwards _mappingpatterns_20_ in + andb (bool_bits_backwards_matches _mappingpatterns_19_) + (if ((bool_bits_backwards_matches _mappingpatterns_19_)) then + let rl := bool_bits_backwards _mappingpatterns_19_ in + andb (bool_bits_backwards_matches _mappingpatterns_18_) + (if ((bool_bits_backwards_matches _mappingpatterns_18_)) then + let aq := bool_bits_backwards _mappingpatterns_18_ in + andb (encdec_amoop_backwards_matches _mappingpatterns_17_) + (if ((encdec_amoop_backwards_matches _mappingpatterns_17_)) then + let op := encdec_amoop_backwards _mappingpatterns_17_ in + true + else false) + else false) + else false) + else false)) + (andb + (eq_vec (subrange_vec_dec v__232 14 14) (vec_of_bits [B0] : mword (14 - 14 + 1))) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B0;B1;B0;B1;B1;B1;B1] : mword (6 - 0 + 1)))))) then + let _mappingpatterns_17_ : mword 5 := subrange_vec_dec v__232 31 27 in + let _mappingpatterns_20_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_19_ : mword 1 := subrange_vec_dec v__232 25 25 in + let _mappingpatterns_18_ : mword 1 := subrange_vec_dec v__232 26 26 in + let _mappingpatterns_17_ : mword 5 := subrange_vec_dec v__232 31 27 in + let size := size_bits_backwards _mappingpatterns_20_ in + let rl := bool_bits_backwards _mappingpatterns_19_ in + let aq := bool_bits_backwards _mappingpatterns_18_ in + let op := encdec_amoop_backwards _mappingpatterns_17_ in + true + else if ((andb + (let _mappingpatterns_22_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_21_ : mword 1 := subrange_vec_dec v__232 14 14 in + andb (encdec_csrop_backwards_matches _mappingpatterns_22_) + (if ((encdec_csrop_backwards_matches _mappingpatterns_22_)) then + let op := encdec_csrop_backwards _mappingpatterns_22_ in + andb (bool_bits_backwards_matches _mappingpatterns_21_) + (if ((bool_bits_backwards_matches _mappingpatterns_21_)) then + let is_imm := bool_bits_backwards _mappingpatterns_21_ in + true + else false) + else false)) + (eq_vec (subrange_vec_dec v__232 6 0) + (vec_of_bits [B1;B1;B1;B0;B0;B1;B1] : mword (6 - 0 + 1))))) then + let _mappingpatterns_22_ : mword 2 := subrange_vec_dec v__232 13 12 in + let _mappingpatterns_21_ : mword 1 := subrange_vec_dec v__232 14 14 in + let op := encdec_csrop_backwards _mappingpatterns_22_ in + let is_imm := bool_bits_backwards _mappingpatterns_21_ in + true + else if ((eq_vec v__232 + (vec_of_bits [B1;B1;B1;B1;B1;B0;B1;B0;B1;B1;B0;B1;B1;B1;B1;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B1;B0;B1;B1] + : mword 32))) then + true + else if ((eq_vec v__232 + (vec_of_bits [B1;B1;B0;B0;B0;B0;B0;B0;B1;B1;B0;B1;B1;B1;B1;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B1;B0;B1;B1] + : mword 32))) then + true + else true. + +Definition encdec_compressed_forwards (arg_ : ast) +: M (mword 16) := + + (match arg_ with + | C_NOP (tt) => + returnm ((concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B0;B1] : mword 2))))) + : mword (3 + (1 + (5 + (5 + 2))))) + | C_ADDI4SPN (rd,v__452) => + let nz96 : bits 4 := subrange_vec_dec v__452 7 4 in + let nz96 : bits 4 := subrange_vec_dec v__452 7 4 in + let nz54 : bits 2 := subrange_vec_dec v__452 3 2 in + let nz3 : bits 1 := subrange_vec_dec v__452 1 1 in + let nz2 : bits 1 := subrange_vec_dec v__452 0 0 in + returnm ((concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (nz54 : bits 2) + (concat_vec (nz96 : bits 4) + (concat_vec (nz2 : bits 1) + (concat_vec (nz3 : bits 1) + (concat_vec (rd : cregbits) (vec_of_bits [B0;B0] : mword 2))))))) + : mword 16) + | C_LW (v__453,rs1,rd) => + let ui6 : bits 1 := subrange_vec_dec v__453 4 4 in + let ui6 : bits 1 := subrange_vec_dec v__453 4 4 in + let ui53 : bits 3 := subrange_vec_dec v__453 3 1 in + let ui2 : bits 1 := subrange_vec_dec v__453 0 0 in + returnm ((concat_vec (vec_of_bits [B0;B1;B0] : mword 3) + (concat_vec (ui53 : bits 3) + (concat_vec (rs1 : cregbits) + (concat_vec (ui2 : bits 1) + (concat_vec (ui6 : bits 1) + (concat_vec (rd : cregbits) (vec_of_bits [B0;B0] : mword 2))))))) + : mword 16) + | C_LD (v__454,rs1,rd) => + let ui76 : bits 2 := subrange_vec_dec v__454 4 3 in + let ui76 : bits 2 := subrange_vec_dec v__454 4 3 in + let ui53 : bits 3 := subrange_vec_dec v__454 2 0 in + returnm ((concat_vec (vec_of_bits [B0;B1;B1] : mword 3) + (concat_vec (ui53 : bits 3) + (concat_vec (rs1 : cregbits) + (concat_vec (ui76 : bits 2) + (concat_vec (rd : cregbits) (vec_of_bits [B0;B0] : mword 2)))))) + : mword 16) + | C_SW (v__455,rs1,rs2) => + let ui6 : bits 1 := subrange_vec_dec v__455 4 4 in + let ui6 : bits 1 := subrange_vec_dec v__455 4 4 in + let ui53 : bits 3 := subrange_vec_dec v__455 3 1 in + let ui2 : bits 1 := subrange_vec_dec v__455 0 0 in + returnm ((concat_vec (vec_of_bits [B1;B1;B0] : mword 3) + (concat_vec (ui53 : bits 3) + (concat_vec (rs1 : cregbits) + (concat_vec (ui2 : bits 1) + (concat_vec (ui6 : bits 1) + (concat_vec (rs2 : cregbits) (vec_of_bits [B0;B0] : mword 2))))))) + : mword 16) + | C_SD (v__456,rs1,rs2) => + let ui76 : bits 2 := subrange_vec_dec v__456 4 3 in + let ui76 : bits 2 := subrange_vec_dec v__456 4 3 in + let ui53 : bits 3 := subrange_vec_dec v__456 2 0 in + returnm ((concat_vec (vec_of_bits [B1;B1;B1] : mword 3) + (concat_vec (ui53 : bits 3) + (concat_vec (rs1 : bits 3) + (concat_vec (ui76 : bits 2) + (concat_vec (rs2 : bits 3) (vec_of_bits [B0;B0] : mword 2)))))) + : mword 16) + | C_ADDI (v__457,rsd) => + let nzi5 : bits 1 := subrange_vec_dec v__457 5 5 in + let nzi5 : bits 1 := subrange_vec_dec v__457 5 5 in + let nzi40 : bits 5 := subrange_vec_dec v__457 4 0 in + returnm ((concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (nzi5 : bits 1) + (concat_vec (rsd : regbits) + (concat_vec (nzi40 : bits 5) (vec_of_bits [B0;B1] : mword 2))))) + : mword 16) + | C_ADDIW (v__458,rsd) => + let imm5 : bits 1 := subrange_vec_dec v__458 5 5 in + let imm5 : bits 1 := subrange_vec_dec v__458 5 5 in + let imm40 : bits 5 := subrange_vec_dec v__458 4 0 in + returnm ((concat_vec (vec_of_bits [B0;B0;B1] : mword 3) + (concat_vec (imm5 : bits 1) + (concat_vec (rsd : regbits) + (concat_vec (imm40 : bits 5) (vec_of_bits [B0;B1] : mword 2))))) + : mword 16) + | C_LI (v__459,rd) => + let imm5 : bits 1 := subrange_vec_dec v__459 5 5 in + let imm5 : bits 1 := subrange_vec_dec v__459 5 5 in + let imm40 : bits 5 := subrange_vec_dec v__459 4 0 in + returnm ((concat_vec (vec_of_bits [B0;B1;B0] : mword 3) + (concat_vec (imm5 : bits 1) + (concat_vec (rd : regbits) + (concat_vec (imm40 : bits 5) (vec_of_bits [B0;B1] : mword 2))))) + : mword 16) + | C_ADDI16SP (v__460) => + let nzi9 : bits 1 := subrange_vec_dec v__460 5 5 in + let nzi9 : bits 1 := subrange_vec_dec v__460 5 5 in + let nzi87 : bits 2 := subrange_vec_dec v__460 4 3 in + let nzi6 : bits 1 := subrange_vec_dec v__460 2 2 in + let nzi5 : bits 1 := subrange_vec_dec v__460 1 1 in + let nzi4 : bits 1 := subrange_vec_dec v__460 0 0 in + returnm ((concat_vec (vec_of_bits [B0;B1;B1] : mword 3) + (concat_vec (nzi9 : bits 1) + (concat_vec (vec_of_bits [B0;B0;B0;B1;B0] : mword 5) + (concat_vec (nzi4 : bits 1) + (concat_vec (nzi6 : bits 1) + (concat_vec (nzi87 : bits 2) + (concat_vec (nzi5 : bits 1) (vec_of_bits [B0;B1] : mword 2)))))))) + : mword 16) + | C_LUI (v__461,rd) => + let imm17 : bits 1 := subrange_vec_dec v__461 5 5 in + let imm17 : bits 1 := subrange_vec_dec v__461 5 5 in + let imm1612 : bits 5 := subrange_vec_dec v__461 4 0 in + returnm ((concat_vec (vec_of_bits [B0;B1;B1] : mword 3) + (concat_vec (imm17 : bits 1) + (concat_vec (rd : regbits) + (concat_vec (imm1612 : bits 5) (vec_of_bits [B0;B1] : mword 2))))) + : mword 16) + | C_SRLI (v__462,rsd) => + let nzui5 : bits 1 := subrange_vec_dec v__462 5 5 in + let nzui5 : bits 1 := subrange_vec_dec v__462 5 5 in + let nzui40 : bits 5 := subrange_vec_dec v__462 4 0 in + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (nzui5 : bits 1) + (concat_vec (vec_of_bits [B0;B0] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (nzui40 : bits 5) (vec_of_bits [B0;B1] : mword 2)))))) + : mword 16) + | C_SRAI (v__463,rsd) => + let nzui5 : bits 1 := subrange_vec_dec v__463 5 5 in + let nzui5 : bits 1 := subrange_vec_dec v__463 5 5 in + let nzui40 : bits 5 := subrange_vec_dec v__463 4 0 in + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (nzui5 : bits 1) + (concat_vec (vec_of_bits [B0;B1] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (nzui40 : bits 5) (vec_of_bits [B0;B1] : mword 2)))))) + : mword 16) + | C_ANDI (v__464,rsd) => + let i5 : bits 1 := subrange_vec_dec v__464 5 5 in + let i5 : bits 1 := subrange_vec_dec v__464 5 5 in + let i40 : bits 5 := subrange_vec_dec v__464 4 0 in + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (i5 : bits 1) + (concat_vec (vec_of_bits [B1;B0] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (i40 : bits 5) (vec_of_bits [B0;B1] : mword 2)))))) + : mword 16) + | C_SUB (rsd,rs2) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (vec_of_bits [B0;B0] : mword 2) + (concat_vec (rs2 : cregbits) (vec_of_bits [B0;B1] : mword 2))))))) + : mword (3 + (1 + (2 + (3 + (2 + (3 + 2))))))) + | C_XOR (rsd,rs2) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (vec_of_bits [B0;B1] : mword 2) + (concat_vec (rs2 : cregbits) (vec_of_bits [B0;B1] : mword 2))))))) + : mword (3 + (1 + (2 + (3 + (2 + (3 + 2))))))) + | C_OR (rsd,rs2) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (vec_of_bits [B1;B0] : mword 2) + (concat_vec (rs2 : cregbits) (vec_of_bits [B0;B1] : mword 2))))))) + : mword (3 + (1 + (2 + (3 + (2 + (3 + 2))))))) + | C_AND (rsd,rs2) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (rs2 : cregbits) (vec_of_bits [B0;B1] : mword 2))))))) + : mword (3 + (1 + (2 + (3 + (2 + (3 + 2))))))) + | C_SUBW (rsd,rs2) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B1] : mword 1) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (vec_of_bits [B0;B0] : mword 2) + (concat_vec (rs2 : cregbits) (vec_of_bits [B0;B1] : mword 2))))))) + : mword (3 + (1 + (2 + (3 + (2 + (3 + 2))))))) + | C_ADDW (rsd,rs2) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B1] : mword 1) + (concat_vec (vec_of_bits [B1;B1] : mword 2) + (concat_vec (rsd : cregbits) + (concat_vec (vec_of_bits [B0;B1] : mword 2) + (concat_vec (rs2 : cregbits) (vec_of_bits [B0;B1] : mword 2))))))) + : mword (3 + (1 + (2 + (3 + (2 + (3 + 2))))))) + | C_J (v__465) => + let i11 : bits 1 := subrange_vec_dec v__465 10 10 in + let i98 : bits 2 := subrange_vec_dec v__465 8 7 in + let i7 : bits 1 := subrange_vec_dec v__465 6 6 in + let i6 : bits 1 := subrange_vec_dec v__465 5 5 in + let i5 : bits 1 := subrange_vec_dec v__465 4 4 in + let i4 : bits 1 := subrange_vec_dec v__465 3 3 in + let i31 : bits 3 := subrange_vec_dec v__465 2 0 in + let i11 : bits 1 := subrange_vec_dec v__465 10 10 in + let i10 : bits 1 := subrange_vec_dec v__465 9 9 in + returnm ((concat_vec (vec_of_bits [B1;B0;B1] : mword 3) + (concat_vec (i11 : bits 1) + (concat_vec (i4 : bits 1) + (concat_vec (i98 : bits 2) + (concat_vec (i10 : bits 1) + (concat_vec (i6 : bits 1) + (concat_vec (i7 : bits 1) + (concat_vec (i31 : bits 3) + (concat_vec (i5 : bits 1) (vec_of_bits [B0;B1] : mword 2)))))))))) + : mword 16) + | C_BEQZ (v__466,rs) => + let i8 : bits 1 := subrange_vec_dec v__466 7 7 in + let i8 : bits 1 := subrange_vec_dec v__466 7 7 in + let i76 : bits 2 := subrange_vec_dec v__466 6 5 in + let i5 : bits 1 := subrange_vec_dec v__466 4 4 in + let i43 : bits 2 := subrange_vec_dec v__466 3 2 in + let i21 : bits 2 := subrange_vec_dec v__466 1 0 in + returnm ((concat_vec (vec_of_bits [B1;B1;B0] : mword 3) + (concat_vec (i8 : bits 1) + (concat_vec (i43 : bits 2) + (concat_vec (rs : cregbits) + (concat_vec (i76 : bits 2) + (concat_vec (i21 : bits 2) + (concat_vec (i5 : bits 1) (vec_of_bits [B0;B1] : mword 2)))))))) + : mword 16) + | C_BNEZ (v__467,rs) => + let i8 : bits 1 := subrange_vec_dec v__467 7 7 in + let i8 : bits 1 := subrange_vec_dec v__467 7 7 in + let i76 : bits 2 := subrange_vec_dec v__467 6 5 in + let i5 : bits 1 := subrange_vec_dec v__467 4 4 in + let i43 : bits 2 := subrange_vec_dec v__467 3 2 in + let i21 : bits 2 := subrange_vec_dec v__467 1 0 in + returnm ((concat_vec (vec_of_bits [B1;B1;B1] : mword 3) + (concat_vec (i8 : bits 1) + (concat_vec (i43 : bits 2) + (concat_vec (rs : cregbits) + (concat_vec (i76 : bits 2) + (concat_vec (i21 : bits 2) + (concat_vec (i5 : bits 1) (vec_of_bits [B0;B1] : mword 2)))))))) + : mword 16) + | C_SLLI (v__468,rsd) => + let nzui5 : bits 1 := subrange_vec_dec v__468 5 5 in + let nzui5 : bits 1 := subrange_vec_dec v__468 5 5 in + let nzui40 : bits 5 := subrange_vec_dec v__468 4 0 in + returnm ((concat_vec (vec_of_bits [B0;B0;B0] : mword 3) + (concat_vec (nzui5 : bits 1) + (concat_vec (rsd : regbits) + (concat_vec (nzui40 : bits 5) (vec_of_bits [B1;B0] : mword 2))))) + : mword 16) + | C_LWSP (v__469,rd) => + let ui76 : bits 2 := subrange_vec_dec v__469 5 4 in + let ui76 : bits 2 := subrange_vec_dec v__469 5 4 in + let ui5 : bits 1 := subrange_vec_dec v__469 3 3 in + let ui42 : bits 3 := subrange_vec_dec v__469 2 0 in + returnm ((concat_vec (vec_of_bits [B0;B1;B0] : mword 3) + (concat_vec (ui5 : bits 1) + (concat_vec (rd : regbits) + (concat_vec (ui42 : bits 3) + (concat_vec (ui76 : bits 2) (vec_of_bits [B1;B0] : mword 2)))))) + : mword 16) + | C_LDSP (v__470,rd) => + let ui86 : bits 3 := subrange_vec_dec v__470 5 3 in + let ui86 : bits 3 := subrange_vec_dec v__470 5 3 in + let ui5 : bits 1 := subrange_vec_dec v__470 2 2 in + let ui43 : bits 2 := subrange_vec_dec v__470 1 0 in + returnm ((concat_vec (vec_of_bits [B0;B1;B1] : mword 3) + (concat_vec (ui5 : bits 1) + (concat_vec (rd : regbits) + (concat_vec (ui43 : bits 2) + (concat_vec (ui86 : bits 3) (vec_of_bits [B1;B0] : mword 2)))))) + : mword 16) + | C_SWSP (v__471,rs2) => + let ui76 : bits 2 := subrange_vec_dec v__471 5 4 in + let ui76 : bits 2 := subrange_vec_dec v__471 5 4 in + let ui52 : bits 4 := subrange_vec_dec v__471 3 0 in + returnm ((concat_vec (vec_of_bits [B1;B1;B0] : mword 3) + (concat_vec (ui52 : bits 4) + (concat_vec (ui76 : bits 2) + (concat_vec (rs2 : regbits) (vec_of_bits [B1;B0] : mword 2))))) + : mword 16) + | C_SDSP (v__472,rs2) => + let ui86 : bits 3 := subrange_vec_dec v__472 5 3 in + let ui86 : bits 3 := subrange_vec_dec v__472 5 3 in + let ui53 : bits 3 := subrange_vec_dec v__472 2 0 in + returnm ((concat_vec (vec_of_bits [B1;B1;B1] : mword 3) + (concat_vec (ui53 : bits 3) + (concat_vec (ui86 : bits 3) + (concat_vec (rs2 : regbits) (vec_of_bits [B1;B0] : mword 2))))) + : mword 16) + | C_JR (rs1) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (rs1 : regbits) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B0] : mword 2))))) + : mword (3 + (1 + (5 + (5 + 2))))) + | C_JALR (rs1) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B1] : mword 1) + (concat_vec (rs1 : regbits) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B0] : mword 2))))) + : mword (3 + (1 + (5 + (5 + 2))))) + | C_MV (rd,rs2) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B0] : mword 1) + (concat_vec (rd : regbits) + (concat_vec (rs2 : regbits) (vec_of_bits [B1;B0] : mword 2))))) + : mword (3 + (1 + (5 + (5 + 2))))) + | C_EBREAK (tt) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B1] : mword 1) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (concat_vec (vec_of_bits [B0;B0;B0;B0;B0] : mword 5) + (vec_of_bits [B1;B0] : mword 2))))) + : mword (3 + (1 + (5 + (5 + 2))))) + | C_ADD (rsd,rs2) => + returnm ((concat_vec (vec_of_bits [B1;B0;B0] : mword 3) + (concat_vec (vec_of_bits [B1] : mword 1) + (concat_vec (rsd : regbits) + (concat_vec (rs2 : regbits) (vec_of_bits [B1;B0] : mword 2))))) + : mword (3 + (1 + (5 + (5 + 2))))) + | C_ILLEGAL (s) => returnm (s : mword 16) + | _ => exit tt : M (mword 16) + end) + : M (mword 16). + +Definition encdec_compressed_backwards (arg_ : mword 16) +: ast := + + let v__473 := arg_ in + if ((eq_vec v__473 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 16))) + then + C_NOP + (tt) + else if ((andb + (let nz96 : bits 4 := subrange_vec_dec v__473 10 7 in + let nz54 : bits 2 := subrange_vec_dec v__473 12 11 in + let nz3 : bits 1 := subrange_vec_dec v__473 5 5 in + let nz2 : bits 1 := subrange_vec_dec v__473 6 6 in + neq_vec (concat_vec nz96 (concat_vec nz54 (concat_vec nz3 nz2))) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] : mword (4 + (2 + (1 + 1))))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B0;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1)))))) + then + let rd : cregbits := subrange_vec_dec v__473 4 2 in + let nz96 : bits 4 := subrange_vec_dec v__473 10 7 in + let nz54 : bits 2 := subrange_vec_dec v__473 12 11 in + let nz3 : bits 1 := subrange_vec_dec v__473 5 5 in + let nz2 : bits 1 := subrange_vec_dec v__473 6 6 in + C_ADDI4SPN + ((rd, concat_vec (nz96 : bits 4) + (concat_vec (nz54 : bits 2) (concat_vec (nz3 : bits 1) (nz2 : bits 1))))) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) + then + let ui6 : bits 1 := subrange_vec_dec v__473 5 5 in + let ui53 : bits 3 := subrange_vec_dec v__473 12 10 in + let ui2 : bits 1 := subrange_vec_dec v__473 6 6 in + let rs1 : cregbits := subrange_vec_dec v__473 9 7 in + let rd : cregbits := subrange_vec_dec v__473 4 2 in + C_LW + ((concat_vec (ui6 : bits 1) (concat_vec (ui53 : bits 3) (ui2 : bits 1)), rs1, rd)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) + then + let ui76 : bits 2 := subrange_vec_dec v__473 6 5 in + let ui53 : bits 3 := subrange_vec_dec v__473 12 10 in + let rs1 : cregbits := subrange_vec_dec v__473 9 7 in + let rd : cregbits := subrange_vec_dec v__473 4 2 in + C_LD + ((concat_vec (ui76 : bits 2) (ui53 : bits 3), rs1, rd)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) + then + let ui6 : bits 1 := subrange_vec_dec v__473 5 5 in + let ui53 : bits 3 := subrange_vec_dec v__473 12 10 in + let ui2 : bits 1 := subrange_vec_dec v__473 6 6 in + let rs2 : cregbits := subrange_vec_dec v__473 4 2 in + let rs1 : cregbits := subrange_vec_dec v__473 9 7 in + C_SW + ((concat_vec (ui6 : bits 1) (concat_vec (ui53 : bits 3) (ui2 : bits 1)), rs1, rs2)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) + then + let ui76 : bits 2 := subrange_vec_dec v__473 6 5 in + let ui53 : bits 3 := subrange_vec_dec v__473 12 10 in + let rs2 : bits 3 := subrange_vec_dec v__473 4 2 in + let rs1 : bits 3 := subrange_vec_dec v__473 9 7 in + C_SD + ((concat_vec (ui76 : bits 2) (ui53 : bits 3), rs1, rs2)) + else if ((andb + (let rsd : regbits := subrange_vec_dec v__473 11 7 in + let nzi5 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzi40 : bits 5 := subrange_vec_dec v__473 6 2 in + andb + (neq_vec (concat_vec nzi5 nzi40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg)))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B0;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : regbits := subrange_vec_dec v__473 11 7 in + let nzi5 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzi40 : bits 5 := subrange_vec_dec v__473 6 2 in + C_ADDI + ((concat_vec (nzi5 : bits 1) (nzi40 : bits 5), rsd)) + else if ((andb + (let rsd : regbits := subrange_vec_dec v__473 11 7 in + neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B0;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : regbits := subrange_vec_dec v__473 11 7 in + let imm5 : bits 1 := subrange_vec_dec v__473 12 12 in + let imm40 : bits 5 := subrange_vec_dec v__473 6 2 in + C_ADDIW + ((concat_vec (imm5 : bits 1) (imm40 : bits 5), rsd)) + else if ((andb + (let rd : regbits := subrange_vec_dec v__473 11 7 in + neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rd : regbits := subrange_vec_dec v__473 11 7 in + let imm5 : bits 1 := subrange_vec_dec v__473 12 12 in + let imm40 : bits 5 := subrange_vec_dec v__473 6 2 in + C_LI + ((concat_vec (imm5 : bits 1) (imm40 : bits 5), rd)) + else if sumbool_of_bool ((andb + (let nzi9 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzi87 : bits 2 := subrange_vec_dec v__473 4 3 in + let nzi6 : bits 1 := subrange_vec_dec v__473 5 5 in + let nzi5 : bits 1 := subrange_vec_dec v__473 2 2 in + let nzi4 : bits 1 := subrange_vec_dec v__473 6 6 in + neq_vec + (concat_vec nzi9 + (concat_vec nzi87 (concat_vec nzi6 (concat_vec nzi5 nzi4)))) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + (2 + (1 + (1 + 1)))))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B1;B1] : mword (15 - 13 + 1))) + (andb + (Z.eqb + (projT1 (regbits_to_regno (subrange_vec_dec v__473 11 7))) + (projT1 (regbits_to_regno + (vec_of_bits [B0;B0;B0;B1;B0] : mword 5)))) + (eq_vec (subrange_vec_dec v__473 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))))) then + let nzi9 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzi87 : bits 2 := subrange_vec_dec v__473 4 3 in + let nzi6 : bits 1 := subrange_vec_dec v__473 5 5 in + let nzi5 : bits 1 := subrange_vec_dec v__473 2 2 in + let nzi4 : bits 1 := subrange_vec_dec v__473 6 6 in + C_ADDI16SP + (concat_vec (nzi9 : bits 1) + (concat_vec (nzi87 : bits 2) + (concat_vec (nzi6 : bits 1) (concat_vec (nzi5 : bits 1) (nzi4 : bits 1))))) + else if ((andb + (let rd : regbits := subrange_vec_dec v__473 11 7 in + let imm17 : bits 1 := subrange_vec_dec v__473 12 12 in + let imm1612 : bits 5 := subrange_vec_dec v__473 6 2 in + andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno sp))) + (neq_vec (concat_vec imm17 imm1612) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rd : regbits := subrange_vec_dec v__473 11 7 in + let imm17 : bits 1 := subrange_vec_dec v__473 12 12 in + let imm1612 : bits 5 := subrange_vec_dec v__473 6 2 in + C_LUI + ((concat_vec (imm17 : bits 1) (imm1612 : bits 5), rd)) + else if ((andb + (let nzui5 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__473 6 2 in + neq_vec (concat_vec nzui5 nzui40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B0;B0] : mword (15 - 13 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 11 10) + (vec_of_bits [B0;B0] : mword (11 - 10 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))))) then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let nzui5 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__473 6 2 in + C_SRLI + ((concat_vec (nzui5 : bits 1) (nzui40 : bits 5), rsd)) + else if ((andb + (let nzui5 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__473 6 2 in + neq_vec (concat_vec nzui5 nzui40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B0;B0] : mword (15 - 13 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 11 10) + (vec_of_bits [B0;B1] : mword (11 - 10 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))))) then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let nzui5 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__473 6 2 in + C_SRAI + ((concat_vec (nzui5 : bits 1) (nzui40 : bits 5), rsd)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B0;B0] : mword (15 - 13 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 11 10) + (vec_of_bits [B1;B0] : mword (11 - 10 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let i5 : bits 1 := subrange_vec_dec v__473 12 12 in + let i40 : bits 5 := subrange_vec_dec v__473 6 2 in + C_ANDI + ((concat_vec (i5 : bits 1) (i40 : bits 5), rsd)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 10) + (vec_of_bits [B1;B0;B0;B0;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 6 5) (vec_of_bits [B0;B0] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let rs2 : cregbits := subrange_vec_dec v__473 4 2 in + C_SUB + ((rsd, rs2)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 10) + (vec_of_bits [B1;B0;B0;B0;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 6 5) (vec_of_bits [B0;B1] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let rs2 : cregbits := subrange_vec_dec v__473 4 2 in + C_XOR + ((rsd, rs2)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 10) + (vec_of_bits [B1;B0;B0;B0;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 6 5) (vec_of_bits [B1;B0] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let rs2 : cregbits := subrange_vec_dec v__473 4 2 in + C_OR + ((rsd, rs2)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 10) + (vec_of_bits [B1;B0;B0;B0;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 6 5) (vec_of_bits [B1;B1] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let rs2 : cregbits := subrange_vec_dec v__473 4 2 in + C_AND + ((rsd, rs2)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 10) + (vec_of_bits [B1;B0;B0;B1;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 6 5) (vec_of_bits [B0;B0] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let rs2 : cregbits := subrange_vec_dec v__473 4 2 in + C_SUBW + ((rsd, rs2)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 10) + (vec_of_bits [B1;B0;B0;B1;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__473 6 5) (vec_of_bits [B0;B1] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + let rsd : cregbits := subrange_vec_dec v__473 9 7 in + let rs2 : cregbits := subrange_vec_dec v__473 4 2 in + C_ADDW + ((rsd, rs2)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B0;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + let i98 : bits 2 := subrange_vec_dec v__473 10 9 in + let i7 : bits 1 := subrange_vec_dec v__473 6 6 in + let i6 : bits 1 := subrange_vec_dec v__473 7 7 in + let i5 : bits 1 := subrange_vec_dec v__473 2 2 in + let i4 : bits 1 := subrange_vec_dec v__473 11 11 in + let i31 : bits 3 := subrange_vec_dec v__473 5 3 in + let i11 : bits 1 := subrange_vec_dec v__473 12 12 in + let i10 : bits 1 := subrange_vec_dec v__473 8 8 in + C_J + (concat_vec (i11 : bits 1) + (concat_vec (i10 : bits 1) + (concat_vec (i98 : bits 2) + (concat_vec (i7 : bits 1) + (concat_vec (i6 : bits 1) + (concat_vec (i5 : bits 1) (concat_vec (i4 : bits 1) (i31 : bits 3)))))))) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + let rs : cregbits := subrange_vec_dec v__473 9 7 in + let i8 : bits 1 := subrange_vec_dec v__473 12 12 in + let i76 : bits 2 := subrange_vec_dec v__473 6 5 in + let i5 : bits 1 := subrange_vec_dec v__473 2 2 in + let i43 : bits 2 := subrange_vec_dec v__473 11 10 in + let i21 : bits 2 := subrange_vec_dec v__473 4 3 in + C_BEQZ + ((concat_vec (i8 : bits 1) + (concat_vec (i76 : bits 2) + (concat_vec (i5 : bits 1) (concat_vec (i43 : bits 2) (i21 : bits 2)))), rs)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + let rs : cregbits := subrange_vec_dec v__473 9 7 in + let i8 : bits 1 := subrange_vec_dec v__473 12 12 in + let i76 : bits 2 := subrange_vec_dec v__473 6 5 in + let i5 : bits 1 := subrange_vec_dec v__473 2 2 in + let i43 : bits 2 := subrange_vec_dec v__473 11 10 in + let i21 : bits 2 := subrange_vec_dec v__473 4 3 in + C_BNEZ + ((concat_vec (i8 : bits 1) + (concat_vec (i76 : bits 2) + (concat_vec (i5 : bits 1) (concat_vec (i43 : bits 2) (i21 : bits 2)))), rs)) + else if ((andb + (let rsd : regbits := subrange_vec_dec v__473 11 7 in + let nzui5 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__473 6 2 in + andb + (neq_vec (concat_vec nzui5 nzui40) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg)))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B0;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + let rsd : regbits := subrange_vec_dec v__473 11 7 in + let nzui5 : bits 1 := subrange_vec_dec v__473 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__473 6 2 in + C_SLLI + ((concat_vec (nzui5 : bits 1) (nzui40 : bits 5), rsd)) + else if ((andb + (let rd : regbits := subrange_vec_dec v__473 11 7 in + neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + let ui76 : bits 2 := subrange_vec_dec v__473 3 2 in + let ui5 : bits 1 := subrange_vec_dec v__473 12 12 in + let ui42 : bits 3 := subrange_vec_dec v__473 6 4 in + let rd : regbits := subrange_vec_dec v__473 11 7 in + C_LWSP + ((concat_vec (ui76 : bits 2) (concat_vec (ui5 : bits 1) (ui42 : bits 3)), rd)) + else if ((andb + (let rd : regbits := subrange_vec_dec v__473 11 7 in + neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B0;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + let ui86 : bits 3 := subrange_vec_dec v__473 4 2 in + let ui5 : bits 1 := subrange_vec_dec v__473 12 12 in + let ui43 : bits 2 := subrange_vec_dec v__473 6 5 in + let rd : regbits := subrange_vec_dec v__473 11 7 in + C_LDSP + ((concat_vec (ui86 : bits 3) (concat_vec (ui5 : bits 1) (ui43 : bits 2)), rd)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) + then + let ui76 : bits 2 := subrange_vec_dec v__473 8 7 in + let ui52 : bits 4 := subrange_vec_dec v__473 12 9 in + let rs2 : regbits := subrange_vec_dec v__473 6 2 in + C_SWSP + ((concat_vec (ui76 : bits 2) (ui52 : bits 4), rs2)) + else if ((andb + (eq_vec (subrange_vec_dec v__473 15 13) + (vec_of_bits [B1;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) + then + let ui86 : bits 3 := subrange_vec_dec v__473 9 7 in + let ui53 : bits 3 := subrange_vec_dec v__473 12 10 in + let rs2 : regbits := subrange_vec_dec v__473 6 2 in + C_SDSP + ((concat_vec (ui86 : bits 3) (ui53 : bits 3), rs2)) + else if ((andb + (let rs1 : regbits := subrange_vec_dec v__473 11 7 in + neq_int (projT1 (regbits_to_regno rs1)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__473 15 12) + (vec_of_bits [B1;B0;B0;B0] : mword (15 - 12 + 1))) + (eq_vec (subrange_vec_dec v__473 6 0) + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0] : mword (6 - 0 + 1)))))) then + let rs1 : regbits := subrange_vec_dec v__473 11 7 in + C_JR + (rs1) + else if ((andb + (let rs1 : regbits := subrange_vec_dec v__473 11 7 in + neq_int (projT1 (regbits_to_regno rs1)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__473 15 12) + (vec_of_bits [B1;B0;B0;B1] : mword (15 - 12 + 1))) + (eq_vec (subrange_vec_dec v__473 6 0) + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0] : mword (6 - 0 + 1)))))) then + let rs1 : regbits := subrange_vec_dec v__473 11 7 in + C_JALR + (rs1) + else if ((andb + (let rs2 : regbits := subrange_vec_dec v__473 6 2 in + let rd : regbits := subrange_vec_dec v__473 11 7 in + andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (neq_int (projT1 (regbits_to_regno rs2)) (projT1 (regbits_to_regno zreg)))) + (andb + (eq_vec (subrange_vec_dec v__473 15 12) + (vec_of_bits [B1;B0;B0;B0] : mword (15 - 12 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + let rs2 : regbits := subrange_vec_dec v__473 6 2 in + let rd : regbits := subrange_vec_dec v__473 11 7 in + C_MV + ((rd, rs2)) + else if ((eq_vec v__473 + (vec_of_bits [B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 16))) then + C_EBREAK + (tt) + else if ((andb + (let rsd : regbits := subrange_vec_dec v__473 11 7 in + let rs2 : regbits := subrange_vec_dec v__473 6 2 in + andb (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))) + (neq_int (projT1 (regbits_to_regno rs2)) (projT1 (regbits_to_regno zreg)))) + (andb + (eq_vec (subrange_vec_dec v__473 15 12) + (vec_of_bits [B1;B0;B0;B1] : mword (15 - 12 + 1))) + (eq_vec (subrange_vec_dec v__473 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + let rsd : regbits := subrange_vec_dec v__473 11 7 in + let rs2 : regbits := subrange_vec_dec v__473 6 2 in + C_ADD + ((rsd, rs2)) + else C_ILLEGAL (v__473). + +Definition encdec_compressed_forwards_matches (arg_ : ast) +: bool := + + match arg_ with + | C_NOP (tt) => true + | C_ADDI4SPN (rd,v__606) => + if ((let nz96 : bits 4 := subrange_vec_dec v__606 7 4 in + let nz96 : bits 4 := subrange_vec_dec v__606 7 4 in + let nz54 : bits 2 := subrange_vec_dec v__606 3 2 in + let nz3 : bits 1 := subrange_vec_dec v__606 1 1 in + let nz2 : bits 1 := subrange_vec_dec v__606 0 0 in + neq_vec (concat_vec nz96 (concat_vec nz54 (concat_vec nz3 nz2))) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] : mword (4 + (2 + (1 + 1)))))) then + true + else + let g__35 := C_ADDI4SPN ((rd, v__606)) in + false + | C_LW (v__607,rs1,rd) => true + | C_LD (v__608,rs1,rd) => true + | C_SW (v__609,rs1,rs2) => true + | C_SD (v__610,rs1,rs2) => true + | C_ADDI (v__611,rsd) => + if ((let nzi5 : bits 1 := subrange_vec_dec v__611 5 5 in + let nzi5 : bits 1 := subrange_vec_dec v__611 5 5 in + let nzi40 : bits 5 := subrange_vec_dec v__611 4 0 in + andb (neq_vec (concat_vec nzi5 nzi40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))))) then + true + else + let g__35 := C_ADDI ((v__611, rsd)) in + false + | C_ADDIW (v__612,rsd) => + if ((neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__35 := C_ADDIW ((v__612, rsd)) in + false + | C_LI (v__613,rd) => + if ((neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__35 := C_LI ((v__613, rd)) in + false + | C_ADDI16SP (v__614) => + if ((let nzi9 : bits 1 := subrange_vec_dec v__614 5 5 in + let nzi9 : bits 1 := subrange_vec_dec v__614 5 5 in + let nzi87 : bits 2 := subrange_vec_dec v__614 4 3 in + let nzi6 : bits 1 := subrange_vec_dec v__614 2 2 in + let nzi5 : bits 1 := subrange_vec_dec v__614 1 1 in + let nzi4 : bits 1 := subrange_vec_dec v__614 0 0 in + neq_vec (concat_vec nzi9 (concat_vec nzi87 (concat_vec nzi6 (concat_vec nzi5 nzi4)))) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + (2 + (1 + (1 + 1))))))) then + true + else + let g__35 := C_ADDI16SP (v__614) in + false + | C_LUI (v__615,rd) => + if ((let imm17 : bits 1 := subrange_vec_dec v__615 5 5 in + let imm17 : bits 1 := subrange_vec_dec v__615 5 5 in + let imm1612 : bits 5 := subrange_vec_dec v__615 4 0 in + andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno sp))) + (neq_vec (concat_vec imm17 imm1612) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5)))))) + then + true + else + let g__35 := C_LUI ((v__615, rd)) in + false + | C_SRLI (v__616,rsd) => + if ((let nzui5 : bits 1 := subrange_vec_dec v__616 5 5 in + let nzui5 : bits 1 := subrange_vec_dec v__616 5 5 in + let nzui40 : bits 5 := subrange_vec_dec v__616 4 0 in + neq_vec (concat_vec nzui5 nzui40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5)))) then + true + else + let g__35 := C_SRLI ((v__616, rsd)) in + false + | C_SRAI (v__617,rsd) => + if ((let nzui5 : bits 1 := subrange_vec_dec v__617 5 5 in + let nzui5 : bits 1 := subrange_vec_dec v__617 5 5 in + let nzui40 : bits 5 := subrange_vec_dec v__617 4 0 in + neq_vec (concat_vec nzui5 nzui40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5)))) then + true + else + let g__35 := C_SRAI ((v__617, rsd)) in + false + | C_ANDI (v__618,rsd) => true + | C_SUB (rsd,rs2) => true + | C_XOR (rsd,rs2) => true + | C_OR (rsd,rs2) => true + | C_AND (rsd,rs2) => true + | C_SUBW (rsd,rs2) => true + | C_ADDW (rsd,rs2) => true + | C_J (v__619) => true + | C_BEQZ (v__620,rs) => true + | C_BNEZ (v__621,rs) => true + | C_SLLI (v__622,rsd) => + if ((let nzui5 : bits 1 := subrange_vec_dec v__622 5 5 in + let nzui5 : bits 1 := subrange_vec_dec v__622 5 5 in + let nzui40 : bits 5 := subrange_vec_dec v__622 4 0 in + andb (neq_vec (concat_vec nzui5 nzui40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))))) then + true + else + let g__35 := C_SLLI ((v__622, rsd)) in + false + | C_LWSP (v__623,rd) => + if ((neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__35 := C_LWSP ((v__623, rd)) in + false + | C_LDSP (v__624,rd) => + if ((neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__35 := C_LDSP ((v__624, rd)) in + false + | C_SWSP (v__625,rs2) => true + | C_SDSP (v__626,rs2) => true + | C_JR (rs1) => + if ((neq_int (projT1 (regbits_to_regno rs1)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__35 := C_JR (rs1) in + false + | C_JALR (rs1) => + if ((neq_int (projT1 (regbits_to_regno rs1)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__35 := C_JALR (rs1) in + false + | C_MV (rd,rs2) => + if ((andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (neq_int (projT1 (regbits_to_regno rs2)) (projT1 (regbits_to_regno zreg))))) then + true + else + let g__35 := C_MV ((rd, rs2)) in + false + | C_EBREAK (tt) => true + | C_ADD (rsd,rs2) => + if ((andb (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))) + (neq_int (projT1 (regbits_to_regno rs2)) (projT1 (regbits_to_regno zreg))))) then + true + else + let g__35 := C_ADD ((rsd, rs2)) in + false + | C_ILLEGAL (s) => true + | g__35 => false + end. + +Definition encdec_compressed_backwards_matches (arg_ : mword 16) +: bool := + + let v__627 := arg_ in + if ((eq_vec v__627 (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1] : mword 16))) + then + true + else if ((andb + (let nz96 : bits 4 := subrange_vec_dec v__627 10 7 in + let nz54 : bits 2 := subrange_vec_dec v__627 12 11 in + let nz3 : bits 1 := subrange_vec_dec v__627 5 5 in + let nz2 : bits 1 := subrange_vec_dec v__627 6 6 in + neq_vec (concat_vec nz96 (concat_vec nz54 (concat_vec nz3 nz2))) + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] : mword (4 + (2 + (1 + 1))))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B0;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (let rsd : regbits := subrange_vec_dec v__627 11 7 in + let nzi5 : bits 1 := subrange_vec_dec v__627 12 12 in + let nzi40 : bits 5 := subrange_vec_dec v__627 6 2 in + andb + (neq_vec (concat_vec nzi5 nzi40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg)))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B0;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (let rsd : regbits := subrange_vec_dec v__627 11 7 in + neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B0;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (let rd : regbits := subrange_vec_dec v__627 11 7 in + neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if sumbool_of_bool ((andb + (let nzi9 : bits 1 := subrange_vec_dec v__627 12 12 in + let nzi87 : bits 2 := subrange_vec_dec v__627 4 3 in + let nzi6 : bits 1 := subrange_vec_dec v__627 5 5 in + let nzi5 : bits 1 := subrange_vec_dec v__627 2 2 in + let nzi4 : bits 1 := subrange_vec_dec v__627 6 6 in + neq_vec + (concat_vec nzi9 + (concat_vec nzi87 (concat_vec nzi6 (concat_vec nzi5 nzi4)))) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + (2 + (1 + (1 + 1)))))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B1;B1] : mword (15 - 13 + 1))) + (andb + (Z.eqb + (projT1 (regbits_to_regno (subrange_vec_dec v__627 11 7))) + (projT1 (regbits_to_regno + (vec_of_bits [B0;B0;B0;B1;B0] : mword 5)))) + (eq_vec (subrange_vec_dec v__627 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))))) then + true + else if ((andb + (let rd : regbits := subrange_vec_dec v__627 11 7 in + let imm17 : bits 1 := subrange_vec_dec v__627 12 12 in + let imm1612 : bits 5 := subrange_vec_dec v__627 6 2 in + andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno sp))) + (neq_vec (concat_vec imm17 imm1612) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (let nzui5 : bits 1 := subrange_vec_dec v__627 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__627 6 2 in + neq_vec (concat_vec nzui5 nzui40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B0;B0] : mword (15 - 13 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 11 10) + (vec_of_bits [B0;B0] : mword (11 - 10 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))))) then + true + else if ((andb + (let nzui5 : bits 1 := subrange_vec_dec v__627 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__627 6 2 in + neq_vec (concat_vec nzui5 nzui40) (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B0;B0] : mword (15 - 13 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 11 10) + (vec_of_bits [B0;B1] : mword (11 - 10 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))))) then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B0;B0] : mword (15 - 13 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 11 10) + (vec_of_bits [B1;B0] : mword (11 - 10 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 10) + (vec_of_bits [B1;B0;B0;B0;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 6 5) (vec_of_bits [B0;B0] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 10) + (vec_of_bits [B1;B0;B0;B0;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 6 5) (vec_of_bits [B0;B1] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 10) + (vec_of_bits [B1;B0;B0;B0;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 6 5) (vec_of_bits [B1;B0] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 10) + (vec_of_bits [B1;B0;B0;B0;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 6 5) (vec_of_bits [B1;B1] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 10) + (vec_of_bits [B1;B0;B0;B1;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 6 5) (vec_of_bits [B0;B0] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 10) + (vec_of_bits [B1;B0;B0;B1;B1;B1] : mword (15 - 10 + 1))) + (andb + (eq_vec (subrange_vec_dec v__627 6 5) (vec_of_bits [B0;B1] : mword (6 - 5 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B0;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (let rsd : regbits := subrange_vec_dec v__627 11 7 in + let nzui5 : bits 1 := subrange_vec_dec v__627 12 12 in + let nzui40 : bits 5 := subrange_vec_dec v__627 6 2 in + andb + (neq_vec (concat_vec nzui5 nzui40) + (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword (1 + 5))) + (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg)))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B0;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (let rd : regbits := subrange_vec_dec v__627 11 7 in + neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (let rd : regbits := subrange_vec_dec v__627 11 7 in + neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B0;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B1;B0] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (eq_vec (subrange_vec_dec v__627 15 13) + (vec_of_bits [B1;B1;B1] : mword (15 - 13 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) + then + true + else if ((andb + (let rs1 : regbits := subrange_vec_dec v__627 11 7 in + neq_int (projT1 (regbits_to_regno rs1)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__627 15 12) + (vec_of_bits [B1;B0;B0;B0] : mword (15 - 12 + 1))) + (eq_vec (subrange_vec_dec v__627 6 0) + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (let rs1 : regbits := subrange_vec_dec v__627 11 7 in + neq_int (projT1 (regbits_to_regno rs1)) (projT1 (regbits_to_regno zreg))) + (andb + (eq_vec (subrange_vec_dec v__627 15 12) + (vec_of_bits [B1;B0;B0;B1] : mword (15 - 12 + 1))) + (eq_vec (subrange_vec_dec v__627 6 0) + (vec_of_bits [B0;B0;B0;B0;B0;B1;B0] : mword (6 - 0 + 1)))))) then + true + else if ((andb + (let rs2 : regbits := subrange_vec_dec v__627 6 2 in + let rd : regbits := subrange_vec_dec v__627 11 7 in + andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (neq_int (projT1 (regbits_to_regno rs2)) (projT1 (regbits_to_regno zreg)))) + (andb + (eq_vec (subrange_vec_dec v__627 15 12) + (vec_of_bits [B1;B0;B0;B0] : mword (15 - 12 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + true + else if ((eq_vec v__627 + (vec_of_bits [B1;B0;B0;B1;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B1;B0] : mword 16))) then + true + else if ((andb + (let rsd : regbits := subrange_vec_dec v__627 11 7 in + let rs2 : regbits := subrange_vec_dec v__627 6 2 in + andb (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))) + (neq_int (projT1 (regbits_to_regno rs2)) (projT1 (regbits_to_regno zreg)))) + (andb + (eq_vec (subrange_vec_dec v__627 15 12) + (vec_of_bits [B1;B0;B0;B1] : mword (15 - 12 + 1))) + (eq_vec (subrange_vec_dec v__627 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1)))))) + then + true + else true. + +Definition assembly_forwards (arg_ : ast) +: M (string) := + + (match arg_ with + | UTYPE (imm,rd,op) => + returnm ((string_append (utype_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))) + : string) + | RISCV_JAL (imm,rd) => + returnm ((string_append "jal" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))) + : string) + | RISCV_JALR (imm,rs1,rd) => + returnm ((string_append "jalr" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))))) + : string) + | BTYPE (imm,rs2,rs1,op) => + returnm ((string_append (btype_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))))) + : string) + | ITYPE (imm,rs1,rd,op) => + returnm ((string_append (itype_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))))) + : string) + | SHIFTIOP (shamt,rs1,rd,op) => + returnm ((string_append (shiftiop_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (decimal_string_of_bits shamt) "")))))) + : string) + | RTYPE (rs2,rs1,rd,op) => + returnm ((string_append (rtype_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) ""))))))) + : string) + | LOAD (imm,rs1,rd,is_unsigned,size,aq,rl) => + returnm ((string_append "l" + (string_append (size_mnemonic_forwards size) + (string_append (maybe_u_forwards is_unsigned) + (string_append (maybe_aq_forwards aq) + (string_append (maybe_rl_forwards rl) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))))))))) + : string) + | STORE (imm,rs1,rd,size,aq,rl) => + returnm ((string_append "s" + (string_append (size_mnemonic_forwards size) + (string_append (maybe_aq_forwards aq) + (string_append (maybe_rl_forwards rl) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) "")))))))))) + : string) + | ADDIW (imm,rs1,rd) => + returnm ((string_append "addiw" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))))) + : string) + | SHIFTW (shamt,rs1,rd,op) => + returnm ((string_append (shiftw_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits shamt) ""))))))) + : string) + | RTYPEW (rs2,rs1,rd,op) => + returnm ((string_append (rtypew_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) ""))))))) + : string) + | SHIFTIWOP (shamt,rs1,rd,op) => + returnm ((string_append (shiftiwop_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (decimal_string_of_bits shamt) "")))))) + : string) + | MUL (rs2,rs1,rd,high,signed1,signed2) => + (mul_mnemonic_forwards (high, signed1, signed2)) >>= fun w__0 : string => + returnm ((string_append w__0 + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) ""))))))) + : string) + | DIV (rs2,rs1,rd,s) => + returnm ((string_append "div" + (string_append (maybe_not_u_forwards s) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) "")))))))) + : string) + | REM (rs2,rs1,rd,s) => + returnm ((string_append "rem" + (string_append (maybe_not_u_forwards s) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) "")))))))) + : string) + | MULW (rs2,rs1,rd) => + returnm ((string_append "mulw" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) ""))))))) + : string) + | DIVW (rs2,rs1,rd,s) => + returnm ((string_append "div" + (string_append (maybe_not_u_forwards s) + (string_append "w" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) ""))))))))) + : string) + | REMW (rs2,rs1,rd,s) => + returnm ((string_append "rem" + (string_append (maybe_not_u_forwards s) + (string_append "w" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) ""))))))))) + : string) + | FENCE (pred,succ) => + returnm ((string_append "fence" + (string_append (spc_forwards tt) + (string_append (fence_bits_forwards pred) + (string_append (sep_forwards tt) + (string_append (fence_bits_forwards succ) ""))))) + : string) + | FENCE_TSO (pred,succ) => + returnm ((string_append "fence.tso" + (string_append (spc_forwards tt) + (string_append (fence_bits_forwards pred) + (string_append (sep_forwards tt) + (string_append (fence_bits_forwards succ) ""))))) + : string) + | FENCEI (tt) => returnm ("fence.i" : string) + | ECALL (tt) => returnm ("ecall" : string) + | MRET (tt) => returnm ("mret" : string) + | SRET (tt) => returnm ("sret" : string) + | EBREAK (tt) => returnm ("ebreak" : string) + | WFI (tt) => returnm ("wfi" : string) + | SFENCE_VMA (rs1,rs2) => + returnm ((string_append "sfence.vma" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) (string_append (reg_name_forwards rs2) ""))))) + : string) + | LOADRES (aq,rl,rs1,size,rd) => + returnm ((string_append "lr." + (string_append (size_mnemonic_forwards size) + (string_append (maybe_aq_forwards aq) + (string_append (maybe_rl_forwards rl) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) "")))))))) + : string) + | STORECON (aq,rl,rs2,rs1,size,rd) => + returnm ((string_append "sc." + (string_append (size_mnemonic_forwards size) + (string_append (maybe_aq_forwards aq) + (string_append (maybe_rl_forwards rl) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) "")))))))))) + : string) + | AMO (op,aq,rl,rs2,rs1,width,rd) => + returnm ((string_append (amo_mnemonic_forwards op) + (string_append "." + (string_append (size_mnemonic_forwards width) + (string_append (maybe_aq_forwards aq) + (string_append (maybe_rl_forwards rl) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs2) ""))))))))))) + : string) + | CSR (csr,rs1,rd,true,op) => + returnm ((string_append (csr_mnemonic_forwards op) + (string_append "i" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits rs1) + (string_append (sep_forwards tt) + (string_append (csr_name_map_forwards csr) "")))))))) + : string) + | CSR (csr,rs1,rd,false,op) => + returnm ((string_append (csr_mnemonic_forwards op) + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (reg_name_forwards rs1) + (string_append (sep_forwards tt) + (string_append (csr_name_map_forwards csr) ""))))))) + : string) + | C_NOP (tt) => returnm ("c.nop" : string) + | C_ADDI4SPN (rdc,nzimm) => + returnm ((string_append "c.addi4spn" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rdc) + (string_append (sep_forwards tt) + (string_append + (decimal_string_of_bits + (concat_vec (nzimm : mword 8) (vec_of_bits [B0;B0] : mword 2))) + ""))))) + : string) + | C_LW (uimm,rsc,rdc) => + returnm ((string_append "c.lw" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rdc) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rsc) + (string_append (sep_forwards tt) + (string_append + (decimal_string_of_bits + (concat_vec (uimm : mword 5) + (vec_of_bits [B0;B0] : mword 2))) ""))))))) + : string) + | C_LD (uimm,rsc,rdc) => + returnm ((string_append "c.ld" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rdc) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rsc) + (string_append (sep_forwards tt) + (string_append + (decimal_string_of_bits + (concat_vec (uimm : mword 5) + (vec_of_bits [B0;B0;B0] : mword 3))) ""))))))) + : string) + | C_SW (uimm,rsc1,rsc2) => + returnm ((string_append "c.sw" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsc1) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rsc2) + (string_append (sep_forwards tt) + (string_append + (decimal_string_of_bits + (concat_vec (uimm : mword 5) + (vec_of_bits [B0;B0] : mword 2))) ""))))))) + : string) + | C_SD (uimm,rsc1,rsc2) => + returnm ((string_append "c.sd" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsc1) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rsc2) + (string_append (sep_forwards tt) + (string_append + (decimal_string_of_bits + (concat_vec (uimm : mword 5) + (vec_of_bits [B0;B0;B0] : mword 3))) ""))))))) + : string) + | C_ADDI (nzi,rsd) => + returnm ((string_append "c.addi" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits nzi) ""))))) + : string) + | C_JAL (imm) => + returnm ((string_append "c.jal" + (string_append (spc_forwards tt) + (string_append + (decimal_string_of_bits + (concat_vec (imm : mword 11) (vec_of_bits [B0] : mword 1))) ""))) + : string) + | C_ADDIW (imm,rsd) => + returnm ((string_append "c.addiw" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))) + : string) + | C_LI (imm,rd) => + returnm ((string_append "c.li" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))) + : string) + | C_ADDI16SP (imm) => + returnm ((string_append "c.addi16sp" + (string_append (spc_forwards tt) (string_append (decimal_string_of_bits imm) ""))) + : string) + | C_LUI (imm,rd) => + returnm ((string_append "c.lui" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))) + : string) + | C_SRLI (shamt,rsd) => + returnm ((string_append "c.srli" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits shamt) ""))))) + : string) + | C_SRAI (shamt,rsd) => + returnm ((string_append "c.srai" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits shamt) ""))))) + : string) + | C_ANDI (imm,rsd) => + returnm ((string_append "c.andi" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))) + : string) + | C_SUB (rsd,rs2) => + returnm ((string_append "c.sub" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rs2) ""))))) + : string) + | C_XOR (rsd,rs2) => + returnm ((string_append "c.xor" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rs2) ""))))) + : string) + | C_OR (rsd,rs2) => + returnm ((string_append "c.or" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rs2) ""))))) + : string) + | C_AND (rsd,rs2) => + returnm ((string_append "c.and" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rs2) ""))))) + : string) + | C_SUBW (rsd,rs2) => + returnm ((string_append "c.subw" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rs2) ""))))) + : string) + | C_ADDW (rsd,rs2) => + returnm ((string_append "c.addw" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (creg_name_forwards rs2) ""))))) + : string) + | C_J (imm) => + returnm ((string_append "c.j" + (string_append (spc_forwards tt) (string_append (decimal_string_of_bits imm) ""))) + : string) + | C_BEQZ (imm,rs) => + returnm ((string_append "c.beqz" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rs) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))) + : string) + | C_BNEZ (imm,rs) => + returnm ((string_append "c.bnez" + (string_append (spc_forwards tt) + (string_append (creg_name_forwards rs) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits imm) ""))))) + : string) + | C_SLLI (shamt,rsd) => + returnm ((string_append "c.slli" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rsd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits shamt) ""))))) + : string) + | C_LWSP (uimm,rd) => + returnm ((string_append "c.lwsp" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits uimm) ""))))) + : string) + | C_LDSP (uimm,rd) => + returnm ((string_append "c.ldsp" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits uimm) ""))))) + : string) + | C_SWSP (uimm,rd) => + returnm ((string_append "c.swsp" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits uimm) ""))))) + : string) + | C_SDSP (uimm,rs2) => + returnm ((string_append "c.sdsp" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rs2) + (string_append (sep_forwards tt) + (string_append (decimal_string_of_bits uimm) ""))))) + : string) + | C_JR (rs1) => + returnm ((string_append "c.jr" + (string_append (spc_forwards tt) (string_append (reg_name_forwards rs1) ""))) + : string) + | C_JALR (rs1) => + returnm ((string_append "c.jalr" + (string_append (spc_forwards tt) (string_append (reg_name_forwards rs1) ""))) + : string) + | C_MV (rd,rs2) => + returnm ((string_append "c.mv" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rd) + (string_append (sep_forwards tt) (string_append (reg_name_forwards rs2) ""))))) + : string) + | C_EBREAK (tt) => returnm ("c.ebreak" : string) + | C_ADD (rsd,rs2) => + returnm ((string_append "c.add" + (string_append (spc_forwards tt) + (string_append (reg_name_forwards rsd) + (string_append (sep_forwards tt) (string_append (reg_name_forwards rs2) ""))))) + : string) + | STOP_FETCHING (tt) => returnm ("stop_fetching" : string) + | THREAD_START (tt) => returnm ("thread_start" : string) + | ILLEGAL (s) => + returnm ((string_append "illegal" + (string_append (spc_forwards tt) (string_append (decimal_string_of_bits s) ""))) + : string) + | C_ILLEGAL (s) => + returnm ((string_append "c.illegal" + (string_append (spc_forwards tt) (string_append (decimal_string_of_bits s) ""))) + : string) + end) + : M (string). + +Definition _s1661_ (_s1662_ : string) +: M (option (mword 16)) := + + let _s1663_ := _s1662_ in + (if ((string_startswith _s1663_ "c.illegal")) then + (match (string_drop _s1663_ (projT1 (string_length "c.illegal"))) with + | _s1664_ => + (spc_matches_prefix _s1664_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s1665_ _)) => + match (string_drop _s1664_ _s1665_) with + | _s1666_ => + match (hex_bits_16_matches_prefix _s1666_) with + | Some (s,(existT _ _s1667_ _)) => + let p0_ := string_drop _s1666_ _s1667_ in + if ((generic_eq p0_ "")) then Some (s) + else None + | _ => None + end + end + | _ => None + end) + : option (mword 16)) + end) + : M (option (mword 16)) + else returnm (None : option (mword 16))) + : M (option (mword 16)). + +Definition _s1653_ (_s1654_ : string) +: M (option (mword 32)) := + + let _s1655_ := _s1654_ in + (if ((string_startswith _s1655_ "illegal")) then + (match (string_drop _s1655_ (projT1 (string_length "illegal"))) with + | _s1656_ => + (spc_matches_prefix _s1656_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s1657_ _)) => + match (string_drop _s1656_ _s1657_) with + | _s1658_ => + match (hex_bits_32_matches_prefix _s1658_) with + | Some (s,(existT _ _s1659_ _)) => + let p0_ := string_drop _s1658_ _s1659_ in + if ((generic_eq p0_ "")) then Some (s) + else None + | _ => None + end + end + | _ => None + end) + : option (mword 32)) + end) + : M (option (mword 32)) + else returnm (None : option (mword 32))) + : M (option (mword 32)). + +Definition _s1641_ (_s1642_ : string) +: M (option ((mword 5 * mword 5))) := + + let _s1643_ := _s1642_ in + (if ((string_startswith _s1643_ "c.add")) then + (match (string_drop _s1643_ (projT1 (string_length "c.add"))) with + | _s1644_ => + (spc_matches_prefix _s1644_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1645_ _)) => + (match (string_drop _s1644_ _s1645_) with + | _s1646_ => + (reg_name_matches_prefix _s1646_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1647_ _)) => + (match (string_drop _s1646_ _s1647_) with + | _s1648_ => + (sep_matches_prefix _s1648_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1649_ _)) => + (match (string_drop _s1648_ _s1649_) with + | _s1650_ => + (reg_name_matches_prefix _s1650_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1651_ _)) => + let p0_ := string_drop _s1650_ _s1651_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + else returnm (None : option ((mword 5 * mword 5)))) + : M (option ((mword 5 * mword 5))). + +Definition _s1629_ (_s1630_ : string) +: M (option ((mword 5 * mword 5))) := + + let _s1631_ := _s1630_ in + (if ((string_startswith _s1631_ "c.mv")) then + (match (string_drop _s1631_ (projT1 (string_length "c.mv"))) with + | _s1632_ => + (spc_matches_prefix _s1632_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1633_ _)) => + (match (string_drop _s1632_ _s1633_) with + | _s1634_ => + (reg_name_matches_prefix _s1634_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1635_ _)) => + (match (string_drop _s1634_ _s1635_) with + | _s1636_ => + (sep_matches_prefix _s1636_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1637_ _)) => + (match (string_drop _s1636_ _s1637_) with + | _s1638_ => + (reg_name_matches_prefix _s1638_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1639_ _)) => + let p0_ := string_drop _s1638_ _s1639_ in + if ((generic_eq p0_ "")) then Some ((rd, rs2)) + else None + | _ => None + end) + : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + else returnm (None : option ((mword 5 * mword 5)))) + : M (option ((mword 5 * mword 5))). + +Definition _s1621_ (_s1622_ : string) +: M (option (mword 5)) := + + let _s1623_ := _s1622_ in + (if ((string_startswith _s1623_ "c.jalr")) then + (match (string_drop _s1623_ (projT1 (string_length "c.jalr"))) with + | _s1624_ => + (spc_matches_prefix _s1624_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1625_ _)) => + (match (string_drop _s1624_ _s1625_) with + | _s1626_ => + (reg_name_matches_prefix _s1626_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (rs1,(existT _ _s1627_ _)) => + let p0_ := string_drop _s1626_ _s1627_ in + if ((generic_eq p0_ "")) then Some (rs1) + else None + | _ => None + end) + : option (mword 5)) + end) + : M (option (mword 5)) + | _ => returnm (None : option (mword 5)) + end) + : M (option (mword 5)) + end) + : M (option (mword 5)) + else returnm (None : option (mword 5))) + : M (option (mword 5)). + +Definition _s1613_ (_s1614_ : string) +: M (option (mword 5)) := + + let _s1615_ := _s1614_ in + (if ((string_startswith _s1615_ "c.jr")) then + (match (string_drop _s1615_ (projT1 (string_length "c.jr"))) with + | _s1616_ => + (spc_matches_prefix _s1616_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1617_ _)) => + (match (string_drop _s1616_ _s1617_) with + | _s1618_ => + (reg_name_matches_prefix _s1618_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (rs1,(existT _ _s1619_ _)) => + let p0_ := string_drop _s1618_ _s1619_ in + if ((generic_eq p0_ "")) then Some (rs1) + else None + | _ => None + end) + : option (mword 5)) + end) + : M (option (mword 5)) + | _ => returnm (None : option (mword 5)) + end) + : M (option (mword 5)) + end) + : M (option (mword 5)) + else returnm (None : option (mword 5))) + : M (option (mword 5)). + +Definition _s1601_ (_s1602_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1603_ := _s1602_ in + (if ((string_startswith _s1603_ "c.sdsp")) then + (match (string_drop _s1603_ (projT1 (string_length "c.sdsp"))) with + | _s1604_ => + (spc_matches_prefix _s1604_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1605_ _)) => + (match (string_drop _s1604_ _s1605_) with + | _s1606_ => + (reg_name_matches_prefix _s1606_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs2,(existT _ _s1607_ _)) => + (match (string_drop _s1606_ _s1607_) with + | _s1608_ => + (sep_matches_prefix _s1608_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1609_ _)) => + match (string_drop _s1608_ _s1609_) with + | _s1610_ => + match (hex_bits_6_matches_prefix _s1610_) with + | Some (uimm,(existT _ _s1611_ _)) => + let p0_ := string_drop _s1610_ _s1611_ in + if ((generic_eq p0_ "")) then Some ((rs2, uimm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1589_ (_s1590_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1591_ := _s1590_ in + (if ((string_startswith _s1591_ "c.swsp")) then + (match (string_drop _s1591_ (projT1 (string_length "c.swsp"))) with + | _s1592_ => + (spc_matches_prefix _s1592_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1593_ _)) => + (match (string_drop _s1592_ _s1593_) with + | _s1594_ => + (reg_name_matches_prefix _s1594_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1595_ _)) => + (match (string_drop _s1594_ _s1595_) with + | _s1596_ => + (sep_matches_prefix _s1596_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1597_ _)) => + match (string_drop _s1596_ _s1597_) with + | _s1598_ => + match (hex_bits_6_matches_prefix _s1598_) with + | Some (uimm,(existT _ _s1599_ _)) => + let p0_ := string_drop _s1598_ _s1599_ in + if ((generic_eq p0_ "")) then Some ((rd, uimm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1577_ (_s1578_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1579_ := _s1578_ in + (if ((string_startswith _s1579_ "c.ldsp")) then + (match (string_drop _s1579_ (projT1 (string_length "c.ldsp"))) with + | _s1580_ => + (spc_matches_prefix _s1580_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1581_ _)) => + (match (string_drop _s1580_ _s1581_) with + | _s1582_ => + (reg_name_matches_prefix _s1582_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1583_ _)) => + (match (string_drop _s1582_ _s1583_) with + | _s1584_ => + (sep_matches_prefix _s1584_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1585_ _)) => + match (string_drop _s1584_ _s1585_) with + | _s1586_ => + match (hex_bits_6_matches_prefix _s1586_) with + | Some (uimm,(existT _ _s1587_ _)) => + let p0_ := string_drop _s1586_ _s1587_ in + if ((generic_eq p0_ "")) then Some ((rd, uimm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1565_ (_s1566_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1567_ := _s1566_ in + (if ((string_startswith _s1567_ "c.lwsp")) then + (match (string_drop _s1567_ (projT1 (string_length "c.lwsp"))) with + | _s1568_ => + (spc_matches_prefix _s1568_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1569_ _)) => + (match (string_drop _s1568_ _s1569_) with + | _s1570_ => + (reg_name_matches_prefix _s1570_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1571_ _)) => + (match (string_drop _s1570_ _s1571_) with + | _s1572_ => + (sep_matches_prefix _s1572_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1573_ _)) => + match (string_drop _s1572_ _s1573_) with + | _s1574_ => + match (hex_bits_6_matches_prefix _s1574_) with + | Some (uimm,(existT _ _s1575_ _)) => + let p0_ := string_drop _s1574_ _s1575_ in + if ((generic_eq p0_ "")) then Some ((rd, uimm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1553_ (_s1554_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1555_ := _s1554_ in + (if ((string_startswith _s1555_ "c.slli")) then + (match (string_drop _s1555_ (projT1 (string_length "c.slli"))) with + | _s1556_ => + (spc_matches_prefix _s1556_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1557_ _)) => + (match (string_drop _s1556_ _s1557_) with + | _s1558_ => + (reg_name_matches_prefix _s1558_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1559_ _)) => + (match (string_drop _s1558_ _s1559_) with + | _s1560_ => + (sep_matches_prefix _s1560_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1561_ _)) => + match (string_drop _s1560_ _s1561_) with + | _s1562_ => + match (hex_bits_6_matches_prefix _s1562_) with + | Some (shamt,(existT _ _s1563_ _)) => + let p0_ := string_drop _s1562_ _s1563_ in + if ((generic_eq p0_ "")) then Some ((rsd, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1541_ (_s1542_ : string) +: M (option ((mword 3 * mword 8))) := + + let _s1543_ := _s1542_ in + (if ((string_startswith _s1543_ "c.bnez")) then + (match (string_drop _s1543_ (projT1 (string_length "c.bnez"))) with + | _s1544_ => + (spc_matches_prefix _s1544_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1545_ _)) => + (match (string_drop _s1544_ _s1545_) with + | _s1546_ => + (creg_name_matches_prefix _s1546_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs,(existT _ _s1547_ _)) => + (match (string_drop _s1546_ _s1547_) with + | _s1548_ => + (sep_matches_prefix _s1548_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1549_ _)) => + match (string_drop _s1548_ _s1549_) with + | _s1550_ => + match (hex_bits_8_matches_prefix _s1550_) with + | Some (imm,(existT _ _s1551_ _)) => + let p0_ := string_drop _s1550_ _s1551_ in + if ((generic_eq p0_ "")) then Some ((rs, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + else returnm (None : option ((mword 3 * mword 8)))) + : M (option ((mword 3 * mword 8))). + +Definition _s1529_ (_s1530_ : string) +: M (option ((mword 3 * mword 8))) := + + let _s1531_ := _s1530_ in + (if ((string_startswith _s1531_ "c.beqz")) then + (match (string_drop _s1531_ (projT1 (string_length "c.beqz"))) with + | _s1532_ => + (spc_matches_prefix _s1532_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1533_ _)) => + (match (string_drop _s1532_ _s1533_) with + | _s1534_ => + (creg_name_matches_prefix _s1534_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs,(existT _ _s1535_ _)) => + (match (string_drop _s1534_ _s1535_) with + | _s1536_ => + (sep_matches_prefix _s1536_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1537_ _)) => + match (string_drop _s1536_ _s1537_) with + | _s1538_ => + match (hex_bits_8_matches_prefix _s1538_) with + | Some (imm,(existT _ _s1539_ _)) => + let p0_ := string_drop _s1538_ _s1539_ in + if ((generic_eq p0_ "")) then Some ((rs, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + else returnm (None : option ((mword 3 * mword 8)))) + : M (option ((mword 3 * mword 8))). + +Definition _s1521_ (_s1522_ : string) +: M (option (mword 11)) := + + let _s1523_ := _s1522_ in + (if ((string_startswith _s1523_ "c.j")) then + (match (string_drop _s1523_ (projT1 (string_length "c.j"))) with + | _s1524_ => + (spc_matches_prefix _s1524_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s1525_ _)) => + match (string_drop _s1524_ _s1525_) with + | _s1526_ => + match (hex_bits_11_matches_prefix _s1526_) with + | Some (imm,(existT _ _s1527_ _)) => + let p0_ := string_drop _s1526_ _s1527_ in + if ((generic_eq p0_ "")) then Some (imm) + else None + | _ => None + end + end + | _ => None + end) + : option (mword 11)) + end) + : M (option (mword 11)) + else returnm (None : option (mword 11))) + : M (option (mword 11)). + +Definition _s1509_ (_s1510_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s1511_ := _s1510_ in + (if ((string_startswith _s1511_ "c.addw")) then + (match (string_drop _s1511_ (projT1 (string_length "c.addw"))) with + | _s1512_ => + (spc_matches_prefix _s1512_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1513_ _)) => + (match (string_drop _s1512_ _s1513_) with + | _s1514_ => + (creg_name_matches_prefix _s1514_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1515_ _)) => + (match (string_drop _s1514_ _s1515_) with + | _s1516_ => + (sep_matches_prefix _s1516_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1517_ _)) => + (match (string_drop _s1516_ _s1517_) with + | _s1518_ => + (creg_name_matches_prefix _s1518_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1519_ _)) => + let p0_ := string_drop _s1518_ _s1519_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s1497_ (_s1498_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s1499_ := _s1498_ in + (if ((string_startswith _s1499_ "c.subw")) then + (match (string_drop _s1499_ (projT1 (string_length "c.subw"))) with + | _s1500_ => + (spc_matches_prefix _s1500_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1501_ _)) => + (match (string_drop _s1500_ _s1501_) with + | _s1502_ => + (creg_name_matches_prefix _s1502_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1503_ _)) => + (match (string_drop _s1502_ _s1503_) with + | _s1504_ => + (sep_matches_prefix _s1504_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1505_ _)) => + (match (string_drop _s1504_ _s1505_) with + | _s1506_ => + (creg_name_matches_prefix _s1506_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1507_ _)) => + let p0_ := string_drop _s1506_ _s1507_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s1485_ (_s1486_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s1487_ := _s1486_ in + (if ((string_startswith _s1487_ "c.and")) then + (match (string_drop _s1487_ (projT1 (string_length "c.and"))) with + | _s1488_ => + (spc_matches_prefix _s1488_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1489_ _)) => + (match (string_drop _s1488_ _s1489_) with + | _s1490_ => + (creg_name_matches_prefix _s1490_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1491_ _)) => + (match (string_drop _s1490_ _s1491_) with + | _s1492_ => + (sep_matches_prefix _s1492_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1493_ _)) => + (match (string_drop _s1492_ _s1493_) with + | _s1494_ => + (creg_name_matches_prefix _s1494_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1495_ _)) => + let p0_ := string_drop _s1494_ _s1495_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s1473_ (_s1474_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s1475_ := _s1474_ in + (if ((string_startswith _s1475_ "c.or")) then + (match (string_drop _s1475_ (projT1 (string_length "c.or"))) with + | _s1476_ => + (spc_matches_prefix _s1476_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1477_ _)) => + (match (string_drop _s1476_ _s1477_) with + | _s1478_ => + (creg_name_matches_prefix _s1478_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1479_ _)) => + (match (string_drop _s1478_ _s1479_) with + | _s1480_ => + (sep_matches_prefix _s1480_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1481_ _)) => + (match (string_drop _s1480_ _s1481_) with + | _s1482_ => + (creg_name_matches_prefix _s1482_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1483_ _)) => + let p0_ := string_drop _s1482_ _s1483_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s1461_ (_s1462_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s1463_ := _s1462_ in + (if ((string_startswith _s1463_ "c.xor")) then + (match (string_drop _s1463_ (projT1 (string_length "c.xor"))) with + | _s1464_ => + (spc_matches_prefix _s1464_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1465_ _)) => + (match (string_drop _s1464_ _s1465_) with + | _s1466_ => + (creg_name_matches_prefix _s1466_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1467_ _)) => + (match (string_drop _s1466_ _s1467_) with + | _s1468_ => + (sep_matches_prefix _s1468_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1469_ _)) => + (match (string_drop _s1468_ _s1469_) with + | _s1470_ => + (creg_name_matches_prefix _s1470_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1471_ _)) => + let p0_ := string_drop _s1470_ _s1471_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s1449_ (_s1450_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s1451_ := _s1450_ in + (if ((string_startswith _s1451_ "c.sub")) then + (match (string_drop _s1451_ (projT1 (string_length "c.sub"))) with + | _s1452_ => + (spc_matches_prefix _s1452_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1453_ _)) => + (match (string_drop _s1452_ _s1453_) with + | _s1454_ => + (creg_name_matches_prefix _s1454_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1455_ _)) => + (match (string_drop _s1454_ _s1455_) with + | _s1456_ => + (sep_matches_prefix _s1456_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1457_ _)) => + (match (string_drop _s1456_ _s1457_) with + | _s1458_ => + (creg_name_matches_prefix _s1458_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1459_ _)) => + let p0_ := string_drop _s1458_ _s1459_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s1437_ (_s1438_ : string) +: M (option ((mword 3 * mword 6))) := + + let _s1439_ := _s1438_ in + (if ((string_startswith _s1439_ "c.andi")) then + (match (string_drop _s1439_ (projT1 (string_length "c.andi"))) with + | _s1440_ => + (spc_matches_prefix _s1440_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1441_ _)) => + (match (string_drop _s1440_ _s1441_) with + | _s1442_ => + (creg_name_matches_prefix _s1442_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1443_ _)) => + (match (string_drop _s1442_ _s1443_) with + | _s1444_ => + (sep_matches_prefix _s1444_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1445_ _)) => + match (string_drop _s1444_ _s1445_) with + | _s1446_ => + match (hex_bits_6_matches_prefix _s1446_) with + | Some (imm,(existT _ _s1447_ _)) => + let p0_ := string_drop _s1446_ _s1447_ in + if ((generic_eq p0_ "")) then Some ((rsd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + else returnm (None : option ((mword 3 * mword 6)))) + : M (option ((mword 3 * mword 6))). + +Definition _s1425_ (_s1426_ : string) +: M (option ((mword 3 * mword 6))) := + + let _s1427_ := _s1426_ in + (if ((string_startswith _s1427_ "c.srai")) then + (match (string_drop _s1427_ (projT1 (string_length "c.srai"))) with + | _s1428_ => + (spc_matches_prefix _s1428_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1429_ _)) => + (match (string_drop _s1428_ _s1429_) with + | _s1430_ => + (creg_name_matches_prefix _s1430_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1431_ _)) => + (match (string_drop _s1430_ _s1431_) with + | _s1432_ => + (sep_matches_prefix _s1432_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1433_ _)) => + match (string_drop _s1432_ _s1433_) with + | _s1434_ => + match (hex_bits_6_matches_prefix _s1434_) with + | Some (shamt,(existT _ _s1435_ _)) => + let p0_ := string_drop _s1434_ _s1435_ in + if ((generic_eq p0_ "")) then Some ((rsd, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + else returnm (None : option ((mword 3 * mword 6)))) + : M (option ((mword 3 * mword 6))). + +Definition _s1413_ (_s1414_ : string) +: M (option ((mword 3 * mword 6))) := + + let _s1415_ := _s1414_ in + (if ((string_startswith _s1415_ "c.srli")) then + (match (string_drop _s1415_ (projT1 (string_length "c.srli"))) with + | _s1416_ => + (spc_matches_prefix _s1416_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1417_ _)) => + (match (string_drop _s1416_ _s1417_) with + | _s1418_ => + (creg_name_matches_prefix _s1418_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1419_ _)) => + (match (string_drop _s1418_ _s1419_) with + | _s1420_ => + (sep_matches_prefix _s1420_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1421_ _)) => + match (string_drop _s1420_ _s1421_) with + | _s1422_ => + match (hex_bits_6_matches_prefix _s1422_) with + | Some (shamt,(existT _ _s1423_ _)) => + let p0_ := string_drop _s1422_ _s1423_ in + if ((generic_eq p0_ "")) then Some ((rsd, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + else returnm (None : option ((mword 3 * mword 6)))) + : M (option ((mword 3 * mword 6))). + +Definition _s1401_ (_s1402_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1403_ := _s1402_ in + (if ((string_startswith _s1403_ "c.lui")) then + (match (string_drop _s1403_ (projT1 (string_length "c.lui"))) with + | _s1404_ => + (spc_matches_prefix _s1404_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1405_ _)) => + (match (string_drop _s1404_ _s1405_) with + | _s1406_ => + (reg_name_matches_prefix _s1406_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1407_ _)) => + (match (string_drop _s1406_ _s1407_) with + | _s1408_ => + (sep_matches_prefix _s1408_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1409_ _)) => + match (string_drop _s1408_ _s1409_) with + | _s1410_ => + match (hex_bits_6_matches_prefix _s1410_) with + | Some (imm,(existT _ _s1411_ _)) => + let p0_ := string_drop _s1410_ _s1411_ in + if ((generic_eq p0_ "")) then Some ((rd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1393_ (_s1394_ : string) +: M (option (mword 6)) := + + let _s1395_ := _s1394_ in + (if ((string_startswith _s1395_ "c.addi16sp")) then + (match (string_drop _s1395_ (projT1 (string_length "c.addi16sp"))) with + | _s1396_ => + (spc_matches_prefix _s1396_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s1397_ _)) => + match (string_drop _s1396_ _s1397_) with + | _s1398_ => + match (hex_bits_6_matches_prefix _s1398_) with + | Some (imm,(existT _ _s1399_ _)) => + let p0_ := string_drop _s1398_ _s1399_ in + if ((generic_eq p0_ "")) then Some (imm) + else None + | _ => None + end + end + | _ => None + end) + : option (mword 6)) + end) + : M (option (mword 6)) + else returnm (None : option (mword 6))) + : M (option (mword 6)). + +Definition _s1381_ (_s1382_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1383_ := _s1382_ in + (if ((string_startswith _s1383_ "c.li")) then + (match (string_drop _s1383_ (projT1 (string_length "c.li"))) with + | _s1384_ => + (spc_matches_prefix _s1384_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1385_ _)) => + (match (string_drop _s1384_ _s1385_) with + | _s1386_ => + (reg_name_matches_prefix _s1386_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1387_ _)) => + (match (string_drop _s1386_ _s1387_) with + | _s1388_ => + (sep_matches_prefix _s1388_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1389_ _)) => + match (string_drop _s1388_ _s1389_) with + | _s1390_ => + match (hex_bits_6_matches_prefix _s1390_) with + | Some (imm,(existT _ _s1391_ _)) => + let p0_ := string_drop _s1390_ _s1391_ in + if ((generic_eq p0_ "")) then Some ((rd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1369_ (_s1370_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1371_ := _s1370_ in + (if ((string_startswith _s1371_ "c.addiw")) then + (match (string_drop _s1371_ (projT1 (string_length "c.addiw"))) with + | _s1372_ => + (spc_matches_prefix _s1372_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1373_ _)) => + (match (string_drop _s1372_ _s1373_) with + | _s1374_ => + (reg_name_matches_prefix _s1374_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1375_ _)) => + (match (string_drop _s1374_ _s1375_) with + | _s1376_ => + (sep_matches_prefix _s1376_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1377_ _)) => + match (string_drop _s1376_ _s1377_) with + | _s1378_ => + match (hex_bits_6_matches_prefix _s1378_) with + | Some (imm,(existT _ _s1379_ _)) => + let p0_ := string_drop _s1378_ _s1379_ in + if ((generic_eq p0_ "")) then Some ((rsd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1361_ (_s1362_ : string) +: M (option (mword 11)) := + + let _s1363_ := _s1362_ in + (if ((string_startswith _s1363_ "c.jal")) then + (match (string_drop _s1363_ (projT1 (string_length "c.jal"))) with + | _s1364_ => + (spc_matches_prefix _s1364_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s1365_ _)) => + match (string_drop _s1364_ _s1365_) with + | _s1366_ => + match (hex_bits_12_matches_prefix _s1366_) with + | Some (v__760,(existT _ _s1367_ _)) => + if ((eq_vec (subrange_vec_dec v__760 0 0) + (vec_of_bits [B0] : mword (0 - 0 + 1)))) then + let imm : mword 11 := subrange_vec_dec v__760 11 1 in + let imm : mword 11 := subrange_vec_dec v__760 11 1 in + let p0_ := string_drop _s1366_ _s1367_ in + if ((generic_eq p0_ "")) then Some (imm) + else None + else + let g__34 := Some ((v__760, _s1367_)) in + None + | g__34 => None + end + end + | _ => None + end) + : option (mword 11)) + end) + : M (option (mword 11)) + else returnm (None : option (mword 11))) + : M (option (mword 11)). + +Definition _s1349_ (_s1350_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s1351_ := _s1350_ in + (if ((string_startswith _s1351_ "c.addi")) then + (match (string_drop _s1351_ (projT1 (string_length "c.addi"))) with + | _s1352_ => + (spc_matches_prefix _s1352_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1353_ _)) => + (match (string_drop _s1352_ _s1353_) with + | _s1354_ => + (reg_name_matches_prefix _s1354_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s1355_ _)) => + (match (string_drop _s1354_ _s1355_) with + | _s1356_ => + (sep_matches_prefix _s1356_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1357_ _)) => + match (string_drop _s1356_ _s1357_) with + | _s1358_ => + match (hex_bits_6_matches_prefix _s1358_) with + | Some (nzi,(existT _ _s1359_ _)) => + let p0_ := string_drop _s1358_ _s1359_ in + if ((generic_eq p0_ "")) then Some ((rsd, nzi)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s1333_ (_s1334_ : string) +: M (option ((mword 3 * mword 3 * mword 5))) := + + let _s1335_ := _s1334_ in + (if ((string_startswith _s1335_ "c.sd")) then + (match (string_drop _s1335_ (projT1 (string_length "c.sd"))) with + | _s1336_ => + (spc_matches_prefix _s1336_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1337_ _)) => + (match (string_drop _s1336_ _s1337_) with + | _s1338_ => + (creg_name_matches_prefix _s1338_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsc1,(existT _ _s1339_ _)) => + (match (string_drop _s1338_ _s1339_) with + | _s1340_ => + (sep_matches_prefix _s1340_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1341_ _)) => + (match (string_drop _s1340_ _s1341_) with + | _s1342_ => + (creg_name_matches_prefix _s1342_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc2,(existT _ _s1343_ _)) => + (match (string_drop _s1342_ _s1343_) with + | _s1344_ => + (sep_matches_prefix _s1344_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s1345_ _)) => + match (string_drop _s1344_ _s1345_) with + | _s1346_ => + match (hex_bits_8_matches_prefix _s1346_) with + | Some (v__762,(existT _ _s1347_ _)) => + if ((eq_vec + (subrange_vec_dec v__762 2 0) + (vec_of_bits [B0;B0;B0] + : mword (2 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__762 7 3 in + let uimm : mword 5 := + subrange_vec_dec v__762 7 3 in + let p0_ := + string_drop _s1346_ _s1347_ in + if ((generic_eq p0_ "")) then + Some + ((rsc1, rsc2, uimm)) + else None + else + let g__33 := Some ((v__762, _s1347_)) in + None + | g__33 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + else returnm (None : option ((mword 3 * mword 3 * mword 5)))) + : M (option ((mword 3 * mword 3 * mword 5))). + +Definition _s1317_ (_s1318_ : string) +: M (option ((mword 3 * mword 3 * mword 5))) := + + let _s1319_ := _s1318_ in + (if ((string_startswith _s1319_ "c.sw")) then + (match (string_drop _s1319_ (projT1 (string_length "c.sw"))) with + | _s1320_ => + (spc_matches_prefix _s1320_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1321_ _)) => + (match (string_drop _s1320_ _s1321_) with + | _s1322_ => + (creg_name_matches_prefix _s1322_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsc1,(existT _ _s1323_ _)) => + (match (string_drop _s1322_ _s1323_) with + | _s1324_ => + (sep_matches_prefix _s1324_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1325_ _)) => + (match (string_drop _s1324_ _s1325_) with + | _s1326_ => + (creg_name_matches_prefix _s1326_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc2,(existT _ _s1327_ _)) => + (match (string_drop _s1326_ _s1327_) with + | _s1328_ => + (sep_matches_prefix _s1328_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s1329_ _)) => + match (string_drop _s1328_ _s1329_) with + | _s1330_ => + match (hex_bits_7_matches_prefix _s1330_) with + | Some (v__764,(existT _ _s1331_ _)) => + if ((eq_vec + (subrange_vec_dec v__764 1 0) + (vec_of_bits [B0;B0] + : mword (1 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__764 6 2 in + let uimm : mword 5 := + subrange_vec_dec v__764 6 2 in + let p0_ := + string_drop _s1330_ _s1331_ in + if ((generic_eq p0_ "")) then + Some + ((rsc1, rsc2, uimm)) + else None + else + let g__32 := Some ((v__764, _s1331_)) in + None + | g__32 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + else returnm (None : option ((mword 3 * mword 3 * mword 5)))) + : M (option ((mword 3 * mword 3 * mword 5))). + +Definition _s1301_ (_s1302_ : string) +: M (option ((mword 3 * mword 3 * mword 5))) := + + let _s1303_ := _s1302_ in + (if ((string_startswith _s1303_ "c.ld")) then + (match (string_drop _s1303_ (projT1 (string_length "c.ld"))) with + | _s1304_ => + (spc_matches_prefix _s1304_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1305_ _)) => + (match (string_drop _s1304_ _s1305_) with + | _s1306_ => + (creg_name_matches_prefix _s1306_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s1307_ _)) => + (match (string_drop _s1306_ _s1307_) with + | _s1308_ => + (sep_matches_prefix _s1308_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1309_ _)) => + (match (string_drop _s1308_ _s1309_) with + | _s1310_ => + (creg_name_matches_prefix _s1310_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc,(existT _ _s1311_ _)) => + (match (string_drop _s1310_ _s1311_) with + | _s1312_ => + (sep_matches_prefix _s1312_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s1313_ _)) => + match (string_drop _s1312_ _s1313_) with + | _s1314_ => + match (hex_bits_8_matches_prefix _s1314_) with + | Some (v__766,(existT _ _s1315_ _)) => + if ((eq_vec + (subrange_vec_dec v__766 2 0) + (vec_of_bits [B0;B0;B0] + : mword (2 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__766 7 3 in + let uimm : mword 5 := + subrange_vec_dec v__766 7 3 in + let p0_ := + string_drop _s1314_ _s1315_ in + if ((generic_eq p0_ "")) then + Some + ((rdc, rsc, uimm)) + else None + else + let g__31 := Some ((v__766, _s1315_)) in + None + | g__31 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + else returnm (None : option ((mword 3 * mword 3 * mword 5)))) + : M (option ((mword 3 * mword 3 * mword 5))). + +Definition _s1285_ (_s1286_ : string) +: M (option ((mword 3 * mword 3 * mword 5))) := + + let _s1287_ := _s1286_ in + (if ((string_startswith _s1287_ "c.lw")) then + (match (string_drop _s1287_ (projT1 (string_length "c.lw"))) with + | _s1288_ => + (spc_matches_prefix _s1288_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1289_ _)) => + (match (string_drop _s1288_ _s1289_) with + | _s1290_ => + (creg_name_matches_prefix _s1290_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s1291_ _)) => + (match (string_drop _s1290_ _s1291_) with + | _s1292_ => + (sep_matches_prefix _s1292_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1293_ _)) => + (match (string_drop _s1292_ _s1293_) with + | _s1294_ => + (creg_name_matches_prefix _s1294_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc,(existT _ _s1295_ _)) => + (match (string_drop _s1294_ _s1295_) with + | _s1296_ => + (sep_matches_prefix _s1296_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s1297_ _)) => + match (string_drop _s1296_ _s1297_) with + | _s1298_ => + match (hex_bits_7_matches_prefix _s1298_) with + | Some (v__768,(existT _ _s1299_ _)) => + if ((eq_vec + (subrange_vec_dec v__768 1 0) + (vec_of_bits [B0;B0] + : mword (1 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__768 6 2 in + let uimm : mword 5 := + subrange_vec_dec v__768 6 2 in + let p0_ := + string_drop _s1298_ _s1299_ in + if ((generic_eq p0_ "")) then + Some + ((rdc, rsc, uimm)) + else None + else + let g__30 := Some ((v__768, _s1299_)) in + None + | g__30 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + else returnm (None : option ((mword 3 * mword 3 * mword 5)))) + : M (option ((mword 3 * mword 3 * mword 5))). + +Definition _s1273_ (_s1274_ : string) +: M (option ((mword 3 * mword 8))) := + + let _s1275_ := _s1274_ in + (if ((string_startswith _s1275_ "c.addi4spn")) then + (match (string_drop _s1275_ (projT1 (string_length "c.addi4spn"))) with + | _s1276_ => + (spc_matches_prefix _s1276_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1277_ _)) => + (match (string_drop _s1276_ _s1277_) with + | _s1278_ => + (creg_name_matches_prefix _s1278_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s1279_ _)) => + (match (string_drop _s1278_ _s1279_) with + | _s1280_ => + (sep_matches_prefix _s1280_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1281_ _)) => + match (string_drop _s1280_ _s1281_) with + | _s1282_ => + match (hex_bits_10_matches_prefix _s1282_) with + | Some (v__770,(existT _ _s1283_ _)) => + if ((eq_vec (subrange_vec_dec v__770 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1)))) + then + let nzimm : mword 8 := subrange_vec_dec v__770 9 2 in + let nzimm : mword 8 := subrange_vec_dec v__770 9 2 in + let p0_ := string_drop _s1282_ _s1283_ in + if ((generic_eq p0_ "")) then Some ((rdc, nzimm)) + else None + else + let g__29 := Some ((v__770, _s1283_)) in + None + | g__29 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + else returnm (None : option ((mword 3 * mword 8)))) + : M (option ((mword 3 * mword 8))). + +Definition _s1256_ (_s1257_ : string) +: M (option ((csrop * mword 5 * mword 5 * mword 12))) := + + (match _s1257_ with + | _s1258_ => + (csr_mnemonic_matches_prefix _s1258_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1259_ _)) => + (match (string_drop _s1258_ _s1259_) with + | _s1260_ => + (spc_matches_prefix _s1260_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1261_ _)) => + (match (string_drop _s1260_ _s1261_) with + | _s1262_ => + (reg_name_matches_prefix _s1262_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1263_ _)) => + (match (string_drop _s1262_ _s1263_) with + | _s1264_ => + (sep_matches_prefix _s1264_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1265_ _)) => + (match (string_drop _s1264_ _s1265_) with + | _s1266_ => + (reg_name_matches_prefix _s1266_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1267_ _)) => + (match (string_drop _s1266_ _s1267_) with + | _s1268_ => + (sep_matches_prefix _s1268_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1269_ _)) => + (match (string_drop _s1268_ _s1269_) with + | _s1270_ => + (csr_name_map_matches_prefix _s1270_) >>= fun w__6 : option ((mword 12 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (csr,(existT _ _s1271_ _)) => + let p0_ := + string_drop _s1270_ _s1271_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, csr)) + else None + | _ => None + end) + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))). + +Definition _s1238_ (_s1239_ : string) +: M (option ((csrop * mword 5 * mword 5 * mword 12))) := + + (match _s1239_ with + | _s1240_ => + (csr_mnemonic_matches_prefix _s1240_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1241_ _)) => + let _s1242_ := string_drop _s1240_ _s1241_ in + (if ((string_startswith _s1242_ "i")) then + (match (string_drop _s1242_ (projT1 (string_length "i"))) with + | _s1243_ => + (spc_matches_prefix _s1243_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1244_ _)) => + (match (string_drop _s1243_ _s1244_) with + | _s1245_ => + (reg_name_matches_prefix _s1245_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1246_ _)) => + (match (string_drop _s1245_ _s1246_) with + | _s1247_ => + (sep_matches_prefix _s1247_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1248_ _)) => + (match (string_drop _s1247_ _s1248_) with + | _s1249_ => + (match (hex_bits_5_matches_prefix _s1249_) with + | Some (rs1,(existT _ _s1250_ _)) => + (match (string_drop _s1249_ _s1250_) with + | _s1251_ => + (sep_matches_prefix _s1251_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s1252_ _)) => + (match (string_drop _s1251_ _s1252_) with + | _s1253_ => + (csr_name_map_matches_prefix _s1253_) >>= fun w__5 : option ((mword 12 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some + (csr,(existT _ _s1254_ _)) => + let p0_ := + string_drop _s1253_ _s1254_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, csr)) + else None + | _ => None + end) + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + else returnm (None : option ((csrop * mword 5 * mword 5 * mword 12)))) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))). + +Definition _s1214_ (_s1215_ : string) +: M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) := + + (match _s1215_ with + | _s1216_ => + (amo_mnemonic_matches_prefix _s1216_) >>= fun w__0 : option ((amoop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1217_ _)) => + let _s1218_ := string_drop _s1216_ _s1217_ in + (if ((string_startswith _s1218_ ".")) then + (match (string_drop _s1218_ (projT1 (string_length "."))) with + | _s1219_ => + (size_mnemonic_matches_prefix _s1219_) >>= fun w__1 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (width,(existT _ _s1220_ _)) => + (match (string_drop _s1219_ _s1220_) with + | _s1221_ => + (maybe_aq_matches_prefix _s1221_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (aq,(existT _ _s1222_ _)) => + (match (string_drop _s1221_ _s1222_) with + | _s1223_ => + (maybe_rl_matches_prefix _s1223_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rl,(existT _ _s1224_ _)) => + (match (string_drop _s1223_ _s1224_) with + | _s1225_ => + (spc_matches_prefix _s1225_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s1226_ _)) => + (match (string_drop _s1225_ _s1226_) with + | _s1227_ => + (reg_name_matches_prefix _s1227_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (rd,(existT _ _s1228_ _)) => + (match (string_drop _s1227_ _s1228_) with + | _s1229_ => + (sep_matches_prefix _s1229_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (tt,(existT _ _s1230_ _)) => + (match (string_drop _s1229_ _s1230_) with + | _s1231_ => + (reg_name_matches_prefix _s1231_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (rs1,(existT _ _s1232_ _)) => + (match (string_drop _s1231_ + _s1232_) with + | _s1233_ => + (sep_matches_prefix + _s1233_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__8 with + | Some + (tt,(existT _ _s1234_ _)) => + (match (string_drop + _s1233_ + _s1234_) with + | _s1235_ => + (reg_name_matches_prefix + _s1235_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__9 with + | Some + (rs2,(existT _ _s1236_ _)) => + let p0_ := + string_drop + _s1235_ + _s1236_ in + if ((generic_eq + p0_ + "")) + then + Some + ((op, width, aq, rl, rd, rs1, rs2)) + else + None + | _ => + None + end) + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + else + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))). + +Definition _s1192_ (_s1193_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) := + + let _s1194_ := _s1193_ in + (if ((string_startswith _s1194_ "sc.")) then + (match (string_drop _s1194_ (projT1 (string_length "sc."))) with + | _s1195_ => + (size_mnemonic_matches_prefix _s1195_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s1196_ _)) => + (match (string_drop _s1195_ _s1196_) with + | _s1197_ => + (maybe_aq_matches_prefix _s1197_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s1198_ _)) => + (match (string_drop _s1197_ _s1198_) with + | _s1199_ => + (maybe_rl_matches_prefix _s1199_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s1200_ _)) => + (match (string_drop _s1199_ _s1200_) with + | _s1201_ => + (spc_matches_prefix _s1201_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1202_ _)) => + (match (string_drop _s1201_ _s1202_) with + | _s1203_ => + (reg_name_matches_prefix _s1203_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s1204_ _)) => + (match (string_drop _s1203_ _s1204_) with + | _s1205_ => + (sep_matches_prefix _s1205_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1206_ _)) => + (match (string_drop _s1205_ _s1206_) with + | _s1207_ => + (reg_name_matches_prefix _s1207_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (rs1,(existT _ _s1208_ _)) => + (match (string_drop _s1207_ _s1208_) with + | _s1209_ => + (sep_matches_prefix _s1209_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (tt,(existT _ _s1210_ _)) => + (match (string_drop _s1209_ + _s1210_) with + | _s1211_ => + (reg_name_matches_prefix + _s1211_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__8 with + | Some + (rs2,(existT _ _s1212_ _)) => + let p0_ := + string_drop + _s1211_ + _s1212_ in + if ((generic_eq + p0_ "")) + then + Some + ((size, aq, rl, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))). + +Definition _s1174_ (_s1175_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5))) := + + let _s1176_ := _s1175_ in + (if ((string_startswith _s1176_ "lr.")) then + (match (string_drop _s1176_ (projT1 (string_length "lr."))) with + | _s1177_ => + (size_mnemonic_matches_prefix _s1177_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s1178_ _)) => + (match (string_drop _s1177_ _s1178_) with + | _s1179_ => + (maybe_aq_matches_prefix _s1179_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s1180_ _)) => + (match (string_drop _s1179_ _s1180_) with + | _s1181_ => + (maybe_rl_matches_prefix _s1181_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s1182_ _)) => + (match (string_drop _s1181_ _s1182_) with + | _s1183_ => + (spc_matches_prefix _s1183_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1184_ _)) => + (match (string_drop _s1183_ _s1184_) with + | _s1185_ => + (reg_name_matches_prefix _s1185_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s1186_ _)) => + (match (string_drop _s1185_ _s1186_) with + | _s1187_ => + (sep_matches_prefix _s1187_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1188_ _)) => + (match (string_drop _s1187_ _s1188_) with + | _s1189_ => + (reg_name_matches_prefix _s1189_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs1,(existT _ _s1190_ _)) => + let p0_ := + string_drop _s1189_ _s1190_ in + if ((generic_eq p0_ "")) then + Some + ((size, aq, rl, rd, rs1)) + else None + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => returnm (None : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => returnm (None : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + else returnm (None : option ((word_width * bool * bool * mword 5 * mword 5)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5))). + +Definition _s1162_ (_s1163_ : string) +: M (option ((mword 5 * mword 5))) := + + let _s1164_ := _s1163_ in + (if ((string_startswith _s1164_ "sfence.vma")) then + (match (string_drop _s1164_ (projT1 (string_length "sfence.vma"))) with + | _s1165_ => + (spc_matches_prefix _s1165_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1166_ _)) => + (match (string_drop _s1165_ _s1166_) with + | _s1167_ => + (reg_name_matches_prefix _s1167_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs1,(existT _ _s1168_ _)) => + (match (string_drop _s1167_ _s1168_) with + | _s1169_ => + (sep_matches_prefix _s1169_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1170_ _)) => + (match (string_drop _s1169_ _s1170_) with + | _s1171_ => + (reg_name_matches_prefix _s1171_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s1172_ _)) => + let p0_ := string_drop _s1171_ _s1172_ in + if ((generic_eq p0_ "")) then Some ((rs1, rs2)) + else None + | _ => None + end) + : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + else returnm (None : option ((mword 5 * mword 5)))) + : M (option ((mword 5 * mword 5))). + +Definition _s1150_ (_s1151_ : string) +: M (option ((mword 4 * mword 4))) := + + let _s1152_ := _s1151_ in + (if ((string_startswith _s1152_ "fence.tso")) then + (match (string_drop _s1152_ (projT1 (string_length "fence.tso"))) with + | _s1153_ => + (spc_matches_prefix _s1153_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1154_ _)) => + (match (string_drop _s1153_ _s1154_) with + | _s1155_ => + (fence_bits_matches_prefix _s1155_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (pred,(existT _ _s1156_ _)) => + (match (string_drop _s1155_ _s1156_) with + | _s1157_ => + (sep_matches_prefix _s1157_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1158_ _)) => + (match (string_drop _s1157_ _s1158_) with + | _s1159_ => + (fence_bits_matches_prefix _s1159_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (succ,(existT _ _s1160_ _)) => + let p0_ := string_drop _s1159_ _s1160_ in + if ((generic_eq p0_ "")) then Some ((pred, succ)) + else None + | _ => None + end) + : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + else returnm (None : option ((mword 4 * mword 4)))) + : M (option ((mword 4 * mword 4))). + +Definition _s1138_ (_s1139_ : string) +: M (option ((mword 4 * mword 4))) := + + let _s1140_ := _s1139_ in + (if ((string_startswith _s1140_ "fence")) then + (match (string_drop _s1140_ (projT1 (string_length "fence"))) with + | _s1141_ => + (spc_matches_prefix _s1141_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1142_ _)) => + (match (string_drop _s1141_ _s1142_) with + | _s1143_ => + (fence_bits_matches_prefix _s1143_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (pred,(existT _ _s1144_ _)) => + (match (string_drop _s1143_ _s1144_) with + | _s1145_ => + (sep_matches_prefix _s1145_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1146_ _)) => + (match (string_drop _s1145_ _s1146_) with + | _s1147_ => + (fence_bits_matches_prefix _s1147_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (succ,(existT _ _s1148_ _)) => + let p0_ := string_drop _s1147_ _s1148_ in + if ((generic_eq p0_ "")) then Some ((pred, succ)) + else None + | _ => None + end) + : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + else returnm (None : option ((mword 4 * mword 4)))) + : M (option ((mword 4 * mword 4))). + +Definition _s1119_ (_s1120_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5))) := + + let _s1121_ := _s1120_ in + (if ((string_startswith _s1121_ "rem")) then + (match (string_drop _s1121_ (projT1 (string_length "rem"))) with + | _s1122_ => + (maybe_not_u_matches_prefix _s1122_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s1123_ _)) => + let _s1124_ := string_drop _s1122_ _s1123_ in + (if ((string_startswith _s1124_ "w")) then + (match (string_drop _s1124_ (projT1 (string_length "w"))) with + | _s1125_ => + (spc_matches_prefix _s1125_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1126_ _)) => + (match (string_drop _s1125_ _s1126_) with + | _s1127_ => + (reg_name_matches_prefix _s1127_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1128_ _)) => + (match (string_drop _s1127_ _s1128_) with + | _s1129_ => + (sep_matches_prefix _s1129_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1130_ _)) => + (match (string_drop _s1129_ _s1130_) with + | _s1131_ => + (reg_name_matches_prefix _s1131_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1132_ _)) => + (match (string_drop _s1131_ _s1132_) with + | _s1133_ => + (sep_matches_prefix _s1133_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1134_ _)) => + (match (string_drop _s1133_ _s1134_) with + | _s1135_ => + (reg_name_matches_prefix _s1135_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s1136_ _)) => + let p0_ := + string_drop _s1135_ + _s1136_ in + if ((generic_eq p0_ "")) + then + Some + ((s, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))). + +Definition _s1100_ (_s1101_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5))) := + + let _s1102_ := _s1101_ in + (if ((string_startswith _s1102_ "div")) then + (match (string_drop _s1102_ (projT1 (string_length "div"))) with + | _s1103_ => + (maybe_not_u_matches_prefix _s1103_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s1104_ _)) => + let _s1105_ := string_drop _s1103_ _s1104_ in + (if ((string_startswith _s1105_ "w")) then + (match (string_drop _s1105_ (projT1 (string_length "w"))) with + | _s1106_ => + (spc_matches_prefix _s1106_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1107_ _)) => + (match (string_drop _s1106_ _s1107_) with + | _s1108_ => + (reg_name_matches_prefix _s1108_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1109_ _)) => + (match (string_drop _s1108_ _s1109_) with + | _s1110_ => + (sep_matches_prefix _s1110_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1111_ _)) => + (match (string_drop _s1110_ _s1111_) with + | _s1112_ => + (reg_name_matches_prefix _s1112_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1113_ _)) => + (match (string_drop _s1112_ _s1113_) with + | _s1114_ => + (sep_matches_prefix _s1114_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1115_ _)) => + (match (string_drop _s1114_ _s1115_) with + | _s1116_ => + (reg_name_matches_prefix _s1116_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s1117_ _)) => + let p0_ := + string_drop _s1116_ + _s1117_ in + if ((generic_eq p0_ "")) + then + Some + ((s, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))). + +Definition _s1084_ (_s1085_ : string) +: M (option ((mword 5 * mword 5 * mword 5))) := + + let _s1086_ := _s1085_ in + (if ((string_startswith _s1086_ "mulw")) then + (match (string_drop _s1086_ (projT1 (string_length "mulw"))) with + | _s1087_ => + (spc_matches_prefix _s1087_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1088_ _)) => + (match (string_drop _s1087_ _s1088_) with + | _s1089_ => + (reg_name_matches_prefix _s1089_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1090_ _)) => + (match (string_drop _s1089_ _s1090_) with + | _s1091_ => + (sep_matches_prefix _s1091_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1092_ _)) => + (match (string_drop _s1091_ _s1092_) with + | _s1093_ => + (reg_name_matches_prefix _s1093_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s1094_ _)) => + (match (string_drop _s1093_ _s1094_) with + | _s1095_ => + (sep_matches_prefix _s1095_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s1096_ _)) => + (match (string_drop _s1095_ _s1096_) with + | _s1097_ => + (reg_name_matches_prefix _s1097_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (rs2,(existT _ _s1098_ _)) => + let p0_ := + string_drop _s1097_ _s1098_ in + if ((generic_eq p0_ "")) then + Some + ((rd, rs1, rs2)) + else None + | _ => None + end) + : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + else returnm (None : option ((mword 5 * mword 5 * mword 5)))) + : M (option ((mword 5 * mword 5 * mword 5))). + +Definition _s1066_ (_s1067_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5))) := + + let _s1068_ := _s1067_ in + (if ((string_startswith _s1068_ "rem")) then + (match (string_drop _s1068_ (projT1 (string_length "rem"))) with + | _s1069_ => + (maybe_not_u_matches_prefix _s1069_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s1070_ _)) => + (match (string_drop _s1069_ _s1070_) with + | _s1071_ => + (spc_matches_prefix _s1071_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1072_ _)) => + (match (string_drop _s1071_ _s1072_) with + | _s1073_ => + (reg_name_matches_prefix _s1073_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1074_ _)) => + (match (string_drop _s1073_ _s1074_) with + | _s1075_ => + (sep_matches_prefix _s1075_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1076_ _)) => + (match (string_drop _s1075_ _s1076_) with + | _s1077_ => + (reg_name_matches_prefix _s1077_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1078_ _)) => + (match (string_drop _s1077_ _s1078_) with + | _s1079_ => + (sep_matches_prefix _s1079_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1080_ _)) => + (match (string_drop _s1079_ _s1080_) with + | _s1081_ => + (reg_name_matches_prefix _s1081_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s1082_ _)) => + let p0_ := + string_drop _s1081_ _s1082_ in + if ((generic_eq p0_ "")) then + Some + ((s, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))). + +Definition _s1048_ (_s1049_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5))) := + + let _s1050_ := _s1049_ in + (if ((string_startswith _s1050_ "div")) then + (match (string_drop _s1050_ (projT1 (string_length "div"))) with + | _s1051_ => + (maybe_not_u_matches_prefix _s1051_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s1052_ _)) => + (match (string_drop _s1051_ _s1052_) with + | _s1053_ => + (spc_matches_prefix _s1053_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1054_ _)) => + (match (string_drop _s1053_ _s1054_) with + | _s1055_ => + (reg_name_matches_prefix _s1055_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1056_ _)) => + (match (string_drop _s1055_ _s1056_) with + | _s1057_ => + (sep_matches_prefix _s1057_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1058_ _)) => + (match (string_drop _s1057_ _s1058_) with + | _s1059_ => + (reg_name_matches_prefix _s1059_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1060_ _)) => + (match (string_drop _s1059_ _s1060_) with + | _s1061_ => + (sep_matches_prefix _s1061_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1062_ _)) => + (match (string_drop _s1061_ _s1062_) with + | _s1063_ => + (reg_name_matches_prefix _s1063_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s1064_ _)) => + let p0_ := + string_drop _s1063_ _s1064_ in + if ((generic_eq p0_ "")) then + Some + ((s, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))). + +Definition _s1031_ (_s1032_ : string) +: M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) := + + (match _s1032_ with + | _s1033_ => + (mul_mnemonic_matches_prefix _s1033_) >>= fun w__0 : option (((bool * bool * bool) * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some ((high, signed1, signed2),(existT _ _s1034_ _)) => + (match (string_drop _s1033_ _s1034_) with + | _s1035_ => + (spc_matches_prefix _s1035_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1036_ _)) => + (match (string_drop _s1035_ _s1036_) with + | _s1037_ => + (reg_name_matches_prefix _s1037_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1038_ _)) => + (match (string_drop _s1037_ _s1038_) with + | _s1039_ => + (sep_matches_prefix _s1039_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1040_ _)) => + (match (string_drop _s1039_ _s1040_) with + | _s1041_ => + (reg_name_matches_prefix _s1041_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1042_ _)) => + (match (string_drop _s1041_ _s1042_) with + | _s1043_ => + (sep_matches_prefix _s1043_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1044_ _)) => + (match (string_drop _s1043_ _s1044_) with + | _s1045_ => + (reg_name_matches_prefix _s1045_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s1046_ _)) => + let p0_ := + string_drop _s1045_ _s1046_ in + if ((generic_eq p0_ "")) then + Some + ((high, signed1, signed2, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))). + +Definition _s1016_ (_s1017_ : string) +: M (option ((sopw * mword 5 * mword 5 * mword 5))) := + + (match _s1017_ with + | _s1018_ => + (shiftiwop_mnemonic_matches_prefix _s1018_) >>= fun w__0 : option ((sopw * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1019_ _)) => + (match (string_drop _s1018_ _s1019_) with + | _s1020_ => + (spc_matches_prefix _s1020_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1021_ _)) => + (match (string_drop _s1020_ _s1021_) with + | _s1022_ => + (reg_name_matches_prefix _s1022_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1023_ _)) => + (match (string_drop _s1022_ _s1023_) with + | _s1024_ => + (sep_matches_prefix _s1024_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1025_ _)) => + (match (string_drop _s1024_ _s1025_) with + | _s1026_ => + (reg_name_matches_prefix _s1026_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (rs1,(existT _ _s1027_ _)) => + match (string_drop _s1026_ _s1027_) with + | _s1028_ => + match (hex_bits_5_matches_prefix _s1028_) with + | Some (shamt,(existT _ _s1029_ _)) => + let p0_ := string_drop _s1028_ _s1029_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))). + +Definition _s999_ (_s1000_ : string) +: M (option ((ropw * mword 5 * mword 5 * mword 5))) := + + (match _s1000_ with + | _s1001_ => + (rtypew_mnemonic_matches_prefix _s1001_) >>= fun w__0 : option ((ropw * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1002_ _)) => + (match (string_drop _s1001_ _s1002_) with + | _s1003_ => + (spc_matches_prefix _s1003_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1004_ _)) => + (match (string_drop _s1003_ _s1004_) with + | _s1005_ => + (reg_name_matches_prefix _s1005_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1006_ _)) => + (match (string_drop _s1005_ _s1006_) with + | _s1007_ => + (sep_matches_prefix _s1007_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1008_ _)) => + (match (string_drop _s1007_ _s1008_) with + | _s1009_ => + (reg_name_matches_prefix _s1009_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1010_ _)) => + (match (string_drop _s1009_ _s1010_) with + | _s1011_ => + (sep_matches_prefix _s1011_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1012_ _)) => + (match (string_drop _s1011_ _s1012_) with + | _s1013_ => + (reg_name_matches_prefix _s1013_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s1014_ _)) => + let p0_ := + string_drop _s1013_ _s1014_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))). + +Definition _s982_ (_s983_ : string) +: M (option ((sop * mword 5 * mword 5 * mword 5))) := + + (match _s983_ with + | _s984_ => + (shiftw_mnemonic_matches_prefix _s984_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s985_ _)) => + (match (string_drop _s984_ _s985_) with + | _s986_ => + (spc_matches_prefix _s986_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__1 with + | Some (tt,(existT _ _s987_ _)) => + (match (string_drop _s986_ _s987_) with + | _s988_ => + (reg_name_matches_prefix _s988_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s989_ _)) => + (match (string_drop _s988_ _s989_) with + | _s990_ => + (sep_matches_prefix _s990_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s991_ _)) => + (match (string_drop _s990_ _s991_) with + | _s992_ => + (reg_name_matches_prefix _s992_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s993_ _)) => + (match (string_drop _s992_ _s993_) with + | _s994_ => + (sep_matches_prefix _s994_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s995_ _)) => + match (string_drop _s994_ _s995_) with + | _s996_ => + match (hex_bits_5_matches_prefix + _s996_) with + | Some (shamt,(existT _ _s997_ _)) => + let p0_ := + string_drop _s996_ _s997_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))). + +Definition _s966_ (_s967_ : string) +: M (option ((mword 5 * mword 5 * mword 12))) := + + let _s968_ := _s967_ in + (if ((string_startswith _s968_ "addiw")) then + (match (string_drop _s968_ (projT1 (string_length "addiw"))) with + | _s969_ => + (spc_matches_prefix _s969_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s970_ _)) => + (match (string_drop _s969_ _s970_) with + | _s971_ => + (reg_name_matches_prefix _s971_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s972_ _)) => + (match (string_drop _s971_ _s972_) with + | _s973_ => + (sep_matches_prefix _s973_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s974_ _)) => + (match (string_drop _s973_ _s974_) with + | _s975_ => + (reg_name_matches_prefix _s975_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s976_ _)) => + (match (string_drop _s975_ _s976_) with + | _s977_ => + (sep_matches_prefix _s977_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s978_ _)) => + match (string_drop _s977_ _s978_) with + | _s979_ => + match (hex_bits_12_matches_prefix _s979_) with + | Some (imm,(existT _ _s980_ _)) => + let p0_ := string_drop _s979_ _s980_ in + if ((generic_eq p0_ "")) then + Some + ((rd, rs1, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + else returnm (None : option ((mword 5 * mword 5 * mword 12)))) + : M (option ((mword 5 * mword 5 * mword 12))). + +Definition _s944_ (_s945_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) := + + let _s946_ := _s945_ in + (if ((string_startswith _s946_ "s")) then + (match (string_drop _s946_ (projT1 (string_length "s"))) with + | _s947_ => + (size_mnemonic_matches_prefix _s947_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s948_ _)) => + (match (string_drop _s947_ _s948_) with + | _s949_ => + (maybe_aq_matches_prefix _s949_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s950_ _)) => + (match (string_drop _s949_ _s950_) with + | _s951_ => + (maybe_rl_matches_prefix _s951_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s952_ _)) => + (match (string_drop _s951_ _s952_) with + | _s953_ => + (spc_matches_prefix _s953_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s954_ _)) => + (match (string_drop _s953_ _s954_) with + | _s955_ => + (reg_name_matches_prefix _s955_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s956_ _)) => + (match (string_drop _s955_ _s956_) with + | _s957_ => + (sep_matches_prefix _s957_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s958_ _)) => + (match (string_drop _s957_ _s958_) with + | _s959_ => + (reg_name_matches_prefix _s959_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (rs1,(existT _ _s960_ _)) => + (match (string_drop _s959_ _s960_) with + | _s961_ => + (sep_matches_prefix _s961_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__7 with + | Some + (tt,(existT _ _s962_ _)) => + match (string_drop + _s961_ + _s962_) with + | _s963_ => + match (hex_bits_12_matches_prefix + _s963_) with + | Some + (imm,(existT _ _s964_ _)) => + let p0_ := + string_drop + _s963_ + _s964_ in + if ((generic_eq + p0_ "")) + then + Some + ((size, aq, rl, rd, rs1, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + else returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))). + +Definition _s920_ (_s921_ : string) +: M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) := + + let _s922_ := _s921_ in + (if ((string_startswith _s922_ "l")) then + (match (string_drop _s922_ (projT1 (string_length "l"))) with + | _s923_ => + (size_mnemonic_matches_prefix _s923_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s924_ _)) => + (match (string_drop _s923_ _s924_) with + | _s925_ => + (maybe_u_matches_prefix _s925_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (is_unsigned,(existT _ _s926_ _)) => + (match (string_drop _s925_ _s926_) with + | _s927_ => + (maybe_aq_matches_prefix _s927_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (aq,(existT _ _s928_ _)) => + (match (string_drop _s927_ _s928_) with + | _s929_ => + (maybe_rl_matches_prefix _s929_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rl,(existT _ _s930_ _)) => + (match (string_drop _s929_ _s930_) with + | _s931_ => + (spc_matches_prefix _s931_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s932_ _)) => + (match (string_drop _s931_ _s932_) with + | _s933_ => + (reg_name_matches_prefix _s933_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (rd,(existT _ _s934_ _)) => + (match (string_drop _s933_ _s934_) with + | _s935_ => + (sep_matches_prefix _s935_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (tt,(existT _ _s936_ _)) => + (match (string_drop _s935_ _s936_) with + | _s937_ => + (reg_name_matches_prefix _s937_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (rs1,(existT _ _s938_ _)) => + (match (string_drop _s937_ + _s938_) with + | _s939_ => + (sep_matches_prefix _s939_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__8 with + | Some + (tt,(existT _ _s940_ _)) => + match (string_drop + _s939_ + _s940_) with + | _s941_ => + match (hex_bits_12_matches_prefix + _s941_) with + | Some + (imm,(existT _ _s942_ _)) => + let p0_ := + string_drop + _s941_ + _s942_ in + if ((generic_eq + p0_ + "")) + then + Some + ((size, is_unsigned, aq, rl, rd, rs1, imm)) + else + None + | _ => + None + end + end + | _ => None + end) + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + else returnm (None : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12)))) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))). + +Definition _s903_ (_s904_ : string) +: M (option ((rop * mword 5 * mword 5 * mword 5))) := + + (match _s904_ with + | _s905_ => + (rtype_mnemonic_matches_prefix _s905_) >>= fun w__0 : option ((rop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s906_ _)) => + (match (string_drop _s905_ _s906_) with + | _s907_ => + (spc_matches_prefix _s907_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__1 with + | Some (tt,(existT _ _s908_ _)) => + (match (string_drop _s907_ _s908_) with + | _s909_ => + (reg_name_matches_prefix _s909_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s910_ _)) => + (match (string_drop _s909_ _s910_) with + | _s911_ => + (sep_matches_prefix _s911_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s912_ _)) => + (match (string_drop _s911_ _s912_) with + | _s913_ => + (reg_name_matches_prefix _s913_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s914_ _)) => + (match (string_drop _s913_ _s914_) with + | _s915_ => + (sep_matches_prefix _s915_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s916_ _)) => + (match (string_drop _s915_ _s916_) with + | _s917_ => + (reg_name_matches_prefix _s917_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s918_ _)) => + let p0_ := + string_drop _s917_ _s918_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))). + +Definition _s888_ (_s889_ : string) +: M (option ((sop * mword 5 * mword 5 * mword 6))) := + + (match _s889_ with + | _s890_ => + (shiftiop_mnemonic_matches_prefix _s890_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s891_ _)) => + (match (string_drop _s890_ _s891_) with + | _s892_ => + (spc_matches_prefix _s892_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__1 with + | Some (tt,(existT _ _s893_ _)) => + (match (string_drop _s892_ _s893_) with + | _s894_ => + (reg_name_matches_prefix _s894_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s895_ _)) => + (match (string_drop _s894_ _s895_) with + | _s896_ => + (sep_matches_prefix _s896_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s897_ _)) => + (match (string_drop _s896_ _s897_) with + | _s898_ => + (reg_name_matches_prefix _s898_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (rs1,(existT _ _s899_ _)) => + match (string_drop _s898_ _s899_) with + | _s900_ => + match (hex_bits_6_matches_prefix _s900_) with + | Some (shamt,(existT _ _s901_ _)) => + let p0_ := string_drop _s900_ _s901_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + | _ => + returnm (None : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))). + +Definition _s871_ (_s872_ : string) +: M (option ((iop * mword 5 * mword 5 * mword 12))) := + + (match _s872_ with + | _s873_ => + (itype_mnemonic_matches_prefix _s873_) >>= fun w__0 : option ((iop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s874_ _)) => + (match (string_drop _s873_ _s874_) with + | _s875_ => + (spc_matches_prefix _s875_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__1 with + | Some (tt,(existT _ _s876_ _)) => + (match (string_drop _s875_ _s876_) with + | _s877_ => + (reg_name_matches_prefix _s877_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s878_ _)) => + (match (string_drop _s877_ _s878_) with + | _s879_ => + (sep_matches_prefix _s879_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s880_ _)) => + (match (string_drop _s879_ _s880_) with + | _s881_ => + (reg_name_matches_prefix _s881_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s882_ _)) => + (match (string_drop _s881_ _s882_) with + | _s883_ => + (sep_matches_prefix _s883_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s884_ _)) => + match (string_drop _s883_ _s884_) with + | _s885_ => + match (hex_bits_12_matches_prefix + _s885_) with + | Some (imm,(existT _ _s886_ _)) => + let p0_ := + string_drop _s885_ _s886_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))). + +Definition _s854_ (_s855_ : string) +: M (option ((bop * mword 5 * mword 5 * mword 13))) := + + (match _s855_ with + | _s856_ => + (btype_mnemonic_matches_prefix _s856_) >>= fun w__0 : option ((bop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s857_ _)) => + (match (string_drop _s856_ _s857_) with + | _s858_ => + (spc_matches_prefix _s858_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__1 with + | Some (tt,(existT _ _s859_ _)) => + (match (string_drop _s858_ _s859_) with + | _s860_ => + (reg_name_matches_prefix _s860_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rs1,(existT _ _s861_ _)) => + (match (string_drop _s860_ _s861_) with + | _s862_ => + (sep_matches_prefix _s862_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s863_ _)) => + (match (string_drop _s862_ _s863_) with + | _s864_ => + (reg_name_matches_prefix _s864_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs2,(existT _ _s865_ _)) => + (match (string_drop _s864_ _s865_) with + | _s866_ => + (sep_matches_prefix _s866_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s867_ _)) => + match (string_drop _s866_ _s867_) with + | _s868_ => + match (hex_bits_13_matches_prefix + _s868_) with + | Some (imm,(existT _ _s869_ _)) => + let p0_ := + string_drop _s868_ _s869_ in + if ((generic_eq p0_ "")) then + Some + ((op, rs1, rs2, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => + returnm (None + : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => + returnm (None : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => returnm (None : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => returnm (None : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => returnm (None : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))). + +Definition _s838_ (_s839_ : string) +: M (option ((mword 5 * mword 5 * mword 12))) := + + let _s840_ := _s839_ in + (if ((string_startswith _s840_ "jalr")) then + (match (string_drop _s840_ (projT1 (string_length "jalr"))) with + | _s841_ => + (spc_matches_prefix _s841_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s842_ _)) => + (match (string_drop _s841_ _s842_) with + | _s843_ => + (reg_name_matches_prefix _s843_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s844_ _)) => + (match (string_drop _s843_ _s844_) with + | _s845_ => + (sep_matches_prefix _s845_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s846_ _)) => + (match (string_drop _s845_ _s846_) with + | _s847_ => + (reg_name_matches_prefix _s847_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s848_ _)) => + (match (string_drop _s847_ _s848_) with + | _s849_ => + (sep_matches_prefix _s849_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s850_ _)) => + match (string_drop _s849_ _s850_) with + | _s851_ => + match (hex_bits_12_matches_prefix _s851_) with + | Some (imm,(existT _ _s852_ _)) => + let p0_ := string_drop _s851_ _s852_ in + if ((generic_eq p0_ "")) then + Some + ((rd, rs1, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + else returnm (None : option ((mword 5 * mword 5 * mword 12)))) + : M (option ((mword 5 * mword 5 * mword 12))). + +Definition _s826_ (_s827_ : string) +: M (option ((mword 5 * mword 21))) := + + let _s828_ := _s827_ in + (if ((string_startswith _s828_ "jal")) then + (match (string_drop _s828_ (projT1 (string_length "jal"))) with + | _s829_ => + (spc_matches_prefix _s829_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s830_ _)) => + (match (string_drop _s829_ _s830_) with + | _s831_ => + (reg_name_matches_prefix _s831_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s832_ _)) => + (match (string_drop _s831_ _s832_) with + | _s833_ => + (sep_matches_prefix _s833_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s834_ _)) => + match (string_drop _s833_ _s834_) with + | _s835_ => + match (hex_bits_21_matches_prefix _s835_) with + | Some (imm,(existT _ _s836_ _)) => + let p0_ := string_drop _s835_ _s836_ in + if ((generic_eq p0_ "")) then Some ((rd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + | _ => returnm (None : option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + | _ => returnm (None : option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + else returnm (None : option ((mword 5 * mword 21)))) + : M (option ((mword 5 * mword 21))). + +Definition _s813_ (_s814_ : string) +: M (option ((uop * mword 5 * mword 20))) := + + (match _s814_ with + | _s815_ => + (utype_mnemonic_matches_prefix _s815_) >>= fun w__0 : option ((uop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s816_ _)) => + (match (string_drop _s815_ _s816_) with + | _s817_ => + (spc_matches_prefix _s817_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__1 with + | Some (tt,(existT _ _s818_ _)) => + (match (string_drop _s817_ _s818_) with + | _s819_ => + (reg_name_matches_prefix _s819_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s820_ _)) => + (match (string_drop _s819_ _s820_) with + | _s821_ => + (sep_matches_prefix _s821_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (tt,(existT _ _s822_ _)) => + match (string_drop _s821_ _s822_) with + | _s823_ => + match (hex_bits_20_matches_prefix _s823_) with + | Some (imm,(existT _ _s824_ _)) => + let p0_ := string_drop _s823_ _s824_ in + if ((generic_eq p0_ "")) then Some ((op, rd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + | _ => returnm (None : option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + | _ => returnm (None : option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + | _ => returnm (None : option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))). + +Definition assembly_backwards (arg_ : string) +: M (ast) := + + let _s825_ := arg_ in + (_s813_ _s825_) >>= fun w__0 : option ((uop * mword 5 * mword 20)) => + (if ((match w__0 with | Some (op,rd,imm) => true | _ => false end)) then + (_s813_ _s825_) >>= fun w__1 : option ((uop * mword 5 * mword 20)) => + (match w__1 with + | Some (op,rd,imm) => returnm ((UTYPE ((imm, rd, op))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s826_ _s825_) >>= fun w__4 : option ((mword 5 * mword 21)) => + (if ((match w__4 with | Some (rd,imm) => true | _ => false end)) then + (_s826_ _s825_) >>= fun w__5 : option ((mword 5 * mword 21)) => + (match w__5 with + | Some (rd,imm) => returnm ((RISCV_JAL ((imm, rd))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s838_ _s825_) >>= fun w__8 : option ((mword 5 * mword 5 * mword 12)) => + (if ((match w__8 with | Some (rd,rs1,imm) => true | _ => false end)) then + (_s838_ _s825_) >>= fun w__9 : option ((mword 5 * mword 5 * mword 12)) => + (match w__9 with + | Some (rd,rs1,imm) => returnm ((RISCV_JALR ((imm, rs1, rd))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s854_ _s825_) >>= fun w__12 : option ((bop * mword 5 * mword 5 * mword 13)) => + (if ((match w__12 with | Some (op,rs1,rs2,imm) => true | _ => false end)) then + (_s854_ _s825_) >>= fun w__13 : option ((bop * mword 5 * mword 5 * mword 13)) => + (match w__13 with + | Some (op,rs1,rs2,imm) => returnm ((BTYPE ((imm, rs2, rs1, op))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s871_ _s825_) >>= fun w__16 : option ((iop * mword 5 * mword 5 * mword 12)) => + (if ((match w__16 with | Some (op,rd,rs1,imm) => true | _ => false end)) then + (_s871_ _s825_) >>= fun w__17 : option ((iop * mword 5 * mword 5 * mword 12)) => + (match w__17 with + | Some (op,rd,rs1,imm) => returnm ((ITYPE ((imm, rs1, rd, op))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s888_ _s825_) >>= fun w__20 : option ((sop * mword 5 * mword 5 * mword 6)) => + (if ((match w__20 with | Some (op,rd,rs1,shamt) => true | _ => false end)) then + (_s888_ _s825_) >>= fun w__21 : option ((sop * mword 5 * mword 5 * mword 6)) => + (match w__21 with + | Some (op,rd,rs1,shamt) => + returnm ((SHIFTIOP ((shamt, rs1, rd, op))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s903_ _s825_) >>= fun w__24 : option ((rop * mword 5 * mword 5 * mword 5)) => + (if ((match w__24 with | Some (op,rd,rs1,rs2) => true | _ => false end)) then + (_s903_ _s825_) >>= fun w__25 : option ((rop * mword 5 * mword 5 * mword 5)) => + (match w__25 with + | Some (op,rd,rs1,rs2) => returnm ((RTYPE ((rs2, rs1, rd, op))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s920_ _s825_) >>= fun w__28 : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12)) => + (if ((match w__28 with + | Some (size,is_unsigned,aq,rl,rd,rs1,imm) => true + | _ => false + end)) then + (_s920_ _s825_) >>= fun w__29 : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12)) => + (match w__29 with + | Some (size,is_unsigned,aq,rl,rd,rs1,imm) => + returnm ((LOAD ((imm, rs1, rd, is_unsigned, size, aq, rl))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s944_ _s825_) >>= fun w__32 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12)) => + (if ((match w__32 with + | Some (size,aq,rl,rd,rs1,imm) => true + | _ => false + end)) then + (_s944_ _s825_) >>= fun w__33 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12)) => + (match w__33 with + | Some (size,aq,rl,rd,rs1,imm) => + returnm ((STORE ((imm, rs1, rd, size, aq, rl))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s966_ _s825_) >>= fun w__36 : option ((mword 5 * mword 5 * mword 12)) => + (if ((match w__36 with | Some (rd,rs1,imm) => true | _ => false end)) + then + (_s966_ _s825_) >>= fun w__37 : option ((mword 5 * mword 5 * mword 12)) => + (match w__37 with + | Some (rd,rs1,imm) => returnm ((ADDIW ((imm, rs1, rd))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s982_ _s825_) >>= fun w__40 : option ((sop * mword 5 * mword 5 * mword 5)) => + (if ((match w__40 with + | Some (op,rd,rs1,shamt) => true + | _ => false + end)) then + (_s982_ _s825_) >>= fun w__41 : option ((sop * mword 5 * mword 5 * mword 5)) => + (match w__41 with + | Some (op,rd,rs1,shamt) => + returnm ((SHIFTW ((shamt, rs1, rd, op))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s999_ _s825_) >>= fun w__44 : option ((ropw * mword 5 * mword 5 * mword 5)) => + (if ((match w__44 with + | Some (op,rd,rs1,rs2) => true + | _ => false + end)) then + (_s999_ _s825_) >>= fun w__45 : option ((ropw * mword 5 * mword 5 * mword 5)) => + (match w__45 with + | Some (op,rd,rs1,rs2) => + returnm ((RTYPEW ((rs2, rs1, rd, op))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1016_ _s825_) >>= fun w__48 : option ((sopw * mword 5 * mword 5 * mword 5)) => + (if ((match w__48 with + | Some (op,rd,rs1,shamt) => true + | _ => false + end)) then + (_s1016_ _s825_) >>= fun w__49 : option ((sopw * mword 5 * mword 5 * mword 5)) => + (match w__49 with + | Some (op,rd,rs1,shamt) => + returnm ((SHIFTIWOP ((shamt, rs1, rd, op))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1031_ _s825_) >>= fun w__52 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__52 with + | Some (high,signed1,signed2,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1031_ _s825_) >>= fun w__53 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5)) => + (match w__53 with + | Some (high,signed1,signed2,rd,rs1,rs2) => + returnm ((MUL + ((rs2, rs1, rd, high, signed1, signed2))) + : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1048_ _s825_) >>= fun w__56 : option ((bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__56 with + | Some (s,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1048_ _s825_) >>= fun w__57 : option ((bool * mword 5 * mword 5 * mword 5)) => + (match w__57 with + | Some (s,rd,rs1,rs2) => + returnm ((DIV ((rs2, rs1, rd, s))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1066_ _s825_) >>= fun w__60 : option ((bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__60 with + | Some (s,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1066_ _s825_) >>= fun w__61 : option ((bool * mword 5 * mword 5 * mword 5)) => + (match w__61 with + | Some (s,rd,rs1,rs2) => + returnm ((REM ((rs2, rs1, rd, s))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1084_ _s825_) >>= fun w__64 : option ((mword 5 * mword 5 * mword 5)) => + (if ((match w__64 with + | Some (rd,rs1,rs2) => true + | _ => false + end)) then + (_s1084_ _s825_) >>= fun w__65 : option ((mword 5 * mword 5 * mword 5)) => + (match w__65 with + | Some (rd,rs1,rs2) => + returnm ((MULW ((rs2, rs1, rd))) : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1100_ _s825_) >>= fun w__68 : option ((bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__68 with + | Some (s,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1100_ _s825_) >>= fun w__69 : option ((bool * mword 5 * mword 5 * mword 5)) => + (match w__69 with + | Some (s,rd,rs1,rs2) => + returnm ((DIVW + ((rs2, rs1, rd, s))) + : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1119_ _s825_) >>= fun w__72 : option ((bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__72 with + | Some (s,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1119_ _s825_) >>= fun w__73 : option ((bool * mword 5 * mword 5 * mword 5)) => + (match w__73 with + | Some (s,rd,rs1,rs2) => + returnm ((REMW + ((rs2, rs1, rd, s))) + : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1138_ _s825_) >>= fun w__76 : option ((mword 4 * mword 4)) => + (if ((match w__76 with + | Some (pred,succ) => true + | _ => false + end)) then + (_s1138_ _s825_) >>= fun w__77 : option ((mword 4 * mword 4)) => + (match w__77 with + | Some (pred,succ) => + returnm ((FENCE + ((pred, succ))) + : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1150_ _s825_) >>= fun w__80 : option ((mword 4 * mword 4)) => + (if ((match w__80 with + | Some (pred,succ) => true + | _ => false + end)) then + (_s1150_ _s825_) >>= fun w__81 : option ((mword 4 * mword 4)) => + (match w__81 with + | Some (pred,succ) => + returnm ((FENCE_TSO + ((pred, succ))) + : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else if ((generic_eq _s825_ + "fence.i")) then + returnm ((FENCEI + (tt)) + : ast ) + else if ((generic_eq _s825_ "ecall")) + then + returnm ((ECALL + (tt)) + : ast ) + else if ((generic_eq _s825_ "mret")) + then + returnm ((MRET + (tt)) + : ast ) + else if ((generic_eq _s825_ "sret")) + then + returnm ((SRET + (tt)) + : ast ) + else if ((generic_eq _s825_ "ebreak")) + then + returnm ((EBREAK + (tt)) + : ast ) + else if ((generic_eq _s825_ "wfi")) + then + returnm ((WFI + (tt)) + : ast ) + else + (_s1162_ _s825_) >>= fun w__84 : option ((mword 5 * mword 5)) => + (if ((match w__84 with + | Some (rs1,rs2) => true + | _ => false + end)) then + (_s1162_ _s825_) >>= fun w__85 : option ((mword 5 * mword 5)) => + (match w__85 with + | Some (rs1,rs2) => + returnm ((SFENCE_VMA + ((rs1, rs2))) + : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1174_ _s825_) >>= fun w__88 : option ((word_width * bool * bool * mword 5 * mword 5)) => + (if ((match w__88 with + | Some + (size,aq,rl,rd,rs1) => + true + | _ => false + end)) then + (_s1174_ _s825_) >>= fun w__89 : option ((word_width * bool * bool * mword 5 * mword 5)) => + (match w__89 with + | Some (size,aq,rl,rd,rs1) => + returnm ((LOADRES + ((aq, rl, rs1, size, rd))) + : ast ) + | _ => exit tt : M (ast) + end) + : M (ast) + else + (_s1192_ _s825_) >>= fun w__92 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__92 with + | Some + (size,aq,rl,rd,rs1,rs2) => + true + | _ => false + end)) then + (_s1192_ _s825_) >>= fun w__93 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)) => + (match w__93 with + | Some + (size,aq,rl,rd,rs1,rs2) => + returnm ((STORECON + ((aq, rl, rs2, rs1, size, rd))) + : ast ) + | _ => + exit tt : M (ast) + end) + : M (ast) + else + (_s1214_ _s825_) >>= fun w__96 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__96 with + | Some + (op,width,aq,rl,rd,rs1,rs2) => + true + | _ => false + end)) then + (_s1214_ _s825_) >>= fun w__97 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)) => + (match w__97 with + | Some + (op,width,aq,rl,rd,rs1,rs2) => + returnm ((AMO + ((op, aq, rl, rs2, rs1, width, rd))) + : ast ) + | _ => + exit tt : M (ast) + end) + : M (ast) + else + (_s1238_ _s825_) >>= fun w__100 : option ((csrop * mword 5 * mword 5 * mword 12)) => + (if ((match w__100 with + | Some + (op,rd,rs1,csr) => + true + | _ => false + end)) then + (_s1238_ _s825_) >>= fun w__101 : option ((csrop * mword 5 * mword 5 * mword 12)) => + (match w__101 with + | Some + (op,rd,rs1,csr) => + returnm ((CSR + ((csr, rs1, rd, true, op))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1256_ _s825_) >>= fun w__104 : option ((csrop * mword 5 * mword 5 * mword 12)) => + (if ((match w__104 with + | Some + (op,rd,rs1,csr) => + true + | _ => false + end)) then + (_s1256_ _s825_) >>= fun w__105 : option ((csrop * mword 5 * mword 5 * mword 12)) => + (match w__105 with + | Some + (op,rd,rs1,csr) => + returnm ((CSR + ((csr, rs1, rd, false, op))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else if ((generic_eq + _s825_ + "c.nop")) + then + returnm ((C_NOP + (tt)) + : ast ) + else + (_s1273_ _s825_) >>= fun w__108 : option ((mword 3 * mword 8)) => + (if ((match w__108 with + | Some + (rdc,nzimm) => + neq_vec + nzimm + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] + : mword 8) + | _ => + false + end)) then + (_s1273_ + _s825_) >>= fun w__109 : option ((mword 3 * mword 8)) => + (match w__109 with + | Some + (rdc,nzimm) => + returnm ((C_ADDI4SPN + ((rdc, nzimm))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1285_ + _s825_) >>= fun w__112 : option ((mword 3 * mword 3 * mword 5)) => + (if ((match w__112 with + | Some + (rdc,rsc,uimm) => + true + | _ => + false + end)) + then + (_s1285_ + _s825_) >>= fun w__113 : option ((mword 3 * mword 3 * mword 5)) => + (match w__113 with + | Some + (rdc,rsc,uimm) => + returnm ((C_LW + ((uimm, rsc, rdc))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1301_ + _s825_) >>= fun w__116 : option ((mword 3 * mword 3 * mword 5)) => + (if ((match w__116 with + | Some + (rdc,rsc,uimm) => + true + | _ => + false + end)) + then + (_s1301_ + _s825_) >>= fun w__117 : option ((mword 3 * mword 3 * mword 5)) => + (match w__117 with + | Some + (rdc,rsc,uimm) => + returnm ((C_LD + ((uimm, rsc, rdc))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1317_ + _s825_) >>= fun w__120 : option ((mword 3 * mword 3 * mword 5)) => + (if ((match w__120 with + | Some + (rsc1,rsc2,uimm) => + true + | _ => + false + end)) + then + (_s1317_ + _s825_) >>= fun w__121 : option ((mword 3 * mword 3 * mword 5)) => + (match w__121 with + | Some + (rsc1,rsc2,uimm) => + returnm ((C_SW + ((uimm, rsc1, rsc2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1333_ + _s825_) >>= fun w__124 : option ((mword 3 * mword 3 * mword 5)) => + (if ((match w__124 with + | Some + (rsc1,rsc2,uimm) => + true + | _ => + false + end)) + then + (_s1333_ + _s825_) >>= fun w__125 : option ((mword 3 * mword 3 * mword 5)) => + (match w__125 with + | Some + (rsc1,rsc2,uimm) => + returnm ((C_SD + ((uimm, rsc1, rsc2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1349_ + _s825_) >>= fun w__128 : option ((mword 5 * mword 6)) => + (if + ((match w__128 with + | Some + (rsd,nzi) => + andb + (neq_vec + nzi + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6)) + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s1349_ + _s825_) >>= fun w__129 : option ((mword 5 * mword 6)) => + (match w__129 with + | Some + (rsd,nzi) => + returnm ((C_ADDI + ((nzi, rsd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1361_ + _s825_) >>= fun w__132 : option (mword 11) => + (if + ((match w__132 with + | Some + (imm) => + true + | _ => + false + end)) + then + (_s1361_ + _s825_) >>= fun w__133 : option (mword 11) => + (match w__133 with + | Some + (imm) => + returnm ((C_JAL + (imm)) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1369_ + _s825_) >>= fun w__136 : option ((mword 5 * mword 6)) => + (if + ((match w__136 with + | Some + (rsd,imm) => + true + | _ => + false + end)) + then + (_s1369_ + _s825_) >>= fun w__137 : option ((mword 5 * mword 6)) => + (match w__137 with + | Some + (rsd,imm) => + returnm ((C_ADDIW + ((imm, rsd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1381_ + _s825_) >>= fun w__140 : option ((mword 5 * mword 6)) => + (if + ((match w__140 with + | Some + (rd,imm) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s1381_ + _s825_) >>= fun w__141 : option ((mword 5 * mword 6)) => + (match w__141 with + | Some + (rd,imm) => + returnm ((C_LI + ((imm, rd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1393_ + _s825_) >>= fun w__144 : option (mword 6) => + (if + ((match w__144 with + | Some + (imm) => + neq_vec + imm + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s1393_ + _s825_) >>= fun w__145 : option (mword 6) => + (match w__145 with + | Some + (imm) => + returnm ((C_ADDI16SP + (imm)) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1401_ + _s825_) >>= fun w__148 : option ((mword 5 * mword 6)) => + (if + ((match w__148 with + | Some + (rd,imm) => + andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg))) + (andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + sp))) + (neq_vec + imm + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6))) + | _ => + false + end)) + then + (_s1401_ + _s825_) >>= fun w__149 : option ((mword 5 * mword 6)) => + (match w__149 with + | Some + (rd,imm) => + returnm ((C_LUI + ((imm, rd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1413_ + _s825_) >>= fun w__152 : option ((mword 3 * mword 6)) => + (if + ((match w__152 with + | Some + (rsd,shamt) => + neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s1413_ + _s825_) >>= fun w__153 : option ((mword 3 * mword 6)) => + (match w__153 with + | Some + (rsd,shamt) => + returnm ((C_SRLI + ((shamt, rsd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1425_ + _s825_) >>= fun w__156 : option ((mword 3 * mword 6)) => + (if + ((match w__156 with + | Some + (rsd,shamt) => + neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s1425_ + _s825_) >>= fun w__157 : option ((mword 3 * mword 6)) => + (match w__157 with + | Some + (rsd,shamt) => + returnm ((C_SRAI + ((shamt, rsd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1437_ + _s825_) >>= fun w__160 : option ((mword 3 * mword 6)) => + (if + ((match w__160 with + | Some + (rsd,imm) => + true + | _ => + false + end)) + then + (_s1437_ + _s825_) >>= fun w__161 : option ((mword 3 * mword 6)) => + (match w__161 with + | Some + (rsd,imm) => + returnm ((C_ANDI + ((imm, rsd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1449_ + _s825_) >>= fun w__164 : option ((mword 3 * mword 3)) => + (if + ((match w__164 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s1449_ + _s825_) >>= fun w__165 : option ((mword 3 * mword 3)) => + (match w__165 with + | Some + (rsd,rs2) => + returnm ((C_SUB + ((rsd, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1461_ + _s825_) >>= fun w__168 : option ((mword 3 * mword 3)) => + (if + ((match w__168 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s1461_ + _s825_) >>= fun w__169 : option ((mword 3 * mword 3)) => + (match w__169 with + | Some + (rsd,rs2) => + returnm ((C_XOR + ((rsd, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1473_ + _s825_) >>= fun w__172 : option ((mword 3 * mword 3)) => + (if + ((match w__172 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s1473_ + _s825_) >>= fun w__173 : option ((mword 3 * mword 3)) => + (match w__173 with + | Some + (rsd,rs2) => + returnm ((C_OR + ((rsd, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1485_ + _s825_) >>= fun w__176 : option ((mword 3 * mword 3)) => + (if + ((match w__176 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s1485_ + _s825_) >>= fun w__177 : option ((mword 3 * mword 3)) => + (match w__177 with + | Some + (rsd,rs2) => + returnm ((C_AND + ((rsd, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1497_ + _s825_) >>= fun w__180 : option ((mword 3 * mword 3)) => + (if + ((match w__180 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s1497_ + _s825_) >>= fun w__181 : option ((mword 3 * mword 3)) => + (match w__181 with + | Some + (rsd,rs2) => + returnm ((C_SUBW + ((rsd, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1509_ + _s825_) >>= fun w__184 : option ((mword 3 * mword 3)) => + (if + ((match w__184 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s1509_ + _s825_) >>= fun w__185 : option ((mword 3 * mword 3)) => + (match w__185 with + | Some + (rsd,rs2) => + returnm ((C_ADDW + ((rsd, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1521_ + _s825_) >>= fun w__188 : option (mword 11) => + (if + ((match w__188 with + | Some + (imm) => + true + | _ => + false + end)) + then + (_s1521_ + _s825_) >>= fun w__189 : option (mword 11) => + (match w__189 with + | Some + (imm) => + returnm ((C_J + (imm)) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1529_ + _s825_) >>= fun w__192 : option ((mword 3 * mword 8)) => + (if + ((match w__192 with + | Some + (rs,imm) => + true + | _ => + false + end)) + then + (_s1529_ + _s825_) >>= fun w__193 : option ((mword 3 * mword 8)) => + (match w__193 with + | Some + (rs,imm) => + returnm ((C_BEQZ + ((imm, rs))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1541_ + _s825_) >>= fun w__196 : option ((mword 3 * mword 8)) => + (if + ((match w__196 with + | Some + (rs,imm) => + true + | _ => + false + end)) + then + (_s1541_ + _s825_) >>= fun w__197 : option ((mword 3 * mword 8)) => + (match w__197 with + | Some + (rs,imm) => + returnm ((C_BNEZ + ((imm, rs))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1553_ + _s825_) >>= fun w__200 : option ((mword 5 * mword 6)) => + (if + ((match w__200 with + | Some + (rsd,shamt) => + andb + (neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6)) + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s1553_ + _s825_) >>= fun w__201 : option ((mword 5 * mword 6)) => + (match w__201 with + | Some + (rsd,shamt) => + returnm ((C_SLLI + ((shamt, rsd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1565_ + _s825_) >>= fun w__204 : option ((mword 5 * mword 6)) => + (if + ((match w__204 with + | Some + (rd,uimm) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s1565_ + _s825_) >>= fun w__205 : option ((mword 5 * mword 6)) => + (match w__205 with + | Some + (rd,uimm) => + returnm ((C_LWSP + ((uimm, rd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1577_ + _s825_) >>= fun w__208 : option ((mword 5 * mword 6)) => + (if + ((match w__208 with + | Some + (rd,uimm) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s1577_ + _s825_) >>= fun w__209 : option ((mword 5 * mword 6)) => + (match w__209 with + | Some + (rd,uimm) => + returnm ((C_LDSP + ((uimm, rd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1589_ + _s825_) >>= fun w__212 : option ((mword 5 * mword 6)) => + (if + ((match w__212 with + | Some + (rd,uimm) => + true + | _ => + false + end)) + then + (_s1589_ + _s825_) >>= fun w__213 : option ((mword 5 * mword 6)) => + (match w__213 with + | Some + (rd,uimm) => + returnm ((C_SWSP + ((uimm, rd))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1601_ + _s825_) >>= fun w__216 : option ((mword 5 * mword 6)) => + (if + ((match w__216 with + | Some + (rs2,uimm) => + true + | _ => + false + end)) + then + (_s1601_ + _s825_) >>= fun w__217 : option ((mword 5 * mword 6)) => + (match w__217 with + | Some + (rs2,uimm) => + returnm ((C_SDSP + ((uimm, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1613_ + _s825_) >>= fun w__220 : option (mword 5) => + (if + ((match w__220 with + | Some + (rs1) => + neq_int + (projT1 (regbits_to_regno + rs1)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s1613_ + _s825_) >>= fun w__221 : option (mword 5) => + (match w__221 with + | Some + (rs1) => + returnm ((C_JR + (rs1)) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1621_ + _s825_) >>= fun w__224 : option (mword 5) => + (if + ((match w__224 with + | Some + (rs1) => + neq_int + (projT1 (regbits_to_regno + rs1)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s1621_ + _s825_) >>= fun w__225 : option (mword 5) => + (match w__225 with + | Some + (rs1) => + returnm ((C_JALR + (rs1)) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1629_ + _s825_) >>= fun w__228 : option ((mword 5 * mword 5)) => + (if + ((match w__228 with + | Some + (rd,rs2) => + andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg))) + (neq_int + (projT1 (regbits_to_regno + rs2)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s1629_ + _s825_) >>= fun w__229 : option ((mword 5 * mword 5)) => + (match w__229 with + | Some + (rd,rs2) => + returnm ((C_MV + ((rd, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else if + ((generic_eq + _s825_ + "c.ebreak")) + then + returnm ((C_EBREAK + (tt)) + : ast ) + else + (_s1641_ + _s825_) >>= fun w__232 : option ((mword 5 * mword 5)) => + (if + ((match w__232 with + | Some + (rsd,rs2) => + andb + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + (neq_int + (projT1 (regbits_to_regno + rs2)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s1641_ + _s825_) >>= fun w__233 : option ((mword 5 * mword 5)) => + (match w__233 with + | Some + (rsd,rs2) => + returnm ((C_ADD + ((rsd, rs2))) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else if + ((generic_eq + _s825_ + "stop_fetching")) + then + returnm ((STOP_FETCHING + (tt)) + : ast ) + else if + ((generic_eq + _s825_ + "thread_start")) + then + returnm ((THREAD_START + (tt)) + : ast ) + else + (_s1653_ + _s825_) >>= fun w__236 : option (mword 32) => + (if + ((match w__236 with + | Some + (s) => + true + | _ => + false + end)) + then + (_s1653_ + _s825_) >>= fun w__237 : option (mword 32) => + (match w__237 with + | Some + (s) => + returnm ((ILLEGAL + (s)) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast) + else + (_s1661_ + _s825_) >>= fun w__240 : option (mword 16) => + (match w__240 with + | Some + (s) => + returnm ((C_ILLEGAL + (s)) + : ast ) + | _ => + exit tt + : M (ast) + end) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast)) + : M (ast). + +Definition assembly_forwards_matches (arg_ : ast) +: bool := + + match arg_ with + | UTYPE (imm,rd,op) => true + | RISCV_JAL (imm,rd) => true + | RISCV_JALR (imm,rs1,rd) => true + | BTYPE (imm,rs2,rs1,op) => true + | ITYPE (imm,rs1,rd,op) => true + | SHIFTIOP (shamt,rs1,rd,op) => true + | RTYPE (rs2,rs1,rd,op) => true + | LOAD (imm,rs1,rd,is_unsigned,size,aq,rl) => true + | STORE (imm,rs1,rd,size,aq,rl) => true + | ADDIW (imm,rs1,rd) => true + | SHIFTW (shamt,rs1,rd,op) => true + | RTYPEW (rs2,rs1,rd,op) => true + | SHIFTIWOP (shamt,rs1,rd,op) => true + | MUL (rs2,rs1,rd,high,signed1,signed2) => true + | DIV (rs2,rs1,rd,s) => true + | REM (rs2,rs1,rd,s) => true + | MULW (rs2,rs1,rd) => true + | DIVW (rs2,rs1,rd,s) => true + | REMW (rs2,rs1,rd,s) => true + | FENCE (pred,succ) => true + | FENCE_TSO (pred,succ) => true + | FENCEI (tt) => true + | ECALL (tt) => true + | MRET (tt) => true + | SRET (tt) => true + | EBREAK (tt) => true + | WFI (tt) => true + | SFENCE_VMA (rs1,rs2) => true + | LOADRES (aq,rl,rs1,size,rd) => true + | STORECON (aq,rl,rs2,rs1,size,rd) => true + | AMO (op,aq,rl,rs2,rs1,width,rd) => true + | CSR (csr,rs1,rd,true,op) => true + | CSR (csr,rs1,rd,false,op) => true + | C_NOP (tt) => true + | C_ADDI4SPN (rdc,nzimm) => + if ((neq_vec nzimm (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] : mword 8))) then true + else + let g__28 := C_ADDI4SPN ((rdc, nzimm)) in + false + | C_LW (uimm,rsc,rdc) => true + | C_LD (uimm,rsc,rdc) => true + | C_SW (uimm,rsc1,rsc2) => true + | C_SD (uimm,rsc1,rsc2) => true + | C_ADDI (nzi,rsd) => + if ((andb (neq_vec nzi (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword 6)) + (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))))) then + true + else + let g__28 := C_ADDI ((nzi, rsd)) in + false + | C_JAL (imm) => true + | C_ADDIW (imm,rsd) => true + | C_LI (imm,rd) => + if ((neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__28 := C_LI ((imm, rd)) in + false + | C_ADDI16SP (imm) => + if ((neq_vec imm (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword 6))) then true + else + let g__28 := C_ADDI16SP (imm) in + false + | C_LUI (imm,rd) => + if ((andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno sp))) + (neq_vec imm (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword 6))))) then + true + else + let g__28 := C_LUI ((imm, rd)) in + false + | C_SRLI (shamt,rsd) => + if ((neq_vec shamt (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword 6))) then true + else + let g__28 := C_SRLI ((shamt, rsd)) in + false + | C_SRAI (shamt,rsd) => + if ((neq_vec shamt (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword 6))) then true + else + let g__28 := C_SRAI ((shamt, rsd)) in + false + | C_ANDI (imm,rsd) => true + | C_SUB (rsd,rs2) => true + | C_XOR (rsd,rs2) => true + | C_OR (rsd,rs2) => true + | C_AND (rsd,rs2) => true + | C_SUBW (rsd,rs2) => true + | C_ADDW (rsd,rs2) => true + | C_J (imm) => true + | C_BEQZ (imm,rs) => true + | C_BNEZ (imm,rs) => true + | C_SLLI (shamt,rsd) => + if ((andb (neq_vec shamt (vec_of_bits [B0;B0;B0;B0;B0;B0] : mword 6)) + (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))))) then + true + else + let g__28 := C_SLLI ((shamt, rsd)) in + false + | C_LWSP (uimm,rd) => + if ((neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__28 := C_LWSP ((uimm, rd)) in + false + | C_LDSP (uimm,rd) => + if ((neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__28 := C_LDSP ((uimm, rd)) in + false + | C_SWSP (uimm,rd) => true + | C_SDSP (uimm,rs2) => true + | C_JR (rs1) => + if ((neq_int (projT1 (regbits_to_regno rs1)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__28 := C_JR (rs1) in + false + | C_JALR (rs1) => + if ((neq_int (projT1 (regbits_to_regno rs1)) (projT1 (regbits_to_regno zreg)))) then true + else + let g__28 := C_JALR (rs1) in + false + | C_MV (rd,rs2) => + if ((andb (neq_int (projT1 (regbits_to_regno rd)) (projT1 (regbits_to_regno zreg))) + (neq_int (projT1 (regbits_to_regno rs2)) (projT1 (regbits_to_regno zreg))))) then + true + else + let g__28 := C_MV ((rd, rs2)) in + false + | C_EBREAK (tt) => true + | C_ADD (rsd,rs2) => + if ((andb (neq_int (projT1 (regbits_to_regno rsd)) (projT1 (regbits_to_regno zreg))) + (neq_int (projT1 (regbits_to_regno rs2)) (projT1 (regbits_to_regno zreg))))) then + true + else + let g__28 := C_ADD ((rsd, rs2)) in + false + | STOP_FETCHING (tt) => true + | THREAD_START (tt) => true + | ILLEGAL (s) => true + | C_ILLEGAL (s) => true + end. + +Definition _s2517_ (_s2518_ : string) +: M (option (mword 16)) := + + let _s2519_ := _s2518_ in + (if ((string_startswith _s2519_ "c.illegal")) then + (match (string_drop _s2519_ (projT1 (string_length "c.illegal"))) with + | _s2520_ => + (spc_matches_prefix _s2520_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s2521_ _)) => + match (string_drop _s2520_ _s2521_) with + | _s2522_ => + match (hex_bits_16_matches_prefix _s2522_) with + | Some (s,(existT _ _s2523_ _)) => + let p0_ := string_drop _s2522_ _s2523_ in + if ((generic_eq p0_ "")) then Some (s) + else None + | _ => None + end + end + | _ => None + end) + : option (mword 16)) + end) + : M (option (mword 16)) + else returnm (None : option (mword 16))) + : M (option (mword 16)). + +Definition _s2509_ (_s2510_ : string) +: M (option (mword 32)) := + + let _s2511_ := _s2510_ in + (if ((string_startswith _s2511_ "illegal")) then + (match (string_drop _s2511_ (projT1 (string_length "illegal"))) with + | _s2512_ => + (spc_matches_prefix _s2512_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s2513_ _)) => + match (string_drop _s2512_ _s2513_) with + | _s2514_ => + match (hex_bits_32_matches_prefix _s2514_) with + | Some (s,(existT _ _s2515_ _)) => + let p0_ := string_drop _s2514_ _s2515_ in + if ((generic_eq p0_ "")) then Some (s) + else None + | _ => None + end + end + | _ => None + end) + : option (mword 32)) + end) + : M (option (mword 32)) + else returnm (None : option (mword 32))) + : M (option (mword 32)). + +Definition _s2497_ (_s2498_ : string) +: M (option ((mword 5 * mword 5))) := + + let _s2499_ := _s2498_ in + (if ((string_startswith _s2499_ "c.add")) then + (match (string_drop _s2499_ (projT1 (string_length "c.add"))) with + | _s2500_ => + (spc_matches_prefix _s2500_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2501_ _)) => + (match (string_drop _s2500_ _s2501_) with + | _s2502_ => + (reg_name_matches_prefix _s2502_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2503_ _)) => + (match (string_drop _s2502_ _s2503_) with + | _s2504_ => + (sep_matches_prefix _s2504_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2505_ _)) => + (match (string_drop _s2504_ _s2505_) with + | _s2506_ => + (reg_name_matches_prefix _s2506_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2507_ _)) => + let p0_ := string_drop _s2506_ _s2507_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + else returnm (None : option ((mword 5 * mword 5)))) + : M (option ((mword 5 * mword 5))). + +Definition _s2485_ (_s2486_ : string) +: M (option ((mword 5 * mword 5))) := + + let _s2487_ := _s2486_ in + (if ((string_startswith _s2487_ "c.mv")) then + (match (string_drop _s2487_ (projT1 (string_length "c.mv"))) with + | _s2488_ => + (spc_matches_prefix _s2488_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2489_ _)) => + (match (string_drop _s2488_ _s2489_) with + | _s2490_ => + (reg_name_matches_prefix _s2490_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2491_ _)) => + (match (string_drop _s2490_ _s2491_) with + | _s2492_ => + (sep_matches_prefix _s2492_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2493_ _)) => + (match (string_drop _s2492_ _s2493_) with + | _s2494_ => + (reg_name_matches_prefix _s2494_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2495_ _)) => + let p0_ := string_drop _s2494_ _s2495_ in + if ((generic_eq p0_ "")) then Some ((rd, rs2)) + else None + | _ => None + end) + : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + else returnm (None : option ((mword 5 * mword 5)))) + : M (option ((mword 5 * mword 5))). + +Definition _s2477_ (_s2478_ : string) +: M (option (mword 5)) := + + let _s2479_ := _s2478_ in + (if ((string_startswith _s2479_ "c.jalr")) then + (match (string_drop _s2479_ (projT1 (string_length "c.jalr"))) with + | _s2480_ => + (spc_matches_prefix _s2480_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2481_ _)) => + (match (string_drop _s2480_ _s2481_) with + | _s2482_ => + (reg_name_matches_prefix _s2482_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (rs1,(existT _ _s2483_ _)) => + let p0_ := string_drop _s2482_ _s2483_ in + if ((generic_eq p0_ "")) then Some (rs1) + else None + | _ => None + end) + : option (mword 5)) + end) + : M (option (mword 5)) + | _ => returnm (None : option (mword 5)) + end) + : M (option (mword 5)) + end) + : M (option (mword 5)) + else returnm (None : option (mword 5))) + : M (option (mword 5)). + +Definition _s2469_ (_s2470_ : string) +: M (option (mword 5)) := + + let _s2471_ := _s2470_ in + (if ((string_startswith _s2471_ "c.jr")) then + (match (string_drop _s2471_ (projT1 (string_length "c.jr"))) with + | _s2472_ => + (spc_matches_prefix _s2472_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2473_ _)) => + (match (string_drop _s2472_ _s2473_) with + | _s2474_ => + (reg_name_matches_prefix _s2474_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (rs1,(existT _ _s2475_ _)) => + let p0_ := string_drop _s2474_ _s2475_ in + if ((generic_eq p0_ "")) then Some (rs1) + else None + | _ => None + end) + : option (mword 5)) + end) + : M (option (mword 5)) + | _ => returnm (None : option (mword 5)) + end) + : M (option (mword 5)) + end) + : M (option (mword 5)) + else returnm (None : option (mword 5))) + : M (option (mword 5)). + +Definition _s2457_ (_s2458_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2459_ := _s2458_ in + (if ((string_startswith _s2459_ "c.sdsp")) then + (match (string_drop _s2459_ (projT1 (string_length "c.sdsp"))) with + | _s2460_ => + (spc_matches_prefix _s2460_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2461_ _)) => + (match (string_drop _s2460_ _s2461_) with + | _s2462_ => + (reg_name_matches_prefix _s2462_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs2,(existT _ _s2463_ _)) => + (match (string_drop _s2462_ _s2463_) with + | _s2464_ => + (sep_matches_prefix _s2464_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2465_ _)) => + match (string_drop _s2464_ _s2465_) with + | _s2466_ => + match (hex_bits_6_matches_prefix _s2466_) with + | Some (uimm,(existT _ _s2467_ _)) => + let p0_ := string_drop _s2466_ _s2467_ in + if ((generic_eq p0_ "")) then Some ((rs2, uimm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2445_ (_s2446_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2447_ := _s2446_ in + (if ((string_startswith _s2447_ "c.swsp")) then + (match (string_drop _s2447_ (projT1 (string_length "c.swsp"))) with + | _s2448_ => + (spc_matches_prefix _s2448_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2449_ _)) => + (match (string_drop _s2448_ _s2449_) with + | _s2450_ => + (reg_name_matches_prefix _s2450_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2451_ _)) => + (match (string_drop _s2450_ _s2451_) with + | _s2452_ => + (sep_matches_prefix _s2452_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2453_ _)) => + match (string_drop _s2452_ _s2453_) with + | _s2454_ => + match (hex_bits_6_matches_prefix _s2454_) with + | Some (uimm,(existT _ _s2455_ _)) => + let p0_ := string_drop _s2454_ _s2455_ in + if ((generic_eq p0_ "")) then Some ((rd, uimm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2433_ (_s2434_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2435_ := _s2434_ in + (if ((string_startswith _s2435_ "c.ldsp")) then + (match (string_drop _s2435_ (projT1 (string_length "c.ldsp"))) with + | _s2436_ => + (spc_matches_prefix _s2436_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2437_ _)) => + (match (string_drop _s2436_ _s2437_) with + | _s2438_ => + (reg_name_matches_prefix _s2438_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2439_ _)) => + (match (string_drop _s2438_ _s2439_) with + | _s2440_ => + (sep_matches_prefix _s2440_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2441_ _)) => + match (string_drop _s2440_ _s2441_) with + | _s2442_ => + match (hex_bits_6_matches_prefix _s2442_) with + | Some (uimm,(existT _ _s2443_ _)) => + let p0_ := string_drop _s2442_ _s2443_ in + if ((generic_eq p0_ "")) then Some ((rd, uimm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2421_ (_s2422_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2423_ := _s2422_ in + (if ((string_startswith _s2423_ "c.lwsp")) then + (match (string_drop _s2423_ (projT1 (string_length "c.lwsp"))) with + | _s2424_ => + (spc_matches_prefix _s2424_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2425_ _)) => + (match (string_drop _s2424_ _s2425_) with + | _s2426_ => + (reg_name_matches_prefix _s2426_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2427_ _)) => + (match (string_drop _s2426_ _s2427_) with + | _s2428_ => + (sep_matches_prefix _s2428_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2429_ _)) => + match (string_drop _s2428_ _s2429_) with + | _s2430_ => + match (hex_bits_6_matches_prefix _s2430_) with + | Some (uimm,(existT _ _s2431_ _)) => + let p0_ := string_drop _s2430_ _s2431_ in + if ((generic_eq p0_ "")) then Some ((rd, uimm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2409_ (_s2410_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2411_ := _s2410_ in + (if ((string_startswith _s2411_ "c.slli")) then + (match (string_drop _s2411_ (projT1 (string_length "c.slli"))) with + | _s2412_ => + (spc_matches_prefix _s2412_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2413_ _)) => + (match (string_drop _s2412_ _s2413_) with + | _s2414_ => + (reg_name_matches_prefix _s2414_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2415_ _)) => + (match (string_drop _s2414_ _s2415_) with + | _s2416_ => + (sep_matches_prefix _s2416_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2417_ _)) => + match (string_drop _s2416_ _s2417_) with + | _s2418_ => + match (hex_bits_6_matches_prefix _s2418_) with + | Some (shamt,(existT _ _s2419_ _)) => + let p0_ := string_drop _s2418_ _s2419_ in + if ((generic_eq p0_ "")) then Some ((rsd, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2397_ (_s2398_ : string) +: M (option ((mword 3 * mword 8))) := + + let _s2399_ := _s2398_ in + (if ((string_startswith _s2399_ "c.bnez")) then + (match (string_drop _s2399_ (projT1 (string_length "c.bnez"))) with + | _s2400_ => + (spc_matches_prefix _s2400_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2401_ _)) => + (match (string_drop _s2400_ _s2401_) with + | _s2402_ => + (creg_name_matches_prefix _s2402_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs,(existT _ _s2403_ _)) => + (match (string_drop _s2402_ _s2403_) with + | _s2404_ => + (sep_matches_prefix _s2404_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2405_ _)) => + match (string_drop _s2404_ _s2405_) with + | _s2406_ => + match (hex_bits_8_matches_prefix _s2406_) with + | Some (imm,(existT _ _s2407_ _)) => + let p0_ := string_drop _s2406_ _s2407_ in + if ((generic_eq p0_ "")) then Some ((rs, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + else returnm (None : option ((mword 3 * mword 8)))) + : M (option ((mword 3 * mword 8))). + +Definition _s2385_ (_s2386_ : string) +: M (option ((mword 3 * mword 8))) := + + let _s2387_ := _s2386_ in + (if ((string_startswith _s2387_ "c.beqz")) then + (match (string_drop _s2387_ (projT1 (string_length "c.beqz"))) with + | _s2388_ => + (spc_matches_prefix _s2388_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2389_ _)) => + (match (string_drop _s2388_ _s2389_) with + | _s2390_ => + (creg_name_matches_prefix _s2390_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs,(existT _ _s2391_ _)) => + (match (string_drop _s2390_ _s2391_) with + | _s2392_ => + (sep_matches_prefix _s2392_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2393_ _)) => + match (string_drop _s2392_ _s2393_) with + | _s2394_ => + match (hex_bits_8_matches_prefix _s2394_) with + | Some (imm,(existT _ _s2395_ _)) => + let p0_ := string_drop _s2394_ _s2395_ in + if ((generic_eq p0_ "")) then Some ((rs, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + else returnm (None : option ((mword 3 * mword 8)))) + : M (option ((mword 3 * mword 8))). + +Definition _s2377_ (_s2378_ : string) +: M (option (mword 11)) := + + let _s2379_ := _s2378_ in + (if ((string_startswith _s2379_ "c.j")) then + (match (string_drop _s2379_ (projT1 (string_length "c.j"))) with + | _s2380_ => + (spc_matches_prefix _s2380_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s2381_ _)) => + match (string_drop _s2380_ _s2381_) with + | _s2382_ => + match (hex_bits_11_matches_prefix _s2382_) with + | Some (imm,(existT _ _s2383_ _)) => + let p0_ := string_drop _s2382_ _s2383_ in + if ((generic_eq p0_ "")) then Some (imm) + else None + | _ => None + end + end + | _ => None + end) + : option (mword 11)) + end) + : M (option (mword 11)) + else returnm (None : option (mword 11))) + : M (option (mword 11)). + +Definition _s2365_ (_s2366_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s2367_ := _s2366_ in + (if ((string_startswith _s2367_ "c.addw")) then + (match (string_drop _s2367_ (projT1 (string_length "c.addw"))) with + | _s2368_ => + (spc_matches_prefix _s2368_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2369_ _)) => + (match (string_drop _s2368_ _s2369_) with + | _s2370_ => + (creg_name_matches_prefix _s2370_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2371_ _)) => + (match (string_drop _s2370_ _s2371_) with + | _s2372_ => + (sep_matches_prefix _s2372_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2373_ _)) => + (match (string_drop _s2372_ _s2373_) with + | _s2374_ => + (creg_name_matches_prefix _s2374_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2375_ _)) => + let p0_ := string_drop _s2374_ _s2375_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s2353_ (_s2354_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s2355_ := _s2354_ in + (if ((string_startswith _s2355_ "c.subw")) then + (match (string_drop _s2355_ (projT1 (string_length "c.subw"))) with + | _s2356_ => + (spc_matches_prefix _s2356_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2357_ _)) => + (match (string_drop _s2356_ _s2357_) with + | _s2358_ => + (creg_name_matches_prefix _s2358_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2359_ _)) => + (match (string_drop _s2358_ _s2359_) with + | _s2360_ => + (sep_matches_prefix _s2360_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2361_ _)) => + (match (string_drop _s2360_ _s2361_) with + | _s2362_ => + (creg_name_matches_prefix _s2362_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2363_ _)) => + let p0_ := string_drop _s2362_ _s2363_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s2341_ (_s2342_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s2343_ := _s2342_ in + (if ((string_startswith _s2343_ "c.and")) then + (match (string_drop _s2343_ (projT1 (string_length "c.and"))) with + | _s2344_ => + (spc_matches_prefix _s2344_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2345_ _)) => + (match (string_drop _s2344_ _s2345_) with + | _s2346_ => + (creg_name_matches_prefix _s2346_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2347_ _)) => + (match (string_drop _s2346_ _s2347_) with + | _s2348_ => + (sep_matches_prefix _s2348_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2349_ _)) => + (match (string_drop _s2348_ _s2349_) with + | _s2350_ => + (creg_name_matches_prefix _s2350_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2351_ _)) => + let p0_ := string_drop _s2350_ _s2351_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s2329_ (_s2330_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s2331_ := _s2330_ in + (if ((string_startswith _s2331_ "c.or")) then + (match (string_drop _s2331_ (projT1 (string_length "c.or"))) with + | _s2332_ => + (spc_matches_prefix _s2332_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2333_ _)) => + (match (string_drop _s2332_ _s2333_) with + | _s2334_ => + (creg_name_matches_prefix _s2334_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2335_ _)) => + (match (string_drop _s2334_ _s2335_) with + | _s2336_ => + (sep_matches_prefix _s2336_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2337_ _)) => + (match (string_drop _s2336_ _s2337_) with + | _s2338_ => + (creg_name_matches_prefix _s2338_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2339_ _)) => + let p0_ := string_drop _s2338_ _s2339_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s2317_ (_s2318_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s2319_ := _s2318_ in + (if ((string_startswith _s2319_ "c.xor")) then + (match (string_drop _s2319_ (projT1 (string_length "c.xor"))) with + | _s2320_ => + (spc_matches_prefix _s2320_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2321_ _)) => + (match (string_drop _s2320_ _s2321_) with + | _s2322_ => + (creg_name_matches_prefix _s2322_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2323_ _)) => + (match (string_drop _s2322_ _s2323_) with + | _s2324_ => + (sep_matches_prefix _s2324_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2325_ _)) => + (match (string_drop _s2324_ _s2325_) with + | _s2326_ => + (creg_name_matches_prefix _s2326_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2327_ _)) => + let p0_ := string_drop _s2326_ _s2327_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s2305_ (_s2306_ : string) +: M (option ((mword 3 * mword 3))) := + + let _s2307_ := _s2306_ in + (if ((string_startswith _s2307_ "c.sub")) then + (match (string_drop _s2307_ (projT1 (string_length "c.sub"))) with + | _s2308_ => + (spc_matches_prefix _s2308_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2309_ _)) => + (match (string_drop _s2308_ _s2309_) with + | _s2310_ => + (creg_name_matches_prefix _s2310_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2311_ _)) => + (match (string_drop _s2310_ _s2311_) with + | _s2312_ => + (sep_matches_prefix _s2312_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2313_ _)) => + (match (string_drop _s2312_ _s2313_) with + | _s2314_ => + (creg_name_matches_prefix _s2314_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2315_ _)) => + let p0_ := string_drop _s2314_ _s2315_ in + if ((generic_eq p0_ "")) then Some ((rsd, rs2)) + else None + | _ => None + end) + : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + | _ => returnm (None : option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + end) + : M (option ((mword 3 * mword 3))) + else returnm (None : option ((mword 3 * mword 3)))) + : M (option ((mword 3 * mword 3))). + +Definition _s2293_ (_s2294_ : string) +: M (option ((mword 3 * mword 6))) := + + let _s2295_ := _s2294_ in + (if ((string_startswith _s2295_ "c.andi")) then + (match (string_drop _s2295_ (projT1 (string_length "c.andi"))) with + | _s2296_ => + (spc_matches_prefix _s2296_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2297_ _)) => + (match (string_drop _s2296_ _s2297_) with + | _s2298_ => + (creg_name_matches_prefix _s2298_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2299_ _)) => + (match (string_drop _s2298_ _s2299_) with + | _s2300_ => + (sep_matches_prefix _s2300_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2301_ _)) => + match (string_drop _s2300_ _s2301_) with + | _s2302_ => + match (hex_bits_6_matches_prefix _s2302_) with + | Some (imm,(existT _ _s2303_ _)) => + let p0_ := string_drop _s2302_ _s2303_ in + if ((generic_eq p0_ "")) then Some ((rsd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + else returnm (None : option ((mword 3 * mword 6)))) + : M (option ((mword 3 * mword 6))). + +Definition _s2281_ (_s2282_ : string) +: M (option ((mword 3 * mword 6))) := + + let _s2283_ := _s2282_ in + (if ((string_startswith _s2283_ "c.srai")) then + (match (string_drop _s2283_ (projT1 (string_length "c.srai"))) with + | _s2284_ => + (spc_matches_prefix _s2284_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2285_ _)) => + (match (string_drop _s2284_ _s2285_) with + | _s2286_ => + (creg_name_matches_prefix _s2286_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2287_ _)) => + (match (string_drop _s2286_ _s2287_) with + | _s2288_ => + (sep_matches_prefix _s2288_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2289_ _)) => + match (string_drop _s2288_ _s2289_) with + | _s2290_ => + match (hex_bits_6_matches_prefix _s2290_) with + | Some (shamt,(existT _ _s2291_ _)) => + let p0_ := string_drop _s2290_ _s2291_ in + if ((generic_eq p0_ "")) then Some ((rsd, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + else returnm (None : option ((mword 3 * mword 6)))) + : M (option ((mword 3 * mword 6))). + +Definition _s2269_ (_s2270_ : string) +: M (option ((mword 3 * mword 6))) := + + let _s2271_ := _s2270_ in + (if ((string_startswith _s2271_ "c.srli")) then + (match (string_drop _s2271_ (projT1 (string_length "c.srli"))) with + | _s2272_ => + (spc_matches_prefix _s2272_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2273_ _)) => + (match (string_drop _s2272_ _s2273_) with + | _s2274_ => + (creg_name_matches_prefix _s2274_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2275_ _)) => + (match (string_drop _s2274_ _s2275_) with + | _s2276_ => + (sep_matches_prefix _s2276_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2277_ _)) => + match (string_drop _s2276_ _s2277_) with + | _s2278_ => + match (hex_bits_6_matches_prefix _s2278_) with + | Some (shamt,(existT _ _s2279_ _)) => + let p0_ := string_drop _s2278_ _s2279_ in + if ((generic_eq p0_ "")) then Some ((rsd, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + | _ => returnm (None : option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + end) + : M (option ((mword 3 * mword 6))) + else returnm (None : option ((mword 3 * mword 6)))) + : M (option ((mword 3 * mword 6))). + +Definition _s2257_ (_s2258_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2259_ := _s2258_ in + (if ((string_startswith _s2259_ "c.lui")) then + (match (string_drop _s2259_ (projT1 (string_length "c.lui"))) with + | _s2260_ => + (spc_matches_prefix _s2260_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2261_ _)) => + (match (string_drop _s2260_ _s2261_) with + | _s2262_ => + (reg_name_matches_prefix _s2262_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2263_ _)) => + (match (string_drop _s2262_ _s2263_) with + | _s2264_ => + (sep_matches_prefix _s2264_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2265_ _)) => + match (string_drop _s2264_ _s2265_) with + | _s2266_ => + match (hex_bits_6_matches_prefix _s2266_) with + | Some (imm,(existT _ _s2267_ _)) => + let p0_ := string_drop _s2266_ _s2267_ in + if ((generic_eq p0_ "")) then Some ((rd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2249_ (_s2250_ : string) +: M (option (mword 6)) := + + let _s2251_ := _s2250_ in + (if ((string_startswith _s2251_ "c.addi16sp")) then + (match (string_drop _s2251_ (projT1 (string_length "c.addi16sp"))) with + | _s2252_ => + (spc_matches_prefix _s2252_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s2253_ _)) => + match (string_drop _s2252_ _s2253_) with + | _s2254_ => + match (hex_bits_6_matches_prefix _s2254_) with + | Some (imm,(existT _ _s2255_ _)) => + let p0_ := string_drop _s2254_ _s2255_ in + if ((generic_eq p0_ "")) then Some (imm) + else None + | _ => None + end + end + | _ => None + end) + : option (mword 6)) + end) + : M (option (mword 6)) + else returnm (None : option (mword 6))) + : M (option (mword 6)). + +Definition _s2237_ (_s2238_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2239_ := _s2238_ in + (if ((string_startswith _s2239_ "c.li")) then + (match (string_drop _s2239_ (projT1 (string_length "c.li"))) with + | _s2240_ => + (spc_matches_prefix _s2240_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2241_ _)) => + (match (string_drop _s2240_ _s2241_) with + | _s2242_ => + (reg_name_matches_prefix _s2242_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2243_ _)) => + (match (string_drop _s2242_ _s2243_) with + | _s2244_ => + (sep_matches_prefix _s2244_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2245_ _)) => + match (string_drop _s2244_ _s2245_) with + | _s2246_ => + match (hex_bits_6_matches_prefix _s2246_) with + | Some (imm,(existT _ _s2247_ _)) => + let p0_ := string_drop _s2246_ _s2247_ in + if ((generic_eq p0_ "")) then Some ((rd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2225_ (_s2226_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2227_ := _s2226_ in + (if ((string_startswith _s2227_ "c.addiw")) then + (match (string_drop _s2227_ (projT1 (string_length "c.addiw"))) with + | _s2228_ => + (spc_matches_prefix _s2228_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2229_ _)) => + (match (string_drop _s2228_ _s2229_) with + | _s2230_ => + (reg_name_matches_prefix _s2230_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2231_ _)) => + (match (string_drop _s2230_ _s2231_) with + | _s2232_ => + (sep_matches_prefix _s2232_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2233_ _)) => + match (string_drop _s2232_ _s2233_) with + | _s2234_ => + match (hex_bits_6_matches_prefix _s2234_) with + | Some (imm,(existT _ _s2235_ _)) => + let p0_ := string_drop _s2234_ _s2235_ in + if ((generic_eq p0_ "")) then Some ((rsd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2217_ (_s2218_ : string) +: M (option (mword 11)) := + + let _s2219_ := _s2218_ in + (if ((string_startswith _s2219_ "c.jal")) then + (match (string_drop _s2219_ (projT1 (string_length "c.jal"))) with + | _s2220_ => + (spc_matches_prefix _s2220_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s2221_ _)) => + match (string_drop _s2220_ _s2221_) with + | _s2222_ => + match (hex_bits_12_matches_prefix _s2222_) with + | Some (v__772,(existT _ _s2223_ _)) => + if ((eq_vec (subrange_vec_dec v__772 0 0) + (vec_of_bits [B0] : mword (0 - 0 + 1)))) then + let imm : mword 11 := subrange_vec_dec v__772 11 1 in + let imm : mword 11 := subrange_vec_dec v__772 11 1 in + let p0_ := string_drop _s2222_ _s2223_ in + if ((generic_eq p0_ "")) then Some (imm) + else None + else + let g__27 := Some ((v__772, _s2223_)) in + None + | g__27 => None + end + end + | _ => None + end) + : option (mword 11)) + end) + : M (option (mword 11)) + else returnm (None : option (mword 11))) + : M (option (mword 11)). + +Definition _s2205_ (_s2206_ : string) +: M (option ((mword 5 * mword 6))) := + + let _s2207_ := _s2206_ in + (if ((string_startswith _s2207_ "c.addi")) then + (match (string_drop _s2207_ (projT1 (string_length "c.addi"))) with + | _s2208_ => + (spc_matches_prefix _s2208_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2209_ _)) => + (match (string_drop _s2208_ _s2209_) with + | _s2210_ => + (reg_name_matches_prefix _s2210_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s2211_ _)) => + (match (string_drop _s2210_ _s2211_) with + | _s2212_ => + (sep_matches_prefix _s2212_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2213_ _)) => + match (string_drop _s2212_ _s2213_) with + | _s2214_ => + match (hex_bits_6_matches_prefix _s2214_) with + | Some (nzi,(existT _ _s2215_ _)) => + let p0_ := string_drop _s2214_ _s2215_ in + if ((generic_eq p0_ "")) then Some ((rsd, nzi)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + | _ => returnm (None : option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + end) + : M (option ((mword 5 * mword 6))) + else returnm (None : option ((mword 5 * mword 6)))) + : M (option ((mword 5 * mword 6))). + +Definition _s2189_ (_s2190_ : string) +: M (option ((mword 3 * mword 3 * mword 5))) := + + let _s2191_ := _s2190_ in + (if ((string_startswith _s2191_ "c.sd")) then + (match (string_drop _s2191_ (projT1 (string_length "c.sd"))) with + | _s2192_ => + (spc_matches_prefix _s2192_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2193_ _)) => + (match (string_drop _s2192_ _s2193_) with + | _s2194_ => + (creg_name_matches_prefix _s2194_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsc1,(existT _ _s2195_ _)) => + (match (string_drop _s2194_ _s2195_) with + | _s2196_ => + (sep_matches_prefix _s2196_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2197_ _)) => + (match (string_drop _s2196_ _s2197_) with + | _s2198_ => + (creg_name_matches_prefix _s2198_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc2,(existT _ _s2199_ _)) => + (match (string_drop _s2198_ _s2199_) with + | _s2200_ => + (sep_matches_prefix _s2200_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s2201_ _)) => + match (string_drop _s2200_ _s2201_) with + | _s2202_ => + match (hex_bits_8_matches_prefix _s2202_) with + | Some (v__774,(existT _ _s2203_ _)) => + if ((eq_vec + (subrange_vec_dec v__774 2 0) + (vec_of_bits [B0;B0;B0] + : mword (2 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__774 7 3 in + let uimm : mword 5 := + subrange_vec_dec v__774 7 3 in + let p0_ := + string_drop _s2202_ _s2203_ in + if ((generic_eq p0_ "")) then + Some + ((rsc1, rsc2, uimm)) + else None + else + let g__26 := Some ((v__774, _s2203_)) in + None + | g__26 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + else returnm (None : option ((mword 3 * mword 3 * mword 5)))) + : M (option ((mword 3 * mword 3 * mword 5))). + +Definition _s2173_ (_s2174_ : string) +: M (option ((mword 3 * mword 3 * mword 5))) := + + let _s2175_ := _s2174_ in + (if ((string_startswith _s2175_ "c.sw")) then + (match (string_drop _s2175_ (projT1 (string_length "c.sw"))) with + | _s2176_ => + (spc_matches_prefix _s2176_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2177_ _)) => + (match (string_drop _s2176_ _s2177_) with + | _s2178_ => + (creg_name_matches_prefix _s2178_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsc1,(existT _ _s2179_ _)) => + (match (string_drop _s2178_ _s2179_) with + | _s2180_ => + (sep_matches_prefix _s2180_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2181_ _)) => + (match (string_drop _s2180_ _s2181_) with + | _s2182_ => + (creg_name_matches_prefix _s2182_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc2,(existT _ _s2183_ _)) => + (match (string_drop _s2182_ _s2183_) with + | _s2184_ => + (sep_matches_prefix _s2184_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s2185_ _)) => + match (string_drop _s2184_ _s2185_) with + | _s2186_ => + match (hex_bits_7_matches_prefix _s2186_) with + | Some (v__776,(existT _ _s2187_ _)) => + if ((eq_vec + (subrange_vec_dec v__776 1 0) + (vec_of_bits [B0;B0] + : mword (1 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__776 6 2 in + let uimm : mword 5 := + subrange_vec_dec v__776 6 2 in + let p0_ := + string_drop _s2186_ _s2187_ in + if ((generic_eq p0_ "")) then + Some + ((rsc1, rsc2, uimm)) + else None + else + let g__25 := Some ((v__776, _s2187_)) in + None + | g__25 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + else returnm (None : option ((mword 3 * mword 3 * mword 5)))) + : M (option ((mword 3 * mword 3 * mword 5))). + +Definition _s2157_ (_s2158_ : string) +: M (option ((mword 3 * mword 3 * mword 5))) := + + let _s2159_ := _s2158_ in + (if ((string_startswith _s2159_ "c.ld")) then + (match (string_drop _s2159_ (projT1 (string_length "c.ld"))) with + | _s2160_ => + (spc_matches_prefix _s2160_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2161_ _)) => + (match (string_drop _s2160_ _s2161_) with + | _s2162_ => + (creg_name_matches_prefix _s2162_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s2163_ _)) => + (match (string_drop _s2162_ _s2163_) with + | _s2164_ => + (sep_matches_prefix _s2164_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2165_ _)) => + (match (string_drop _s2164_ _s2165_) with + | _s2166_ => + (creg_name_matches_prefix _s2166_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc,(existT _ _s2167_ _)) => + (match (string_drop _s2166_ _s2167_) with + | _s2168_ => + (sep_matches_prefix _s2168_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s2169_ _)) => + match (string_drop _s2168_ _s2169_) with + | _s2170_ => + match (hex_bits_8_matches_prefix _s2170_) with + | Some (v__778,(existT _ _s2171_ _)) => + if ((eq_vec + (subrange_vec_dec v__778 2 0) + (vec_of_bits [B0;B0;B0] + : mword (2 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__778 7 3 in + let uimm : mword 5 := + subrange_vec_dec v__778 7 3 in + let p0_ := + string_drop _s2170_ _s2171_ in + if ((generic_eq p0_ "")) then + Some + ((rdc, rsc, uimm)) + else None + else + let g__24 := Some ((v__778, _s2171_)) in + None + | g__24 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + else returnm (None : option ((mword 3 * mword 3 * mword 5)))) + : M (option ((mword 3 * mword 3 * mword 5))). + +Definition _s2141_ (_s2142_ : string) +: M (option ((mword 3 * mword 3 * mword 5))) := + + let _s2143_ := _s2142_ in + (if ((string_startswith _s2143_ "c.lw")) then + (match (string_drop _s2143_ (projT1 (string_length "c.lw"))) with + | _s2144_ => + (spc_matches_prefix _s2144_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2145_ _)) => + (match (string_drop _s2144_ _s2145_) with + | _s2146_ => + (creg_name_matches_prefix _s2146_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s2147_ _)) => + (match (string_drop _s2146_ _s2147_) with + | _s2148_ => + (sep_matches_prefix _s2148_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2149_ _)) => + (match (string_drop _s2148_ _s2149_) with + | _s2150_ => + (creg_name_matches_prefix _s2150_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc,(existT _ _s2151_ _)) => + (match (string_drop _s2150_ _s2151_) with + | _s2152_ => + (sep_matches_prefix _s2152_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s2153_ _)) => + match (string_drop _s2152_ _s2153_) with + | _s2154_ => + match (hex_bits_7_matches_prefix _s2154_) with + | Some (v__780,(existT _ _s2155_ _)) => + if ((eq_vec + (subrange_vec_dec v__780 1 0) + (vec_of_bits [B0;B0] + : mword (1 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__780 6 2 in + let uimm : mword 5 := + subrange_vec_dec v__780 6 2 in + let p0_ := + string_drop _s2154_ _s2155_ in + if ((generic_eq p0_ "")) then + Some + ((rdc, rsc, uimm)) + else None + else + let g__23 := Some ((v__780, _s2155_)) in + None + | g__23 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + end) + : M (option ((mword 3 * mword 3 * mword 5))) + else returnm (None : option ((mword 3 * mword 3 * mword 5)))) + : M (option ((mword 3 * mword 3 * mword 5))). + +Definition _s2129_ (_s2130_ : string) +: M (option ((mword 3 * mword 8))) := + + let _s2131_ := _s2130_ in + (if ((string_startswith _s2131_ "c.addi4spn")) then + (match (string_drop _s2131_ (projT1 (string_length "c.addi4spn"))) with + | _s2132_ => + (spc_matches_prefix _s2132_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2133_ _)) => + (match (string_drop _s2132_ _s2133_) with + | _s2134_ => + (creg_name_matches_prefix _s2134_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s2135_ _)) => + (match (string_drop _s2134_ _s2135_) with + | _s2136_ => + (sep_matches_prefix _s2136_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2137_ _)) => + match (string_drop _s2136_ _s2137_) with + | _s2138_ => + match (hex_bits_10_matches_prefix _s2138_) with + | Some (v__782,(existT _ _s2139_ _)) => + if ((eq_vec (subrange_vec_dec v__782 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1)))) + then + let nzimm : mword 8 := subrange_vec_dec v__782 9 2 in + let nzimm : mword 8 := subrange_vec_dec v__782 9 2 in + let p0_ := string_drop _s2138_ _s2139_ in + if ((generic_eq p0_ "")) then Some ((rdc, nzimm)) + else None + else + let g__22 := Some ((v__782, _s2139_)) in + None + | g__22 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + | _ => returnm (None : option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + end) + : M (option ((mword 3 * mword 8))) + else returnm (None : option ((mword 3 * mword 8)))) + : M (option ((mword 3 * mword 8))). + +Definition _s2112_ (_s2113_ : string) +: M (option ((csrop * mword 5 * mword 5 * mword 12))) := + + (match _s2113_ with + | _s2114_ => + (csr_mnemonic_matches_prefix _s2114_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2115_ _)) => + (match (string_drop _s2114_ _s2115_) with + | _s2116_ => + (spc_matches_prefix _s2116_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2117_ _)) => + (match (string_drop _s2116_ _s2117_) with + | _s2118_ => + (reg_name_matches_prefix _s2118_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2119_ _)) => + (match (string_drop _s2118_ _s2119_) with + | _s2120_ => + (sep_matches_prefix _s2120_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2121_ _)) => + (match (string_drop _s2120_ _s2121_) with + | _s2122_ => + (reg_name_matches_prefix _s2122_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2123_ _)) => + (match (string_drop _s2122_ _s2123_) with + | _s2124_ => + (sep_matches_prefix _s2124_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2125_ _)) => + (match (string_drop _s2124_ _s2125_) with + | _s2126_ => + (csr_name_map_matches_prefix _s2126_) >>= fun w__6 : option ((mword 12 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (csr,(existT _ _s2127_ _)) => + let p0_ := + string_drop _s2126_ _s2127_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, csr)) + else None + | _ => None + end) + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))). + +Definition _s2094_ (_s2095_ : string) +: M (option ((csrop * mword 5 * mword 5 * mword 12))) := + + (match _s2095_ with + | _s2096_ => + (csr_mnemonic_matches_prefix _s2096_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2097_ _)) => + let _s2098_ := string_drop _s2096_ _s2097_ in + (if ((string_startswith _s2098_ "i")) then + (match (string_drop _s2098_ (projT1 (string_length "i"))) with + | _s2099_ => + (spc_matches_prefix _s2099_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2100_ _)) => + (match (string_drop _s2099_ _s2100_) with + | _s2101_ => + (reg_name_matches_prefix _s2101_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2102_ _)) => + (match (string_drop _s2101_ _s2102_) with + | _s2103_ => + (sep_matches_prefix _s2103_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2104_ _)) => + (match (string_drop _s2103_ _s2104_) with + | _s2105_ => + (match (hex_bits_5_matches_prefix _s2105_) with + | Some (rs1,(existT _ _s2106_ _)) => + (match (string_drop _s2105_ _s2106_) with + | _s2107_ => + (sep_matches_prefix _s2107_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s2108_ _)) => + (match (string_drop _s2107_ _s2108_) with + | _s2109_ => + (csr_name_map_matches_prefix _s2109_) >>= fun w__5 : option ((mword 12 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some + (csr,(existT _ _s2110_ _)) => + let p0_ := + string_drop _s2109_ _s2110_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, csr)) + else None + | _ => None + end) + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + else returnm (None : option ((csrop * mword 5 * mword 5 * mword 12)))) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12))). + +Definition _s2070_ (_s2071_ : string) +: M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) := + + (match _s2071_ with + | _s2072_ => + (amo_mnemonic_matches_prefix _s2072_) >>= fun w__0 : option ((amoop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2073_ _)) => + let _s2074_ := string_drop _s2072_ _s2073_ in + (if ((string_startswith _s2074_ ".")) then + (match (string_drop _s2074_ (projT1 (string_length "."))) with + | _s2075_ => + (size_mnemonic_matches_prefix _s2075_) >>= fun w__1 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (width,(existT _ _s2076_ _)) => + (match (string_drop _s2075_ _s2076_) with + | _s2077_ => + (maybe_aq_matches_prefix _s2077_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (aq,(existT _ _s2078_ _)) => + (match (string_drop _s2077_ _s2078_) with + | _s2079_ => + (maybe_rl_matches_prefix _s2079_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rl,(existT _ _s2080_ _)) => + (match (string_drop _s2079_ _s2080_) with + | _s2081_ => + (spc_matches_prefix _s2081_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s2082_ _)) => + (match (string_drop _s2081_ _s2082_) with + | _s2083_ => + (reg_name_matches_prefix _s2083_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (rd,(existT _ _s2084_ _)) => + (match (string_drop _s2083_ _s2084_) with + | _s2085_ => + (sep_matches_prefix _s2085_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (tt,(existT _ _s2086_ _)) => + (match (string_drop _s2085_ _s2086_) with + | _s2087_ => + (reg_name_matches_prefix _s2087_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (rs1,(existT _ _s2088_ _)) => + (match (string_drop _s2087_ + _s2088_) with + | _s2089_ => + (sep_matches_prefix + _s2089_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__8 with + | Some + (tt,(existT _ _s2090_ _)) => + (match (string_drop + _s2089_ + _s2090_) with + | _s2091_ => + (reg_name_matches_prefix + _s2091_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__9 with + | Some + (rs2,(existT _ _s2092_ _)) => + let p0_ := + string_drop + _s2091_ + _s2092_ in + if ((generic_eq + p0_ + "")) + then + Some + ((op, width, aq, rl, rd, rs1, rs2)) + else + None + | _ => + None + end) + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + else + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))). + +Definition _s2048_ (_s2049_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) := + + let _s2050_ := _s2049_ in + (if ((string_startswith _s2050_ "sc.")) then + (match (string_drop _s2050_ (projT1 (string_length "sc."))) with + | _s2051_ => + (size_mnemonic_matches_prefix _s2051_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s2052_ _)) => + (match (string_drop _s2051_ _s2052_) with + | _s2053_ => + (maybe_aq_matches_prefix _s2053_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s2054_ _)) => + (match (string_drop _s2053_ _s2054_) with + | _s2055_ => + (maybe_rl_matches_prefix _s2055_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s2056_ _)) => + (match (string_drop _s2055_ _s2056_) with + | _s2057_ => + (spc_matches_prefix _s2057_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2058_ _)) => + (match (string_drop _s2057_ _s2058_) with + | _s2059_ => + (reg_name_matches_prefix _s2059_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s2060_ _)) => + (match (string_drop _s2059_ _s2060_) with + | _s2061_ => + (sep_matches_prefix _s2061_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2062_ _)) => + (match (string_drop _s2061_ _s2062_) with + | _s2063_ => + (reg_name_matches_prefix _s2063_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (rs1,(existT _ _s2064_ _)) => + (match (string_drop _s2063_ _s2064_) with + | _s2065_ => + (sep_matches_prefix _s2065_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (tt,(existT _ _s2066_ _)) => + (match (string_drop _s2065_ + _s2066_) with + | _s2067_ => + (reg_name_matches_prefix + _s2067_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__8 with + | Some + (rs2,(existT _ _s2068_ _)) => + let p0_ := + string_drop + _s2067_ + _s2068_ in + if ((generic_eq + p0_ "")) + then + Some + ((size, aq, rl, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))). + +Definition _s2030_ (_s2031_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5))) := + + let _s2032_ := _s2031_ in + (if ((string_startswith _s2032_ "lr.")) then + (match (string_drop _s2032_ (projT1 (string_length "lr."))) with + | _s2033_ => + (size_mnemonic_matches_prefix _s2033_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s2034_ _)) => + (match (string_drop _s2033_ _s2034_) with + | _s2035_ => + (maybe_aq_matches_prefix _s2035_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s2036_ _)) => + (match (string_drop _s2035_ _s2036_) with + | _s2037_ => + (maybe_rl_matches_prefix _s2037_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s2038_ _)) => + (match (string_drop _s2037_ _s2038_) with + | _s2039_ => + (spc_matches_prefix _s2039_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2040_ _)) => + (match (string_drop _s2039_ _s2040_) with + | _s2041_ => + (reg_name_matches_prefix _s2041_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s2042_ _)) => + (match (string_drop _s2041_ _s2042_) with + | _s2043_ => + (sep_matches_prefix _s2043_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2044_ _)) => + (match (string_drop _s2043_ _s2044_) with + | _s2045_ => + (reg_name_matches_prefix _s2045_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs1,(existT _ _s2046_ _)) => + let p0_ := + string_drop _s2045_ _s2046_ in + if ((generic_eq p0_ "")) then + Some + ((size, aq, rl, rd, rs1)) + else None + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => returnm (None : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + | _ => returnm (None : option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5))) + else returnm (None : option ((word_width * bool * bool * mword 5 * mword 5)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5))). + +Definition _s2018_ (_s2019_ : string) +: M (option ((mword 5 * mword 5))) := + + let _s2020_ := _s2019_ in + (if ((string_startswith _s2020_ "sfence.vma")) then + (match (string_drop _s2020_ (projT1 (string_length "sfence.vma"))) with + | _s2021_ => + (spc_matches_prefix _s2021_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2022_ _)) => + (match (string_drop _s2021_ _s2022_) with + | _s2023_ => + (reg_name_matches_prefix _s2023_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs1,(existT _ _s2024_ _)) => + (match (string_drop _s2023_ _s2024_) with + | _s2025_ => + (sep_matches_prefix _s2025_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2026_ _)) => + (match (string_drop _s2025_ _s2026_) with + | _s2027_ => + (reg_name_matches_prefix _s2027_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2028_ _)) => + let p0_ := string_drop _s2027_ _s2028_ in + if ((generic_eq p0_ "")) then Some ((rs1, rs2)) + else None + | _ => None + end) + : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5))) + else returnm (None : option ((mword 5 * mword 5)))) + : M (option ((mword 5 * mword 5))). + +Definition _s2006_ (_s2007_ : string) +: M (option ((mword 4 * mword 4))) := + + let _s2008_ := _s2007_ in + (if ((string_startswith _s2008_ "fence.tso")) then + (match (string_drop _s2008_ (projT1 (string_length "fence.tso"))) with + | _s2009_ => + (spc_matches_prefix _s2009_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2010_ _)) => + (match (string_drop _s2009_ _s2010_) with + | _s2011_ => + (fence_bits_matches_prefix _s2011_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (pred,(existT _ _s2012_ _)) => + (match (string_drop _s2011_ _s2012_) with + | _s2013_ => + (sep_matches_prefix _s2013_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2014_ _)) => + (match (string_drop _s2013_ _s2014_) with + | _s2015_ => + (fence_bits_matches_prefix _s2015_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (succ,(existT _ _s2016_ _)) => + let p0_ := string_drop _s2015_ _s2016_ in + if ((generic_eq p0_ "")) then Some ((pred, succ)) + else None + | _ => None + end) + : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + else returnm (None : option ((mword 4 * mword 4)))) + : M (option ((mword 4 * mword 4))). + +Definition _s1994_ (_s1995_ : string) +: M (option ((mword 4 * mword 4))) := + + let _s1996_ := _s1995_ in + (if ((string_startswith _s1996_ "fence")) then + (match (string_drop _s1996_ (projT1 (string_length "fence"))) with + | _s1997_ => + (spc_matches_prefix _s1997_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1998_ _)) => + (match (string_drop _s1997_ _s1998_) with + | _s1999_ => + (fence_bits_matches_prefix _s1999_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (pred,(existT _ _s2000_ _)) => + (match (string_drop _s1999_ _s2000_) with + | _s2001_ => + (sep_matches_prefix _s2001_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2002_ _)) => + (match (string_drop _s2001_ _s2002_) with + | _s2003_ => + (fence_bits_matches_prefix _s2003_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (succ,(existT _ _s2004_ _)) => + let p0_ := string_drop _s2003_ _s2004_ in + if ((generic_eq p0_ "")) then Some ((pred, succ)) + else None + | _ => None + end) + : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + | _ => returnm (None : option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + end) + : M (option ((mword 4 * mword 4))) + else returnm (None : option ((mword 4 * mword 4)))) + : M (option ((mword 4 * mword 4))). + +Definition _s1975_ (_s1976_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5))) := + + let _s1977_ := _s1976_ in + (if ((string_startswith _s1977_ "rem")) then + (match (string_drop _s1977_ (projT1 (string_length "rem"))) with + | _s1978_ => + (maybe_not_u_matches_prefix _s1978_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s1979_ _)) => + let _s1980_ := string_drop _s1978_ _s1979_ in + (if ((string_startswith _s1980_ "w")) then + (match (string_drop _s1980_ (projT1 (string_length "w"))) with + | _s1981_ => + (spc_matches_prefix _s1981_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1982_ _)) => + (match (string_drop _s1981_ _s1982_) with + | _s1983_ => + (reg_name_matches_prefix _s1983_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1984_ _)) => + (match (string_drop _s1983_ _s1984_) with + | _s1985_ => + (sep_matches_prefix _s1985_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1986_ _)) => + (match (string_drop _s1985_ _s1986_) with + | _s1987_ => + (reg_name_matches_prefix _s1987_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1988_ _)) => + (match (string_drop _s1987_ _s1988_) with + | _s1989_ => + (sep_matches_prefix _s1989_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1990_ _)) => + (match (string_drop _s1989_ _s1990_) with + | _s1991_ => + (reg_name_matches_prefix _s1991_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s1992_ _)) => + let p0_ := + string_drop _s1991_ + _s1992_ in + if ((generic_eq p0_ "")) + then + Some + ((s, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))). + +Definition _s1956_ (_s1957_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5))) := + + let _s1958_ := _s1957_ in + (if ((string_startswith _s1958_ "div")) then + (match (string_drop _s1958_ (projT1 (string_length "div"))) with + | _s1959_ => + (maybe_not_u_matches_prefix _s1959_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s1960_ _)) => + let _s1961_ := string_drop _s1959_ _s1960_ in + (if ((string_startswith _s1961_ "w")) then + (match (string_drop _s1961_ (projT1 (string_length "w"))) with + | _s1962_ => + (spc_matches_prefix _s1962_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1963_ _)) => + (match (string_drop _s1962_ _s1963_) with + | _s1964_ => + (reg_name_matches_prefix _s1964_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1965_ _)) => + (match (string_drop _s1964_ _s1965_) with + | _s1966_ => + (sep_matches_prefix _s1966_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1967_ _)) => + (match (string_drop _s1966_ _s1967_) with + | _s1968_ => + (reg_name_matches_prefix _s1968_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1969_ _)) => + (match (string_drop _s1968_ _s1969_) with + | _s1970_ => + (sep_matches_prefix _s1970_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1971_ _)) => + (match (string_drop _s1970_ _s1971_) with + | _s1972_ => + (reg_name_matches_prefix _s1972_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s1973_ _)) => + let p0_ := + string_drop _s1972_ + _s1973_ in + if ((generic_eq p0_ "")) + then + Some + ((s, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))). + +Definition _s1940_ (_s1941_ : string) +: M (option ((mword 5 * mword 5 * mword 5))) := + + let _s1942_ := _s1941_ in + (if ((string_startswith _s1942_ "mulw")) then + (match (string_drop _s1942_ (projT1 (string_length "mulw"))) with + | _s1943_ => + (spc_matches_prefix _s1943_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1944_ _)) => + (match (string_drop _s1943_ _s1944_) with + | _s1945_ => + (reg_name_matches_prefix _s1945_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1946_ _)) => + (match (string_drop _s1945_ _s1946_) with + | _s1947_ => + (sep_matches_prefix _s1947_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1948_ _)) => + (match (string_drop _s1947_ _s1948_) with + | _s1949_ => + (reg_name_matches_prefix _s1949_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s1950_ _)) => + (match (string_drop _s1949_ _s1950_) with + | _s1951_ => + (sep_matches_prefix _s1951_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s1952_ _)) => + (match (string_drop _s1951_ _s1952_) with + | _s1953_ => + (reg_name_matches_prefix _s1953_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (rs2,(existT _ _s1954_ _)) => + let p0_ := + string_drop _s1953_ _s1954_ in + if ((generic_eq p0_ "")) then + Some + ((rd, rs1, rs2)) + else None + | _ => None + end) + : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + end) + : M (option ((mword 5 * mword 5 * mword 5))) + else returnm (None : option ((mword 5 * mword 5 * mword 5)))) + : M (option ((mword 5 * mword 5 * mword 5))). + +Definition _s1922_ (_s1923_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5))) := + + let _s1924_ := _s1923_ in + (if ((string_startswith _s1924_ "rem")) then + (match (string_drop _s1924_ (projT1 (string_length "rem"))) with + | _s1925_ => + (maybe_not_u_matches_prefix _s1925_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s1926_ _)) => + (match (string_drop _s1925_ _s1926_) with + | _s1927_ => + (spc_matches_prefix _s1927_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1928_ _)) => + (match (string_drop _s1927_ _s1928_) with + | _s1929_ => + (reg_name_matches_prefix _s1929_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1930_ _)) => + (match (string_drop _s1929_ _s1930_) with + | _s1931_ => + (sep_matches_prefix _s1931_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1932_ _)) => + (match (string_drop _s1931_ _s1932_) with + | _s1933_ => + (reg_name_matches_prefix _s1933_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1934_ _)) => + (match (string_drop _s1933_ _s1934_) with + | _s1935_ => + (sep_matches_prefix _s1935_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1936_ _)) => + (match (string_drop _s1935_ _s1936_) with + | _s1937_ => + (reg_name_matches_prefix _s1937_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s1938_ _)) => + let p0_ := + string_drop _s1937_ _s1938_ in + if ((generic_eq p0_ "")) then + Some + ((s, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))). + +Definition _s1904_ (_s1905_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5))) := + + let _s1906_ := _s1905_ in + (if ((string_startswith _s1906_ "div")) then + (match (string_drop _s1906_ (projT1 (string_length "div"))) with + | _s1907_ => + (maybe_not_u_matches_prefix _s1907_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s1908_ _)) => + (match (string_drop _s1907_ _s1908_) with + | _s1909_ => + (spc_matches_prefix _s1909_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1910_ _)) => + (match (string_drop _s1909_ _s1910_) with + | _s1911_ => + (reg_name_matches_prefix _s1911_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1912_ _)) => + (match (string_drop _s1911_ _s1912_) with + | _s1913_ => + (sep_matches_prefix _s1913_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1914_ _)) => + (match (string_drop _s1913_ _s1914_) with + | _s1915_ => + (reg_name_matches_prefix _s1915_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1916_ _)) => + (match (string_drop _s1915_ _s1916_) with + | _s1917_ => + (sep_matches_prefix _s1917_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1918_ _)) => + (match (string_drop _s1917_ _s1918_) with + | _s1919_ => + (reg_name_matches_prefix _s1919_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s1920_ _)) => + let p0_ := + string_drop _s1919_ _s1920_ in + if ((generic_eq p0_ "")) then + Some + ((s, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5)))) + : M (option ((bool * mword 5 * mword 5 * mword 5))). + +Definition _s1887_ (_s1888_ : string) +: M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) := + + (match _s1888_ with + | _s1889_ => + (mul_mnemonic_matches_prefix _s1889_) >>= fun w__0 : option (((bool * bool * bool) * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some ((high, signed1, signed2),(existT _ _s1890_ _)) => + (match (string_drop _s1889_ _s1890_) with + | _s1891_ => + (spc_matches_prefix _s1891_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1892_ _)) => + (match (string_drop _s1891_ _s1892_) with + | _s1893_ => + (reg_name_matches_prefix _s1893_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1894_ _)) => + (match (string_drop _s1893_ _s1894_) with + | _s1895_ => + (sep_matches_prefix _s1895_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1896_ _)) => + (match (string_drop _s1895_ _s1896_) with + | _s1897_ => + (reg_name_matches_prefix _s1897_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1898_ _)) => + (match (string_drop _s1897_ _s1898_) with + | _s1899_ => + (sep_matches_prefix _s1899_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1900_ _)) => + (match (string_drop _s1899_ _s1900_) with + | _s1901_ => + (reg_name_matches_prefix _s1901_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s1902_ _)) => + let p0_ := + string_drop _s1901_ _s1902_ in + if ((generic_eq p0_ "")) then + Some + ((high, signed1, signed2, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))). + +Definition _s1872_ (_s1873_ : string) +: M (option ((sopw * mword 5 * mword 5 * mword 5))) := + + (match _s1873_ with + | _s1874_ => + (shiftiwop_mnemonic_matches_prefix _s1874_) >>= fun w__0 : option ((sopw * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1875_ _)) => + (match (string_drop _s1874_ _s1875_) with + | _s1876_ => + (spc_matches_prefix _s1876_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1877_ _)) => + (match (string_drop _s1876_ _s1877_) with + | _s1878_ => + (reg_name_matches_prefix _s1878_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1879_ _)) => + (match (string_drop _s1878_ _s1879_) with + | _s1880_ => + (sep_matches_prefix _s1880_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1881_ _)) => + (match (string_drop _s1880_ _s1881_) with + | _s1882_ => + (reg_name_matches_prefix _s1882_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (rs1,(existT _ _s1883_ _)) => + match (string_drop _s1882_ _s1883_) with + | _s1884_ => + match (hex_bits_5_matches_prefix _s1884_) with + | Some (shamt,(existT _ _s1885_ _)) => + let p0_ := string_drop _s1884_ _s1885_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5))). + +Definition _s1855_ (_s1856_ : string) +: M (option ((ropw * mword 5 * mword 5 * mword 5))) := + + (match _s1856_ with + | _s1857_ => + (rtypew_mnemonic_matches_prefix _s1857_) >>= fun w__0 : option ((ropw * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1858_ _)) => + (match (string_drop _s1857_ _s1858_) with + | _s1859_ => + (spc_matches_prefix _s1859_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1860_ _)) => + (match (string_drop _s1859_ _s1860_) with + | _s1861_ => + (reg_name_matches_prefix _s1861_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1862_ _)) => + (match (string_drop _s1861_ _s1862_) with + | _s1863_ => + (sep_matches_prefix _s1863_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1864_ _)) => + (match (string_drop _s1863_ _s1864_) with + | _s1865_ => + (reg_name_matches_prefix _s1865_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1866_ _)) => + (match (string_drop _s1865_ _s1866_) with + | _s1867_ => + (sep_matches_prefix _s1867_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1868_ _)) => + (match (string_drop _s1867_ _s1868_) with + | _s1869_ => + (reg_name_matches_prefix _s1869_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s1870_ _)) => + let p0_ := + string_drop _s1869_ _s1870_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5))). + +Definition _s1838_ (_s1839_ : string) +: M (option ((sop * mword 5 * mword 5 * mword 5))) := + + (match _s1839_ with + | _s1840_ => + (shiftw_mnemonic_matches_prefix _s1840_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1841_ _)) => + (match (string_drop _s1840_ _s1841_) with + | _s1842_ => + (spc_matches_prefix _s1842_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1843_ _)) => + (match (string_drop _s1842_ _s1843_) with + | _s1844_ => + (reg_name_matches_prefix _s1844_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1845_ _)) => + (match (string_drop _s1844_ _s1845_) with + | _s1846_ => + (sep_matches_prefix _s1846_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1847_ _)) => + (match (string_drop _s1846_ _s1847_) with + | _s1848_ => + (reg_name_matches_prefix _s1848_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1849_ _)) => + (match (string_drop _s1848_ _s1849_) with + | _s1850_ => + (sep_matches_prefix _s1850_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s1851_ _)) => + match (string_drop _s1850_ _s1851_) with + | _s1852_ => + match (hex_bits_5_matches_prefix + _s1852_) with + | Some (shamt,(existT _ _s1853_ _)) => + let p0_ := + string_drop _s1852_ _s1853_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5))). + +Definition _s1822_ (_s1823_ : string) +: M (option ((mword 5 * mword 5 * mword 12))) := + + let _s1824_ := _s1823_ in + (if ((string_startswith _s1824_ "addiw")) then + (match (string_drop _s1824_ (projT1 (string_length "addiw"))) with + | _s1825_ => + (spc_matches_prefix _s1825_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1826_ _)) => + (match (string_drop _s1825_ _s1826_) with + | _s1827_ => + (reg_name_matches_prefix _s1827_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1828_ _)) => + (match (string_drop _s1827_ _s1828_) with + | _s1829_ => + (sep_matches_prefix _s1829_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1830_ _)) => + (match (string_drop _s1829_ _s1830_) with + | _s1831_ => + (reg_name_matches_prefix _s1831_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s1832_ _)) => + (match (string_drop _s1831_ _s1832_) with + | _s1833_ => + (sep_matches_prefix _s1833_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s1834_ _)) => + match (string_drop _s1833_ _s1834_) with + | _s1835_ => + match (hex_bits_12_matches_prefix _s1835_) with + | Some (imm,(existT _ _s1836_ _)) => + let p0_ := string_drop _s1835_ _s1836_ in + if ((generic_eq p0_ "")) then + Some + ((rd, rs1, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + else returnm (None : option ((mword 5 * mword 5 * mword 12)))) + : M (option ((mword 5 * mword 5 * mword 12))). + +Definition _s1800_ (_s1801_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) := + + let _s1802_ := _s1801_ in + (if ((string_startswith _s1802_ "s")) then + (match (string_drop _s1802_ (projT1 (string_length "s"))) with + | _s1803_ => + (size_mnemonic_matches_prefix _s1803_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s1804_ _)) => + (match (string_drop _s1803_ _s1804_) with + | _s1805_ => + (maybe_aq_matches_prefix _s1805_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s1806_ _)) => + (match (string_drop _s1805_ _s1806_) with + | _s1807_ => + (maybe_rl_matches_prefix _s1807_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s1808_ _)) => + (match (string_drop _s1807_ _s1808_) with + | _s1809_ => + (spc_matches_prefix _s1809_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1810_ _)) => + (match (string_drop _s1809_ _s1810_) with + | _s1811_ => + (reg_name_matches_prefix _s1811_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s1812_ _)) => + (match (string_drop _s1811_ _s1812_) with + | _s1813_ => + (sep_matches_prefix _s1813_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1814_ _)) => + (match (string_drop _s1813_ _s1814_) with + | _s1815_ => + (reg_name_matches_prefix _s1815_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (rs1,(existT _ _s1816_ _)) => + (match (string_drop _s1815_ _s1816_) with + | _s1817_ => + (sep_matches_prefix _s1817_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__7 with + | Some + (tt,(existT _ _s1818_ _)) => + match (string_drop + _s1817_ + _s1818_) with + | _s1819_ => + match (hex_bits_12_matches_prefix + _s1819_) with + | Some + (imm,(existT _ _s1820_ _)) => + let p0_ := + string_drop + _s1819_ + _s1820_ in + if ((generic_eq + p0_ "")) + then + Some + ((size, aq, rl, rd, rs1, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))) + else returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12))). + +Definition _s1776_ (_s1777_ : string) +: M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) := + + let _s1778_ := _s1777_ in + (if ((string_startswith _s1778_ "l")) then + (match (string_drop _s1778_ (projT1 (string_length "l"))) with + | _s1779_ => + (size_mnemonic_matches_prefix _s1779_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s1780_ _)) => + (match (string_drop _s1779_ _s1780_) with + | _s1781_ => + (maybe_u_matches_prefix _s1781_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (is_unsigned,(existT _ _s1782_ _)) => + (match (string_drop _s1781_ _s1782_) with + | _s1783_ => + (maybe_aq_matches_prefix _s1783_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (aq,(existT _ _s1784_ _)) => + (match (string_drop _s1783_ _s1784_) with + | _s1785_ => + (maybe_rl_matches_prefix _s1785_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rl,(existT _ _s1786_ _)) => + (match (string_drop _s1785_ _s1786_) with + | _s1787_ => + (spc_matches_prefix _s1787_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s1788_ _)) => + (match (string_drop _s1787_ _s1788_) with + | _s1789_ => + (reg_name_matches_prefix _s1789_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (rd,(existT _ _s1790_ _)) => + (match (string_drop _s1789_ _s1790_) with + | _s1791_ => + (sep_matches_prefix _s1791_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (tt,(existT _ _s1792_ _)) => + (match (string_drop _s1791_ _s1792_) with + | _s1793_ => + (reg_name_matches_prefix _s1793_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (rs1,(existT _ _s1794_ _)) => + (match (string_drop _s1793_ + _s1794_) with + | _s1795_ => + (sep_matches_prefix + _s1795_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__8 with + | Some + (tt,(existT _ _s1796_ _)) => + match (string_drop + _s1795_ + _s1796_) with + | _s1797_ => + match (hex_bits_12_matches_prefix + _s1797_) with + | Some + (imm,(existT _ _s1798_ _)) => + let p0_ := + string_drop + _s1797_ + _s1798_ in + if ((generic_eq + p0_ + "")) + then + Some + ((size, is_unsigned, aq, rl, rd, rs1, imm)) + else + None + | _ => + None + end + end + | _ => None + end) + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))) + else returnm (None : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12)))) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12))). + +Definition _s1759_ (_s1760_ : string) +: M (option ((rop * mword 5 * mword 5 * mword 5))) := + + (match _s1760_ with + | _s1761_ => + (rtype_mnemonic_matches_prefix _s1761_) >>= fun w__0 : option ((rop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1762_ _)) => + (match (string_drop _s1761_ _s1762_) with + | _s1763_ => + (spc_matches_prefix _s1763_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1764_ _)) => + (match (string_drop _s1763_ _s1764_) with + | _s1765_ => + (reg_name_matches_prefix _s1765_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1766_ _)) => + (match (string_drop _s1765_ _s1766_) with + | _s1767_ => + (sep_matches_prefix _s1767_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1768_ _)) => + (match (string_drop _s1767_ _s1768_) with + | _s1769_ => + (reg_name_matches_prefix _s1769_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1770_ _)) => + (match (string_drop _s1769_ _s1770_) with + | _s1771_ => + (sep_matches_prefix _s1771_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s1772_ _)) => + (match (string_drop _s1771_ _s1772_) with + | _s1773_ => + (reg_name_matches_prefix _s1773_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s1774_ _)) => + let p0_ := + string_drop _s1773_ _s1774_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, rs2)) + else None + | _ => None + end) + : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None + : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => + returnm (None : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + | _ => returnm (None : option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5))). + +Definition _s1744_ (_s1745_ : string) +: M (option ((sop * mword 5 * mword 5 * mword 6))) := + + (match _s1745_ with + | _s1746_ => + (shiftiop_mnemonic_matches_prefix _s1746_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1747_ _)) => + (match (string_drop _s1746_ _s1747_) with + | _s1748_ => + (spc_matches_prefix _s1748_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1749_ _)) => + (match (string_drop _s1748_ _s1749_) with + | _s1750_ => + (reg_name_matches_prefix _s1750_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1751_ _)) => + (match (string_drop _s1750_ _s1751_) with + | _s1752_ => + (sep_matches_prefix _s1752_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1753_ _)) => + (match (string_drop _s1752_ _s1753_) with + | _s1754_ => + (reg_name_matches_prefix _s1754_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (rs1,(existT _ _s1755_ _)) => + match (string_drop _s1754_ _s1755_) with + | _s1756_ => + match (hex_bits_6_matches_prefix _s1756_) with + | Some (shamt,(existT _ _s1757_ _)) => + let p0_ := string_drop _s1756_ _s1757_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, shamt)) + else None + | _ => None + end + end + | _ => None + end) + : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + | _ => + returnm (None : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6))). + +Definition _s1727_ (_s1728_ : string) +: M (option ((iop * mword 5 * mword 5 * mword 12))) := + + (match _s1728_ with + | _s1729_ => + (itype_mnemonic_matches_prefix _s1729_) >>= fun w__0 : option ((iop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1730_ _)) => + (match (string_drop _s1729_ _s1730_) with + | _s1731_ => + (spc_matches_prefix _s1731_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1732_ _)) => + (match (string_drop _s1731_ _s1732_) with + | _s1733_ => + (reg_name_matches_prefix _s1733_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1734_ _)) => + (match (string_drop _s1733_ _s1734_) with + | _s1735_ => + (sep_matches_prefix _s1735_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1736_ _)) => + (match (string_drop _s1735_ _s1736_) with + | _s1737_ => + (reg_name_matches_prefix _s1737_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s1738_ _)) => + (match (string_drop _s1737_ _s1738_) with + | _s1739_ => + (sep_matches_prefix _s1739_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s1740_ _)) => + match (string_drop _s1739_ _s1740_) with + | _s1741_ => + match (hex_bits_12_matches_prefix + _s1741_) with + | Some (imm,(existT _ _s1742_ _)) => + let p0_ := + string_drop _s1741_ _s1742_ in + if ((generic_eq p0_ "")) then + Some + ((op, rd, rs1, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None + : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => + returnm (None : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12))). + +Definition _s1710_ (_s1711_ : string) +: M (option ((bop * mword 5 * mword 5 * mword 13))) := + + (match _s1711_ with + | _s1712_ => + (btype_mnemonic_matches_prefix _s1712_) >>= fun w__0 : option ((bop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1713_ _)) => + (match (string_drop _s1712_ _s1713_) with + | _s1714_ => + (spc_matches_prefix _s1714_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1715_ _)) => + (match (string_drop _s1714_ _s1715_) with + | _s1716_ => + (reg_name_matches_prefix _s1716_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rs1,(existT _ _s1717_ _)) => + (match (string_drop _s1716_ _s1717_) with + | _s1718_ => + (sep_matches_prefix _s1718_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s1719_ _)) => + (match (string_drop _s1718_ _s1719_) with + | _s1720_ => + (reg_name_matches_prefix _s1720_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs2,(existT _ _s1721_ _)) => + (match (string_drop _s1720_ _s1721_) with + | _s1722_ => + (sep_matches_prefix _s1722_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s1723_ _)) => + match (string_drop _s1722_ _s1723_) with + | _s1724_ => + match (hex_bits_13_matches_prefix + _s1724_) with + | Some (imm,(existT _ _s1725_ _)) => + let p0_ := + string_drop _s1724_ _s1725_ in + if ((generic_eq p0_ "")) then + Some + ((op, rs1, rs2, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => + returnm (None + : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => + returnm (None : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => returnm (None : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => returnm (None : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + | _ => returnm (None : option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13))). + +Definition _s1694_ (_s1695_ : string) +: M (option ((mword 5 * mword 5 * mword 12))) := + + let _s1696_ := _s1695_ in + (if ((string_startswith _s1696_ "jalr")) then + (match (string_drop _s1696_ (projT1 (string_length "jalr"))) with + | _s1697_ => + (spc_matches_prefix _s1697_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1698_ _)) => + (match (string_drop _s1697_ _s1698_) with + | _s1699_ => + (reg_name_matches_prefix _s1699_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1700_ _)) => + (match (string_drop _s1699_ _s1700_) with + | _s1701_ => + (sep_matches_prefix _s1701_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s1702_ _)) => + (match (string_drop _s1701_ _s1702_) with + | _s1703_ => + (reg_name_matches_prefix _s1703_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s1704_ _)) => + (match (string_drop _s1703_ _s1704_) with + | _s1705_ => + (sep_matches_prefix _s1705_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s1706_ _)) => + match (string_drop _s1705_ _s1706_) with + | _s1707_ => + match (hex_bits_12_matches_prefix _s1707_) with + | Some (imm,(existT _ _s1708_ _)) => + let p0_ := string_drop _s1707_ _s1708_ in + if ((generic_eq p0_ "")) then + Some + ((rd, rs1, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + end) + : M (option ((mword 5 * mword 5 * mword 12))) + else returnm (None : option ((mword 5 * mword 5 * mword 12)))) + : M (option ((mword 5 * mword 5 * mword 12))). + +Definition _s1682_ (_s1683_ : string) +: M (option ((mword 5 * mword 21))) := + + let _s1684_ := _s1683_ in + (if ((string_startswith _s1684_ "jal")) then + (match (string_drop _s1684_ (projT1 (string_length "jal"))) with + | _s1685_ => + (spc_matches_prefix _s1685_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s1686_ _)) => + (match (string_drop _s1685_ _s1686_) with + | _s1687_ => + (reg_name_matches_prefix _s1687_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s1688_ _)) => + (match (string_drop _s1687_ _s1688_) with + | _s1689_ => + (sep_matches_prefix _s1689_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s1690_ _)) => + match (string_drop _s1689_ _s1690_) with + | _s1691_ => + match (hex_bits_21_matches_prefix _s1691_) with + | Some (imm,(existT _ _s1692_ _)) => + let p0_ := string_drop _s1691_ _s1692_ in + if ((generic_eq p0_ "")) then Some ((rd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + | _ => returnm (None : option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + | _ => returnm (None : option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + end) + : M (option ((mword 5 * mword 21))) + else returnm (None : option ((mword 5 * mword 21)))) + : M (option ((mword 5 * mword 21))). + +Definition _s1669_ (_s1670_ : string) +: M (option ((uop * mword 5 * mword 20))) := + + (match _s1670_ with + | _s1671_ => + (utype_mnemonic_matches_prefix _s1671_) >>= fun w__0 : option ((uop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s1672_ _)) => + (match (string_drop _s1671_ _s1672_) with + | _s1673_ => + (spc_matches_prefix _s1673_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s1674_ _)) => + (match (string_drop _s1673_ _s1674_) with + | _s1675_ => + (reg_name_matches_prefix _s1675_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s1676_ _)) => + (match (string_drop _s1675_ _s1676_) with + | _s1677_ => + (sep_matches_prefix _s1677_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (tt,(existT _ _s1678_ _)) => + match (string_drop _s1677_ _s1678_) with + | _s1679_ => + match (hex_bits_20_matches_prefix _s1679_) with + | Some (imm,(existT _ _s1680_ _)) => + let p0_ := string_drop _s1679_ _s1680_ in + if ((generic_eq p0_ "")) then Some ((op, rd, imm)) + else None + | _ => None + end + end + | _ => None + end) + : option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + | _ => returnm (None : option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + | _ => returnm (None : option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + | _ => returnm (None : option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))) + end) + : M (option ((uop * mword 5 * mword 20))). + +Definition assembly_backwards_matches (arg_ : string) +: M (bool) := + + let _s1681_ := arg_ in + (_s1669_ _s1681_) >>= fun w__0 : option ((uop * mword 5 * mword 20)) => + (if ((match w__0 with | Some (op,rd,imm) => true | _ => false end)) then + (_s1669_ _s1681_) >>= fun w__1 : option ((uop * mword 5 * mword 20)) => + (match w__1 with | Some (op,rd,imm) => returnm (true : bool) | _ => exit tt : M (bool) end) + : M (bool) + else + (_s1682_ _s1681_) >>= fun w__4 : option ((mword 5 * mword 21)) => + (if ((match w__4 with | Some (rd,imm) => true | _ => false end)) then + (_s1682_ _s1681_) >>= fun w__5 : option ((mword 5 * mword 21)) => + (match w__5 with | Some (rd,imm) => returnm (true : bool) | _ => exit tt : M (bool) end) + : M (bool) + else + (_s1694_ _s1681_) >>= fun w__8 : option ((mword 5 * mword 5 * mword 12)) => + (if ((match w__8 with | Some (rd,rs1,imm) => true | _ => false end)) then + (_s1694_ _s1681_) >>= fun w__9 : option ((mword 5 * mword 5 * mword 12)) => + (match w__9 with + | Some (rd,rs1,imm) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1710_ _s1681_) >>= fun w__12 : option ((bop * mword 5 * mword 5 * mword 13)) => + (if ((match w__12 with | Some (op,rs1,rs2,imm) => true | _ => false end)) then + (_s1710_ _s1681_) >>= fun w__13 : option ((bop * mword 5 * mword 5 * mword 13)) => + (match w__13 with + | Some (op,rs1,rs2,imm) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1727_ _s1681_) >>= fun w__16 : option ((iop * mword 5 * mword 5 * mword 12)) => + (if ((match w__16 with | Some (op,rd,rs1,imm) => true | _ => false end)) then + (_s1727_ _s1681_) >>= fun w__17 : option ((iop * mword 5 * mword 5 * mword 12)) => + (match w__17 with + | Some (op,rd,rs1,imm) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1744_ _s1681_) >>= fun w__20 : option ((sop * mword 5 * mword 5 * mword 6)) => + (if ((match w__20 with | Some (op,rd,rs1,shamt) => true | _ => false end)) then + (_s1744_ _s1681_) >>= fun w__21 : option ((sop * mword 5 * mword 5 * mword 6)) => + (match w__21 with + | Some (op,rd,rs1,shamt) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1759_ _s1681_) >>= fun w__24 : option ((rop * mword 5 * mword 5 * mword 5)) => + (if ((match w__24 with | Some (op,rd,rs1,rs2) => true | _ => false end)) then + (_s1759_ _s1681_) >>= fun w__25 : option ((rop * mword 5 * mword 5 * mword 5)) => + (match w__25 with + | Some (op,rd,rs1,rs2) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1776_ _s1681_) >>= fun w__28 : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12)) => + (if ((match w__28 with + | Some (size,is_unsigned,aq,rl,rd,rs1,imm) => true + | _ => false + end)) then + (_s1776_ _s1681_) >>= fun w__29 : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12)) => + (match w__29 with + | Some (size,is_unsigned,aq,rl,rd,rs1,imm) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1800_ _s1681_) >>= fun w__32 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12)) => + (if ((match w__32 with + | Some (size,aq,rl,rd,rs1,imm) => true + | _ => false + end)) then + (_s1800_ _s1681_) >>= fun w__33 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12)) => + (match w__33 with + | Some (size,aq,rl,rd,rs1,imm) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1822_ _s1681_) >>= fun w__36 : option ((mword 5 * mword 5 * mword 12)) => + (if ((match w__36 with | Some (rd,rs1,imm) => true | _ => false end)) + then + (_s1822_ _s1681_) >>= fun w__37 : option ((mword 5 * mword 5 * mword 12)) => + (match w__37 with + | Some (rd,rs1,imm) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1838_ _s1681_) >>= fun w__40 : option ((sop * mword 5 * mword 5 * mword 5)) => + (if ((match w__40 with + | Some (op,rd,rs1,shamt) => true + | _ => false + end)) then + (_s1838_ _s1681_) >>= fun w__41 : option ((sop * mword 5 * mword 5 * mword 5)) => + (match w__41 with + | Some (op,rd,rs1,shamt) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1855_ _s1681_) >>= fun w__44 : option ((ropw * mword 5 * mword 5 * mword 5)) => + (if ((match w__44 with + | Some (op,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1855_ _s1681_) >>= fun w__45 : option ((ropw * mword 5 * mword 5 * mword 5)) => + (match w__45 with + | Some (op,rd,rs1,rs2) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1872_ _s1681_) >>= fun w__48 : option ((sopw * mword 5 * mword 5 * mword 5)) => + (if ((match w__48 with + | Some (op,rd,rs1,shamt) => true + | _ => false + end)) then + (_s1872_ _s1681_) >>= fun w__49 : option ((sopw * mword 5 * mword 5 * mword 5)) => + (match w__49 with + | Some (op,rd,rs1,shamt) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1887_ _s1681_) >>= fun w__52 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__52 with + | Some (high,signed1,signed2,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1887_ _s1681_) >>= fun w__53 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5)) => + (match w__53 with + | Some (high,signed1,signed2,rd,rs1,rs2) => + returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1904_ _s1681_) >>= fun w__56 : option ((bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__56 with + | Some (s,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1904_ _s1681_) >>= fun w__57 : option ((bool * mword 5 * mword 5 * mword 5)) => + (match w__57 with + | Some (s,rd,rs1,rs2) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1922_ _s1681_) >>= fun w__60 : option ((bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__60 with + | Some (s,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1922_ _s1681_) >>= fun w__61 : option ((bool * mword 5 * mword 5 * mword 5)) => + (match w__61 with + | Some (s,rd,rs1,rs2) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1940_ _s1681_) >>= fun w__64 : option ((mword 5 * mword 5 * mword 5)) => + (if ((match w__64 with + | Some (rd,rs1,rs2) => true + | _ => false + end)) then + (_s1940_ _s1681_) >>= fun w__65 : option ((mword 5 * mword 5 * mword 5)) => + (match w__65 with + | Some (rd,rs1,rs2) => returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1956_ _s1681_) >>= fun w__68 : option ((bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__68 with + | Some (s,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1956_ _s1681_) >>= fun w__69 : option ((bool * mword 5 * mword 5 * mword 5)) => + (match w__69 with + | Some (s,rd,rs1,rs2) => + returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1975_ _s1681_) >>= fun w__72 : option ((bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__72 with + | Some (s,rd,rs1,rs2) => true + | _ => false + end)) then + (_s1975_ _s1681_) >>= fun w__73 : option ((bool * mword 5 * mword 5 * mword 5)) => + (match w__73 with + | Some (s,rd,rs1,rs2) => + returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s1994_ _s1681_) >>= fun w__76 : option ((mword 4 * mword 4)) => + (if ((match w__76 with + | Some (pred,succ) => true + | _ => false + end)) then + (_s1994_ _s1681_) >>= fun w__77 : option ((mword 4 * mword 4)) => + (match w__77 with + | Some (pred,succ) => + returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s2006_ _s1681_) >>= fun w__80 : option ((mword 4 * mword 4)) => + (if ((match w__80 with + | Some (pred,succ) => true + | _ => false + end)) then + (_s2006_ _s1681_) >>= fun w__81 : option ((mword 4 * mword 4)) => + (match w__81 with + | Some (pred,succ) => + returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else if ((generic_eq _s1681_ + "fence.i")) then + returnm (true + : bool) + else if ((generic_eq _s1681_ "ecall")) + then + returnm (true + : bool) + else if ((generic_eq _s1681_ "mret")) + then + returnm (true + : bool) + else if ((generic_eq _s1681_ "sret")) + then + returnm (true + : bool) + else if ((generic_eq _s1681_ + "ebreak")) then + returnm (true + : bool) + else if ((generic_eq _s1681_ "wfi")) + then + returnm (true + : bool) + else + (_s2018_ _s1681_) >>= fun w__84 : option ((mword 5 * mword 5)) => + (if ((match w__84 with + | Some (rs1,rs2) => true + | _ => false + end)) then + (_s2018_ _s1681_) >>= fun w__85 : option ((mword 5 * mword 5)) => + (match w__85 with + | Some (rs1,rs2) => + returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s2030_ _s1681_) >>= fun w__88 : option ((word_width * bool * bool * mword 5 * mword 5)) => + (if ((match w__88 with + | Some + (size,aq,rl,rd,rs1) => + true + | _ => false + end)) then + (_s2030_ _s1681_) >>= fun w__89 : option ((word_width * bool * bool * mword 5 * mword 5)) => + (match w__89 with + | Some (size,aq,rl,rd,rs1) => + returnm (true : bool) + | _ => exit tt : M (bool) + end) + : M (bool) + else + (_s2048_ _s1681_) >>= fun w__92 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__92 with + | Some + (size,aq,rl,rd,rs1,rs2) => + true + | _ => false + end)) then + (_s2048_ _s1681_) >>= fun w__93 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)) => + (match w__93 with + | Some + (size,aq,rl,rd,rs1,rs2) => + returnm (true + : bool) + | _ => + exit tt : M (bool) + end) + : M (bool) + else + (_s2070_ _s1681_) >>= fun w__96 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)) => + (if ((match w__96 with + | Some + (op,width,aq,rl,rd,rs1,rs2) => + true + | _ => false + end)) then + (_s2070_ _s1681_) >>= fun w__97 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)) => + (match w__97 with + | Some + (op,width,aq,rl,rd,rs1,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2094_ _s1681_) >>= fun w__100 : option ((csrop * mword 5 * mword 5 * mword 12)) => + (if ((match w__100 with + | Some + (op,rd,rs1,csr) => + true + | _ => false + end)) then + (_s2094_ _s1681_) >>= fun w__101 : option ((csrop * mword 5 * mword 5 * mword 12)) => + (match w__101 with + | Some + (op,rd,rs1,csr) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2112_ _s1681_) >>= fun w__104 : option ((csrop * mword 5 * mword 5 * mword 12)) => + (if ((match w__104 with + | Some + (op,rd,rs1,csr) => + true + | _ => false + end)) then + (_s2112_ _s1681_) >>= fun w__105 : option ((csrop * mword 5 * mword 5 * mword 12)) => + (match w__105 with + | Some + (op,rd,rs1,csr) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else if ((generic_eq + _s1681_ + "c.nop")) + then + returnm (true + : bool) + else + (_s2129_ _s1681_) >>= fun w__108 : option ((mword 3 * mword 8)) => + (if ((match w__108 with + | Some + (rdc,nzimm) => + neq_vec + nzimm + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] + : mword 8) + | _ => + false + end)) then + (_s2129_ + _s1681_) >>= fun w__109 : option ((mword 3 * mword 8)) => + (match w__109 with + | Some + (rdc,nzimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2141_ + _s1681_) >>= fun w__112 : option ((mword 3 * mword 3 * mword 5)) => + (if ((match w__112 with + | Some + (rdc,rsc,uimm) => + true + | _ => + false + end)) + then + (_s2141_ + _s1681_) >>= fun w__113 : option ((mword 3 * mword 3 * mword 5)) => + (match w__113 with + | Some + (rdc,rsc,uimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2157_ + _s1681_) >>= fun w__116 : option ((mword 3 * mword 3 * mword 5)) => + (if ((match w__116 with + | Some + (rdc,rsc,uimm) => + true + | _ => + false + end)) + then + (_s2157_ + _s1681_) >>= fun w__117 : option ((mword 3 * mword 3 * mword 5)) => + (match w__117 with + | Some + (rdc,rsc,uimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2173_ + _s1681_) >>= fun w__120 : option ((mword 3 * mword 3 * mword 5)) => + (if ((match w__120 with + | Some + (rsc1,rsc2,uimm) => + true + | _ => + false + end)) + then + (_s2173_ + _s1681_) >>= fun w__121 : option ((mword 3 * mword 3 * mword 5)) => + (match w__121 with + | Some + (rsc1,rsc2,uimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2189_ + _s1681_) >>= fun w__124 : option ((mword 3 * mword 3 * mword 5)) => + (if ((match w__124 with + | Some + (rsc1,rsc2,uimm) => + true + | _ => + false + end)) + then + (_s2189_ + _s1681_) >>= fun w__125 : option ((mword 3 * mword 3 * mword 5)) => + (match w__125 with + | Some + (rsc1,rsc2,uimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2205_ + _s1681_) >>= fun w__128 : option ((mword 5 * mword 6)) => + (if + ((match w__128 with + | Some + (rsd,nzi) => + andb + (neq_vec + nzi + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6)) + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s2205_ + _s1681_) >>= fun w__129 : option ((mword 5 * mword 6)) => + (match w__129 with + | Some + (rsd,nzi) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2217_ + _s1681_) >>= fun w__132 : option (mword 11) => + (if + ((match w__132 with + | Some + (imm) => + true + | _ => + false + end)) + then + (_s2217_ + _s1681_) >>= fun w__133 : option (mword 11) => + (match w__133 with + | Some + (imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2225_ + _s1681_) >>= fun w__136 : option ((mword 5 * mword 6)) => + (if + ((match w__136 with + | Some + (rsd,imm) => + true + | _ => + false + end)) + then + (_s2225_ + _s1681_) >>= fun w__137 : option ((mword 5 * mword 6)) => + (match w__137 with + | Some + (rsd,imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2237_ + _s1681_) >>= fun w__140 : option ((mword 5 * mword 6)) => + (if + ((match w__140 with + | Some + (rd,imm) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s2237_ + _s1681_) >>= fun w__141 : option ((mword 5 * mword 6)) => + (match w__141 with + | Some + (rd,imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2249_ + _s1681_) >>= fun w__144 : option (mword 6) => + (if + ((match w__144 with + | Some + (imm) => + neq_vec + imm + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s2249_ + _s1681_) >>= fun w__145 : option (mword 6) => + (match w__145 with + | Some + (imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2257_ + _s1681_) >>= fun w__148 : option ((mword 5 * mword 6)) => + (if + ((match w__148 with + | Some + (rd,imm) => + andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg))) + (andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + sp))) + (neq_vec + imm + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6))) + | _ => + false + end)) + then + (_s2257_ + _s1681_) >>= fun w__149 : option ((mword 5 * mword 6)) => + (match w__149 with + | Some + (rd,imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2269_ + _s1681_) >>= fun w__152 : option ((mword 3 * mword 6)) => + (if + ((match w__152 with + | Some + (rsd,shamt) => + neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s2269_ + _s1681_) >>= fun w__153 : option ((mword 3 * mword 6)) => + (match w__153 with + | Some + (rsd,shamt) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2281_ + _s1681_) >>= fun w__156 : option ((mword 3 * mword 6)) => + (if + ((match w__156 with + | Some + (rsd,shamt) => + neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s2281_ + _s1681_) >>= fun w__157 : option ((mword 3 * mword 6)) => + (match w__157 with + | Some + (rsd,shamt) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2293_ + _s1681_) >>= fun w__160 : option ((mword 3 * mword 6)) => + (if + ((match w__160 with + | Some + (rsd,imm) => + true + | _ => + false + end)) + then + (_s2293_ + _s1681_) >>= fun w__161 : option ((mword 3 * mword 6)) => + (match w__161 with + | Some + (rsd,imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2305_ + _s1681_) >>= fun w__164 : option ((mword 3 * mword 3)) => + (if + ((match w__164 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s2305_ + _s1681_) >>= fun w__165 : option ((mword 3 * mword 3)) => + (match w__165 with + | Some + (rsd,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2317_ + _s1681_) >>= fun w__168 : option ((mword 3 * mword 3)) => + (if + ((match w__168 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s2317_ + _s1681_) >>= fun w__169 : option ((mword 3 * mword 3)) => + (match w__169 with + | Some + (rsd,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2329_ + _s1681_) >>= fun w__172 : option ((mword 3 * mword 3)) => + (if + ((match w__172 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s2329_ + _s1681_) >>= fun w__173 : option ((mword 3 * mword 3)) => + (match w__173 with + | Some + (rsd,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2341_ + _s1681_) >>= fun w__176 : option ((mword 3 * mword 3)) => + (if + ((match w__176 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s2341_ + _s1681_) >>= fun w__177 : option ((mword 3 * mword 3)) => + (match w__177 with + | Some + (rsd,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2353_ + _s1681_) >>= fun w__180 : option ((mword 3 * mword 3)) => + (if + ((match w__180 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s2353_ + _s1681_) >>= fun w__181 : option ((mword 3 * mword 3)) => + (match w__181 with + | Some + (rsd,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2365_ + _s1681_) >>= fun w__184 : option ((mword 3 * mword 3)) => + (if + ((match w__184 with + | Some + (rsd,rs2) => + true + | _ => + false + end)) + then + (_s2365_ + _s1681_) >>= fun w__185 : option ((mword 3 * mword 3)) => + (match w__185 with + | Some + (rsd,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2377_ + _s1681_) >>= fun w__188 : option (mword 11) => + (if + ((match w__188 with + | Some + (imm) => + true + | _ => + false + end)) + then + (_s2377_ + _s1681_) >>= fun w__189 : option (mword 11) => + (match w__189 with + | Some + (imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2385_ + _s1681_) >>= fun w__192 : option ((mword 3 * mword 8)) => + (if + ((match w__192 with + | Some + (rs,imm) => + true + | _ => + false + end)) + then + (_s2385_ + _s1681_) >>= fun w__193 : option ((mword 3 * mword 8)) => + (match w__193 with + | Some + (rs,imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2397_ + _s1681_) >>= fun w__196 : option ((mword 3 * mword 8)) => + (if + ((match w__196 with + | Some + (rs,imm) => + true + | _ => + false + end)) + then + (_s2397_ + _s1681_) >>= fun w__197 : option ((mword 3 * mword 8)) => + (match w__197 with + | Some + (rs,imm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2409_ + _s1681_) >>= fun w__200 : option ((mword 5 * mword 6)) => + (if + ((match w__200 with + | Some + (rsd,shamt) => + andb + (neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6)) + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s2409_ + _s1681_) >>= fun w__201 : option ((mword 5 * mword 6)) => + (match w__201 with + | Some + (rsd,shamt) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2421_ + _s1681_) >>= fun w__204 : option ((mword 5 * mword 6)) => + (if + ((match w__204 with + | Some + (rd,uimm) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s2421_ + _s1681_) >>= fun w__205 : option ((mword 5 * mword 6)) => + (match w__205 with + | Some + (rd,uimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2433_ + _s1681_) >>= fun w__208 : option ((mword 5 * mword 6)) => + (if + ((match w__208 with + | Some + (rd,uimm) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s2433_ + _s1681_) >>= fun w__209 : option ((mword 5 * mword 6)) => + (match w__209 with + | Some + (rd,uimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2445_ + _s1681_) >>= fun w__212 : option ((mword 5 * mword 6)) => + (if + ((match w__212 with + | Some + (rd,uimm) => + true + | _ => + false + end)) + then + (_s2445_ + _s1681_) >>= fun w__213 : option ((mword 5 * mword 6)) => + (match w__213 with + | Some + (rd,uimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2457_ + _s1681_) >>= fun w__216 : option ((mword 5 * mword 6)) => + (if + ((match w__216 with + | Some + (rs2,uimm) => + true + | _ => + false + end)) + then + (_s2457_ + _s1681_) >>= fun w__217 : option ((mword 5 * mword 6)) => + (match w__217 with + | Some + (rs2,uimm) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2469_ + _s1681_) >>= fun w__220 : option (mword 5) => + (if + ((match w__220 with + | Some + (rs1) => + neq_int + (projT1 (regbits_to_regno + rs1)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s2469_ + _s1681_) >>= fun w__221 : option (mword 5) => + (match w__221 with + | Some + (rs1) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2477_ + _s1681_) >>= fun w__224 : option (mword 5) => + (if + ((match w__224 with + | Some + (rs1) => + neq_int + (projT1 (regbits_to_regno + rs1)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s2477_ + _s1681_) >>= fun w__225 : option (mword 5) => + (match w__225 with + | Some + (rs1) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2485_ + _s1681_) >>= fun w__228 : option ((mword 5 * mword 5)) => + (if + ((match w__228 with + | Some + (rd,rs2) => + andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg))) + (neq_int + (projT1 (regbits_to_regno + rs2)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s2485_ + _s1681_) >>= fun w__229 : option ((mword 5 * mword 5)) => + (match w__229 with + | Some + (rd,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else if + ((generic_eq + _s1681_ + "c.ebreak")) + then + returnm (true + : bool) + else + (_s2497_ + _s1681_) >>= fun w__232 : option ((mword 5 * mword 5)) => + (if + ((match w__232 with + | Some + (rsd,rs2) => + andb + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + (neq_int + (projT1 (regbits_to_regno + rs2)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s2497_ + _s1681_) >>= fun w__233 : option ((mword 5 * mword 5)) => + (match w__233 with + | Some + (rsd,rs2) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else if + ((generic_eq + _s1681_ + "stop_fetching")) + then + returnm (true + : bool) + else if + ((generic_eq + _s1681_ + "thread_start")) + then + returnm (true + : bool) + else + (_s2509_ + _s1681_) >>= fun w__236 : option (mword 32) => + (if + ((match w__236 with + | Some + (s) => + true + | _ => + false + end)) + then + (_s2509_ + _s1681_) >>= fun w__237 : option (mword 32) => + (match w__237 with + | Some + (s) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + (_s2517_ + _s1681_) >>= fun w__240 : option (mword 16) => + (if + ((match w__240 with + | Some + (s) => + true + | _ => + false + end)) + then + (_s2517_ + _s1681_) >>= fun w__241 : option (mword 16) => + (match w__241 with + | Some + (s) => + returnm (true + : bool) + | _ => + exit tt + : M (bool) + end) + : M (bool) + else + returnm (false + : bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool)) + : M (bool). + +Definition _s3413_ (_s3414_ : string) +: M (option ((mword 16 * string))) := + + let _s3415_ := _s3414_ in + (if ((string_startswith _s3415_ "c.illegal")) then + (match (string_drop _s3415_ (projT1 (string_length "c.illegal"))) with + | _s3416_ => + (spc_matches_prefix _s3416_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s3417_ _)) => + match (string_drop _s3416_ _s3417_) with + | _s3418_ => + match (hex_bits_16_matches_prefix _s3418_) with + | Some (s,(existT _ _s3419_ _)) => + match (string_drop _s3418_ _s3419_) with | s_ => Some ((s, s_)) end + | _ => None + end + end + | _ => None + end) + : option ((mword 16 * string))) + end) + : M (option ((mword 16 * string))) + else returnm (None : option ((mword 16 * string)))) + : M (option ((mword 16 * string))). + +Definition _s3405_ (_s3406_ : string) +: M (option ((mword 32 * string))) := + + let _s3407_ := _s3406_ in + (if ((string_startswith _s3407_ "illegal")) then + (match (string_drop _s3407_ (projT1 (string_length "illegal"))) with + | _s3408_ => + (spc_matches_prefix _s3408_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s3409_ _)) => + match (string_drop _s3408_ _s3409_) with + | _s3410_ => + match (hex_bits_32_matches_prefix _s3410_) with + | Some (s,(existT _ _s3411_ _)) => + match (string_drop _s3410_ _s3411_) with | s_ => Some ((s, s_)) end + | _ => None + end + end + | _ => None + end) + : option ((mword 32 * string))) + end) + : M (option ((mword 32 * string))) + else returnm (None : option ((mword 32 * string)))) + : M (option ((mword 32 * string))). + +Definition _s3401_ (_s3402_ : string) +: option string := + + let _s3403_ := _s3402_ in + if ((string_startswith _s3403_ "thread_start")) then + match (string_drop _s3403_ (projT1 (string_length "thread_start"))) with | s_ => Some (s_) end + else None. + +Definition _s3397_ (_s3398_ : string) +: option string := + + let _s3399_ := _s3398_ in + if ((string_startswith _s3399_ "stop_fetching")) then + match (string_drop _s3399_ (projT1 (string_length "stop_fetching"))) with | s_ => Some (s_) end + else None. + +Definition _s3385_ (_s3386_ : string) +: M (option ((mword 5 * mword 5 * string))) := + + let _s3387_ := _s3386_ in + (if ((string_startswith _s3387_ "c.add")) then + (match (string_drop _s3387_ (projT1 (string_length "c.add"))) with + | _s3388_ => + (spc_matches_prefix _s3388_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3389_ _)) => + (match (string_drop _s3388_ _s3389_) with + | _s3390_ => + (reg_name_matches_prefix _s3390_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3391_ _)) => + (match (string_drop _s3390_ _s3391_) with + | _s3392_ => + (sep_matches_prefix _s3392_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3393_ _)) => + (match (string_drop _s3392_ _s3393_) with + | _s3394_ => + (reg_name_matches_prefix _s3394_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s3395_ _)) => + match (string_drop _s3394_ _s3395_) with + | s_ => Some ((rsd, rs2, s_)) + end + | _ => None + end) + : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + else returnm (None : option ((mword 5 * mword 5 * string)))) + : M (option ((mword 5 * mword 5 * string))). + +Definition _s3381_ (_s3382_ : string) +: option string := + + let _s3383_ := _s3382_ in + if ((string_startswith _s3383_ "c.ebreak")) then + match (string_drop _s3383_ (projT1 (string_length "c.ebreak"))) with | s_ => Some (s_) end + else None. + +Definition _s3369_ (_s3370_ : string) +: M (option ((mword 5 * mword 5 * string))) := + + let _s3371_ := _s3370_ in + (if ((string_startswith _s3371_ "c.mv")) then + (match (string_drop _s3371_ (projT1 (string_length "c.mv"))) with + | _s3372_ => + (spc_matches_prefix _s3372_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3373_ _)) => + (match (string_drop _s3372_ _s3373_) with + | _s3374_ => + (reg_name_matches_prefix _s3374_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s3375_ _)) => + (match (string_drop _s3374_ _s3375_) with + | _s3376_ => + (sep_matches_prefix _s3376_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3377_ _)) => + (match (string_drop _s3376_ _s3377_) with + | _s3378_ => + (reg_name_matches_prefix _s3378_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s3379_ _)) => + match (string_drop _s3378_ _s3379_) with + | s_ => Some ((rd, rs2, s_)) + end + | _ => None + end) + : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + else returnm (None : option ((mword 5 * mword 5 * string)))) + : M (option ((mword 5 * mword 5 * string))). + +Definition _s3361_ (_s3362_ : string) +: M (option ((mword 5 * string))) := + + let _s3363_ := _s3362_ in + (if ((string_startswith _s3363_ "c.jalr")) then + (match (string_drop _s3363_ (projT1 (string_length "c.jalr"))) with + | _s3364_ => + (spc_matches_prefix _s3364_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3365_ _)) => + (match (string_drop _s3364_ _s3365_) with + | _s3366_ => + (reg_name_matches_prefix _s3366_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (rs1,(existT _ _s3367_ _)) => + match (string_drop _s3366_ _s3367_) with | s_ => Some ((rs1, s_)) end + | _ => None + end) + : option ((mword 5 * string))) + end) + : M (option ((mword 5 * string))) + | _ => returnm (None : option ((mword 5 * string))) + end) + : M (option ((mword 5 * string))) + end) + : M (option ((mword 5 * string))) + else returnm (None : option ((mword 5 * string)))) + : M (option ((mword 5 * string))). + +Definition _s3353_ (_s3354_ : string) +: M (option ((mword 5 * string))) := + + let _s3355_ := _s3354_ in + (if ((string_startswith _s3355_ "c.jr")) then + (match (string_drop _s3355_ (projT1 (string_length "c.jr"))) with + | _s3356_ => + (spc_matches_prefix _s3356_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3357_ _)) => + (match (string_drop _s3356_ _s3357_) with + | _s3358_ => + (reg_name_matches_prefix _s3358_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__1 with + | Some (rs1,(existT _ _s3359_ _)) => + match (string_drop _s3358_ _s3359_) with | s_ => Some ((rs1, s_)) end + | _ => None + end) + : option ((mword 5 * string))) + end) + : M (option ((mword 5 * string))) + | _ => returnm (None : option ((mword 5 * string))) + end) + : M (option ((mword 5 * string))) + end) + : M (option ((mword 5 * string))) + else returnm (None : option ((mword 5 * string)))) + : M (option ((mword 5 * string))). + +Definition _s3341_ (_s3342_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3343_ := _s3342_ in + (if ((string_startswith _s3343_ "c.sdsp")) then + (match (string_drop _s3343_ (projT1 (string_length "c.sdsp"))) with + | _s3344_ => + (spc_matches_prefix _s3344_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3345_ _)) => + (match (string_drop _s3344_ _s3345_) with + | _s3346_ => + (reg_name_matches_prefix _s3346_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs2,(existT _ _s3347_ _)) => + (match (string_drop _s3346_ _s3347_) with + | _s3348_ => + (sep_matches_prefix _s3348_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3349_ _)) => + match (string_drop _s3348_ _s3349_) with + | _s3350_ => + match (hex_bits_6_matches_prefix _s3350_) with + | Some (uimm,(existT _ _s3351_ _)) => + match (string_drop _s3350_ _s3351_) with + | s_ => Some ((rs2, uimm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3329_ (_s3330_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3331_ := _s3330_ in + (if ((string_startswith _s3331_ "c.swsp")) then + (match (string_drop _s3331_ (projT1 (string_length "c.swsp"))) with + | _s3332_ => + (spc_matches_prefix _s3332_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3333_ _)) => + (match (string_drop _s3332_ _s3333_) with + | _s3334_ => + (reg_name_matches_prefix _s3334_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s3335_ _)) => + (match (string_drop _s3334_ _s3335_) with + | _s3336_ => + (sep_matches_prefix _s3336_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3337_ _)) => + match (string_drop _s3336_ _s3337_) with + | _s3338_ => + match (hex_bits_6_matches_prefix _s3338_) with + | Some (uimm,(existT _ _s3339_ _)) => + match (string_drop _s3338_ _s3339_) with + | s_ => Some ((rd, uimm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3317_ (_s3318_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3319_ := _s3318_ in + (if ((string_startswith _s3319_ "c.ldsp")) then + (match (string_drop _s3319_ (projT1 (string_length "c.ldsp"))) with + | _s3320_ => + (spc_matches_prefix _s3320_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3321_ _)) => + (match (string_drop _s3320_ _s3321_) with + | _s3322_ => + (reg_name_matches_prefix _s3322_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s3323_ _)) => + (match (string_drop _s3322_ _s3323_) with + | _s3324_ => + (sep_matches_prefix _s3324_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3325_ _)) => + match (string_drop _s3324_ _s3325_) with + | _s3326_ => + match (hex_bits_6_matches_prefix _s3326_) with + | Some (uimm,(existT _ _s3327_ _)) => + match (string_drop _s3326_ _s3327_) with + | s_ => Some ((rd, uimm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3305_ (_s3306_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3307_ := _s3306_ in + (if ((string_startswith _s3307_ "c.lwsp")) then + (match (string_drop _s3307_ (projT1 (string_length "c.lwsp"))) with + | _s3308_ => + (spc_matches_prefix _s3308_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3309_ _)) => + (match (string_drop _s3308_ _s3309_) with + | _s3310_ => + (reg_name_matches_prefix _s3310_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s3311_ _)) => + (match (string_drop _s3310_ _s3311_) with + | _s3312_ => + (sep_matches_prefix _s3312_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3313_ _)) => + match (string_drop _s3312_ _s3313_) with + | _s3314_ => + match (hex_bits_6_matches_prefix _s3314_) with + | Some (uimm,(existT _ _s3315_ _)) => + match (string_drop _s3314_ _s3315_) with + | s_ => Some ((rd, uimm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3293_ (_s3294_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3295_ := _s3294_ in + (if ((string_startswith _s3295_ "c.slli")) then + (match (string_drop _s3295_ (projT1 (string_length "c.slli"))) with + | _s3296_ => + (spc_matches_prefix _s3296_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3297_ _)) => + (match (string_drop _s3296_ _s3297_) with + | _s3298_ => + (reg_name_matches_prefix _s3298_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3299_ _)) => + (match (string_drop _s3298_ _s3299_) with + | _s3300_ => + (sep_matches_prefix _s3300_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3301_ _)) => + match (string_drop _s3300_ _s3301_) with + | _s3302_ => + match (hex_bits_6_matches_prefix _s3302_) with + | Some (shamt,(existT _ _s3303_ _)) => + match (string_drop _s3302_ _s3303_) with + | s_ => Some ((rsd, shamt, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3281_ (_s3282_ : string) +: M (option ((mword 3 * mword 8 * string))) := + + let _s3283_ := _s3282_ in + (if ((string_startswith _s3283_ "c.bnez")) then + (match (string_drop _s3283_ (projT1 (string_length "c.bnez"))) with + | _s3284_ => + (spc_matches_prefix _s3284_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3285_ _)) => + (match (string_drop _s3284_ _s3285_) with + | _s3286_ => + (creg_name_matches_prefix _s3286_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs,(existT _ _s3287_ _)) => + (match (string_drop _s3286_ _s3287_) with + | _s3288_ => + (sep_matches_prefix _s3288_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3289_ _)) => + match (string_drop _s3288_ _s3289_) with + | _s3290_ => + match (hex_bits_8_matches_prefix _s3290_) with + | Some (imm,(existT _ _s3291_ _)) => + match (string_drop _s3290_ _s3291_) with + | s_ => Some ((rs, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + | _ => returnm (None : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + | _ => returnm (None : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + else returnm (None : option ((mword 3 * mword 8 * string)))) + : M (option ((mword 3 * mword 8 * string))). + +Definition _s3269_ (_s3270_ : string) +: M (option ((mword 3 * mword 8 * string))) := + + let _s3271_ := _s3270_ in + (if ((string_startswith _s3271_ "c.beqz")) then + (match (string_drop _s3271_ (projT1 (string_length "c.beqz"))) with + | _s3272_ => + (spc_matches_prefix _s3272_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3273_ _)) => + (match (string_drop _s3272_ _s3273_) with + | _s3274_ => + (creg_name_matches_prefix _s3274_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs,(existT _ _s3275_ _)) => + (match (string_drop _s3274_ _s3275_) with + | _s3276_ => + (sep_matches_prefix _s3276_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3277_ _)) => + match (string_drop _s3276_ _s3277_) with + | _s3278_ => + match (hex_bits_8_matches_prefix _s3278_) with + | Some (imm,(existT _ _s3279_ _)) => + match (string_drop _s3278_ _s3279_) with + | s_ => Some ((rs, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + | _ => returnm (None : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + | _ => returnm (None : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + else returnm (None : option ((mword 3 * mword 8 * string)))) + : M (option ((mword 3 * mword 8 * string))). + +Definition _s3261_ (_s3262_ : string) +: M (option ((mword 11 * string))) := + + let _s3263_ := _s3262_ in + (if ((string_startswith _s3263_ "c.j")) then + (match (string_drop _s3263_ (projT1 (string_length "c.j"))) with + | _s3264_ => + (spc_matches_prefix _s3264_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s3265_ _)) => + match (string_drop _s3264_ _s3265_) with + | _s3266_ => + match (hex_bits_11_matches_prefix _s3266_) with + | Some (imm,(existT _ _s3267_ _)) => + match (string_drop _s3266_ _s3267_) with | s_ => Some ((imm, s_)) end + | _ => None + end + end + | _ => None + end) + : option ((mword 11 * string))) + end) + : M (option ((mword 11 * string))) + else returnm (None : option ((mword 11 * string)))) + : M (option ((mword 11 * string))). + +Definition _s3249_ (_s3250_ : string) +: M (option ((mword 3 * mword 3 * string))) := + + let _s3251_ := _s3250_ in + (if ((string_startswith _s3251_ "c.addw")) then + (match (string_drop _s3251_ (projT1 (string_length "c.addw"))) with + | _s3252_ => + (spc_matches_prefix _s3252_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3253_ _)) => + (match (string_drop _s3252_ _s3253_) with + | _s3254_ => + (creg_name_matches_prefix _s3254_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3255_ _)) => + (match (string_drop _s3254_ _s3255_) with + | _s3256_ => + (sep_matches_prefix _s3256_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3257_ _)) => + (match (string_drop _s3256_ _s3257_) with + | _s3258_ => + (creg_name_matches_prefix _s3258_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s3259_ _)) => + match (string_drop _s3258_ _s3259_) with + | s_ => Some ((rsd, rs2, s_)) + end + | _ => None + end) + : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + else returnm (None : option ((mword 3 * mword 3 * string)))) + : M (option ((mword 3 * mword 3 * string))). + +Definition _s3237_ (_s3238_ : string) +: M (option ((mword 3 * mword 3 * string))) := + + let _s3239_ := _s3238_ in + (if ((string_startswith _s3239_ "c.subw")) then + (match (string_drop _s3239_ (projT1 (string_length "c.subw"))) with + | _s3240_ => + (spc_matches_prefix _s3240_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3241_ _)) => + (match (string_drop _s3240_ _s3241_) with + | _s3242_ => + (creg_name_matches_prefix _s3242_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3243_ _)) => + (match (string_drop _s3242_ _s3243_) with + | _s3244_ => + (sep_matches_prefix _s3244_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3245_ _)) => + (match (string_drop _s3244_ _s3245_) with + | _s3246_ => + (creg_name_matches_prefix _s3246_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s3247_ _)) => + match (string_drop _s3246_ _s3247_) with + | s_ => Some ((rsd, rs2, s_)) + end + | _ => None + end) + : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + else returnm (None : option ((mword 3 * mword 3 * string)))) + : M (option ((mword 3 * mword 3 * string))). + +Definition _s3225_ (_s3226_ : string) +: M (option ((mword 3 * mword 3 * string))) := + + let _s3227_ := _s3226_ in + (if ((string_startswith _s3227_ "c.and")) then + (match (string_drop _s3227_ (projT1 (string_length "c.and"))) with + | _s3228_ => + (spc_matches_prefix _s3228_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3229_ _)) => + (match (string_drop _s3228_ _s3229_) with + | _s3230_ => + (creg_name_matches_prefix _s3230_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3231_ _)) => + (match (string_drop _s3230_ _s3231_) with + | _s3232_ => + (sep_matches_prefix _s3232_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3233_ _)) => + (match (string_drop _s3232_ _s3233_) with + | _s3234_ => + (creg_name_matches_prefix _s3234_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s3235_ _)) => + match (string_drop _s3234_ _s3235_) with + | s_ => Some ((rsd, rs2, s_)) + end + | _ => None + end) + : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + else returnm (None : option ((mword 3 * mword 3 * string)))) + : M (option ((mword 3 * mword 3 * string))). + +Definition _s3213_ (_s3214_ : string) +: M (option ((mword 3 * mword 3 * string))) := + + let _s3215_ := _s3214_ in + (if ((string_startswith _s3215_ "c.or")) then + (match (string_drop _s3215_ (projT1 (string_length "c.or"))) with + | _s3216_ => + (spc_matches_prefix _s3216_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3217_ _)) => + (match (string_drop _s3216_ _s3217_) with + | _s3218_ => + (creg_name_matches_prefix _s3218_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3219_ _)) => + (match (string_drop _s3218_ _s3219_) with + | _s3220_ => + (sep_matches_prefix _s3220_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3221_ _)) => + (match (string_drop _s3220_ _s3221_) with + | _s3222_ => + (creg_name_matches_prefix _s3222_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s3223_ _)) => + match (string_drop _s3222_ _s3223_) with + | s_ => Some ((rsd, rs2, s_)) + end + | _ => None + end) + : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + else returnm (None : option ((mword 3 * mword 3 * string)))) + : M (option ((mword 3 * mword 3 * string))). + +Definition _s3201_ (_s3202_ : string) +: M (option ((mword 3 * mword 3 * string))) := + + let _s3203_ := _s3202_ in + (if ((string_startswith _s3203_ "c.xor")) then + (match (string_drop _s3203_ (projT1 (string_length "c.xor"))) with + | _s3204_ => + (spc_matches_prefix _s3204_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3205_ _)) => + (match (string_drop _s3204_ _s3205_) with + | _s3206_ => + (creg_name_matches_prefix _s3206_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3207_ _)) => + (match (string_drop _s3206_ _s3207_) with + | _s3208_ => + (sep_matches_prefix _s3208_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3209_ _)) => + (match (string_drop _s3208_ _s3209_) with + | _s3210_ => + (creg_name_matches_prefix _s3210_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s3211_ _)) => + match (string_drop _s3210_ _s3211_) with + | s_ => Some ((rsd, rs2, s_)) + end + | _ => None + end) + : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + else returnm (None : option ((mword 3 * mword 3 * string)))) + : M (option ((mword 3 * mword 3 * string))). + +Definition _s3189_ (_s3190_ : string) +: M (option ((mword 3 * mword 3 * string))) := + + let _s3191_ := _s3190_ in + (if ((string_startswith _s3191_ "c.sub")) then + (match (string_drop _s3191_ (projT1 (string_length "c.sub"))) with + | _s3192_ => + (spc_matches_prefix _s3192_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3193_ _)) => + (match (string_drop _s3192_ _s3193_) with + | _s3194_ => + (creg_name_matches_prefix _s3194_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3195_ _)) => + (match (string_drop _s3194_ _s3195_) with + | _s3196_ => + (sep_matches_prefix _s3196_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3197_ _)) => + (match (string_drop _s3196_ _s3197_) with + | _s3198_ => + (creg_name_matches_prefix _s3198_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s3199_ _)) => + match (string_drop _s3198_ _s3199_) with + | s_ => Some ((rsd, rs2, s_)) + end + | _ => None + end) + : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + end) + : M (option ((mword 3 * mword 3 * string))) + else returnm (None : option ((mword 3 * mword 3 * string)))) + : M (option ((mword 3 * mword 3 * string))). + +Definition _s3177_ (_s3178_ : string) +: M (option ((mword 3 * mword 6 * string))) := + + let _s3179_ := _s3178_ in + (if ((string_startswith _s3179_ "c.andi")) then + (match (string_drop _s3179_ (projT1 (string_length "c.andi"))) with + | _s3180_ => + (spc_matches_prefix _s3180_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3181_ _)) => + (match (string_drop _s3180_ _s3181_) with + | _s3182_ => + (creg_name_matches_prefix _s3182_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3183_ _)) => + (match (string_drop _s3182_ _s3183_) with + | _s3184_ => + (sep_matches_prefix _s3184_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3185_ _)) => + match (string_drop _s3184_ _s3185_) with + | _s3186_ => + match (hex_bits_6_matches_prefix _s3186_) with + | Some (imm,(existT _ _s3187_ _)) => + match (string_drop _s3186_ _s3187_) with + | s_ => Some ((rsd, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + | _ => returnm (None : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + | _ => returnm (None : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + else returnm (None : option ((mword 3 * mword 6 * string)))) + : M (option ((mword 3 * mword 6 * string))). + +Definition _s3165_ (_s3166_ : string) +: M (option ((mword 3 * mword 6 * string))) := + + let _s3167_ := _s3166_ in + (if ((string_startswith _s3167_ "c.srai")) then + (match (string_drop _s3167_ (projT1 (string_length "c.srai"))) with + | _s3168_ => + (spc_matches_prefix _s3168_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3169_ _)) => + (match (string_drop _s3168_ _s3169_) with + | _s3170_ => + (creg_name_matches_prefix _s3170_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3171_ _)) => + (match (string_drop _s3170_ _s3171_) with + | _s3172_ => + (sep_matches_prefix _s3172_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3173_ _)) => + match (string_drop _s3172_ _s3173_) with + | _s3174_ => + match (hex_bits_6_matches_prefix _s3174_) with + | Some (shamt,(existT _ _s3175_ _)) => + match (string_drop _s3174_ _s3175_) with + | s_ => Some ((rsd, shamt, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + | _ => returnm (None : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + | _ => returnm (None : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + else returnm (None : option ((mword 3 * mword 6 * string)))) + : M (option ((mword 3 * mword 6 * string))). + +Definition _s3153_ (_s3154_ : string) +: M (option ((mword 3 * mword 6 * string))) := + + let _s3155_ := _s3154_ in + (if ((string_startswith _s3155_ "c.srli")) then + (match (string_drop _s3155_ (projT1 (string_length "c.srli"))) with + | _s3156_ => + (spc_matches_prefix _s3156_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3157_ _)) => + (match (string_drop _s3156_ _s3157_) with + | _s3158_ => + (creg_name_matches_prefix _s3158_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3159_ _)) => + (match (string_drop _s3158_ _s3159_) with + | _s3160_ => + (sep_matches_prefix _s3160_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3161_ _)) => + match (string_drop _s3160_ _s3161_) with + | _s3162_ => + match (hex_bits_6_matches_prefix _s3162_) with + | Some (shamt,(existT _ _s3163_ _)) => + match (string_drop _s3162_ _s3163_) with + | s_ => Some ((rsd, shamt, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + | _ => returnm (None : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + | _ => returnm (None : option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + end) + : M (option ((mword 3 * mword 6 * string))) + else returnm (None : option ((mword 3 * mword 6 * string)))) + : M (option ((mword 3 * mword 6 * string))). + +Definition _s3141_ (_s3142_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3143_ := _s3142_ in + (if ((string_startswith _s3143_ "c.lui")) then + (match (string_drop _s3143_ (projT1 (string_length "c.lui"))) with + | _s3144_ => + (spc_matches_prefix _s3144_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3145_ _)) => + (match (string_drop _s3144_ _s3145_) with + | _s3146_ => + (reg_name_matches_prefix _s3146_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s3147_ _)) => + (match (string_drop _s3146_ _s3147_) with + | _s3148_ => + (sep_matches_prefix _s3148_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3149_ _)) => + match (string_drop _s3148_ _s3149_) with + | _s3150_ => + match (hex_bits_6_matches_prefix _s3150_) with + | Some (imm,(existT _ _s3151_ _)) => + match (string_drop _s3150_ _s3151_) with + | s_ => Some ((rd, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3133_ (_s3134_ : string) +: M (option ((mword 6 * string))) := + + let _s3135_ := _s3134_ in + (if ((string_startswith _s3135_ "c.addi16sp")) then + (match (string_drop _s3135_ (projT1 (string_length "c.addi16sp"))) with + | _s3136_ => + (spc_matches_prefix _s3136_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s3137_ _)) => + match (string_drop _s3136_ _s3137_) with + | _s3138_ => + match (hex_bits_6_matches_prefix _s3138_) with + | Some (imm,(existT _ _s3139_ _)) => + match (string_drop _s3138_ _s3139_) with | s_ => Some ((imm, s_)) end + | _ => None + end + end + | _ => None + end) + : option ((mword 6 * string))) + end) + : M (option ((mword 6 * string))) + else returnm (None : option ((mword 6 * string)))) + : M (option ((mword 6 * string))). + +Definition _s3121_ (_s3122_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3123_ := _s3122_ in + (if ((string_startswith _s3123_ "c.li")) then + (match (string_drop _s3123_ (projT1 (string_length "c.li"))) with + | _s3124_ => + (spc_matches_prefix _s3124_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3125_ _)) => + (match (string_drop _s3124_ _s3125_) with + | _s3126_ => + (reg_name_matches_prefix _s3126_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s3127_ _)) => + (match (string_drop _s3126_ _s3127_) with + | _s3128_ => + (sep_matches_prefix _s3128_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3129_ _)) => + match (string_drop _s3128_ _s3129_) with + | _s3130_ => + match (hex_bits_6_matches_prefix _s3130_) with + | Some (imm,(existT _ _s3131_ _)) => + match (string_drop _s3130_ _s3131_) with + | s_ => Some ((rd, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3109_ (_s3110_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3111_ := _s3110_ in + (if ((string_startswith _s3111_ "c.addiw")) then + (match (string_drop _s3111_ (projT1 (string_length "c.addiw"))) with + | _s3112_ => + (spc_matches_prefix _s3112_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3113_ _)) => + (match (string_drop _s3112_ _s3113_) with + | _s3114_ => + (reg_name_matches_prefix _s3114_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3115_ _)) => + (match (string_drop _s3114_ _s3115_) with + | _s3116_ => + (sep_matches_prefix _s3116_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3117_ _)) => + match (string_drop _s3116_ _s3117_) with + | _s3118_ => + match (hex_bits_6_matches_prefix _s3118_) with + | Some (imm,(existT _ _s3119_ _)) => + match (string_drop _s3118_ _s3119_) with + | s_ => Some ((rsd, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3101_ (_s3102_ : string) +: M (option ((mword 11 * string))) := + + let _s3103_ := _s3102_ in + (if ((string_startswith _s3103_ "c.jal")) then + (match (string_drop _s3103_ (projT1 (string_length "c.jal"))) with + | _s3104_ => + (spc_matches_prefix _s3104_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + returnm ((match w__0 with + | Some (tt,(existT _ _s3105_ _)) => + match (string_drop _s3104_ _s3105_) with + | _s3106_ => + match (hex_bits_12_matches_prefix _s3106_) with + | Some (v__784,(existT _ _s3107_ _)) => + if ((eq_vec (subrange_vec_dec v__784 0 0) + (vec_of_bits [B0] : mword (0 - 0 + 1)))) then + let imm : mword 11 := subrange_vec_dec v__784 11 1 in + let imm : mword 11 := subrange_vec_dec v__784 11 1 in + match (string_drop _s3106_ _s3107_) with | s_ => Some ((imm, s_)) end + else + let g__21 := Some ((v__784, _s3107_)) in + None + | g__21 => None + end + end + | _ => None + end) + : option ((mword 11 * string))) + end) + : M (option ((mword 11 * string))) + else returnm (None : option ((mword 11 * string)))) + : M (option ((mword 11 * string))). + +Definition _s3089_ (_s3090_ : string) +: M (option ((mword 5 * mword 6 * string))) := + + let _s3091_ := _s3090_ in + (if ((string_startswith _s3091_ "c.addi")) then + (match (string_drop _s3091_ (projT1 (string_length "c.addi"))) with + | _s3092_ => + (spc_matches_prefix _s3092_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3093_ _)) => + (match (string_drop _s3092_ _s3093_) with + | _s3094_ => + (reg_name_matches_prefix _s3094_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsd,(existT _ _s3095_ _)) => + (match (string_drop _s3094_ _s3095_) with + | _s3096_ => + (sep_matches_prefix _s3096_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3097_ _)) => + match (string_drop _s3096_ _s3097_) with + | _s3098_ => + match (hex_bits_6_matches_prefix _s3098_) with + | Some (nzi,(existT _ _s3099_ _)) => + match (string_drop _s3098_ _s3099_) with + | s_ => Some ((rsd, nzi, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + | _ => returnm (None : option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + end) + : M (option ((mword 5 * mword 6 * string))) + else returnm (None : option ((mword 5 * mword 6 * string)))) + : M (option ((mword 5 * mword 6 * string))). + +Definition _s3073_ (_s3074_ : string) +: M (option ((mword 3 * mword 3 * mword 5 * string))) := + + let _s3075_ := _s3074_ in + (if ((string_startswith _s3075_ "c.sd")) then + (match (string_drop _s3075_ (projT1 (string_length "c.sd"))) with + | _s3076_ => + (spc_matches_prefix _s3076_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3077_ _)) => + (match (string_drop _s3076_ _s3077_) with + | _s3078_ => + (creg_name_matches_prefix _s3078_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsc1,(existT _ _s3079_ _)) => + (match (string_drop _s3078_ _s3079_) with + | _s3080_ => + (sep_matches_prefix _s3080_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3081_ _)) => + (match (string_drop _s3080_ _s3081_) with + | _s3082_ => + (creg_name_matches_prefix _s3082_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc2,(existT _ _s3083_ _)) => + (match (string_drop _s3082_ _s3083_) with + | _s3084_ => + (sep_matches_prefix _s3084_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s3085_ _)) => + match (string_drop _s3084_ _s3085_) with + | _s3086_ => + match (hex_bits_8_matches_prefix _s3086_) with + | Some (v__786,(existT _ _s3087_ _)) => + if ((eq_vec + (subrange_vec_dec v__786 2 0) + (vec_of_bits [B0;B0;B0] + : mword (2 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__786 7 3 in + let uimm : mword 5 := + subrange_vec_dec v__786 7 3 in + match (string_drop _s3086_ _s3087_) with + | s_ => Some ((rsc1, rsc2, uimm, s_)) + end + else + let g__20 := Some ((v__786, _s3087_)) in + None + | g__20 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => + returnm (None + : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + else returnm (None : option ((mword 3 * mword 3 * mword 5 * string)))) + : M (option ((mword 3 * mword 3 * mword 5 * string))). + +Definition _s3057_ (_s3058_ : string) +: M (option ((mword 3 * mword 3 * mword 5 * string))) := + + let _s3059_ := _s3058_ in + (if ((string_startswith _s3059_ "c.sw")) then + (match (string_drop _s3059_ (projT1 (string_length "c.sw"))) with + | _s3060_ => + (spc_matches_prefix _s3060_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3061_ _)) => + (match (string_drop _s3060_ _s3061_) with + | _s3062_ => + (creg_name_matches_prefix _s3062_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rsc1,(existT _ _s3063_ _)) => + (match (string_drop _s3062_ _s3063_) with + | _s3064_ => + (sep_matches_prefix _s3064_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3065_ _)) => + (match (string_drop _s3064_ _s3065_) with + | _s3066_ => + (creg_name_matches_prefix _s3066_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc2,(existT _ _s3067_ _)) => + (match (string_drop _s3066_ _s3067_) with + | _s3068_ => + (sep_matches_prefix _s3068_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s3069_ _)) => + match (string_drop _s3068_ _s3069_) with + | _s3070_ => + match (hex_bits_7_matches_prefix _s3070_) with + | Some (v__788,(existT _ _s3071_ _)) => + if ((eq_vec + (subrange_vec_dec v__788 1 0) + (vec_of_bits [B0;B0] + : mword (1 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__788 6 2 in + let uimm : mword 5 := + subrange_vec_dec v__788 6 2 in + match (string_drop _s3070_ _s3071_) with + | s_ => Some ((rsc1, rsc2, uimm, s_)) + end + else + let g__19 := Some ((v__788, _s3071_)) in + None + | g__19 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => + returnm (None + : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + else returnm (None : option ((mword 3 * mword 3 * mword 5 * string)))) + : M (option ((mword 3 * mword 3 * mword 5 * string))). + +Definition _s3041_ (_s3042_ : string) +: M (option ((mword 3 * mword 3 * mword 5 * string))) := + + let _s3043_ := _s3042_ in + (if ((string_startswith _s3043_ "c.ld")) then + (match (string_drop _s3043_ (projT1 (string_length "c.ld"))) with + | _s3044_ => + (spc_matches_prefix _s3044_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3045_ _)) => + (match (string_drop _s3044_ _s3045_) with + | _s3046_ => + (creg_name_matches_prefix _s3046_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s3047_ _)) => + (match (string_drop _s3046_ _s3047_) with + | _s3048_ => + (sep_matches_prefix _s3048_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3049_ _)) => + (match (string_drop _s3048_ _s3049_) with + | _s3050_ => + (creg_name_matches_prefix _s3050_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc,(existT _ _s3051_ _)) => + (match (string_drop _s3050_ _s3051_) with + | _s3052_ => + (sep_matches_prefix _s3052_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s3053_ _)) => + match (string_drop _s3052_ _s3053_) with + | _s3054_ => + match (hex_bits_8_matches_prefix _s3054_) with + | Some (v__790,(existT _ _s3055_ _)) => + if ((eq_vec + (subrange_vec_dec v__790 2 0) + (vec_of_bits [B0;B0;B0] + : mword (2 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__790 7 3 in + let uimm : mword 5 := + subrange_vec_dec v__790 7 3 in + match (string_drop _s3054_ _s3055_) with + | s_ => Some ((rdc, rsc, uimm, s_)) + end + else + let g__18 := Some ((v__790, _s3055_)) in + None + | g__18 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => + returnm (None + : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + else returnm (None : option ((mword 3 * mword 3 * mword 5 * string)))) + : M (option ((mword 3 * mword 3 * mword 5 * string))). + +Definition _s3025_ (_s3026_ : string) +: M (option ((mword 3 * mword 3 * mword 5 * string))) := + + let _s3027_ := _s3026_ in + (if ((string_startswith _s3027_ "c.lw")) then + (match (string_drop _s3027_ (projT1 (string_length "c.lw"))) with + | _s3028_ => + (spc_matches_prefix _s3028_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3029_ _)) => + (match (string_drop _s3028_ _s3029_) with + | _s3030_ => + (creg_name_matches_prefix _s3030_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s3031_ _)) => + (match (string_drop _s3030_ _s3031_) with + | _s3032_ => + (sep_matches_prefix _s3032_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s3033_ _)) => + (match (string_drop _s3032_ _s3033_) with + | _s3034_ => + (creg_name_matches_prefix _s3034_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rsc,(existT _ _s3035_ _)) => + (match (string_drop _s3034_ _s3035_) with + | _s3036_ => + (sep_matches_prefix _s3036_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s3037_ _)) => + match (string_drop _s3036_ _s3037_) with + | _s3038_ => + match (hex_bits_7_matches_prefix _s3038_) with + | Some (v__792,(existT _ _s3039_ _)) => + if ((eq_vec + (subrange_vec_dec v__792 1 0) + (vec_of_bits [B0;B0] + : mword (1 - 0 + 1)))) then + let uimm : mword 5 := + subrange_vec_dec v__792 6 2 in + let uimm : mword 5 := + subrange_vec_dec v__792 6 2 in + match (string_drop _s3038_ _s3039_) with + | s_ => Some ((rdc, rsc, uimm, s_)) + end + else + let g__17 := Some ((v__792, _s3039_)) in + None + | g__17 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => + returnm (None + : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + | _ => returnm (None : option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + end) + : M (option ((mword 3 * mword 3 * mword 5 * string))) + else returnm (None : option ((mword 3 * mword 3 * mword 5 * string)))) + : M (option ((mword 3 * mword 3 * mword 5 * string))). + +Definition _s3013_ (_s3014_ : string) +: M (option ((mword 3 * mword 8 * string))) := + + let _s3015_ := _s3014_ in + (if ((string_startswith _s3015_ "c.addi4spn")) then + (match (string_drop _s3015_ (projT1 (string_length "c.addi4spn"))) with + | _s3016_ => + (spc_matches_prefix _s3016_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s3017_ _)) => + (match (string_drop _s3016_ _s3017_) with + | _s3018_ => + (creg_name_matches_prefix _s3018_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rdc,(existT _ _s3019_ _)) => + (match (string_drop _s3018_ _s3019_) with + | _s3020_ => + (sep_matches_prefix _s3020_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s3021_ _)) => + match (string_drop _s3020_ _s3021_) with + | _s3022_ => + match (hex_bits_10_matches_prefix _s3022_) with + | Some (v__794,(existT _ _s3023_ _)) => + if ((eq_vec (subrange_vec_dec v__794 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1)))) + then + let nzimm : mword 8 := subrange_vec_dec v__794 9 2 in + let nzimm : mword 8 := subrange_vec_dec v__794 9 2 in + match (string_drop _s3022_ _s3023_) with + | s_ => Some ((rdc, nzimm, s_)) + end + else + let g__16 := Some ((v__794, _s3023_)) in + None + | g__16 => None + end + end + | _ => None + end) + : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + | _ => returnm (None : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + | _ => returnm (None : option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + end) + : M (option ((mword 3 * mword 8 * string))) + else returnm (None : option ((mword 3 * mword 8 * string)))) + : M (option ((mword 3 * mword 8 * string))). + +Definition _s3009_ (_s3010_ : string) +: option string := + + let _s3011_ := _s3010_ in + if ((string_startswith _s3011_ "c.nop")) then + match (string_drop _s3011_ (projT1 (string_length "c.nop"))) with | s_ => Some (s_) end + else None. + +Definition _s2992_ (_s2993_ : string) +: M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) := + + (match _s2993_ with + | _s2994_ => + (csr_mnemonic_matches_prefix _s2994_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2995_ _)) => + (match (string_drop _s2994_ _s2995_) with + | _s2996_ => + (spc_matches_prefix _s2996_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2997_ _)) => + (match (string_drop _s2996_ _s2997_) with + | _s2998_ => + (reg_name_matches_prefix _s2998_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2999_ _)) => + (match (string_drop _s2998_ _s2999_) with + | _s3000_ => + (sep_matches_prefix _s3000_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s3001_ _)) => + (match (string_drop _s3000_ _s3001_) with + | _s3002_ => + (reg_name_matches_prefix _s3002_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s3003_ _)) => + (match (string_drop _s3002_ _s3003_) with + | _s3004_ => + (sep_matches_prefix _s3004_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s3005_ _)) => + (match (string_drop _s3004_ _s3005_) with + | _s3006_ => + (csr_name_map_matches_prefix _s3006_) >>= fun w__6 : option ((mword 12 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (csr,(existT _ _s3007_ _)) => + match (string_drop _s3006_ + _s3007_) with + | s_ => + Some ((op, rd, rs1, csr, s_)) + end + | _ => None + end) + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))). + +Definition _s2974_ (_s2975_ : string) +: M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) := + + (match _s2975_ with + | _s2976_ => + (csr_mnemonic_matches_prefix _s2976_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2977_ _)) => + let _s2978_ := string_drop _s2976_ _s2977_ in + (if ((string_startswith _s2978_ "i")) then + (match (string_drop _s2978_ (projT1 (string_length "i"))) with + | _s2979_ => + (spc_matches_prefix _s2979_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2980_ _)) => + (match (string_drop _s2979_ _s2980_) with + | _s2981_ => + (reg_name_matches_prefix _s2981_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2982_ _)) => + (match (string_drop _s2981_ _s2982_) with + | _s2983_ => + (sep_matches_prefix _s2983_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2984_ _)) => + (match (string_drop _s2983_ _s2984_) with + | _s2985_ => + (match (hex_bits_5_matches_prefix _s2985_) with + | Some (rs1,(existT _ _s2986_ _)) => + (match (string_drop _s2985_ _s2986_) with + | _s2987_ => + (sep_matches_prefix _s2987_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s2988_ _)) => + (match (string_drop _s2987_ _s2988_) with + | _s2989_ => + (csr_name_map_matches_prefix _s2989_) >>= fun w__5 : option ((mword 12 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some + (csr,(existT _ _s2990_ _)) => + match (string_drop _s2989_ + _s2990_) with + | s_ => + Some + ((op, rd, rs1, csr, s_)) + end + | _ => None + end) + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + else returnm (None : option ((csrop * mword 5 * mword 5 * mword 12 * string)))) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((csrop * mword 5 * mword 5 * mword 12 * string))). + +Definition _s2950_ (_s2951_ : string) +: M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) := + + (match _s2951_ with + | _s2952_ => + (amo_mnemonic_matches_prefix _s2952_) >>= fun w__0 : option ((amoop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2953_ _)) => + let _s2954_ := string_drop _s2952_ _s2953_ in + (if ((string_startswith _s2954_ ".")) then + (match (string_drop _s2954_ (projT1 (string_length "."))) with + | _s2955_ => + (size_mnemonic_matches_prefix _s2955_) >>= fun w__1 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (width,(existT _ _s2956_ _)) => + (match (string_drop _s2955_ _s2956_) with + | _s2957_ => + (maybe_aq_matches_prefix _s2957_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (aq,(existT _ _s2958_ _)) => + (match (string_drop _s2957_ _s2958_) with + | _s2959_ => + (maybe_rl_matches_prefix _s2959_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rl,(existT _ _s2960_ _)) => + (match (string_drop _s2959_ _s2960_) with + | _s2961_ => + (spc_matches_prefix _s2961_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s2962_ _)) => + (match (string_drop _s2961_ _s2962_) with + | _s2963_ => + (reg_name_matches_prefix _s2963_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (rd,(existT _ _s2964_ _)) => + (match (string_drop _s2963_ _s2964_) with + | _s2965_ => + (sep_matches_prefix _s2965_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (tt,(existT _ _s2966_ _)) => + (match (string_drop _s2965_ _s2966_) with + | _s2967_ => + (reg_name_matches_prefix _s2967_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (rs1,(existT _ _s2968_ _)) => + (match (string_drop _s2967_ + _s2968_) with + | _s2969_ => + (sep_matches_prefix + _s2969_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__8 with + | Some + (tt,(existT _ _s2970_ _)) => + (match (string_drop + _s2969_ + _s2970_) with + | _s2971_ => + (reg_name_matches_prefix + _s2971_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__9 with + | Some + (rs2,(existT _ _s2972_ _)) => + match (string_drop + _s2971_ + _s2972_) with + | s_ => + Some + ((op, width, aq, rl, rd, rs1, rs2, s_)) + end + | _ => + None + end) + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + else + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2928_ (_s2929_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) := + + let _s2930_ := _s2929_ in + (if ((string_startswith _s2930_ "sc.")) then + (match (string_drop _s2930_ (projT1 (string_length "sc."))) with + | _s2931_ => + (size_mnemonic_matches_prefix _s2931_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s2932_ _)) => + (match (string_drop _s2931_ _s2932_) with + | _s2933_ => + (maybe_aq_matches_prefix _s2933_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s2934_ _)) => + (match (string_drop _s2933_ _s2934_) with + | _s2935_ => + (maybe_rl_matches_prefix _s2935_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s2936_ _)) => + (match (string_drop _s2935_ _s2936_) with + | _s2937_ => + (spc_matches_prefix _s2937_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2938_ _)) => + (match (string_drop _s2937_ _s2938_) with + | _s2939_ => + (reg_name_matches_prefix _s2939_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s2940_ _)) => + (match (string_drop _s2939_ _s2940_) with + | _s2941_ => + (sep_matches_prefix _s2941_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2942_ _)) => + (match (string_drop _s2941_ _s2942_) with + | _s2943_ => + (reg_name_matches_prefix _s2943_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (rs1,(existT _ _s2944_ _)) => + (match (string_drop _s2943_ _s2944_) with + | _s2945_ => + (sep_matches_prefix _s2945_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (tt,(existT _ _s2946_ _)) => + (match (string_drop _s2945_ + _s2946_) with + | _s2947_ => + (reg_name_matches_prefix + _s2947_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__8 with + | Some + (rs2,(existT _ _s2948_ _)) => + match (string_drop + _s2947_ + _s2948_) with + | s_ => + Some + ((size, aq, rl, rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) + else + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2910_ (_s2911_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) := + + let _s2912_ := _s2911_ in + (if ((string_startswith _s2912_ "lr.")) then + (match (string_drop _s2912_ (projT1 (string_length "lr."))) with + | _s2913_ => + (size_mnemonic_matches_prefix _s2913_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s2914_ _)) => + (match (string_drop _s2913_ _s2914_) with + | _s2915_ => + (maybe_aq_matches_prefix _s2915_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s2916_ _)) => + (match (string_drop _s2915_ _s2916_) with + | _s2917_ => + (maybe_rl_matches_prefix _s2917_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s2918_ _)) => + (match (string_drop _s2917_ _s2918_) with + | _s2919_ => + (spc_matches_prefix _s2919_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2920_ _)) => + (match (string_drop _s2919_ _s2920_) with + | _s2921_ => + (reg_name_matches_prefix _s2921_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s2922_ _)) => + (match (string_drop _s2921_ _s2922_) with + | _s2923_ => + (sep_matches_prefix _s2923_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2924_ _)) => + (match (string_drop _s2923_ _s2924_) with + | _s2925_ => + (reg_name_matches_prefix _s2925_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs1,(existT _ _s2926_ _)) => + match (string_drop _s2925_ + _s2926_) with + | s_ => + Some + ((size, aq, rl, rd, rs1, s_)) + end + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) + else returnm (None : option ((word_width * bool * bool * mword 5 * mword 5 * string)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))). + +Definition _s2898_ (_s2899_ : string) +: M (option ((mword 5 * mword 5 * string))) := + + let _s2900_ := _s2899_ in + (if ((string_startswith _s2900_ "sfence.vma")) then + (match (string_drop _s2900_ (projT1 (string_length "sfence.vma"))) with + | _s2901_ => + (spc_matches_prefix _s2901_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2902_ _)) => + (match (string_drop _s2901_ _s2902_) with + | _s2903_ => + (reg_name_matches_prefix _s2903_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rs1,(existT _ _s2904_ _)) => + (match (string_drop _s2903_ _s2904_) with + | _s2905_ => + (sep_matches_prefix _s2905_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2906_ _)) => + (match (string_drop _s2905_ _s2906_) with + | _s2907_ => + (reg_name_matches_prefix _s2907_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (rs2,(existT _ _s2908_ _)) => + match (string_drop _s2907_ _s2908_) with + | s_ => Some ((rs1, rs2, s_)) + end + | _ => None + end) + : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * string))) + else returnm (None : option ((mword 5 * mword 5 * string)))) + : M (option ((mword 5 * mword 5 * string))). + +Definition _s2894_ (_s2895_ : string) +: option string := + + let _s2896_ := _s2895_ in + if ((string_startswith _s2896_ "wfi")) then + match (string_drop _s2896_ (projT1 (string_length "wfi"))) with | s_ => Some (s_) end + else None. + +Definition _s2890_ (_s2891_ : string) +: option string := + + let _s2892_ := _s2891_ in + if ((string_startswith _s2892_ "ebreak")) then + match (string_drop _s2892_ (projT1 (string_length "ebreak"))) with | s_ => Some (s_) end + else None. + +Definition _s2886_ (_s2887_ : string) +: option string := + + let _s2888_ := _s2887_ in + if ((string_startswith _s2888_ "sret")) then + match (string_drop _s2888_ (projT1 (string_length "sret"))) with | s_ => Some (s_) end + else None. + +Definition _s2882_ (_s2883_ : string) +: option string := + + let _s2884_ := _s2883_ in + if ((string_startswith _s2884_ "mret")) then + match (string_drop _s2884_ (projT1 (string_length "mret"))) with | s_ => Some (s_) end + else None. + +Definition _s2878_ (_s2879_ : string) +: option string := + + let _s2880_ := _s2879_ in + if ((string_startswith _s2880_ "ecall")) then + match (string_drop _s2880_ (projT1 (string_length "ecall"))) with | s_ => Some (s_) end + else None. + +Definition _s2874_ (_s2875_ : string) +: option string := + + let _s2876_ := _s2875_ in + if ((string_startswith _s2876_ "fence.i")) then + match (string_drop _s2876_ (projT1 (string_length "fence.i"))) with | s_ => Some (s_) end + else None. + +Definition _s2862_ (_s2863_ : string) +: M (option ((mword 4 * mword 4 * string))) := + + let _s2864_ := _s2863_ in + (if ((string_startswith _s2864_ "fence.tso")) then + (match (string_drop _s2864_ (projT1 (string_length "fence.tso"))) with + | _s2865_ => + (spc_matches_prefix _s2865_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2866_ _)) => + (match (string_drop _s2865_ _s2866_) with + | _s2867_ => + (fence_bits_matches_prefix _s2867_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (pred,(existT _ _s2868_ _)) => + (match (string_drop _s2867_ _s2868_) with + | _s2869_ => + (sep_matches_prefix _s2869_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2870_ _)) => + (match (string_drop _s2869_ _s2870_) with + | _s2871_ => + (fence_bits_matches_prefix _s2871_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (succ,(existT _ _s2872_ _)) => + match (string_drop _s2871_ _s2872_) with + | s_ => Some ((pred, succ, s_)) + end + | _ => None + end) + : option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + | _ => returnm (None : option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + | _ => returnm (None : option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + | _ => returnm (None : option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + else returnm (None : option ((mword 4 * mword 4 * string)))) + : M (option ((mword 4 * mword 4 * string))). + +Definition _s2850_ (_s2851_ : string) +: M (option ((mword 4 * mword 4 * string))) := + + let _s2852_ := _s2851_ in + (if ((string_startswith _s2852_ "fence")) then + (match (string_drop _s2852_ (projT1 (string_length "fence"))) with + | _s2853_ => + (spc_matches_prefix _s2853_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2854_ _)) => + (match (string_drop _s2853_ _s2854_) with + | _s2855_ => + (fence_bits_matches_prefix _s2855_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (pred,(existT _ _s2856_ _)) => + (match (string_drop _s2855_ _s2856_) with + | _s2857_ => + (sep_matches_prefix _s2857_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2858_ _)) => + (match (string_drop _s2857_ _s2858_) with + | _s2859_ => + (fence_bits_matches_prefix _s2859_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (succ,(existT _ _s2860_ _)) => + match (string_drop _s2859_ _s2860_) with + | s_ => Some ((pred, succ, s_)) + end + | _ => None + end) + : option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + | _ => returnm (None : option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + | _ => returnm (None : option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + | _ => returnm (None : option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + end) + : M (option ((mword 4 * mword 4 * string))) + else returnm (None : option ((mword 4 * mword 4 * string)))) + : M (option ((mword 4 * mword 4 * string))). + +Definition _s2831_ (_s2832_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5 * string))) := + + let _s2833_ := _s2832_ in + (if ((string_startswith _s2833_ "rem")) then + (match (string_drop _s2833_ (projT1 (string_length "rem"))) with + | _s2834_ => + (maybe_not_u_matches_prefix _s2834_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s2835_ _)) => + let _s2836_ := string_drop _s2834_ _s2835_ in + (if ((string_startswith _s2836_ "w")) then + (match (string_drop _s2836_ (projT1 (string_length "w"))) with + | _s2837_ => + (spc_matches_prefix _s2837_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2838_ _)) => + (match (string_drop _s2837_ _s2838_) with + | _s2839_ => + (reg_name_matches_prefix _s2839_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2840_ _)) => + (match (string_drop _s2839_ _s2840_) with + | _s2841_ => + (sep_matches_prefix _s2841_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2842_ _)) => + (match (string_drop _s2841_ _s2842_) with + | _s2843_ => + (reg_name_matches_prefix _s2843_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2844_ _)) => + (match (string_drop _s2843_ _s2844_) with + | _s2845_ => + (sep_matches_prefix _s2845_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2846_ _)) => + (match (string_drop _s2845_ _s2846_) with + | _s2847_ => + (reg_name_matches_prefix _s2847_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s2848_ _)) => + match (string_drop _s2847_ + _s2848_) with + | s_ => + Some + ((s, rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string)))) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string)))) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2812_ (_s2813_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5 * string))) := + + let _s2814_ := _s2813_ in + (if ((string_startswith _s2814_ "div")) then + (match (string_drop _s2814_ (projT1 (string_length "div"))) with + | _s2815_ => + (maybe_not_u_matches_prefix _s2815_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s2816_ _)) => + let _s2817_ := string_drop _s2815_ _s2816_ in + (if ((string_startswith _s2817_ "w")) then + (match (string_drop _s2817_ (projT1 (string_length "w"))) with + | _s2818_ => + (spc_matches_prefix _s2818_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2819_ _)) => + (match (string_drop _s2818_ _s2819_) with + | _s2820_ => + (reg_name_matches_prefix _s2820_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2821_ _)) => + (match (string_drop _s2820_ _s2821_) with + | _s2822_ => + (sep_matches_prefix _s2822_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2823_ _)) => + (match (string_drop _s2822_ _s2823_) with + | _s2824_ => + (reg_name_matches_prefix _s2824_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2825_ _)) => + (match (string_drop _s2824_ _s2825_) with + | _s2826_ => + (sep_matches_prefix _s2826_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2827_ _)) => + (match (string_drop _s2826_ _s2827_) with + | _s2828_ => + (reg_name_matches_prefix _s2828_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s2829_ _)) => + match (string_drop _s2828_ + _s2829_) with + | s_ => + Some + ((s, rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string)))) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string)))) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2796_ (_s2797_ : string) +: M (option ((mword 5 * mword 5 * mword 5 * string))) := + + let _s2798_ := _s2797_ in + (if ((string_startswith _s2798_ "mulw")) then + (match (string_drop _s2798_ (projT1 (string_length "mulw"))) with + | _s2799_ => + (spc_matches_prefix _s2799_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2800_ _)) => + (match (string_drop _s2799_ _s2800_) with + | _s2801_ => + (reg_name_matches_prefix _s2801_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2802_ _)) => + (match (string_drop _s2801_ _s2802_) with + | _s2803_ => + (sep_matches_prefix _s2803_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2804_ _)) => + (match (string_drop _s2803_ _s2804_) with + | _s2805_ => + (reg_name_matches_prefix _s2805_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s2806_ _)) => + (match (string_drop _s2805_ _s2806_) with + | _s2807_ => + (sep_matches_prefix _s2807_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s2808_ _)) => + (match (string_drop _s2807_ _s2808_) with + | _s2809_ => + (reg_name_matches_prefix _s2809_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (rs2,(existT _ _s2810_ _)) => + match (string_drop _s2809_ _s2810_) with + | s_ => Some ((rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 5 * string))) + else returnm (None : option ((mword 5 * mword 5 * mword 5 * string)))) + : M (option ((mword 5 * mword 5 * mword 5 * string))). + +Definition _s2778_ (_s2779_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5 * string))) := + + let _s2780_ := _s2779_ in + (if ((string_startswith _s2780_ "rem")) then + (match (string_drop _s2780_ (projT1 (string_length "rem"))) with + | _s2781_ => + (maybe_not_u_matches_prefix _s2781_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s2782_ _)) => + (match (string_drop _s2781_ _s2782_) with + | _s2783_ => + (spc_matches_prefix _s2783_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2784_ _)) => + (match (string_drop _s2783_ _s2784_) with + | _s2785_ => + (reg_name_matches_prefix _s2785_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2786_ _)) => + (match (string_drop _s2785_ _s2786_) with + | _s2787_ => + (sep_matches_prefix _s2787_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2788_ _)) => + (match (string_drop _s2787_ _s2788_) with + | _s2789_ => + (reg_name_matches_prefix _s2789_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2790_ _)) => + (match (string_drop _s2789_ _s2790_) with + | _s2791_ => + (sep_matches_prefix _s2791_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2792_ _)) => + (match (string_drop _s2791_ _s2792_) with + | _s2793_ => + (reg_name_matches_prefix _s2793_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s2794_ _)) => + match (string_drop _s2793_ + _s2794_) with + | s_ => + Some + ((s, rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string)))) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2760_ (_s2761_ : string) +: M (option ((bool * mword 5 * mword 5 * mword 5 * string))) := + + let _s2762_ := _s2761_ in + (if ((string_startswith _s2762_ "div")) then + (match (string_drop _s2762_ (projT1 (string_length "div"))) with + | _s2763_ => + (maybe_not_u_matches_prefix _s2763_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (s,(existT _ _s2764_ _)) => + (match (string_drop _s2763_ _s2764_) with + | _s2765_ => + (spc_matches_prefix _s2765_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2766_ _)) => + (match (string_drop _s2765_ _s2766_) with + | _s2767_ => + (reg_name_matches_prefix _s2767_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2768_ _)) => + (match (string_drop _s2767_ _s2768_) with + | _s2769_ => + (sep_matches_prefix _s2769_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2770_ _)) => + (match (string_drop _s2769_ _s2770_) with + | _s2771_ => + (reg_name_matches_prefix _s2771_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2772_ _)) => + (match (string_drop _s2771_ _s2772_) with + | _s2773_ => + (sep_matches_prefix _s2773_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2774_ _)) => + (match (string_drop _s2773_ _s2774_) with + | _s2775_ => + (reg_name_matches_prefix _s2775_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some + (rs2,(existT _ _s2776_ _)) => + match (string_drop _s2775_ + _s2776_) with + | s_ => + Some + ((s, rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) + else returnm (None : option ((bool * mword 5 * mword 5 * mword 5 * string)))) + : M (option ((bool * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2743_ (_s2744_ : string) +: M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) := + + (match _s2744_ with + | _s2745_ => + (mul_mnemonic_matches_prefix _s2745_) >>= fun w__0 : option (((bool * bool * bool) * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some ((high, signed1, signed2),(existT _ _s2746_ _)) => + (match (string_drop _s2745_ _s2746_) with + | _s2747_ => + (spc_matches_prefix _s2747_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2748_ _)) => + (match (string_drop _s2747_ _s2748_) with + | _s2749_ => + (reg_name_matches_prefix _s2749_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2750_ _)) => + (match (string_drop _s2749_ _s2750_) with + | _s2751_ => + (sep_matches_prefix _s2751_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2752_ _)) => + (match (string_drop _s2751_ _s2752_) with + | _s2753_ => + (reg_name_matches_prefix _s2753_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2754_ _)) => + (match (string_drop _s2753_ _s2754_) with + | _s2755_ => + (sep_matches_prefix _s2755_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2756_ _)) => + (match (string_drop _s2755_ _s2756_) with + | _s2757_ => + (reg_name_matches_prefix _s2757_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s2758_ _)) => + match (string_drop _s2757_ + _s2758_) with + | s_ => + Some + ((high, signed1, signed2, rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2728_ (_s2729_ : string) +: M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) := + + (match _s2729_ with + | _s2730_ => + (shiftiwop_mnemonic_matches_prefix _s2730_) >>= fun w__0 : option ((sopw * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2731_ _)) => + (match (string_drop _s2730_ _s2731_) with + | _s2732_ => + (spc_matches_prefix _s2732_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2733_ _)) => + (match (string_drop _s2732_ _s2733_) with + | _s2734_ => + (reg_name_matches_prefix _s2734_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2735_ _)) => + (match (string_drop _s2734_ _s2735_) with + | _s2736_ => + (sep_matches_prefix _s2736_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2737_ _)) => + (match (string_drop _s2736_ _s2737_) with + | _s2738_ => + (reg_name_matches_prefix _s2738_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (rs1,(existT _ _s2739_ _)) => + match (string_drop _s2738_ _s2739_) with + | _s2740_ => + match (hex_bits_5_matches_prefix _s2740_) with + | Some (shamt,(existT _ _s2741_ _)) => + match (string_drop _s2740_ _s2741_) with + | s_ => Some ((op, rd, rs1, shamt, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None : option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2711_ (_s2712_ : string) +: M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) := + + (match _s2712_ with + | _s2713_ => + (rtypew_mnemonic_matches_prefix _s2713_) >>= fun w__0 : option ((ropw * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2714_ _)) => + (match (string_drop _s2713_ _s2714_) with + | _s2715_ => + (spc_matches_prefix _s2715_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2716_ _)) => + (match (string_drop _s2715_ _s2716_) with + | _s2717_ => + (reg_name_matches_prefix _s2717_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2718_ _)) => + (match (string_drop _s2717_ _s2718_) with + | _s2719_ => + (sep_matches_prefix _s2719_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2720_ _)) => + (match (string_drop _s2719_ _s2720_) with + | _s2721_ => + (reg_name_matches_prefix _s2721_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2722_ _)) => + (match (string_drop _s2721_ _s2722_) with + | _s2723_ => + (sep_matches_prefix _s2723_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2724_ _)) => + (match (string_drop _s2723_ _s2724_) with + | _s2725_ => + (reg_name_matches_prefix _s2725_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s2726_ _)) => + match (string_drop _s2725_ + _s2726_) with + | s_ => + Some ((op, rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None : option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2694_ (_s2695_ : string) +: M (option ((sop * mword 5 * mword 5 * mword 5 * string))) := + + (match _s2695_ with + | _s2696_ => + (shiftw_mnemonic_matches_prefix _s2696_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2697_ _)) => + (match (string_drop _s2696_ _s2697_) with + | _s2698_ => + (spc_matches_prefix _s2698_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2699_ _)) => + (match (string_drop _s2698_ _s2699_) with + | _s2700_ => + (reg_name_matches_prefix _s2700_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2701_ _)) => + (match (string_drop _s2700_ _s2701_) with + | _s2702_ => + (sep_matches_prefix _s2702_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2703_ _)) => + (match (string_drop _s2702_ _s2703_) with + | _s2704_ => + (reg_name_matches_prefix _s2704_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2705_ _)) => + (match (string_drop _s2704_ _s2705_) with + | _s2706_ => + (sep_matches_prefix _s2706_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s2707_ _)) => + match (string_drop _s2706_ _s2707_) with + | _s2708_ => + match (hex_bits_5_matches_prefix + _s2708_) with + | Some (shamt,(existT _ _s2709_ _)) => + match (string_drop _s2708_ _s2709_) with + | s_ => + Some ((op, rd, rs1, shamt, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None : option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2678_ (_s2679_ : string) +: M (option ((mword 5 * mword 5 * mword 12 * string))) := + + let _s2680_ := _s2679_ in + (if ((string_startswith _s2680_ "addiw")) then + (match (string_drop _s2680_ (projT1 (string_length "addiw"))) with + | _s2681_ => + (spc_matches_prefix _s2681_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2682_ _)) => + (match (string_drop _s2681_ _s2682_) with + | _s2683_ => + (reg_name_matches_prefix _s2683_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2684_ _)) => + (match (string_drop _s2683_ _s2684_) with + | _s2685_ => + (sep_matches_prefix _s2685_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2686_ _)) => + (match (string_drop _s2685_ _s2686_) with + | _s2687_ => + (reg_name_matches_prefix _s2687_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s2688_ _)) => + (match (string_drop _s2687_ _s2688_) with + | _s2689_ => + (sep_matches_prefix _s2689_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s2690_ _)) => + match (string_drop _s2689_ _s2690_) with + | _s2691_ => + match (hex_bits_12_matches_prefix _s2691_) with + | Some (imm,(existT _ _s2692_ _)) => + match (string_drop _s2691_ _s2692_) with + | s_ => Some ((rd, rs1, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + else returnm (None : option ((mword 5 * mword 5 * mword 12 * string)))) + : M (option ((mword 5 * mword 5 * mword 12 * string))). + +Definition _s2656_ (_s2657_ : string) +: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) := + + let _s2658_ := _s2657_ in + (if ((string_startswith _s2658_ "s")) then + (match (string_drop _s2658_ (projT1 (string_length "s"))) with + | _s2659_ => + (size_mnemonic_matches_prefix _s2659_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s2660_ _)) => + (match (string_drop _s2659_ _s2660_) with + | _s2661_ => + (maybe_aq_matches_prefix _s2661_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (aq,(existT _ _s2662_ _)) => + (match (string_drop _s2661_ _s2662_) with + | _s2663_ => + (maybe_rl_matches_prefix _s2663_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rl,(existT _ _s2664_ _)) => + (match (string_drop _s2663_ _s2664_) with + | _s2665_ => + (spc_matches_prefix _s2665_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2666_ _)) => + (match (string_drop _s2665_ _s2666_) with + | _s2667_ => + (reg_name_matches_prefix _s2667_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rd,(existT _ _s2668_ _)) => + (match (string_drop _s2667_ _s2668_) with + | _s2669_ => + (sep_matches_prefix _s2669_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2670_ _)) => + (match (string_drop _s2669_ _s2670_) with + | _s2671_ => + (reg_name_matches_prefix _s2671_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (rs1,(existT _ _s2672_ _)) => + (match (string_drop _s2671_ _s2672_) with + | _s2673_ => + (sep_matches_prefix _s2673_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__7 with + | Some + (tt,(existT _ _s2674_ _)) => + match (string_drop + _s2673_ + _s2674_) with + | _s2675_ => + match (hex_bits_12_matches_prefix + _s2675_) with + | Some + (imm,(existT _ _s2676_ _)) => + match (string_drop + _s2675_ + _s2676_) with + | s_ => + Some + ((size, aq, rl, rd, rs1, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))) + else + returnm (None + : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string)))) + : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string))). + +Definition _s2632_ (_s2633_ : string) +: M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) := + + let _s2634_ := _s2633_ in + (if ((string_startswith _s2634_ "l")) then + (match (string_drop _s2634_ (projT1 (string_length "l"))) with + | _s2635_ => + (size_mnemonic_matches_prefix _s2635_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (size,(existT _ _s2636_ _)) => + (match (string_drop _s2635_ _s2636_) with + | _s2637_ => + (maybe_u_matches_prefix _s2637_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (is_unsigned,(existT _ _s2638_ _)) => + (match (string_drop _s2637_ _s2638_) with + | _s2639_ => + (maybe_aq_matches_prefix _s2639_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (aq,(existT _ _s2640_ _)) => + (match (string_drop _s2639_ _s2640_) with + | _s2641_ => + (maybe_rl_matches_prefix _s2641_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rl,(existT _ _s2642_ _)) => + (match (string_drop _s2641_ _s2642_) with + | _s2643_ => + (spc_matches_prefix _s2643_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (tt,(existT _ _s2644_ _)) => + (match (string_drop _s2643_ _s2644_) with + | _s2645_ => + (reg_name_matches_prefix _s2645_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (rd,(existT _ _s2646_ _)) => + (match (string_drop _s2645_ _s2646_) with + | _s2647_ => + (sep_matches_prefix _s2647_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__6 with + | Some (tt,(existT _ _s2648_ _)) => + (match (string_drop _s2647_ _s2648_) with + | _s2649_ => + (reg_name_matches_prefix _s2649_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__7 with + | Some (rs1,(existT _ _s2650_ _)) => + (match (string_drop _s2649_ + _s2650_) with + | _s2651_ => + (sep_matches_prefix + _s2651_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__8 with + | Some + (tt,(existT _ _s2652_ _)) => + match (string_drop + _s2651_ + _s2652_) with + | _s2653_ => + match (hex_bits_12_matches_prefix + _s2653_) with + | Some + (imm,(existT _ _s2654_ _)) => + match (string_drop + _s2653_ + _s2654_) with + | s_ => + Some + ((size, is_unsigned, aq, rl, rd, rs1, imm, s_)) + end + | _ => + None + end + end + | _ => None + end) + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))) + else + returnm (None + : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string)))) + : M (option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string))). + +Definition _s2615_ (_s2616_ : string) +: M (option ((rop * mword 5 * mword 5 * mword 5 * string))) := + + (match _s2616_ with + | _s2617_ => + (rtype_mnemonic_matches_prefix _s2617_) >>= fun w__0 : option ((rop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2618_ _)) => + (match (string_drop _s2617_ _s2618_) with + | _s2619_ => + (spc_matches_prefix _s2619_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2620_ _)) => + (match (string_drop _s2619_ _s2620_) with + | _s2621_ => + (reg_name_matches_prefix _s2621_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2622_ _)) => + (match (string_drop _s2621_ _s2622_) with + | _s2623_ => + (sep_matches_prefix _s2623_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2624_ _)) => + (match (string_drop _s2623_ _s2624_) with + | _s2625_ => + (reg_name_matches_prefix _s2625_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2626_ _)) => + (match (string_drop _s2625_ _s2626_) with + | _s2627_ => + (sep_matches_prefix _s2627_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__5 with + | Some (tt,(existT _ _s2628_ _)) => + (match (string_drop _s2627_ _s2628_) with + | _s2629_ => + (reg_name_matches_prefix _s2629_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__6 with + | Some (rs2,(existT _ _s2630_ _)) => + match (string_drop _s2629_ + _s2630_) with + | s_ => + Some ((op, rd, rs1, rs2, s_)) + end + | _ => None + end) + : option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None + : option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + | _ => + returnm (None : option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + | _ => returnm (None : option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) + end) + : M (option ((rop * mword 5 * mword 5 * mword 5 * string))). + +Definition _s2600_ (_s2601_ : string) +: M (option ((sop * mword 5 * mword 5 * mword 6 * string))) := + + (match _s2601_ with + | _s2602_ => + (shiftiop_mnemonic_matches_prefix _s2602_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2603_ _)) => + (match (string_drop _s2602_ _s2603_) with + | _s2604_ => + (spc_matches_prefix _s2604_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2605_ _)) => + (match (string_drop _s2604_ _s2605_) with + | _s2606_ => + (reg_name_matches_prefix _s2606_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2607_ _)) => + (match (string_drop _s2606_ _s2607_) with + | _s2608_ => + (sep_matches_prefix _s2608_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2609_ _)) => + (match (string_drop _s2608_ _s2609_) with + | _s2610_ => + (reg_name_matches_prefix _s2610_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (rs1,(existT _ _s2611_ _)) => + match (string_drop _s2610_ _s2611_) with + | _s2612_ => + match (hex_bits_6_matches_prefix _s2612_) with + | Some (shamt,(existT _ _s2613_ _)) => + match (string_drop _s2612_ _s2613_) with + | s_ => Some ((op, rd, rs1, shamt, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) + | _ => + returnm (None + : option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) + | _ => + returnm (None : option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) + | _ => returnm (None : option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) + end) + : M (option ((sop * mword 5 * mword 5 * mword 6 * string))). + +Definition _s2583_ (_s2584_ : string) +: M (option ((iop * mword 5 * mword 5 * mword 12 * string))) := + + (match _s2584_ with + | _s2585_ => + (itype_mnemonic_matches_prefix _s2585_) >>= fun w__0 : option ((iop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2586_ _)) => + (match (string_drop _s2585_ _s2586_) with + | _s2587_ => + (spc_matches_prefix _s2587_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2588_ _)) => + (match (string_drop _s2587_ _s2588_) with + | _s2589_ => + (reg_name_matches_prefix _s2589_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2590_ _)) => + (match (string_drop _s2589_ _s2590_) with + | _s2591_ => + (sep_matches_prefix _s2591_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2592_ _)) => + (match (string_drop _s2591_ _s2592_) with + | _s2593_ => + (reg_name_matches_prefix _s2593_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs1,(existT _ _s2594_ _)) => + (match (string_drop _s2593_ _s2594_) with + | _s2595_ => + (sep_matches_prefix _s2595_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s2596_ _)) => + match (string_drop _s2595_ _s2596_) with + | _s2597_ => + match (hex_bits_12_matches_prefix + _s2597_) with + | Some (imm,(existT _ _s2598_ _)) => + match (string_drop _s2597_ _s2598_) with + | s_ => + Some ((op, rd, rs1, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None : option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((iop * mword 5 * mword 5 * mword 12 * string))). + +Definition _s2566_ (_s2567_ : string) +: M (option ((bop * mword 5 * mword 5 * mword 13 * string))) := + + (match _s2567_ with + | _s2568_ => + (btype_mnemonic_matches_prefix _s2568_) >>= fun w__0 : option ((bop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2569_ _)) => + (match (string_drop _s2568_ _s2569_) with + | _s2570_ => + (spc_matches_prefix _s2570_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2571_ _)) => + (match (string_drop _s2570_ _s2571_) with + | _s2572_ => + (reg_name_matches_prefix _s2572_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rs1,(existT _ _s2573_ _)) => + (match (string_drop _s2572_ _s2573_) with + | _s2574_ => + (sep_matches_prefix _s2574_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (tt,(existT _ _s2575_ _)) => + (match (string_drop _s2574_ _s2575_) with + | _s2576_ => + (reg_name_matches_prefix _s2576_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__4 with + | Some (rs2,(existT _ _s2577_ _)) => + (match (string_drop _s2576_ _s2577_) with + | _s2578_ => + (sep_matches_prefix _s2578_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__5 with + | Some (tt,(existT _ _s2579_ _)) => + match (string_drop _s2578_ _s2579_) with + | _s2580_ => + match (hex_bits_13_matches_prefix + _s2580_) with + | Some (imm,(existT _ _s2581_ _)) => + match (string_drop _s2580_ _s2581_) with + | s_ => + Some ((op, rs1, rs2, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + | _ => + returnm (None + : option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + | _ => + returnm (None + : option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + | _ => + returnm (None : option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + | _ => returnm (None : option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + | _ => returnm (None : option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) + end) + : M (option ((bop * mword 5 * mword 5 * mword 13 * string))). + +Definition _s2550_ (_s2551_ : string) +: M (option ((mword 5 * mword 5 * mword 12 * string))) := + + let _s2552_ := _s2551_ in + (if ((string_startswith _s2552_ "jalr")) then + (match (string_drop _s2552_ (projT1 (string_length "jalr"))) with + | _s2553_ => + (spc_matches_prefix _s2553_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2554_ _)) => + (match (string_drop _s2553_ _s2554_) with + | _s2555_ => + (reg_name_matches_prefix _s2555_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2556_ _)) => + (match (string_drop _s2555_ _s2556_) with + | _s2557_ => + (sep_matches_prefix _s2557_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (tt,(existT _ _s2558_ _)) => + (match (string_drop _s2557_ _s2558_) with + | _s2559_ => + (reg_name_matches_prefix _s2559_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__3 with + | Some (rs1,(existT _ _s2560_ _)) => + (match (string_drop _s2559_ _s2560_) with + | _s2561_ => + (sep_matches_prefix _s2561_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__4 with + | Some (tt,(existT _ _s2562_ _)) => + match (string_drop _s2561_ _s2562_) with + | _s2563_ => + match (hex_bits_12_matches_prefix _s2563_) with + | Some (imm,(existT _ _s2564_ _)) => + match (string_drop _s2563_ _s2564_) with + | s_ => Some ((rd, rs1, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + | _ => + returnm (None + : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + | _ => returnm (None : option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + end) + : M (option ((mword 5 * mword 5 * mword 12 * string))) + else returnm (None : option ((mword 5 * mword 5 * mword 12 * string)))) + : M (option ((mword 5 * mword 5 * mword 12 * string))). + +Definition _s2538_ (_s2539_ : string) +: M (option ((mword 5 * mword 21 * string))) := + + let _s2540_ := _s2539_ in + (if ((string_startswith _s2540_ "jal")) then + (match (string_drop _s2540_ (projT1 (string_length "jal"))) with + | _s2541_ => + (spc_matches_prefix _s2541_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >= 0)})) => + (match w__0 with + | Some (tt,(existT _ _s2542_ _)) => + (match (string_drop _s2541_ _s2542_) with + | _s2543_ => + (reg_name_matches_prefix _s2543_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (rd,(existT _ _s2544_ _)) => + (match (string_drop _s2543_ _s2544_) with + | _s2545_ => + (sep_matches_prefix _s2545_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__2 with + | Some (tt,(existT _ _s2546_ _)) => + match (string_drop _s2545_ _s2546_) with + | _s2547_ => + match (hex_bits_21_matches_prefix _s2547_) with + | Some (imm,(existT _ _s2548_ _)) => + match (string_drop _s2547_ _s2548_) with + | s_ => Some ((rd, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((mword 5 * mword 21 * string))) + end) + : M (option ((mword 5 * mword 21 * string))) + | _ => returnm (None : option ((mword 5 * mword 21 * string))) + end) + : M (option ((mword 5 * mword 21 * string))) + end) + : M (option ((mword 5 * mword 21 * string))) + | _ => returnm (None : option ((mword 5 * mword 21 * string))) + end) + : M (option ((mword 5 * mword 21 * string))) + end) + : M (option ((mword 5 * mword 21 * string))) + else returnm (None : option ((mword 5 * mword 21 * string)))) + : M (option ((mword 5 * mword 21 * string))). + +Definition _s2525_ (_s2526_ : string) +: M (option ((uop * mword 5 * mword 20 * string))) := + + (match _s2526_ with + | _s2527_ => + (utype_mnemonic_matches_prefix _s2527_) >>= fun w__0 : option ((uop * {n : Z & ArithFact (n >= + 0)})) => + (match w__0 with + | Some (op,(existT _ _s2528_ _)) => + (match (string_drop _s2527_ _s2528_) with + | _s2529_ => + (spc_matches_prefix _s2529_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + (match w__1 with + | Some (tt,(existT _ _s2530_ _)) => + (match (string_drop _s2529_ _s2530_) with + | _s2531_ => + (reg_name_matches_prefix _s2531_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >= + 0)})) => + (match w__2 with + | Some (rd,(existT _ _s2532_ _)) => + (match (string_drop _s2531_ _s2532_) with + | _s2533_ => + (sep_matches_prefix _s2533_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >= + 0)})) => + returnm ((match w__3 with + | Some (tt,(existT _ _s2534_ _)) => + match (string_drop _s2533_ _s2534_) with + | _s2535_ => + match (hex_bits_20_matches_prefix _s2535_) with + | Some (imm,(existT _ _s2536_ _)) => + match (string_drop _s2535_ _s2536_) with + | s_ => Some ((op, rd, imm, s_)) + end + | _ => None + end + end + | _ => None + end) + : option ((uop * mword 5 * mword 20 * string))) + end) + : M (option ((uop * mword 5 * mword 20 * string))) + | _ => returnm (None : option ((uop * mword 5 * mword 20 * string))) + end) + : M (option ((uop * mword 5 * mword 20 * string))) + end) + : M (option ((uop * mword 5 * mword 20 * string))) + | _ => returnm (None : option ((uop * mword 5 * mword 20 * string))) + end) + : M (option ((uop * mword 5 * mword 20 * string))) + end) + : M (option ((uop * mword 5 * mword 20 * string))) + | _ => returnm (None : option ((uop * mword 5 * mword 20 * string))) + end) + : M (option ((uop * mword 5 * mword 20 * string))) + end) + : M (option ((uop * mword 5 * mword 20 * string))). + +Definition assembly_matches_prefix (arg_ : string) +: M (option ((ast * {n : Z & ArithFact (n >= 0)}))) := + + let _s2537_ := arg_ in + (_s2525_ _s2537_) >>= fun w__0 : option ((uop * mword 5 * mword 20 * string)) => + (if ((match w__0 with | Some (op,rd,imm,s_) => true | _ => false end)) then + (_s2525_ _s2537_) >>= fun w__1 : option ((uop * mword 5 * mword 20 * string)) => + (match w__1 with + | Some (op,rd,imm,s_) => + returnm ((Some + ((UTYPE + ((imm, rd, op)), build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2538_ _s2537_) >>= fun w__4 : option ((mword 5 * mword 21 * string)) => + (if ((match w__4 with | Some (rd,imm,s_) => true | _ => false end)) then + (_s2538_ _s2537_) >>= fun w__5 : option ((mword 5 * mword 21 * string)) => + (match w__5 with + | Some (rd,imm,s_) => + returnm ((Some + ((RISCV_JAL + ((imm, rd)), build_ex (projT1 (sub_nat (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2550_ _s2537_) >>= fun w__8 : option ((mword 5 * mword 5 * mword 12 * string)) => + (if ((match w__8 with | Some (rd,rs1,imm,s_) => true | _ => false end)) then + (_s2550_ _s2537_) >>= fun w__9 : option ((mword 5 * mword 5 * mword 12 * string)) => + (match w__9 with + | Some (rd,rs1,imm,s_) => + returnm ((Some + ((RISCV_JALR + ((imm, rs1, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length arg_)) + (projT1 (string_length s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2566_ _s2537_) >>= fun w__12 : option ((bop * mword 5 * mword 5 * mword 13 * string)) => + (if ((match w__12 with | Some (op,rs1,rs2,imm,s_) => true | _ => false end)) then + (_s2566_ _s2537_) >>= fun w__13 : option ((bop * mword 5 * mword 5 * mword 13 * string)) => + (match w__13 with + | Some (op,rs1,rs2,imm,s_) => + returnm ((Some + ((BTYPE + ((imm, rs2, rs1, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2583_ _s2537_) >>= fun w__16 : option ((iop * mword 5 * mword 5 * mword 12 * string)) => + (if ((match w__16 with | Some (op,rd,rs1,imm,s_) => true | _ => false end)) then + (_s2583_ _s2537_) >>= fun w__17 : option ((iop * mword 5 * mword 5 * mword 12 * string)) => + (match w__17 with + | Some (op,rd,rs1,imm,s_) => + returnm ((Some + ((ITYPE + ((imm, rs1, rd, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2600_ _s2537_) >>= fun w__20 : option ((sop * mword 5 * mword 5 * mword 6 * string)) => + (if ((match w__20 with | Some (op,rd,rs1,shamt,s_) => true | _ => false end)) then + (_s2600_ _s2537_) >>= fun w__21 : option ((sop * mword 5 * mword 5 * mword 6 * string)) => + (match w__21 with + | Some (op,rd,rs1,shamt,s_) => + returnm ((Some + ((SHIFTIOP + ((shamt, rs1, rd, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2615_ _s2537_) >>= fun w__24 : option ((rop * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__24 with | Some (op,rd,rs1,rs2,s_) => true | _ => false end)) + then + (_s2615_ _s2537_) >>= fun w__25 : option ((rop * mword 5 * mword 5 * mword 5 * string)) => + (match w__25 with + | Some (op,rd,rs1,rs2,s_) => + returnm ((Some + ((RTYPE + ((rs2, rs1, rd, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2632_ _s2537_) >>= fun w__28 : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string)) => + (if ((match w__28 with + | Some (size,is_unsigned,aq,rl,rd,rs1,imm,s_) => true + | _ => false + end)) then + (_s2632_ _s2537_) >>= fun w__29 : option ((word_width * bool * bool * bool * mword 5 * mword 5 * mword 12 * string)) => + (match w__29 with + | Some (size,is_unsigned,aq,rl,rd,rs1,imm,s_) => + returnm ((Some + ((LOAD + ((imm, rs1, rd, is_unsigned, size, aq, rl)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2656_ _s2537_) >>= fun w__32 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string)) => + (if ((match w__32 with + | Some (size,aq,rl,rd,rs1,imm,s_) => true + | _ => false + end)) then + (_s2656_ _s2537_) >>= fun w__33 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 12 * string)) => + (match w__33 with + | Some (size,aq,rl,rd,rs1,imm,s_) => + returnm ((Some + ((STORE + ((imm, rs1, rd, size, aq, rl)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2678_ _s2537_) >>= fun w__36 : option ((mword 5 * mword 5 * mword 12 * string)) => + (if ((match w__36 with | Some (rd,rs1,imm,s_) => true | _ => false end)) + then + (_s2678_ _s2537_) >>= fun w__37 : option ((mword 5 * mword 5 * mword 12 * string)) => + (match w__37 with + | Some (rd,rs1,imm,s_) => + returnm ((Some + ((ADDIW + ((imm, rs1, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => + exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2694_ _s2537_) >>= fun w__40 : option ((sop * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__40 with + | Some (op,rd,rs1,shamt,s_) => true + | _ => false + end)) then + (_s2694_ _s2537_) >>= fun w__41 : option ((sop * mword 5 * mword 5 * mword 5 * string)) => + (match w__41 with + | Some (op,rd,rs1,shamt,s_) => + returnm ((Some + ((SHIFTW + ((shamt, rs1, rd, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => + exit tt : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2711_ _s2537_) >>= fun w__44 : option ((ropw * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__44 with + | Some (op,rd,rs1,rs2,s_) => true + | _ => false + end)) then + (_s2711_ _s2537_) >>= fun w__45 : option ((ropw * mword 5 * mword 5 * mword 5 * string)) => + (match w__45 with + | Some (op,rd,rs1,rs2,s_) => + returnm ((Some + ((RTYPEW + ((rs2, rs1, rd, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2728_ _s2537_) >>= fun w__48 : option ((sopw * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__48 with + | Some (op,rd,rs1,shamt,s_) => true + | _ => false + end)) then + (_s2728_ _s2537_) >>= fun w__49 : option ((sopw * mword 5 * mword 5 * mword 5 * string)) => + (match w__49 with + | Some (op,rd,rs1,shamt,s_) => + returnm ((Some + ((SHIFTIWOP + ((shamt, rs1, rd, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2743_ _s2537_) >>= fun w__52 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__52 with + | Some (high,signed1,signed2,rd,rs1,rs2,s_) => true + | _ => false + end)) then + (_s2743_ _s2537_) >>= fun w__53 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)) => + (match w__53 with + | Some (high,signed1,signed2,rd,rs1,rs2,s_) => + returnm ((Some + ((MUL + ((rs2, rs1, rd, high, signed1, signed2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2760_ _s2537_) >>= fun w__56 : option ((bool * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__56 with + | Some (s,rd,rs1,rs2,s_) => true + | _ => false + end)) then + (_s2760_ _s2537_) >>= fun w__57 : option ((bool * mword 5 * mword 5 * mword 5 * string)) => + (match w__57 with + | Some (s,rd,rs1,rs2,s_) => + returnm ((Some + ((DIV + ((rs2, rs1, rd, s)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2778_ _s2537_) >>= fun w__60 : option ((bool * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__60 with + | Some (s,rd,rs1,rs2,s_) => true + | _ => false + end)) then + (_s2778_ _s2537_) >>= fun w__61 : option ((bool * mword 5 * mword 5 * mword 5 * string)) => + (match w__61 with + | Some (s,rd,rs1,rs2,s_) => + returnm ((Some + ((REM + ((rs2, rs1, rd, s)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))) + else + (_s2796_ _s2537_) >>= fun w__64 : option ((mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__64 with + | Some (rd,rs1,rs2,s_) => true + | _ => false + end)) then + (_s2796_ _s2537_) >>= fun w__65 : option ((mword 5 * mword 5 * mword 5 * string)) => + (match w__65 with + | Some (rd,rs1,rs2,s_) => + returnm ((Some + ((MULW + ((rs2, rs1, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2812_ _s2537_) >>= fun w__68 : option ((bool * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__68 with + | Some (s,rd,rs1,rs2,s_) => true + | _ => false + end)) then + (_s2812_ _s2537_) >>= fun w__69 : option ((bool * mword 5 * mword 5 * mword 5 * string)) => + (match w__69 with + | Some (s,rd,rs1,rs2,s_) => + returnm ((Some + ((DIVW + ((rs2, rs1, rd, s)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2831_ _s2537_) >>= fun w__72 : option ((bool * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__72 with + | Some (s,rd,rs1,rs2,s_) => true + | _ => false + end)) then + (_s2831_ _s2537_) >>= fun w__73 : option ((bool * mword 5 * mword 5 * mword 5 * string)) => + (match w__73 with + | Some (s,rd,rs1,rs2,s_) => + returnm ((Some + ((REMW + ((rs2, rs1, rd, s)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2850_ _s2537_) >>= fun w__76 : option ((mword 4 * mword 4 * string)) => + (if ((match w__76 with + | Some (pred,succ,s_) => true + | _ => false + end)) then + (_s2850_ _s2537_) >>= fun w__77 : option ((mword 4 * mword 4 * string)) => + (match w__77 with + | Some (pred,succ,s_) => + returnm ((Some + ((FENCE + ((pred, succ)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2862_ _s2537_) >>= fun w__80 : option ((mword 4 * mword 4 * string)) => + (if ((match w__80 with + | Some (pred,succ,s_) => true + | _ => false + end)) then + (_s2862_ _s2537_) >>= fun w__81 : option ((mword 4 * mword 4 * string)) => + (match w__81 with + | Some (pred,succ,s_) => + returnm ((Some + ((FENCE_TSO + ((pred, succ)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if ((match (_s2874_ _s2537_) with + | Some (s_) => true + | _ => false + end)) then + (match (_s2874_ _s2537_) with + | Some (s_) => + returnm ((Some + ((FENCEI + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if ((match (_s2878_ _s2537_) with + | Some (s_) => true + | _ => false + end)) then + (match (_s2878_ _s2537_) with + | Some (s_) => + returnm ((Some + ((ECALL + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if ((match (_s2882_ _s2537_) with + | Some (s_) => true + | _ => false + end)) then + (match (_s2882_ _s2537_) with + | Some (s_) => + returnm ((Some + ((MRET + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if ((match (_s2886_ _s2537_) with + | Some (s_) => true + | _ => false + end)) then + (match (_s2886_ _s2537_) with + | Some (s_) => + returnm ((Some + ((SRET + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if ((match (_s2890_ _s2537_) with + | Some (s_) => true + | _ => false + end)) then + (match (_s2890_ _s2537_) with + | Some (s_) => + returnm ((Some + ((EBREAK + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if ((match (_s2894_ _s2537_) with + | Some (s_) => true + | _ => false + end)) then + (match (_s2894_ _s2537_) with + | Some (s_) => + returnm ((Some + ((WFI + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2898_ _s2537_) >>= fun w__96 : option ((mword 5 * mword 5 * string)) => + (if ((match w__96 with + | Some (rs1,rs2,s_) => true + | _ => false + end)) then + (_s2898_ _s2537_) >>= fun w__97 : option ((mword 5 * mword 5 * string)) => + (match w__97 with + | Some (rs1,rs2,s_) => + returnm ((Some + ((SFENCE_VMA + ((rs1, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2910_ _s2537_) >>= fun w__100 : option ((word_width * bool * bool * mword 5 * mword 5 * string)) => + (if ((match w__100 with + | Some + (size,aq,rl,rd,rs1,s_) => + true + | _ => false + end)) then + (_s2910_ _s2537_) >>= fun w__101 : option ((word_width * bool * bool * mword 5 * mword 5 * string)) => + (match w__101 with + | Some + (size,aq,rl,rd,rs1,s_) => + returnm ((Some + ((LOADRES + ((aq, rl, rs1, size, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2928_ _s2537_) >>= fun w__104 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__104 with + | Some + (size,aq,rl,rd,rs1,rs2,s_) => + true + | _ => false + end)) then + (_s2928_ _s2537_) >>= fun w__105 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)) => + (match w__105 with + | Some + (size,aq,rl,rd,rs1,rs2,s_) => + returnm ((Some + ((STORECON + ((aq, rl, rs2, rs1, size, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2950_ _s2537_) >>= fun w__108 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)) => + (if ((match w__108 with + | Some + (op,width,aq,rl,rd,rs1,rs2,s_) => + true + | _ => false + end)) then + (_s2950_ _s2537_) >>= fun w__109 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)) => + (match w__109 with + | Some + (op,width,aq,rl,rd,rs1,rs2,s_) => + returnm ((Some + ((AMO + ((op, aq, rl, rs2, rs1, width, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2974_ _s2537_) >>= fun w__112 : option ((csrop * mword 5 * mword 5 * mword 12 * string)) => + (if ((match w__112 with + | Some + (op,rd,rs1,csr,s_) => + true + | _ => false + end)) then + (_s2974_ _s2537_) >>= fun w__113 : option ((csrop * mword 5 * mword 5 * mword 12 * string)) => + (match w__113 with + | Some + (op,rd,rs1,csr,s_) => + returnm ((Some + ((CSR + ((csr, rs1, rd, true, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s2992_ _s2537_) >>= fun w__116 : option ((csrop * mword 5 * mword 5 * mword 12 * string)) => + (if ((match w__116 with + | Some + (op,rd,rs1,csr,s_) => + true + | _ => false + end)) then + (_s2992_ _s2537_) >>= fun w__117 : option ((csrop * mword 5 * mword 5 * mword 12 * string)) => + (match w__117 with + | Some + (op,rd,rs1,csr,s_) => + returnm ((Some + ((CSR + ((csr, rs1, rd, false, op)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if ((match (_s3009_ + _s2537_) with + | Some + (s_) => + true + | _ => + false + end)) + then + (match (_s3009_ + _s2537_) with + | Some (s_) => + returnm ((Some + ((C_NOP + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3013_ _s2537_) >>= fun w__122 : option ((mword 3 * mword 8 * string)) => + (if ((match w__122 with + | Some + (rdc,nzimm,s_) => + neq_vec + nzimm + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0] + : mword 8) + | _ => + false + end)) then + (_s3013_ + _s2537_) >>= fun w__123 : option ((mword 3 * mword 8 * string)) => + (match w__123 with + | Some + (rdc,nzimm,s_) => + returnm ((Some + ((C_ADDI4SPN + ((rdc, nzimm)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3025_ + _s2537_) >>= fun w__126 : option ((mword 3 * mword 3 * mword 5 * string)) => + (if ((match w__126 with + | Some + (rdc,rsc,uimm,s_) => + true + | _ => + false + end)) + then + (_s3025_ + _s2537_) >>= fun w__127 : option ((mword 3 * mword 3 * mword 5 * string)) => + (match w__127 with + | Some + (rdc,rsc,uimm,s_) => + returnm ((Some + ((C_LW + ((uimm, rsc, rdc)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3041_ + _s2537_) >>= fun w__130 : option ((mword 3 * mword 3 * mword 5 * string)) => + (if ((match w__130 with + | Some + (rdc,rsc,uimm,s_) => + true + | _ => + false + end)) + then + (_s3041_ + _s2537_) >>= fun w__131 : option ((mword 3 * mword 3 * mword 5 * string)) => + (match w__131 with + | Some + (rdc,rsc,uimm,s_) => + returnm ((Some + ((C_LD + ((uimm, rsc, rdc)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3057_ + _s2537_) >>= fun w__134 : option ((mword 3 * mword 3 * mword 5 * string)) => + (if ((match w__134 with + | Some + (rsc1,rsc2,uimm,s_) => + true + | _ => + false + end)) + then + (_s3057_ + _s2537_) >>= fun w__135 : option ((mword 3 * mword 3 * mword 5 * string)) => + (match w__135 with + | Some + (rsc1,rsc2,uimm,s_) => + returnm ((Some + ((C_SW + ((uimm, rsc1, rsc2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3073_ + _s2537_) >>= fun w__138 : option ((mword 3 * mword 3 * mword 5 * string)) => + (if ((match w__138 with + | Some + (rsc1,rsc2,uimm,s_) => + true + | _ => + false + end)) + then + (_s3073_ + _s2537_) >>= fun w__139 : option ((mword 3 * mword 3 * mword 5 * string)) => + (match w__139 with + | Some + (rsc1,rsc2,uimm,s_) => + returnm ((Some + ((C_SD + ((uimm, rsc1, rsc2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3089_ + _s2537_) >>= fun w__142 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__142 with + | Some + (rsd,nzi,s_) => + andb + (neq_vec + nzi + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6)) + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s3089_ + _s2537_) >>= fun w__143 : option ((mword 5 * mword 6 * string)) => + (match w__143 with + | Some + (rsd,nzi,s_) => + returnm ((Some + ((C_ADDI + ((nzi, rsd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3101_ + _s2537_) >>= fun w__146 : option ((mword 11 * string)) => + (if + ((match w__146 with + | Some + (imm,s_) => + true + | _ => + false + end)) + then + (_s3101_ + _s2537_) >>= fun w__147 : option ((mword 11 * string)) => + (match w__147 with + | Some + (imm,s_) => + returnm ((Some + ((C_JAL + (imm), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3109_ + _s2537_) >>= fun w__150 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__150 with + | Some + (rsd,imm,s_) => + true + | _ => + false + end)) + then + (_s3109_ + _s2537_) >>= fun w__151 : option ((mword 5 * mword 6 * string)) => + (match w__151 with + | Some + (rsd,imm,s_) => + returnm ((Some + ((C_ADDIW + ((imm, rsd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3121_ + _s2537_) >>= fun w__154 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__154 with + | Some + (rd,imm,s_) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s3121_ + _s2537_) >>= fun w__155 : option ((mword 5 * mword 6 * string)) => + (match w__155 with + | Some + (rd,imm,s_) => + returnm ((Some + ((C_LI + ((imm, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3133_ + _s2537_) >>= fun w__158 : option ((mword 6 * string)) => + (if + ((match w__158 with + | Some + (imm,s_) => + neq_vec + imm + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s3133_ + _s2537_) >>= fun w__159 : option ((mword 6 * string)) => + (match w__159 with + | Some + (imm,s_) => + returnm ((Some + ((C_ADDI16SP + (imm), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3141_ + _s2537_) >>= fun w__162 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__162 with + | Some + (rd,imm,s_) => + andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg))) + (andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + sp))) + (neq_vec + imm + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6))) + | _ => + false + end)) + then + (_s3141_ + _s2537_) >>= fun w__163 : option ((mword 5 * mword 6 * string)) => + (match w__163 with + | Some + (rd,imm,s_) => + returnm ((Some + ((C_LUI + ((imm, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3153_ + _s2537_) >>= fun w__166 : option ((mword 3 * mword 6 * string)) => + (if + ((match w__166 with + | Some + (rsd,shamt,s_) => + neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s3153_ + _s2537_) >>= fun w__167 : option ((mword 3 * mword 6 * string)) => + (match w__167 with + | Some + (rsd,shamt,s_) => + returnm ((Some + ((C_SRLI + ((shamt, rsd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3165_ + _s2537_) >>= fun w__170 : option ((mword 3 * mword 6 * string)) => + (if + ((match w__170 with + | Some + (rsd,shamt,s_) => + neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6) + | _ => + false + end)) + then + (_s3165_ + _s2537_) >>= fun w__171 : option ((mword 3 * mword 6 * string)) => + (match w__171 with + | Some + (rsd,shamt,s_) => + returnm ((Some + ((C_SRAI + ((shamt, rsd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3177_ + _s2537_) >>= fun w__174 : option ((mword 3 * mword 6 * string)) => + (if + ((match w__174 with + | Some + (rsd,imm,s_) => + true + | _ => + false + end)) + then + (_s3177_ + _s2537_) >>= fun w__175 : option ((mword 3 * mword 6 * string)) => + (match w__175 with + | Some + (rsd,imm,s_) => + returnm ((Some + ((C_ANDI + ((imm, rsd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3189_ + _s2537_) >>= fun w__178 : option ((mword 3 * mword 3 * string)) => + (if + ((match w__178 with + | Some + (rsd,rs2,s_) => + true + | _ => + false + end)) + then + (_s3189_ + _s2537_) >>= fun w__179 : option ((mword 3 * mword 3 * string)) => + (match w__179 with + | Some + (rsd,rs2,s_) => + returnm ((Some + ((C_SUB + ((rsd, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3201_ + _s2537_) >>= fun w__182 : option ((mword 3 * mword 3 * string)) => + (if + ((match w__182 with + | Some + (rsd,rs2,s_) => + true + | _ => + false + end)) + then + (_s3201_ + _s2537_) >>= fun w__183 : option ((mword 3 * mword 3 * string)) => + (match w__183 with + | Some + (rsd,rs2,s_) => + returnm ((Some + ((C_XOR + ((rsd, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3213_ + _s2537_) >>= fun w__186 : option ((mword 3 * mword 3 * string)) => + (if + ((match w__186 with + | Some + (rsd,rs2,s_) => + true + | _ => + false + end)) + then + (_s3213_ + _s2537_) >>= fun w__187 : option ((mword 3 * mword 3 * string)) => + (match w__187 with + | Some + (rsd,rs2,s_) => + returnm ((Some + ((C_OR + ((rsd, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3225_ + _s2537_) >>= fun w__190 : option ((mword 3 * mword 3 * string)) => + (if + ((match w__190 with + | Some + (rsd,rs2,s_) => + true + | _ => + false + end)) + then + (_s3225_ + _s2537_) >>= fun w__191 : option ((mword 3 * mword 3 * string)) => + (match w__191 with + | Some + (rsd,rs2,s_) => + returnm ((Some + ((C_AND + ((rsd, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3237_ + _s2537_) >>= fun w__194 : option ((mword 3 * mword 3 * string)) => + (if + ((match w__194 with + | Some + (rsd,rs2,s_) => + true + | _ => + false + end)) + then + (_s3237_ + _s2537_) >>= fun w__195 : option ((mword 3 * mword 3 * string)) => + (match w__195 with + | Some + (rsd,rs2,s_) => + returnm ((Some + ((C_SUBW + ((rsd, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3249_ + _s2537_) >>= fun w__198 : option ((mword 3 * mword 3 * string)) => + (if + ((match w__198 with + | Some + (rsd,rs2,s_) => + true + | _ => + false + end)) + then + (_s3249_ + _s2537_) >>= fun w__199 : option ((mword 3 * mword 3 * string)) => + (match w__199 with + | Some + (rsd,rs2,s_) => + returnm ((Some + ((C_ADDW + ((rsd, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3261_ + _s2537_) >>= fun w__202 : option ((mword 11 * string)) => + (if + ((match w__202 with + | Some + (imm,s_) => + true + | _ => + false + end)) + then + (_s3261_ + _s2537_) >>= fun w__203 : option ((mword 11 * string)) => + (match w__203 with + | Some + (imm,s_) => + returnm ((Some + ((C_J + (imm), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3269_ + _s2537_) >>= fun w__206 : option ((mword 3 * mword 8 * string)) => + (if + ((match w__206 with + | Some + (rs,imm,s_) => + true + | _ => + false + end)) + then + (_s3269_ + _s2537_) >>= fun w__207 : option ((mword 3 * mword 8 * string)) => + (match w__207 with + | Some + (rs,imm,s_) => + returnm ((Some + ((C_BEQZ + ((imm, rs)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3281_ + _s2537_) >>= fun w__210 : option ((mword 3 * mword 8 * string)) => + (if + ((match w__210 with + | Some + (rs,imm,s_) => + true + | _ => + false + end)) + then + (_s3281_ + _s2537_) >>= fun w__211 : option ((mword 3 * mword 8 * string)) => + (match w__211 with + | Some + (rs,imm,s_) => + returnm ((Some + ((C_BNEZ + ((imm, rs)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3293_ + _s2537_) >>= fun w__214 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__214 with + | Some + (rsd,shamt,s_) => + andb + (neq_vec + shamt + (vec_of_bits [B0;B0;B0;B0;B0;B0] + : mword 6)) + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s3293_ + _s2537_) >>= fun w__215 : option ((mword 5 * mword 6 * string)) => + (match w__215 with + | Some + (rsd,shamt,s_) => + returnm ((Some + ((C_SLLI + ((shamt, rsd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3305_ + _s2537_) >>= fun w__218 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__218 with + | Some + (rd,uimm,s_) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s3305_ + _s2537_) >>= fun w__219 : option ((mword 5 * mword 6 * string)) => + (match w__219 with + | Some + (rd,uimm,s_) => + returnm ((Some + ((C_LWSP + ((uimm, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3317_ + _s2537_) >>= fun w__222 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__222 with + | Some + (rd,uimm,s_) => + neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s3317_ + _s2537_) >>= fun w__223 : option ((mword 5 * mword 6 * string)) => + (match w__223 with + | Some + (rd,uimm,s_) => + returnm ((Some + ((C_LDSP + ((uimm, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3329_ + _s2537_) >>= fun w__226 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__226 with + | Some + (rd,uimm,s_) => + true + | _ => + false + end)) + then + (_s3329_ + _s2537_) >>= fun w__227 : option ((mword 5 * mword 6 * string)) => + (match w__227 with + | Some + (rd,uimm,s_) => + returnm ((Some + ((C_SWSP + ((uimm, rd)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3341_ + _s2537_) >>= fun w__230 : option ((mword 5 * mword 6 * string)) => + (if + ((match w__230 with + | Some + (rs2,uimm,s_) => + true + | _ => + false + end)) + then + (_s3341_ + _s2537_) >>= fun w__231 : option ((mword 5 * mword 6 * string)) => + (match w__231 with + | Some + (rs2,uimm,s_) => + returnm ((Some + ((C_SDSP + ((uimm, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3353_ + _s2537_) >>= fun w__234 : option ((mword 5 * string)) => + (if + ((match w__234 with + | Some + (rs1,s_) => + neq_int + (projT1 (regbits_to_regno + rs1)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s3353_ + _s2537_) >>= fun w__235 : option ((mword 5 * string)) => + (match w__235 with + | Some + (rs1,s_) => + returnm ((Some + ((C_JR + (rs1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3361_ + _s2537_) >>= fun w__238 : option ((mword 5 * string)) => + (if + ((match w__238 with + | Some + (rs1,s_) => + neq_int + (projT1 (regbits_to_regno + rs1)) + (projT1 (regbits_to_regno + zreg)) + | _ => + false + end)) + then + (_s3361_ + _s2537_) >>= fun w__239 : option ((mword 5 * string)) => + (match w__239 with + | Some + (rs1,s_) => + returnm ((Some + ((C_JALR + (rs1), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3369_ + _s2537_) >>= fun w__242 : option ((mword 5 * mword 5 * string)) => + (if + ((match w__242 with + | Some + (rd,rs2,s_) => + andb + (neq_int + (projT1 (regbits_to_regno + rd)) + (projT1 (regbits_to_regno + zreg))) + (neq_int + (projT1 (regbits_to_regno + rs2)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s3369_ + _s2537_) >>= fun w__243 : option ((mword 5 * mword 5 * string)) => + (match w__243 with + | Some + (rd,rs2,s_) => + returnm ((Some + ((C_MV + ((rd, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if + ((match (_s3381_ + _s2537_) with + | Some + (s_) => + true + | _ => + false + end)) + then + (match (_s3381_ + _s2537_) with + | Some + (s_) => + returnm ((Some + ((C_EBREAK + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3385_ + _s2537_) >>= fun w__248 : option ((mword 5 * mword 5 * string)) => + (if + ((match w__248 with + | Some + (rsd,rs2,s_) => + andb + (neq_int + (projT1 (regbits_to_regno + rsd)) + (projT1 (regbits_to_regno + zreg))) + (neq_int + (projT1 (regbits_to_regno + rs2)) + (projT1 (regbits_to_regno + zreg))) + | _ => + false + end)) + then + (_s3385_ + _s2537_) >>= fun w__249 : option ((mword 5 * mword 5 * string)) => + (match w__249 with + | Some + (rsd,rs2,s_) => + returnm ((Some + ((C_ADD + ((rsd, rs2)), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if + ((match (_s3397_ + _s2537_) with + | Some + (s_) => + true + | _ => + false + end)) + then + (match (_s3397_ + _s2537_) with + | Some + (s_) => + returnm ((Some + ((STOP_FETCHING + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else if + ((match (_s3401_ + _s2537_) with + | Some + (s_) => + true + | _ => + false + end)) + then + (match (_s3401_ + _s2537_) with + | Some + (s_) => + returnm ((Some + ((THREAD_START + (tt), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3405_ + _s2537_) >>= fun w__256 : option ((mword 32 * string)) => + (if + ((match w__256 with + | Some + (s,s_) => + true + | _ => + false + end)) + then + (_s3405_ + _s2537_) >>= fun w__257 : option ((mword 32 * string)) => + (match w__257 with + | Some + (s,s_) => + returnm ((Some + ((ILLEGAL + (s), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + (_s3413_ + _s2537_) >>= fun w__260 : option ((mword 16 * string)) => + (if + ((match w__260 with + | Some + (s,s_) => + true + | _ => + false + end)) + then + (_s3413_ + _s2537_) >>= fun w__261 : option ((mword 16 * string)) => + (match w__261 with + | Some + (s,s_) => + returnm ((Some + ((C_ILLEGAL + (s), build_ex (projT1 (sub_nat + (projT1 (string_length + arg_)) + (projT1 (string_length + s_))))))) + : option ((ast * {n : Z & ArithFact (n >= + 0)}))) + | _ => + exit tt + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + end) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)}))) + else + returnm (None + : option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= + 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)})))) + : M (option ((ast * {n : Z & ArithFact (n >= 0)}))). + +Definition execute_WFI '(tt : unit) +: M (bool) := + + read_reg cur_privilege_ref >>= fun w__0 : Privilege => + (match w__0 with + | Machine => (platform_wfi tt) >> returnm (true : bool) + | Supervisor => + read_reg mstatus_ref >>= fun w__1 : Mstatus => + (if ((eq_vec (_get_Mstatus_TW w__1) ((bool_to_bits true) : mword 1))) then + (handle_illegal tt) >> returnm (false : bool) + else (platform_wfi tt) >> returnm (true : bool)) + : M (bool) + | User => (handle_illegal tt) >> returnm (false : bool) + end) + : M (bool). + +Definition execute_UTYPE (imm : mword 20) (rd : mword 5) (op : uop) +: M (bool) := + + let off : xlenbits := + EXTS 64 (concat_vec imm (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] : mword 12)) in + (match op with + | RISCV_LUI => returnm (off : xlenbits) + | RISCV_AUIPC => + ((read_reg PC_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + returnm ((add_vec w__0 off) + : mword 64) + end) >>= fun ret : xlenbits => + (wX (projT1 (regbits_to_regno rd)) ret) >> returnm (true : bool). + +Definition execute_THREAD_START '(tt : unit) : bool := true. + +Definition execute_STORECON +(aq : bool) (rl : bool) (rs2 : mword 5) (rs1 : mword 5) (width : word_width) (rd : mword 5) +: M (bool) := + + (speculate_conditional tt) >>= fun w__0 : bool => + (if ((Bool.eqb w__0 false)) then + (wX (projT1 (regbits_to_regno rd)) (EXTZ 64 (vec_of_bits [B1] : mword 1))) >> + returnm (true + : bool) + else + (rX (projT1 (regbits_to_regno rs1))) >>= fun vaddr : xlenbits => + (match width with + | BYTE => returnm (true : bool) + | HALF => + (cast_unit_vec (access_vec_dec vaddr 0)) >>= fun w__1 : mword 1 => + returnm ((eq_vec w__1 (vec_of_bits [B0] : mword 1)) + : bool) + | WORD => + returnm ((eq_vec (subrange_vec_dec vaddr 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))) + : bool) + | DOUBLE => + returnm ((eq_vec (subrange_vec_dec vaddr 2 0) + (vec_of_bits [B0;B0;B0] : mword (2 - 0 + 1))) + : bool) + end) >>= fun aligned : bool => + (if ((negb aligned)) then + (handle_mem_exception vaddr E_SAMO_Addr_Align) >> returnm (false : bool) + else if ((Bool.eqb (match_reservation vaddr) false)) then + (wX (projT1 (regbits_to_regno rd)) (EXTZ 64 (vec_of_bits [B1] : mword 1))) >> + returnm (true + : bool) + else + (translateAddr vaddr Write Data) >>= fun w__2 : TR_Result => + (match w__2 with + | TR_Failure (e) => (handle_mem_exception vaddr e) >> returnm (false : bool) + | TR_Address (addr) => + (match width with + | WORD => (mem_write_ea addr 4 aq rl true) : M (MemoryOpResult unit) + | DOUBLE => (mem_write_ea addr 8 aq rl true) : M (MemoryOpResult unit) + | _ => (internal_error "STORECON expected word or double") : M (MemoryOpResult unit) + end) >>= fun eares : MemoryOpResult unit => + (match eares with + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + | MemValue (_) => + (rX (projT1 (regbits_to_regno rs2))) >>= fun rs2_val => + (match width with + | WORD => + (mem_write_value addr 4 (subrange_vec_dec rs2_val 31 0) aq rl true) + : M (MemoryOpResult bool) + | DOUBLE => (mem_write_value addr 8 rs2_val aq rl true) : M (MemoryOpResult bool) + | _ => + (internal_error "STORECON expected word or double") : M (MemoryOpResult bool) + end) >>= fun res : MemoryOpResult bool => + (match res with + | MemValue (true) => + (wX (projT1 (regbits_to_regno rd)) (EXTZ 64 (vec_of_bits [B0] : mword 1))) >> + let '_ := (cancel_reservation tt) : unit in + returnm (true + : bool) + | MemValue (false) => + (wX (projT1 (regbits_to_regno rd)) (EXTZ 64 (vec_of_bits [B1] : mword 1))) >> + let '_ := (cancel_reservation tt) : unit in + returnm (true + : bool) + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + end) + : M (bool) + end) + : M (bool) + end) + : M (bool)) + : M (bool)) + : M (bool). + +Definition execute_STORE +(imm : mword 12) (rs2 : mword 5) (rs1 : mword 5) (width : word_width) (aq : bool) (rl : bool) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let vaddr : xlenbits := add_vec w__0 (EXTS 64 imm) in + (check_misaligned vaddr width) >>= fun w__1 : bool => + (if (w__1) then (handle_mem_exception vaddr E_SAMO_Addr_Align) >> returnm (false : bool) + else + (translateAddr vaddr Write Data) >>= fun w__2 : TR_Result => + (match w__2 with + | TR_Failure (e) => (handle_mem_exception vaddr e) >> returnm (false : bool) + | TR_Address (addr) => + (match width with + | BYTE => (mem_write_ea addr 1 aq rl false) : M (MemoryOpResult unit) + | HALF => (mem_write_ea addr 2 aq rl false) : M (MemoryOpResult unit) + | WORD => (mem_write_ea addr 4 aq rl false) : M (MemoryOpResult unit) + | DOUBLE => (mem_write_ea addr 8 aq rl false) : M (MemoryOpResult unit) + end) >>= fun eares : MemoryOpResult unit => + (match eares with + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + | MemValue (_) => + (rX (projT1 (regbits_to_regno rs2))) >>= fun rs2_val => + (match width with + | BYTE => + (mem_write_value addr 1 (subrange_vec_dec rs2_val 7 0) aq rl false) + : M (MemoryOpResult bool) + | HALF => + (mem_write_value addr 2 (subrange_vec_dec rs2_val 15 0) aq rl false) + : M (MemoryOpResult bool) + | WORD => + (mem_write_value addr 4 (subrange_vec_dec rs2_val 31 0) aq rl false) + : M (MemoryOpResult bool) + | DOUBLE => (mem_write_value addr 8 rs2_val aq rl false) : M (MemoryOpResult bool) + end) >>= fun res : MemoryOpResult bool => + (match res with + | MemValue (true) => returnm (true : bool) + | MemValue (false) => + (internal_error "store got false from mem_write_value") : M (bool) + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + end) + : M (bool) + end) + : M (bool) + end) + : M (bool)) + : M (bool). + +Definition execute_STOP_FETCHING '(tt : unit) : bool := true. + +Definition execute_SRET '(tt : unit) +: M (bool) := + + read_reg cur_privilege_ref >>= fun w__0 : Privilege => + (match w__0 with + | User => (handle_illegal tt) : M (unit) + | Supervisor => + read_reg mstatus_ref >>= fun w__1 : Mstatus => + (if ((eq_vec (_get_Mstatus_TSR w__1) ((bool_to_bits true) : mword 1))) then + (handle_illegal tt) + : M (unit) + else + read_reg cur_privilege_ref >>= fun w__2 : Privilege => + ((read_reg PC_ref) : M (mword 64)) >>= fun w__3 : xlenbits => + (handle_exception w__2 (CTL_SRET (tt)) w__3) >>= fun w__4 : mword 64 => + write_reg nextPC_ref w__4 + : M (unit)) + : M (unit) + | Machine => + read_reg cur_privilege_ref >>= fun w__5 : Privilege => + ((read_reg PC_ref) : M (mword 64)) >>= fun w__6 : xlenbits => + (handle_exception w__5 (CTL_SRET (tt)) w__6) >>= fun w__7 : mword 64 => + write_reg nextPC_ref w__7 + : M (unit) + end) >> + returnm (false + : bool). + +Definition execute_SHIFTW (shamt : mword 5) (rs1 : mword 5) (rd : mword 5) (op : sop) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let rs1_val := subrange_vec_dec w__0 31 0 in + let result : bits 32 := + match op with + | RISCV_SLLI => shift_bits_left rs1_val shamt + | RISCV_SRLI => shift_bits_right rs1_val shamt + | RISCV_SRAI => shift_right_arith32 rs1_val shamt + end in + (wX (projT1 (regbits_to_regno rd)) (EXTS 64 result)) >> returnm (true : bool). + +Definition execute_SHIFTIWOP (shamt : mword 5) (rs1 : mword 5) (rd : mword 5) (op : sopw) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun rs1_val => + let result : xlenbits := + match op with + | RISCV_SLLIW => EXTS 64 (shift_bits_left (subrange_vec_dec rs1_val 31 0) shamt) + | RISCV_SRLIW => EXTS 64 (shift_bits_right (subrange_vec_dec rs1_val 31 0) shamt) + | RISCV_SRAIW => EXTS 64 (shift_right_arith32 (subrange_vec_dec rs1_val 31 0) shamt) + end in + (wX (projT1 (regbits_to_regno rd)) result) >> returnm (true : bool). + +Definition execute_SHIFTIOP (shamt : mword 6) (rs1 : mword 5) (rd : mword 5) (op : sop) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun rs1_val => + let result : xlenbits := + match op with + | RISCV_SLLI => shift_bits_left rs1_val shamt + | RISCV_SRLI => shift_bits_right rs1_val shamt + | RISCV_SRAI => shift_right_arith64 rs1_val shamt + end in + (wX (projT1 (regbits_to_regno rd)) result) >> returnm (true : bool). + +Definition execute_SFENCE_VMA (rs1 : mword 5) (rs2 : mword 5) +: M (bool) := + + read_reg cur_privilege_ref >>= fun w__0 : Privilege => + (if ((eq_vec (privLevel_to_bits w__0) ((privLevel_to_bits User) : mword 2))) then + (handle_illegal tt) >> returnm (false : bool) + else + read_reg mstatus_ref >>= fun w__1 : Mstatus => + read_reg mstatus_ref >>= fun w__2 : Mstatus => + let p__15 := (architecture (_get_Mstatus_SXL w__1), _get_Mstatus_TVM w__2) in + (match p__15 with + | (Some (RV64), v_0) => + (if ((eq_vec v_0 ((bool_to_bits true) : mword 1))) then + (handle_illegal tt) >> returnm (false : bool) + else if ((eq_vec v_0 ((bool_to_bits false) : mword 1))) then + (if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then + returnm (None + : option (mword 39)) + else + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__3 : mword 64 => + returnm ((Some + (subrange_vec_dec w__3 38 0)) + : option (mword 39))) >>= fun addr : option vaddr39 => + (if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs2)) 0)) then + returnm (None + : option (mword 16)) + else + (rX (projT1 (regbits_to_regno rs2))) >>= fun w__4 : mword 64 => + returnm ((Some + (subrange_vec_dec w__4 15 0)) + : option (mword 16))) >>= fun asid : option asid64 => + (flushTLB asid addr) >> returnm (true : bool) + else + (match (Some + (RV64), v_0) with + | (g__13, g__14) => (internal_error "unimplemented sfence architecture") : M (bool) + end) + : M (bool)) + : M (bool) + | (g__13, g__14) => (internal_error "unimplemented sfence architecture") : M (bool) + end) + : M (bool)) + : M (bool). + +Definition execute_RTYPEW (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (op : ropw) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let rs1_val := subrange_vec_dec w__0 31 0 in + (rX (projT1 (regbits_to_regno rs2))) >>= fun w__1 : mword 64 => + let rs2_val := subrange_vec_dec w__1 31 0 in + let result : bits 32 := + match op with + | RISCV_ADDW => add_vec rs1_val rs2_val + | RISCV_SUBW => sub_vec rs1_val rs2_val + | RISCV_SLLW => shift_bits_left rs1_val (subrange_vec_dec rs2_val 4 0) + | RISCV_SRLW => shift_bits_right rs1_val (subrange_vec_dec rs2_val 4 0) + | RISCV_SRAW => shift_right_arith32 rs1_val (subrange_vec_dec rs2_val 4 0) + end in + (wX (projT1 (regbits_to_regno rd)) (EXTS 64 result)) >> returnm (true : bool). + +Definition execute_RTYPE (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (op : rop) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun rs1_val => + (rX (projT1 (regbits_to_regno rs2))) >>= fun rs2_val => + let result : xlenbits := + match op with + | RISCV_ADD => add_vec rs1_val rs2_val + | RISCV_SUB => sub_vec rs1_val rs2_val + | RISCV_SLL => shift_bits_left rs1_val (subrange_vec_dec rs2_val 5 0) + | RISCV_SLT => EXTZ 64 (bool_to_bits (zopz0zI_s rs1_val rs2_val)) + | RISCV_SLTU => EXTZ 64 (bool_to_bits (zopz0zI_u rs1_val rs2_val)) + | RISCV_XOR => xor_vec rs1_val rs2_val + | RISCV_SRL => shift_bits_right rs1_val (subrange_vec_dec rs2_val 5 0) + | RISCV_SRA => shift_right_arith64 rs1_val (subrange_vec_dec rs2_val 5 0) + | RISCV_OR => or_vec rs1_val rs2_val + | RISCV_AND => and_vec rs1_val rs2_val + end in + (wX (projT1 (regbits_to_regno rd)) result) >> returnm (true : bool). + +Definition execute_RISCV_JALR (imm : mword 12) (rs1 : mword 5) (rd : mword 5) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let newPC : xlenbits := + concat_vec (subrange_vec_dec (add_vec w__0 (EXTS 64 imm)) 63 1) (vec_of_bits [B0] : mword 1) in + (and_boolM ((bit_to_bool (access_vec_dec newPC 1)) : M (bool)) + ((haveRVC tt) >>= fun w__2 : bool => returnm ((negb w__2) : bool))) >>= fun w__3 : bool => + (if (w__3) then (handle_mem_exception newPC E_Fetch_Addr_Align) >> returnm (false : bool) + else + ((read_reg nextPC_ref) : M (mword 64)) >>= fun w__4 : xlenbits => + (wX (projT1 (regbits_to_regno rd)) w__4) >> + write_reg nextPC_ref newPC >> returnm (true : bool)) + : M (bool). + +Definition execute_RISCV_JAL (imm : mword 21) (rd : mword 5) +: M (bool) := + + ((read_reg PC_ref) : M (mword 64)) >>= fun pc : xlenbits => + let newPC : xlenbits := add_vec pc (EXTS 64 imm) in + (and_boolM ((bit_to_bool (access_vec_dec newPC 1)) : M (bool)) + ((haveRVC tt) >>= fun w__1 : bool => returnm ((negb w__1) : bool))) >>= fun w__2 : bool => + (if (w__2) then (handle_mem_exception newPC E_Fetch_Addr_Align) >> returnm (false : bool) + else + ((read_reg nextPC_ref) : M (mword 64)) >>= fun w__3 : xlenbits => + (wX (projT1 (regbits_to_regno rd)) w__3) >> + write_reg nextPC_ref newPC >> returnm (true : bool)) + : M (bool). + +Definition execute_REMW (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (s : bool) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let rs1_val := subrange_vec_dec w__0 31 0 in + (rX (projT1 (regbits_to_regno rs2))) >>= fun w__1 : mword 64 => + let rs2_val := subrange_vec_dec w__1 31 0 in + let rs1_int : Z := if (s) then projT1 (sint rs1_val) else projT1 (uint rs1_val) in + let rs2_int : Z := if (s) then projT1 (sint rs2_val) else projT1 (uint rs2_val) in + let r : Z := + if sumbool_of_bool ((Z.eqb rs2_int 0)) then rs1_int + else rem_round_zero rs1_int rs2_int in + (wX (projT1 (regbits_to_regno rd)) (EXTS 64 (to_bits 32 r))) >> returnm (true : bool). + +Definition execute_REM (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (s : bool) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun rs1_val => + (rX (projT1 (regbits_to_regno rs2))) >>= fun rs2_val => + let rs1_int : Z := if (s) then projT1 (sint rs1_val) else projT1 (uint rs1_val) in + let rs2_int : Z := if (s) then projT1 (sint rs2_val) else projT1 (uint rs2_val) in + let r : Z := + if sumbool_of_bool ((Z.eqb rs2_int 0)) then rs1_int + else rem_round_zero rs1_int rs2_int in + (wX (projT1 (regbits_to_regno rd)) (to_bits xlen r)) >> returnm (true : bool). + +Definition execute_MULW (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let rs1_val := subrange_vec_dec w__0 31 0 in + (rX (projT1 (regbits_to_regno rs2))) >>= fun w__1 : mword 64 => + let rs2_val := subrange_vec_dec w__1 31 0 in + let rs1_int : Z := projT1 (sint rs1_val) in + let rs2_int : Z := projT1 (sint rs2_val) in + let result32 := subrange_vec_dec (to_bits 64 (Z.mul rs1_int rs2_int)) 31 0 in + let result : xlenbits := EXTS 64 result32 in + (wX (projT1 (regbits_to_regno rd)) result) >> returnm (true : bool). + +Definition execute_MUL +(rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (high : bool) (signed1 : bool) (signed2 : bool) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun rs1_val => + (rX (projT1 (regbits_to_regno rs2))) >>= fun rs2_val => + let rs1_int : Z := if (signed1) then projT1 (sint rs1_val) else projT1 (uint rs1_val) in + let rs2_int : Z := if (signed2) then projT1 (sint rs2_val) else projT1 (uint rs2_val) in + let result128 := to_bits 128 (Z.mul rs1_int rs2_int) in + let result := + if (high) then subrange_vec_dec result128 127 64 + else subrange_vec_dec result128 63 0 in + (wX (projT1 (regbits_to_regno rd)) result) >> returnm (true : bool). + +Definition execute_MRET '(tt : unit) +: M (bool) := + + read_reg cur_privilege_ref >>= fun w__0 : Privilege => + (if ((eq_vec (privLevel_to_bits w__0) ((privLevel_to_bits Machine) : mword 2))) then + read_reg cur_privilege_ref >>= fun w__1 : Privilege => + ((read_reg PC_ref) : M (mword 64)) >>= fun w__2 : xlenbits => + (handle_exception w__1 (CTL_MRET (tt)) w__2) >>= fun w__3 : mword 64 => + write_reg nextPC_ref w__3 + : M (unit) + else (handle_illegal tt) : M (unit)) >> + returnm (false + : bool). + +Definition execute_LOADRES +(aq : bool) (rl : bool) (rs1 : mword 5) (width : word_width) (rd : mword 5) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun vaddr : xlenbits => + (match width with + | BYTE => returnm (true : bool) + | HALF => + (cast_unit_vec (access_vec_dec vaddr 0)) >>= fun w__0 : mword 1 => + returnm ((eq_vec w__0 (vec_of_bits [B0] : mword 1)) + : bool) + | WORD => + returnm ((eq_vec (subrange_vec_dec vaddr 1 0) (vec_of_bits [B0;B0] : mword (1 - 0 + 1))) + : bool) + | DOUBLE => + returnm ((eq_vec (subrange_vec_dec vaddr 2 0) (vec_of_bits [B0;B0;B0] : mword (2 - 0 + 1))) + : bool) + end) >>= fun aligned : bool => + (if ((negb aligned)) then + (handle_mem_exception vaddr E_Load_Addr_Align) >> returnm (false : bool) + else + (translateAddr vaddr Read Data) >>= fun w__1 : TR_Result => + (match w__1 with + | TR_Failure (e) => (handle_mem_exception vaddr e) >> returnm (false : bool) + | TR_Address (addr) => + (match width with + | WORD => + (mem_read addr 4 aq rl true) >>= fun w__2 : MemoryOpResult (mword (8 * 4)) => + (process_loadres rd vaddr w__2 false) + : M (bool) + | DOUBLE => + (mem_read addr 8 aq rl true) >>= fun w__4 : MemoryOpResult (mword (8 * 8)) => + (process_loadres rd vaddr w__4 false) + : M (bool) + | _ => (internal_error "LOADRES expected WORD or DOUBLE") : M (bool) + end) + : M (bool) + end) + : M (bool)) + : M (bool). + +Definition execute_LOAD +(imm : mword 12) (rs1 : mword 5) (rd : mword 5) (is_unsigned : bool) (width : word_width) +(aq : bool) (rl : bool) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let vaddr : xlenbits := add_vec w__0 (EXTS 64 imm) in + (check_misaligned vaddr width) >>= fun w__1 : bool => + (if (w__1) then (handle_mem_exception vaddr E_Load_Addr_Align) >> returnm (false : bool) + else + (translateAddr vaddr Read Data) >>= fun w__2 : TR_Result => + (match w__2 with + | TR_Failure (e) => (handle_mem_exception vaddr e) >> returnm (false : bool) + | TR_Address (addr) => + (match width with + | BYTE => + (mem_read addr 1 aq rl false) >>= fun w__3 : MemoryOpResult (mword (8 * 1)) => + (process_load rd vaddr w__3 is_unsigned) + : M (bool) + | HALF => + (mem_read addr 2 aq rl false) >>= fun w__5 : MemoryOpResult (mword (8 * 2)) => + (process_load rd vaddr w__5 is_unsigned) + : M (bool) + | WORD => + (mem_read addr 4 aq rl false) >>= fun w__7 : MemoryOpResult (mword (8 * 4)) => + (process_load rd vaddr w__7 is_unsigned) + : M (bool) + | DOUBLE => + (mem_read addr 8 aq rl false) >>= fun w__9 : MemoryOpResult (mword (8 * 8)) => + (process_load rd vaddr w__9 is_unsigned) + : M (bool) + end) + : M (bool) + end) + : M (bool)) + : M (bool). + +Definition execute_ITYPE (imm : mword 12) (rs1 : mword 5) (rd : mword 5) (op : iop) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun rs1_val => + let immext : xlenbits := EXTS 64 imm in + let result : xlenbits := + match op with + | RISCV_ADDI => add_vec rs1_val immext + | RISCV_SLTI => EXTZ 64 (bool_to_bits (zopz0zI_s rs1_val immext)) + | RISCV_SLTIU => EXTZ 64 (bool_to_bits (zopz0zI_u rs1_val immext)) + | RISCV_XORI => xor_vec rs1_val immext + | RISCV_ORI => or_vec rs1_val immext + | RISCV_ANDI => and_vec rs1_val immext + end in + (wX (projT1 (regbits_to_regno rd)) result) >> returnm (true : bool). + +Definition execute_ILLEGAL (s : mword 32) +: M (bool) := + + (handle_illegal tt) >> returnm (false : bool). + +Definition execute_FENCE_TSO (pred : mword 4) (succ : mword 4) +: M (bool) := + + (match (pred, succ) with + | (v__836, v__837) => + (if ((andb (eq_vec (subrange_vec_dec v__836 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__837 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))))) + then + (MEM_fence_tso tt) + : M (unit) + else + returnm ((if ((andb + (eq_vec (subrange_vec_dec v__836 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__837 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) then + tt + else + let '_ := (print_endline "FIXME: unsupported fence") : unit in + tt) + : unit)) + : M (unit) + end) >> + returnm (true + : bool). + +Definition execute_FENCEI '(tt : unit) : bool := true. + +Definition execute_FENCE (pred : mword 4) (succ : mword 4) +: M (bool) := + + (match (pred, succ) with + | (v__796, v__797) => + (if ((andb (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))))) + then + (MEM_fence_rw_rw tt) + : M (unit) + else if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))))) + then + (MEM_fence_r_rw tt) + : M (unit) + else if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) + then + (MEM_fence_r_r tt) + : M (unit) + else if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + (MEM_fence_rw_w tt) + : M (unit) + else if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + (MEM_fence_w_w tt) + : M (unit) + else if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))))) + then + (MEM_fence_w_rw tt) + : M (unit) + else if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) + then + (MEM_fence_rw_r tt) + : M (unit) + else if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) + then + (MEM_fence_r_w tt) + : M (unit) + else if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) (vec_of_bits [B0;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) + then + (MEM_fence_w_r tt) + : M (unit) + else + returnm ((if ((andb + (eq_vec (subrange_vec_dec v__796 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__797 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) then + tt + else + let '_ := (print_endline "FIXME: unsupported fence") : unit in + tt) + : unit)) + : M (unit) + end) >> + returnm (true + : bool). + +Definition execute_ECALL '(tt : unit) +: M (bool) := + + read_reg cur_privilege_ref >>= fun w__0 : Privilege => + let t : sync_exception := + {| sync_exception_trap := + (match w__0 with + | User => E_U_EnvCall + | Supervisor => E_S_EnvCall + | Machine => E_M_EnvCall + end); + sync_exception_excinfo := (None : option xlenbits) |} in + read_reg cur_privilege_ref >>= fun w__1 : Privilege => + ((read_reg PC_ref) : M (mword 64)) >>= fun w__2 : xlenbits => + (handle_exception w__1 (CTL_TRAP (t)) w__2) >>= fun w__3 : mword 64 => + write_reg nextPC_ref w__3 >> returnm (false : bool). + +Definition execute_EBREAK '(tt : unit) +: M (bool) := + + ((read_reg PC_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + (handle_mem_exception w__0 E_Breakpoint) >> returnm (false : bool). + +Definition execute_DIVW (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (s : bool) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let rs1_val := subrange_vec_dec w__0 31 0 in + (rX (projT1 (regbits_to_regno rs2))) >>= fun w__1 : mword 64 => + let rs2_val := subrange_vec_dec w__1 31 0 in + let rs1_int : Z := if (s) then projT1 (sint rs1_val) else projT1 (uint rs1_val) in + let rs2_int : Z := if (s) then projT1 (sint rs2_val) else projT1 (uint rs2_val) in + let q : Z := + if sumbool_of_bool ((Z.eqb rs2_int 0)) then (-1) + else quot_round_zero rs1_int rs2_int in + let q' : Z := + if sumbool_of_bool ((andb s (Z.gtb q (Z.sub (projT1 (pow2 31)) 1)))) then Z.sub 0 (pow 2 31) + else q in + (wX (projT1 (regbits_to_regno rd)) (EXTS 64 (to_bits 32 q'))) >> returnm (true : bool). + +Definition execute_DIV (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (s : bool) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun rs1_val => + (rX (projT1 (regbits_to_regno rs2))) >>= fun rs2_val => + let rs1_int : Z := if (s) then projT1 (sint rs1_val) else projT1 (uint rs1_val) in + let rs2_int : Z := if (s) then projT1 (sint rs2_val) else projT1 (uint rs2_val) in + let q : Z := + if sumbool_of_bool ((Z.eqb rs2_int 0)) then (-1) + else quot_round_zero rs1_int rs2_int in + let q' : Z := if sumbool_of_bool ((andb s (Z.gtb q xlen_max_signed))) then xlen_min_signed else q in + (wX (projT1 (regbits_to_regno rd)) (to_bits xlen q')) >> returnm (true : bool). + +Definition execute_C_NOP '(tt : unit) : bool := true. + +Definition execute_C_ILLEGAL (s : mword 16) +: M (bool) := + + (handle_illegal tt) >> returnm (false : bool). + +Definition execute_C_ADDIW (imm : mword 6) (rsd : mword 5) +: M (bool) := + + let imm : bits 32 := EXTS 32 imm in + (rX (projT1 (regbits_to_regno rsd))) >>= fun rs_val => + let res : bits 32 := add_vec (subrange_vec_dec rs_val 31 0) imm in + (wX (projT1 (regbits_to_regno rsd)) (EXTS 64 res)) >> returnm (true : bool). + +Definition execute_CSR (csr : mword 12) (rs1 : mword 5) (rd : mword 5) (is_imm : bool) (op : csrop) +: M (bool) := + + (if (is_imm) then returnm ((EXTZ 64 rs1) : mword 64) + else (rX (projT1 (regbits_to_regno rs1))) : M (mword 64)) >>= fun rs1_val : xlenbits => + let isWrite : bool := + match op with + | CSRRW => true + | _ => if (is_imm) then neq_int (projT1 (uint rs1_val)) 0 else neq_int (projT1 (uint rs1)) 0 + end in + read_reg cur_privilege_ref >>= fun w__1 : Privilege => + (check_CSR csr w__1 isWrite) >>= fun w__2 : bool => + (if ((negb w__2)) then (handle_illegal tt) >> returnm (false : bool) + else + (readCSR csr) >>= fun csr_val => + (if (isWrite) then + let new_val : xlenbits := + match op with + | CSRRW => rs1_val + | CSRRS => or_vec csr_val rs1_val + | CSRRC => and_vec csr_val (not_vec rs1_val) + end in + (writeCSR csr new_val) + : M (unit) + else returnm (tt : unit)) >> + (wX (projT1 (regbits_to_regno rd)) csr_val) >> returnm (true : bool)) + : M (bool). + +Definition execute_BTYPE (imm : mword 13) (rs2 : mword 5) (rs1 : mword 5) (op : bop) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun rs1_val => + (rX (projT1 (regbits_to_regno rs2))) >>= fun rs2_val => + let taken : bool := + match op with + | RISCV_BEQ => eq_vec rs1_val rs2_val + | RISCV_BNE => neq_vec rs1_val rs2_val + | RISCV_BLT => zopz0zI_s rs1_val rs2_val + | RISCV_BGE => zopz0zKzJ_s rs1_val rs2_val + | RISCV_BLTU => zopz0zI_u rs1_val rs2_val + | RISCV_BGEU => zopz0zKzJ_u rs1_val rs2_val + end in + ((read_reg PC_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + let newPC := add_vec w__0 (EXTS 64 imm) in + (if (taken) then + (and_boolM ((bit_to_bool (access_vec_dec newPC 1)) : M (bool)) + ((haveRVC tt) >>= fun w__2 : bool => returnm ((negb w__2) : bool))) >>= fun w__3 : bool => + (if (w__3) then (handle_mem_exception newPC E_Fetch_Addr_Align) >> returnm (false : bool) + else write_reg nextPC_ref newPC >> returnm (true : bool)) + : M (bool) + else returnm (true : bool)) + : M (bool). + +Definition execute_AMO +(op : amoop) (aq : bool) (rl : bool) (rs2 : mword 5) (rs1 : mword 5) (width : word_width) +(rd : mword 5) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun vaddr : xlenbits => + (translateAddr vaddr ReadWrite Data) >>= fun w__0 : TR_Result => + (match w__0 with + | TR_Failure (e) => (handle_mem_exception vaddr e) >> returnm (false : bool) + | TR_Address (addr) => + (match width with + | WORD => (mem_write_ea addr 4 (andb aq rl) rl true) : M (MemoryOpResult unit) + | DOUBLE => (mem_write_ea addr 8 (andb aq rl) rl true) : M (MemoryOpResult unit) + | _ => (internal_error "AMO expected WORD or DOUBLE") : M (MemoryOpResult unit) + end) >>= fun eares : MemoryOpResult unit => + (match eares with + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + | MemValue (_) => + (match width with + | WORD => + (mem_read addr 4 aq (andb aq rl) true) >>= fun w__4 : MemoryOpResult (mword (8 * 4)) => + returnm ((extend_value false w__4) + : MemoryOpResult (mword 64)) + | DOUBLE => + (mem_read addr 8 aq (andb aq rl) true) >>= fun w__5 : MemoryOpResult (mword (8 * 8)) => + returnm ((extend_value false w__5) + : MemoryOpResult (mword 64)) + | _ => (internal_error "AMO expected WORD or DOUBLE") : M (MemoryOpResult (mword 64)) + end) >>= fun rval : MemoryOpResult xlenbits => + (match rval with + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + | MemValue (loaded) => + (rX (projT1 (regbits_to_regno rs2))) >>= fun rs2_val : xlenbits => + let result : xlenbits := + match op with + | AMOSWAP => rs2_val + | AMOADD => add_vec rs2_val loaded + | AMOXOR => xor_vec rs2_val loaded + | AMOAND => and_vec rs2_val loaded + | AMOOR => or_vec rs2_val loaded + | AMOMIN => vector64 (Z.min (projT1 (sint rs2_val)) (projT1 (sint loaded))) + | AMOMAX => vector64 (Z.max (projT1 (sint rs2_val)) (projT1 (sint loaded))) + | AMOMINU => + vector64 (projT1 (min_nat (projT1 (uint rs2_val)) (projT1 (uint loaded)))) + | AMOMAXU => + vector64 (projT1 (max_nat (projT1 (uint rs2_val)) (projT1 (uint loaded)))) + end in + (match width with + | WORD => + (mem_write_value addr 4 (subrange_vec_dec result 31 0) (andb aq rl) rl true) + : M (MemoryOpResult bool) + | DOUBLE => + (mem_write_value addr 8 result (andb aq rl) rl true) : M (MemoryOpResult bool) + | _ => (internal_error "AMO expected WORD or DOUBLE") : M (MemoryOpResult bool) + end) >>= fun wval : MemoryOpResult bool => + (match wval with + | MemValue (true) => + (wX (projT1 (regbits_to_regno rd)) loaded) >> returnm (true : bool) + | MemValue (false) => + (internal_error "AMO got false from mem_write_value") : M (bool) + | MemException (e) => (handle_mem_exception addr e) >> returnm (false : bool) + end) + : M (bool) + end) + : M (bool) + end) + : M (bool) + end) + : M (bool). + +Definition execute_ADDIW (imm : mword 12) (rs1 : mword 5) (rd : mword 5) +: M (bool) := + + (rX (projT1 (regbits_to_regno rs1))) >>= fun w__0 : mword 64 => + let result : xlenbits := add_vec (EXTS 64 imm) w__0 in + (wX (projT1 (regbits_to_regno rd)) (EXTS 64 (subrange_vec_dec result 31 0))) >> + returnm (true + : bool). + +Definition compressed_measure (instr : ast) +: Z := + + match instr with + | C_ADDI4SPN (rdc,nzimm) => 1 + | C_LW (uimm,rsc,rdc) => 1 + | C_LD (uimm,rsc,rdc) => 1 + | C_SW (uimm,rsc1,rsc2) => 1 + | C_SD (uimm,rsc1,rsc2) => 1 + | C_ADDI (nzi,rsd) => 1 + | C_JAL (imm) => 1 + | C_LI (imm,rd) => 1 + | C_ADDI16SP (imm) => 1 + | C_LUI (imm,rd) => 1 + | C_SRLI (shamt,rsd) => 1 + | C_SRAI (shamt,rsd) => 1 + | C_ANDI (imm,rsd) => 1 + | C_SUB (rsd,rs2) => 1 + | C_XOR (rsd,rs2) => 1 + | C_OR (rsd,rs2) => 1 + | C_AND (rsd,rs2) => 1 + | C_SUBW (rsd,rs2) => 1 + | C_ADDW (rsd,rs2) => 1 + | C_J (imm) => 1 + | C_BEQZ (imm,rs) => 1 + | C_BNEZ (imm,rs) => 1 + | C_SLLI (shamt,rsd) => 1 + | C_LWSP (uimm,rd) => 1 + | C_LDSP (uimm,rd) => 1 + | C_SWSP (uimm,rs2) => 1 + | C_SDSP (uimm,rs2) => 1 + | C_JR (rs1) => 1 + | C_JALR (rs1) => 1 + | C_MV (rd,rs2) => 1 + | C_EBREAK (tt') => 1 + | C_ADD (rsd,rs2) => 1 + | _ => 0 + end. + +Fixpoint _rec_execute (merge_var : ast) (_reclimit : Z) (_acc : Acc (Zwf 0) _reclimit) +{struct _acc} : M (bool) := + + assert_exp' (Z.geb _reclimit 0) "recursion limit reached" >>= fun _ => + (match merge_var with + | C_ADDI4SPN (rdc,nzimm) => + let imm : bits 12 := + concat_vec (vec_of_bits [B0;B0] : mword 2) + (concat_vec nzimm (vec_of_bits [B0;B0] : mword 2)) in + let rd := creg2reg_bits rdc in + (_rec_execute (ITYPE ((imm, sp, rd, RISCV_ADDI))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_LW (uimm,rsc,rdc) => + let imm : bits 12 := EXTZ 12 (concat_vec uimm (vec_of_bits [B0;B0] : mword 2)) in + let rd := creg2reg_bits rdc in + let rs := creg2reg_bits rsc in + (_rec_execute (LOAD ((imm, rs, rd, false, WORD, false, false))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_LD (uimm,rsc,rdc) => + let imm : bits 12 := EXTZ 12 (concat_vec uimm (vec_of_bits [B0;B0;B0] : mword 3)) in + let rd := creg2reg_bits rdc in + let rs := creg2reg_bits rsc in + (_rec_execute (LOAD ((imm, rs, rd, false, DOUBLE, false, false))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_SW (uimm,rsc1,rsc2) => + let imm : bits 12 := EXTZ 12 (concat_vec uimm (vec_of_bits [B0;B0] : mword 2)) in + let rs1 := creg2reg_bits rsc1 in + let rs2 := creg2reg_bits rsc2 in + (_rec_execute (STORE ((imm, rs2, rs1, WORD, false, false))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_SD (uimm,rsc1,rsc2) => + let imm : bits 12 := EXTZ 12 (concat_vec uimm (vec_of_bits [B0;B0;B0] : mword 3)) in + let rs1 := creg2reg_bits rsc1 in + let rs2 := creg2reg_bits rsc2 in + (_rec_execute (STORE ((imm, rs2, rs1, DOUBLE, false, false))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_ADDI (nzi,rsd) => + let imm : bits 12 := EXTS 12 nzi in + (_rec_execute (ITYPE ((imm, rsd, rsd, RISCV_ADDI))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_JAL (imm) => + (_rec_execute (RISCV_JAL ((EXTS 21 (concat_vec imm (vec_of_bits [B0] : mword 1)), ra))) + (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_LI (imm,rd) => + let imm : bits 12 := EXTS 12 imm in + (_rec_execute (ITYPE ((imm, zreg, rd, RISCV_ADDI))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_ADDI16SP (imm) => + let imm : bits 12 := EXTS 12 (concat_vec imm (vec_of_bits [B0;B0;B0;B0] : mword 4)) in + (_rec_execute (ITYPE ((imm, sp, sp, RISCV_ADDI))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_LUI (imm,rd) => + let res : bits 20 := EXTS 20 imm in + (_rec_execute (UTYPE ((res, rd, RISCV_LUI))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_SRLI (shamt,rsd) => + let rsd := creg2reg_bits rsd in + (_rec_execute (SHIFTIOP ((shamt, rsd, rsd, RISCV_SRLI))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_SRAI (shamt,rsd) => + let rsd := creg2reg_bits rsd in + (_rec_execute (SHIFTIOP ((shamt, rsd, rsd, RISCV_SRAI))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_ANDI (imm,rsd) => + let rsd := creg2reg_bits rsd in + (_rec_execute (ITYPE ((EXTS 12 imm, rsd, rsd, RISCV_ANDI))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_SUB (rsd,rs2) => + let rsd := creg2reg_bits rsd in + let rs2 := creg2reg_bits rs2 in + (_rec_execute (RTYPE ((rs2, rsd, rsd, RISCV_SUB))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_XOR (rsd,rs2) => + let rsd := creg2reg_bits rsd in + let rs2 := creg2reg_bits rs2 in + (_rec_execute (RTYPE ((rs2, rsd, rsd, RISCV_XOR))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_OR (rsd,rs2) => + let rsd := creg2reg_bits rsd in + let rs2 := creg2reg_bits rs2 in + (_rec_execute (RTYPE ((rs2, rsd, rsd, RISCV_OR))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_AND (rsd,rs2) => + let rsd := creg2reg_bits rsd in + let rs2 := creg2reg_bits rs2 in + (_rec_execute (RTYPE ((rs2, rsd, rsd, RISCV_AND))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_SUBW (rsd,rs2) => + let rsd := creg2reg_bits rsd in + let rs2 := creg2reg_bits rs2 in + (_rec_execute (RTYPEW ((rs2, rsd, rsd, RISCV_SUBW))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_ADDW (rsd,rs2) => + let rsd := creg2reg_bits rsd in + let rs2 := creg2reg_bits rs2 in + (_rec_execute (RTYPEW ((rs2, rsd, rsd, RISCV_ADDW))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_J (imm) => + (_rec_execute (RISCV_JAL ((EXTS 21 (concat_vec imm (vec_of_bits [B0] : mword 1)), zreg))) + (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_BEQZ (imm,rs) => + (_rec_execute + (BTYPE + ((EXTS 13 (concat_vec imm (vec_of_bits [B0] : mword 1)), zreg, creg2reg_bits rs, RISCV_BEQ))) + (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_BNEZ (imm,rs) => + (_rec_execute + (BTYPE + ((EXTS 13 (concat_vec imm (vec_of_bits [B0] : mword 1)), zreg, creg2reg_bits rs, RISCV_BNE))) + (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_SLLI (shamt,rsd) => + (_rec_execute (SHIFTIOP ((shamt, rsd, rsd, RISCV_SLLI))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_LWSP (uimm,rd) => + let imm : bits 12 := EXTZ 12 (concat_vec uimm (vec_of_bits [B0;B0] : mword 2)) in + (_rec_execute (LOAD ((imm, sp, rd, false, WORD, false, false))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_LDSP (uimm,rd) => + let imm : bits 12 := EXTZ 12 (concat_vec uimm (vec_of_bits [B0;B0;B0] : mword 3)) in + (_rec_execute (LOAD ((imm, sp, rd, false, DOUBLE, false, false))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_SWSP (uimm,rs2) => + let imm : bits 12 := EXTZ 12 (concat_vec uimm (vec_of_bits [B0;B0] : mword 2)) in + (_rec_execute (STORE ((imm, rs2, sp, WORD, false, false))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_SDSP (uimm,rs2) => + let imm : bits 12 := EXTZ 12 (concat_vec uimm (vec_of_bits [B0;B0;B0] : mword 3)) in + (_rec_execute (STORE ((imm, rs2, sp, DOUBLE, false, false))) (Z.sub _reclimit 1) + (_limit_reduces _acc)) + : M (bool) + | C_JR (rs1) => + (_rec_execute (RISCV_JALR ((EXTZ 12 (vec_of_bits [B0] : mword 1), rs1, zreg))) + (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_JALR (rs1) => + (_rec_execute (RISCV_JALR ((EXTZ 12 (vec_of_bits [B0] : mword 1), rs1, ra))) + (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_MV (rd,rs2) => + (_rec_execute (RTYPE ((rs2, zreg, rd, RISCV_ADD))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | C_EBREAK (tt) => + (_rec_execute (EBREAK (tt)) (Z.sub _reclimit 1) (_limit_reduces _acc)) : M (bool) + | C_ADD (rsd,rs2) => + (_rec_execute (RTYPE ((rs2, rsd, rsd, RISCV_ADD))) (Z.sub _reclimit 1) (_limit_reduces _acc)) + : M (bool) + | UTYPE (imm,rd,op) => (execute_UTYPE imm rd op) : M (bool) + | RISCV_JAL (imm,rd) => (execute_RISCV_JAL imm rd) : M (bool) + | BTYPE (imm,rs2,rs1,op) => (execute_BTYPE imm rs2 rs1 op) : M (bool) + | ITYPE (imm,rs1,rd,op) => (execute_ITYPE imm rs1 rd op) : M (bool) + | SHIFTIOP (shamt,rs1,rd,op) => (execute_SHIFTIOP shamt rs1 rd op) : M (bool) + | RTYPE (rs2,rs1,rd,op) => (execute_RTYPE rs2 rs1 rd op) : M (bool) + | LOAD (imm,rs1,rd,is_unsigned,width,aq,rl) => + (execute_LOAD imm rs1 rd is_unsigned width aq rl) : M (bool) + | STORE (imm,rs2,rs1,width,aq,rl) => (execute_STORE imm rs2 rs1 width aq rl) : M (bool) + | ADDIW (imm,rs1,rd) => (execute_ADDIW imm rs1 rd) : M (bool) + | SHIFTW (shamt,rs1,rd,op) => (execute_SHIFTW shamt rs1 rd op) : M (bool) + | RTYPEW (rs2,rs1,rd,op) => (execute_RTYPEW rs2 rs1 rd op) : M (bool) + | SHIFTIWOP (shamt,rs1,rd,op) => (execute_SHIFTIWOP shamt rs1 rd op) : M (bool) + | MUL (rs2,rs1,rd,high,signed1,signed2) => + (execute_MUL rs2 rs1 rd high signed1 signed2) : M (bool) + | DIV (rs2,rs1,rd,s) => (execute_DIV rs2 rs1 rd s) : M (bool) + | REM (rs2,rs1,rd,s) => (execute_REM rs2 rs1 rd s) : M (bool) + | MULW (rs2,rs1,rd) => (execute_MULW rs2 rs1 rd) : M (bool) + | DIVW (rs2,rs1,rd,s) => (execute_DIVW rs2 rs1 rd s) : M (bool) + | REMW (rs2,rs1,rd,s) => (execute_REMW rs2 rs1 rd s) : M (bool) + | FENCE (pred,succ) => (execute_FENCE pred succ) : M (bool) + | FENCE_TSO (pred,succ) => (execute_FENCE_TSO pred succ) : M (bool) + | FENCEI (arg0) => returnm ((execute_FENCEI arg0) : bool) + | ECALL (arg0) => (execute_ECALL arg0) : M (bool) + | MRET (arg0) => (execute_MRET arg0) : M (bool) + | SRET (arg0) => (execute_SRET arg0) : M (bool) + | EBREAK (arg0) => (execute_EBREAK arg0) : M (bool) + | WFI (arg0) => (execute_WFI arg0) : M (bool) + | SFENCE_VMA (rs1,rs2) => (execute_SFENCE_VMA rs1 rs2) : M (bool) + | LOADRES (aq,rl,rs1,width,rd) => (execute_LOADRES aq rl rs1 width rd) : M (bool) + | STORECON (aq,rl,rs2,rs1,width,rd) => (execute_STORECON aq rl rs2 rs1 width rd) : M (bool) + | AMO (op,aq,rl,rs2,rs1,width,rd) => (execute_AMO op aq rl rs2 rs1 width rd) : M (bool) + | CSR (csr,rs1,rd,is_imm,op) => (execute_CSR csr rs1 rd is_imm op) : M (bool) + | C_NOP (arg0) => returnm ((execute_C_NOP arg0) : bool) + | C_ADDIW (imm,rsd) => (execute_C_ADDIW imm rsd) : M (bool) + | STOP_FETCHING (arg0) => returnm ((execute_STOP_FETCHING arg0) : bool) + | THREAD_START (arg0) => returnm ((execute_THREAD_START arg0) : bool) + | ILLEGAL (s) => (execute_ILLEGAL s) : M (bool) + | C_ILLEGAL (s) => (execute_C_ILLEGAL s) : M (bool) + | RISCV_JALR (imm,rs1,rd) => (execute_RISCV_JALR imm rs1 rd) : M (bool) + end) + : M (bool). + +Definition execute (i : ast) +: M (bool) := + + (_rec_execute i ((compressed_measure i) : Z) (Zwf_guarded _)) + : M (bool). + +Definition print_insn (insn : ast) : M (string) := (assembly_forwards insn) : M (string). + +Definition decode (bv : mword 32) : option ast := Some (encdec_backwards bv). + +Definition decodeCompressed (bv : mword 16) : option ast := Some (encdec_compressed_backwards bv). + +Definition read_kind_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 11)} +: read_kind := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then Read_plain + else if sumbool_of_bool ((Z.eqb p0_ 1)) then Read_reserve + else if sumbool_of_bool ((Z.eqb p0_ 2)) then Read_acquire + else if sumbool_of_bool ((Z.eqb p0_ 3)) then Read_exclusive + else if sumbool_of_bool ((Z.eqb p0_ 4)) then Read_exclusive_acquire + else if sumbool_of_bool ((Z.eqb p0_ 5)) then Read_stream + else if sumbool_of_bool ((Z.eqb p0_ 6)) then Read_RISCV_acquire + else if sumbool_of_bool ((Z.eqb p0_ 7)) then Read_RISCV_strong_acquire + else if sumbool_of_bool ((Z.eqb p0_ 8)) then Read_RISCV_reserved + else if sumbool_of_bool ((Z.eqb p0_ 9)) then Read_RISCV_reserved_acquire + else if sumbool_of_bool ((Z.eqb p0_ 10)) then Read_RISCV_reserved_strong_acquire + else Read_X86_locked. + +Definition num_of_read_kind (arg_ : read_kind) +: {e : Z & ArithFact (0 <= e /\ e <= 11)} := + + build_ex(match arg_ with + | Read_plain => 0 + | Read_reserve => 1 + | Read_acquire => 2 + | Read_exclusive => 3 + | Read_exclusive_acquire => 4 + | Read_stream => 5 + | Read_RISCV_acquire => 6 + | Read_RISCV_strong_acquire => 7 + | Read_RISCV_reserved => 8 + | Read_RISCV_reserved_acquire => 9 + | Read_RISCV_reserved_strong_acquire => 10 + | Read_X86_locked => 11 + end). + +Definition write_kind_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 10)} +: write_kind := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then Write_plain + else if sumbool_of_bool ((Z.eqb p0_ 1)) then Write_conditional + else if sumbool_of_bool ((Z.eqb p0_ 2)) then Write_release + else if sumbool_of_bool ((Z.eqb p0_ 3)) then Write_exclusive + else if sumbool_of_bool ((Z.eqb p0_ 4)) then Write_exclusive_release + else if sumbool_of_bool ((Z.eqb p0_ 5)) then Write_RISCV_release + else if sumbool_of_bool ((Z.eqb p0_ 6)) then Write_RISCV_strong_release + else if sumbool_of_bool ((Z.eqb p0_ 7)) then Write_RISCV_conditional + else if sumbool_of_bool ((Z.eqb p0_ 8)) then Write_RISCV_conditional_release + else if sumbool_of_bool ((Z.eqb p0_ 9)) then Write_RISCV_conditional_strong_release + else Write_X86_locked. + +Definition num_of_write_kind (arg_ : write_kind) +: {e : Z & ArithFact (0 <= e /\ e <= 10)} := + + build_ex(match arg_ with + | Write_plain => 0 + | Write_conditional => 1 + | Write_release => 2 + | Write_exclusive => 3 + | Write_exclusive_release => 4 + | Write_RISCV_release => 5 + | Write_RISCV_strong_release => 6 + | Write_RISCV_conditional => 7 + | Write_RISCV_conditional_release => 8 + | Write_RISCV_conditional_strong_release => 9 + | Write_X86_locked => 10 + end). + +Definition barrier_kind_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 23)} +: barrier_kind := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then Barrier_Sync + else if sumbool_of_bool ((Z.eqb p0_ 1)) then Barrier_LwSync + else if sumbool_of_bool ((Z.eqb p0_ 2)) then Barrier_Eieio + else if sumbool_of_bool ((Z.eqb p0_ 3)) then Barrier_Isync + else if sumbool_of_bool ((Z.eqb p0_ 4)) then Barrier_DMB + else if sumbool_of_bool ((Z.eqb p0_ 5)) then Barrier_DMB_ST + else if sumbool_of_bool ((Z.eqb p0_ 6)) then Barrier_DMB_LD + else if sumbool_of_bool ((Z.eqb p0_ 7)) then Barrier_DSB + else if sumbool_of_bool ((Z.eqb p0_ 8)) then Barrier_DSB_ST + else if sumbool_of_bool ((Z.eqb p0_ 9)) then Barrier_DSB_LD + else if sumbool_of_bool ((Z.eqb p0_ 10)) then Barrier_ISB + else if sumbool_of_bool ((Z.eqb p0_ 11)) then Barrier_MIPS_SYNC + else if sumbool_of_bool ((Z.eqb p0_ 12)) then Barrier_RISCV_rw_rw + else if sumbool_of_bool ((Z.eqb p0_ 13)) then Barrier_RISCV_r_rw + else if sumbool_of_bool ((Z.eqb p0_ 14)) then Barrier_RISCV_r_r + else if sumbool_of_bool ((Z.eqb p0_ 15)) then Barrier_RISCV_rw_w + else if sumbool_of_bool ((Z.eqb p0_ 16)) then Barrier_RISCV_w_w + else if sumbool_of_bool ((Z.eqb p0_ 17)) then Barrier_RISCV_w_rw + else if sumbool_of_bool ((Z.eqb p0_ 18)) then Barrier_RISCV_rw_r + else if sumbool_of_bool ((Z.eqb p0_ 19)) then Barrier_RISCV_r_w + else if sumbool_of_bool ((Z.eqb p0_ 20)) then Barrier_RISCV_w_r + else if sumbool_of_bool ((Z.eqb p0_ 21)) then Barrier_RISCV_tso + else if sumbool_of_bool ((Z.eqb p0_ 22)) then Barrier_RISCV_i + else Barrier_x86_MFENCE. + +Definition num_of_barrier_kind (arg_ : barrier_kind) +: {e : Z & ArithFact (0 <= e /\ e <= 23)} := + + build_ex(match arg_ with + | Barrier_Sync => 0 + | Barrier_LwSync => 1 + | Barrier_Eieio => 2 + | Barrier_Isync => 3 + | Barrier_DMB => 4 + | Barrier_DMB_ST => 5 + | Barrier_DMB_LD => 6 + | Barrier_DSB => 7 + | Barrier_DSB_ST => 8 + | Barrier_DSB_LD => 9 + | Barrier_ISB => 10 + | Barrier_MIPS_SYNC => 11 + | Barrier_RISCV_rw_rw => 12 + | Barrier_RISCV_r_rw => 13 + | Barrier_RISCV_r_r => 14 + | Barrier_RISCV_rw_w => 15 + | Barrier_RISCV_w_w => 16 + | Barrier_RISCV_w_rw => 17 + | Barrier_RISCV_rw_r => 18 + | Barrier_RISCV_r_w => 19 + | Barrier_RISCV_w_r => 20 + | Barrier_RISCV_tso => 21 + | Barrier_RISCV_i => 22 + | Barrier_x86_MFENCE => 23 + end). + +Definition trans_kind_of_num (arg_ : Z) `{ArithFact (0 <= arg_ /\ arg_ <= 2)} +: trans_kind := + + let p0_ := arg_ in + if sumbool_of_bool ((Z.eqb p0_ 0)) then Transaction_start + else if sumbool_of_bool ((Z.eqb p0_ 1)) then Transaction_commit + else Transaction_abort. + +Definition num_of_trans_kind (arg_ : trans_kind) +: {e : Z & ArithFact (0 <= e /\ e <= 2)} := + + build_ex(match arg_ with + | Transaction_start => 0 + | Transaction_commit => 1 + | Transaction_abort => 2 + end). + +Definition GPRstr : vec string 32 := +vec_of_list_len ["x31";"x30";"x29";"x28";"x27";"x26";"x25";"x24";"x23";"x22";"x21";"x20";"x19";"x18";"x17";"x16";"x15";"x14";"x13";"x12";"x11"; + "x10";"x9";"x8";"x7";"x6";"x5";"x4";"x3";"x2";"x1";"x0"]. +Hint Unfold GPRstr : sail. +Definition CIA_fp := RFull ("CIA"). +Hint Unfold CIA_fp : sail. +Definition NIA_fp := RFull ("NIA"). +Hint Unfold NIA_fp : sail. +Definition initial_analysis (instr : ast) +: M ((list regfp * list regfp * list regfp * list niafp * diafp * instruction_kind)) := + + let iR := [] : regfps in + let oR := [] : regfps in + let aR := [] : regfps in + let ik := (IK_simple (tt)) : instruction_kind in + let Nias := [NIAFP_successor (tt)] : niafps in + let Dia := (DIAFP_none (tt)) : diafp in + (match instr with + | EBREAK (tt) => returnm (Nias, aR, iR, ik, oR) + | UTYPE (imm,rd,op) => + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + returnm (Nias, aR, iR, ik, oR) + | RISCV_JAL (imm,rd) => + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + let offset : bits 64 := EXTS 64 imm in + ((read_reg PC_ref) : M (mword 64)) >>= fun w__0 : xlenbits => + let Nias : niafps := [NIAFP_concrete_address (add_vec w__0 offset)] in + let ik : instruction_kind := IK_branch (tt) in + returnm (Nias, aR, iR, ik, oR) + | RISCV_JALR (imm,rs,rd) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + let offset : bits 64 := EXTS 64 imm in + let Nias : niafps := [NIAFP_indirect_address (tt)] in + let ik : instruction_kind := IK_branch (tt) in + returnm (Nias, aR, iR, ik, oR) + | BTYPE (imm,rs2,rs1,op) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs2)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs2)))) :: iR in + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: iR in + let ik := (IK_branch (tt)) : instruction_kind in + let offset : bits 64 := EXTS 64 imm in + ((read_reg PC_ref) : M (mword 64)) >>= fun w__1 : xlenbits => + let Nias : niafps := [NIAFP_concrete_address (add_vec w__1 offset);NIAFP_successor (tt)] in + returnm (Nias, aR, iR, ik, oR) + | ITYPE (imm,rs,rd,op) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + returnm (Nias, aR, iR, ik, oR) + | SHIFTIOP (imm,rs,rd,op) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + returnm (Nias, aR, iR, ik, oR) + | RTYPE (rs2,rs1,rd,op) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs2)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs2)))) :: iR in + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + returnm (Nias, aR, iR, ik, oR) + | CSR (csr,rs1,rd,is_imm,op) => + let isWrite : bool := + match op with + | CSRRW => true + | _ => if (is_imm) then neq_int (projT1 (uint rs1)) 0 else neq_int (projT1 (uint rs1)) 0 + end in + let iR : regfps := (RFull (csr_name csr)) :: iR in + let iR : regfps := + if ((negb is_imm)) then + (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: iR + else iR in + let oR : regfps := if (isWrite) then (RFull (csr_name csr)) :: oR else oR in + let oR : regfps := (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + returnm (Nias, aR, iR, ik, oR) + | LOAD (imm,rs,rd,unsign,width,aq,rl) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + let aR := iR : regfps in + (match (aq, rl) with + | (false, false) => returnm ((IK_mem_read (Read_plain)) : instruction_kind ) + | (true, false) => returnm ((IK_mem_read (Read_RISCV_acquire)) : instruction_kind ) + | (true, true) => returnm ((IK_mem_read (Read_RISCV_strong_acquire)) : instruction_kind ) + | _ => + (internal_error "LOAD type not implemented in initial_analysis") : M (instruction_kind) + end) >>= fun w__3 : instruction_kind => + let ik : instruction_kind := w__3 in + returnm (Nias, aR, iR, ik, oR) + | STORE (imm,rs2,rs1,width,aq,rl) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs2)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs2)))) :: iR in + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: iR in + let aR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then aR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: aR in + (match (aq, rl) with + | (false, false) => returnm ((IK_mem_write (Write_plain)) : instruction_kind ) + | (false, true) => returnm ((IK_mem_write (Write_RISCV_release)) : instruction_kind ) + | (true, true) => returnm ((IK_mem_write (Write_RISCV_strong_release)) : instruction_kind ) + | _ => + (internal_error "STORE type not implemented in initial_analysis") : M (instruction_kind) + end) >>= fun w__5 : instruction_kind => + let ik : instruction_kind := w__5 in + returnm (Nias, aR, iR, ik, oR) + | ADDIW (imm,rs,rd) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + returnm (Nias, aR, iR, ik, oR) + | SHIFTW (imm,rs,rd,op) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + returnm (Nias, aR, iR, ik, oR) + | RTYPEW (rs2,rs1,rd,op) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs2)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs2)))) :: iR in + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + returnm (Nias, aR, iR, ik, oR) + | FENCE (pred,succ) => + (match (pred, succ) with + | (v__844, v__845) => + (if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))))) + then + returnm ((IK_barrier + (Barrier_RISCV_rw_rw)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B1;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B1;B1] : mword (1 - 0 + 1))))) then + returnm ((IK_barrier + (Barrier_RISCV_r_rw)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B1;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) then + returnm ((IK_barrier + (Barrier_RISCV_r_r)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B1;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) then + returnm ((IK_barrier + (Barrier_RISCV_rw_w)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) then + returnm ((IK_barrier + (Barrier_RISCV_w_w)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B1;B1] : mword (1 - 0 + 1))))) then + returnm ((IK_barrier + (Barrier_RISCV_w_rw)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B1;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) then + returnm ((IK_barrier + (Barrier_RISCV_rw_r)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B1;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))))) then + returnm ((IK_barrier + (Barrier_RISCV_r_w)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B0;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B1;B0] : mword (1 - 0 + 1))))) then + returnm ((IK_barrier + (Barrier_RISCV_w_r)) + : instruction_kind ) + else if ((andb + (eq_vec (subrange_vec_dec v__844 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__845 1 0) + (vec_of_bits [B0;B0] : mword (1 - 0 + 1))))) then + returnm ((IK_simple + (tt)) + : instruction_kind ) + else + (internal_error "barrier type not implemented in initial_analysis") + : M (instruction_kind)) + : M (instruction_kind) + end) >>= fun w__17 : instruction_kind => + let ik : instruction_kind := w__17 in + returnm (Nias, aR, iR, ik, oR) + | FENCE_TSO (pred,succ) => + (match (pred, succ) with + | (v__884, v__885) => + (if ((andb + (eq_vec (subrange_vec_dec v__884 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))) + (eq_vec (subrange_vec_dec v__885 1 0) (vec_of_bits [B1;B1] : mword (1 - 0 + 1))))) + then + returnm ((IK_barrier + (Barrier_RISCV_tso)) + : instruction_kind ) + else + (internal_error "barrier type not implemented in initial_analysis") + : M (instruction_kind)) + : M (instruction_kind) + end) >>= fun w__20 : instruction_kind => + let ik : instruction_kind := w__20 in + returnm (Nias, aR, iR, ik, oR) + | FENCEI (tt) => + let ik : instruction_kind := IK_simple (tt) in + returnm (Nias, aR, iR, ik, oR) + | LOADRES (aq,rl,rs1,width,rd) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: iR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + let aR := iR : regfps in + (match (aq, rl) with + | (false, false) => returnm ((IK_mem_read (Read_RISCV_reserved)) : instruction_kind ) + | (true, false) => + returnm ((IK_mem_read (Read_RISCV_reserved_acquire)) : instruction_kind ) + | (true, true) => + returnm ((IK_mem_read (Read_RISCV_reserved_strong_acquire)) : instruction_kind ) + | (false, true) => + (internal_error "LOADRES type not implemented in initial_analysis") + : M (instruction_kind) + end) >>= fun w__22 : instruction_kind => + let ik : instruction_kind := w__22 in + returnm (Nias, aR, iR, ik, oR) + | STORECON (aq,rl,rs2,rs1,width,rd) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs2)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs2)))) :: iR in + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: iR in + let aR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then aR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: aR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + (match (aq, rl) with + | (false, false) => returnm ((IK_mem_write (Write_RISCV_conditional)) : instruction_kind ) + | (false, true) => + returnm ((IK_mem_write (Write_RISCV_conditional_release)) : instruction_kind ) + | (true, true) => + returnm ((IK_mem_write (Write_RISCV_conditional_strong_release)) : instruction_kind ) + | (true, false) => + (internal_error "STORECON type not implemented in initial_analysis") + : M (instruction_kind) + end) >>= fun w__24 : instruction_kind => + let ik : instruction_kind := w__24 in + returnm (Nias, aR, iR, ik, oR) + | AMO (op,aq,rl,rs2,rs1,width,rd) => + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs2)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs2)))) :: iR in + let iR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then iR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: iR in + let aR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rs1)) 0)) then aR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rs1)))) :: aR in + let oR : regfps := + if sumbool_of_bool ((Z.eqb (projT1 (regbits_to_regno rd)) 0)) then oR + else (RFull (vec_access_dec GPRstr (projT1 (regbits_to_regno rd)))) :: oR in + let ik : instruction_kind := + match (aq, rl) with + | (false, false) => IK_mem_rmw ((Read_RISCV_reserved, Write_RISCV_conditional)) + | (false, true) => IK_mem_rmw ((Read_RISCV_reserved, Write_RISCV_conditional_release)) + | (true, false) => IK_mem_rmw ((Read_RISCV_reserved_acquire, Write_RISCV_conditional)) + | (true, true) => + IK_mem_rmw ((Read_RISCV_reserved_acquire, Write_RISCV_conditional_release)) + end in + returnm (Nias, aR, iR, ik, oR) + | _ => returnm (Nias, aR, iR, ik, oR) + end) >>= fun '(Nias, aR, iR, ik, oR) => + returnm (iR, oR, aR, Nias, Dia, ik). + +Definition initial_regstate : regstate := +{| tlb39 := None; + htif_exit_code := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + htif_done := false; + htif_tohost := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mtimecmp := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + tselect := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + stval := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + scause := + ({| Mcause_Mcause_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + sepc := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + sscratch := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + stvec := + ({| Mtvec_Mtvec_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + satp := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + sideleg := + ({| Sinterrupts_Sinterrupts_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + sedeleg := + ({| Sedeleg_Sedeleg_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + pmpcfg0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + pmpaddr0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mhartid := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + marchid := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mimpid := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mvendorid := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + minstret_written := false; + minstret := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mtime := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mcycle := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + scounteren := + ({| Counteren_Counteren_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] + : mword 32) |}); + mcounteren := + ({| Counteren_Counteren_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0] + : mword 32) |}); + mscratch := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mtval := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mepc := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + mcause := + ({| Mcause_Mcause_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + mtvec := + ({| Mtvec_Mtvec_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + medeleg := + ({| Medeleg_Medeleg_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + mideleg := + ({| Minterrupts_Minterrupts_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + mie := + ({| Minterrupts_Minterrupts_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + mip := + ({| Minterrupts_Minterrupts_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + mstatus := + ({| Mstatus_Mstatus_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + misa := + ({| Misa_Misa_chunk_0 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}); + cur_inst := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + cur_privilege := User; + x31 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x30 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x29 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x28 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x27 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x26 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x25 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x24 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x23 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x22 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x21 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x20 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x19 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x18 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x17 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x16 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x15 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x14 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x13 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x12 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x11 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x10 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x9 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x8 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x7 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x6 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x5 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x4 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x3 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x2 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + x1 := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + Xs := + (vec_of_list_len [(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64);(vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64)]); + instbits := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + nextPC := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64); + PC := + (vec_of_bits [B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0;B0; + B0] + : mword 64) |}. +Hint Unfold initial_regstate : sail. + +End Content. |
