From 2e100780abcda98c3088e62387f380d67f5789a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=85=D8=B5=D8=B7=D9=81=D9=8A=20=D9=85=D8=AD=D9=85=D9=88?= =?UTF-8?q?=D8=AF=20=D9=83=D9=85=D8=A7=D9=84=20=D8=A7=D9=84=D8=AF=D9=8A?= =?UTF-8?q?=D9=86?= <48567303+moste00@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:22:18 +0200 Subject: [PATCH] added the start of operand details generation (for each instruction, what registers/literals/addresses it uses), added a do-not-modify warning at each generated file starts, improved smoke test --- .github/workflows/end2end-smoke-test.yml | 53 +- bin/main.ml | 83 +- lib/constants.ml | 4 + lib/decode_procedure.ml | 3 + lib/gen_decoder.ml | 22 +- lib/gen_decoder.mli | 2 +- lib/gen_operand_info.ml | 94 + lib/sail_analysis.ml | 10 + lib/sail_analysis.mli | 3 + lib/stringify.ml | 13 +- riscv_disasm/riscv_ast.gen.inc | 13 +- riscv_disasm/riscv_ast2str.gen.inc | 85 +- riscv_disasm/riscv_ast2str_tbls.gen.inc | 10 + riscv_disasm/riscv_decode.gen.inc | 15763 +++++++++-------- riscv_disasm/riscv_decode_compressed.gen.inc | 1043 ++ riscv_disasm/riscv_insn.gen.inc | 13 +- riscv_disasm/riscv_insn_mapping.gen.inc | 13 +- sail.filepaths.txt | 5 +- sail.hash.txt | 2 +- 19 files changed, 10157 insertions(+), 7077 deletions(-) create mode 100644 lib/gen_operand_info.ml create mode 100644 riscv_disasm/riscv_decode_compressed.gen.inc diff --git a/.github/workflows/end2end-smoke-test.yml b/.github/workflows/end2end-smoke-test.yml index cdeb5d4..7faa3fe 100644 --- a/.github/workflows/end2end-smoke-test.yml +++ b/.github/workflows/end2end-smoke-test.yml @@ -57,8 +57,12 @@ jobs: touch test_main.c echo '#include "riscv_decode.gen.inc"' >> test_main.c echo >> test_main.c + echo '#include "riscv_decode_compressed.gen.inc"' >> test_main.c + echo >> test_main.c echo '#include "riscv_ast2str.gen.inc"' >> test_main.c echo >> test_main.c + echo '#include "riscv_insn_mapping.gen.inc"' >> test_main.c + echo >> test_main.c echo 'void main() {}' >> test_main.c mv ../old_output/riscv_helpers_ast2str.h riscv_helpers_ast2str.h @@ -68,19 +72,40 @@ jobs: clang-format -i * - if diff -q riscv_ast.gen.inc ../old_output/riscv_ast.gen.inc > /dev/null 2>&1; then - if diff -q riscv_decode.gen.inc ../old_output/riscv_decode.gen.inc > /dev/null 2>&1; then - if diff -q riscv_ast2str.gen.inc ../old_output/riscv_ast2str.gen.inc > /dev/null 2>&1; then - echo "Success: The tool generates compiling C code that is identical to the files committed." - else - echo "Failure: The tool-generated ast stringification logic differ from the one committed in the repo" - exit 1 - fi - else - echo "Failure: The tool-generated decoding logic differ from the one committed in the repo." - exit 1 - fi - else + if ! diff -q riscv_ast.gen.inc ../old_output/riscv_ast.gen.inc > /dev/null 2>&1; then echo "Failure: The tool-generated ast definition differ from the one committed in the repo." exit 1 - fi \ No newline at end of file + fi + + if ! diff -q riscv_decode.gen.inc ../old_output/riscv_decode.gen.inc > /dev/null 2>&1; then + echo "Failure: The tool-generated decoding logic differ from the one committed in the repo." + exit 1 + fi + + if ! diff -q riscv_decode_compressed.gen.inc ../old_output/riscv_decode_compressed.gen.inc > /dev/null 2>&1; then + echo "Failure: The tool-generated compressed (16-bit) decoding logic differ from the one committed in the repo." + exit 1 + fi + + if ! diff -q riscv_ast2str_tbls.gen.inc ../old_output/riscv_ast2str_tbls.gen.inc > /dev/null 2>&1; then + echo "Failure: The tool-generated stringification helpers differ from the one committed in the repo" + exit 1 + fi + + if ! diff -q riscv_ast2str.gen.inc ../old_output/riscv_ast2str.gen.inc > /dev/null 2>&1; then + echo "Failure: The tool-generated ast stringification logic differ from the one committed in the repo" + exit 1 + fi + + if ! diff -q riscv_insn_mapping.gen.inc ../old_output/riscv_insn_mapping.gen.inc > /dev/null 2>&1; then + echo "Failure: The tool-generated ast-id->instruction-id mapping logic differ from the one committed in the repo" + exit 1 + fi + + if ! diff -q riscv_insn.gen.inc ../old_output/riscv_insn.gen.gen.inc > /dev/null 2>&1; then + echo "Failure: The tool-generated instruction ids differ from the one committed in the repo" + exit 1 + fi + + echo "Success: The tool generates compiling C code that is identical to the files committed." + \ No newline at end of file diff --git a/bin/main.ml b/bin/main.ml index 5979b4a..23bf835 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1,10 +1,38 @@ open Libsail open Type_check open Ast + open Riscv_disasm_from_sail open Constants +open Gen_decoder +open Gen_assembler +open Stringify + open Printexc +let get_generator_comment () = + let sail_hash = List.nth (Utils.read_file "sail.hash.txt") 0 in + let delimiter = + "=======================================================================" + in + "/*" + ^ String.concat "*/\n/*" + [ + delimiter; + + "This code was generated by the tool riscv_disasm_from_sail (see " + ^ "https://github.com/moste00/riscv_disasm_from_sail)"; + + "from the sail model of RISC-V (see " ^ + "https://github.com/riscv/sail-riscv) @ version " ^ sail_hash ^ "."; + + "DO NOT MODIFY THIS CODE MANUALLY."; + " "; + "SPDX-License-Identifier: BSD-3-Clause"; + delimiter; + ] + ^ "*/\n\n" + let mkdir_if_none_exists dirname = try Sys.mkdir dirname 0o777 with Sys_error _ -> () @@ -13,11 +41,19 @@ let write_c_file ?(additional_includes = []) name code = let oc = open_out ("riscv_disasm/" ^ name) in let mk_include_lines incs = - String.concat "\n" (List.map (fun i -> "#include " ^ i ^ "\n") incs) + String.concat "\n" + (List.map + (fun i -> + let delimiter = if i.[0] = '<' || i.[0] = '"' then "" else "\"" in + "#include " ^ delimiter ^ i ^ delimiter ^ "\n" + ) + incs + ) in - let include_string = mk_include_lines Constants.includes in + let include_string = mk_include_lines includes in let additional_includes_string = mk_include_lines additional_includes in let name_no_dots = String.map (fun c -> if c = '.' then '_' else c) name in + Printf.fprintf oc "%s" (get_generator_comment ()); Printf.fprintf oc "%s" ("#ifndef __" ^ String.capitalize_ascii name_no_dots ^ "__\n"); Printf.fprintf oc "%s" @@ -68,11 +104,16 @@ let ctypedefs_str = Stringify.stringify_typdef ctypedefs let analysis = Sail_analysis.analyze ast types -let dec = Gen_decoder.gen_decoder ast analysis +let dec = gen_decode_proc (gen_decoder ast_decode_mapping ast analysis) + +let compressed_dec = + gen_decode_proc (gen_decoder ast_compressed_decode_mapping ast analysis) -let proc_dec = Gen_decoder.gen_decode_proc dec +let dec_str = stringify_decode_procedure dec typdefwalker -let proc_dec_str = Stringify.stringify_decode_procedure proc_dec typdefwalker +let compressed_dec_str = + stringify_decode_procedure ~c_proc_name:"decode_compressed" compressed_dec + typdefwalker let asm = Gen_assembler.gen_asm ast analysis @@ -86,28 +127,26 @@ let instr_types = Gen_instr_types.gen_instr_types analysis gen_instr_types_conf let instr_types_str, instr_types_mapping_str = Stringify.stringify_instr_types instr_types typdefwalker -let () = write_c_file Constants.ast_type_filename ctypedefs_str -let () = - write_c_file Constants.decode_logic_filename proc_dec_str - ~additional_includes:["\"" ^ Constants.ast_type_filename ^ "\""] +let _ = Gen_operand_info.gen_operand_info ast analysis +let () = write_c_file ast_type_filename ctypedefs_str +let () = + write_c_file decode_logic_filename dec_str + ~additional_includes:[ast_type_filename] let () = - write_c_file Constants.assembler_filename asm_str + write_c_file compressed_decode_logic_filename compressed_dec_str + ~additional_includes:[ast_type_filename] +let () = + write_c_file assembler_filename asm_str ~additional_includes: - [ - "\"" ^ Constants.ast_type_filename ^ "\""; - "\"" ^ Constants.ast2str_tables_filename ^ "\""; - "\"riscv_helpers_ast2str.h\""; - ] + [ast_type_filename; ast2str_tables_filename; "riscv_helpers_ast2str.h"] let () = - write_c_file Constants.ast2str_tables_filename tables_str - ~additional_includes:["\"" ^ Constants.ast_type_filename ^ "\""] + write_c_file ast2str_tables_filename tables_str + ~additional_includes:[ast_type_filename] -let () = - write_c_file Constants.instr_types_filename instr_types_str - ~additional_includes:["\"" ^ Constants.ast_type_filename ^ "\""] +let () = write_c_file instr_types_filename instr_types_str let () = - write_c_file Constants.instr_types_mapping_filename instr_types_mapping_str - ~additional_includes:["\"" ^ Constants.instr_types_filename ^ "\""] + write_c_file instr_types_mapping_filename instr_types_mapping_str + ~additional_includes:[instr_types_filename] diff --git a/lib/constants.ml b/lib/constants.ml index 3a6bfef..b086778 100644 --- a/lib/constants.ml +++ b/lib/constants.ml @@ -4,6 +4,8 @@ let ast_sail_destructuring_function = "execute" let ast_decode_mapping = "encdec" +let ast_compressed_decode_mapping = "encdec_compressed" + let generated_ast_enum_suffix = "_node_type" let generated_ast_payload_suffix = "_node" @@ -18,6 +20,8 @@ let ast_type_filename = "riscv_ast.gen.inc" let decode_logic_filename = "riscv_decode.gen.inc" +let compressed_decode_logic_filename = "riscv_decode_compressed.gen.inc" + let identifier_prefix = "RISCV_" let ast_assembly_mapping = "assembly" diff --git a/lib/decode_procedure.ml b/lib/decode_procedure.ml index 4853bf5..24fb44c 100644 --- a/lib/decode_procedure.ml +++ b/lib/decode_procedure.ml @@ -29,5 +29,8 @@ type stmt = | Set_ast_next_case_member of value_xor_expr | Ret_ast | Block of stmt list + | Start_rule of string + | End_rule +(* delineate the beginning and end of an instruction group that implement one declarative rule*) type decproc = Proc of stmt diff --git a/lib/gen_decoder.ml b/lib/gen_decoder.ml index 51b72ee..dacb166 100644 --- a/lib/gen_decoder.ml +++ b/lib/gen_decoder.ml @@ -205,19 +205,19 @@ let calculate_instr_len state _ id _ typ = state.instr_length <- Some (calculate_instr_length typ) ) -let gen_decode_rule state _ id tannot left right = - if id_to_str id = ast_decode_mapping then ( +let gen_decode_rule decode_mappig_name state _ id tannot left right = + if id_to_str id = decode_mappig_name then ( let bindings, consequences = bind_args_and_create_consequences state left in let conditions = create_conditions state right bindings in state.decode_rules <- (conditions, consequences) :: state.decode_rules ) -let gen_decoder ast analysis = +let gen_decoder decode_mappig_name ast analysis = let state = { analysis; decode_rules = []; instr_length = None } in let decoder_gen_processor = { default_processor with - process_mapping_bidir_clause = gen_decode_rule; + process_mapping_bidir_clause = gen_decode_rule decode_mappig_name; process_val = calculate_instr_len; } in @@ -285,7 +285,7 @@ let gen_mapbind_stmt offsets (i, cond) body = Block [switch; If (Is_struct_var_valid var_name, body)] | _ -> body -let gen_stmt_from_conditions conds conseq_stmts = +let gen_stmt_from_conditions rule_name conds conseq_stmts = let offsets = calculate_offsets conds in let indices = List.mapi (fun i _ -> i) conds in let conds_indexed = List.combine indices conds in @@ -298,8 +298,10 @@ let gen_stmt_from_conditions conds conseq_stmts = (Block (List.append bind_stmts conseq_stmts)) in match assert_exprs with - | [] -> mapbind_stmt - | _ -> If (And assert_exprs, mapbind_stmt) + | [] -> Block [Start_rule rule_name; mapbind_stmt; End_rule] + | _ -> + Block + [Start_rule rule_name; If (And assert_exprs, mapbind_stmt); End_rule] let gen_stmt_from_consequences consequences = let head, bodies = consequences in @@ -326,11 +328,11 @@ let gen_stmt_from_consequences consequences = ) bodies in - List.append (Set_ast_case case_name :: body_stmts) [Ret_ast] + (List.append (Set_ast_case case_name :: body_stmts) [Ret_ast], case_name) let gen_stmt_from_rule rule = let conditions, consequences = rule in - let conseq_stmts = gen_stmt_from_consequences consequences in - gen_stmt_from_conditions conditions conseq_stmts + let conseq_stmts, name = gen_stmt_from_consequences consequences in + gen_stmt_from_conditions name conditions conseq_stmts let gen_decode_proc decoder = Proc (Block (List.map gen_stmt_from_rule decoder)) diff --git a/lib/gen_decoder.mli b/lib/gen_decoder.mli index 9f3d06f..f439e66 100644 --- a/lib/gen_decoder.mli +++ b/lib/gen_decoder.mli @@ -6,6 +6,6 @@ open Decoder open Decode_procedure open Sail_analysis -val gen_decoder : (tannot, env) ast -> sail_analysis_result -> decoder +val gen_decoder : string -> (tannot, env) ast -> sail_analysis_result -> decoder val gen_decode_proc : decoder -> decproc diff --git a/lib/gen_operand_info.ml b/lib/gen_operand_info.ml new file mode 100644 index 0000000..1224a12 --- /dev/null +++ b/lib/gen_operand_info.ml @@ -0,0 +1,94 @@ +open Libsail +open Ast + +open Sail_ast_foreach +open Sail_ast_processor +open Sail_utils +open Sail_analysis + +open Utils + +(* The four register files in RISCV and its standard extensions *) +(* The float and double register files overlap, but they should still + be counted as seperate for max clarity of information provided + by the generated disassembler *) +type regfile = Base | Float | Double | Vector +type operand = Reg of int * regfile + +type operand_info = (string, operand list) Hashtbl.t + +type operand_gen_iteration_state = { + analysis : sail_analysis_result; + info : operand_info; +} + +let destructure_arglist args = + let (P_aux (args_pat, _)) = args in + match args_pat with + | P_app (id, arg_names) -> ( + let args_tuple = Option.get (get_sole_element_or_none arg_names) in + match args_tuple with + | P_aux (P_tuple args, _) -> + print_endline + "\n--------------------SUCC----------------------------\n"; + ( id_to_str id, + List.map + (fun (P_aux (p, _)) -> + match p with P_id i -> id_to_str i | _ -> failwith "******" + ) + args + ) + | _ -> (id_to_str id, []) + ) + | _ -> failwith "__++__" + +let bind_regidx_args reg_indices_members arg_names = + let binding = Hashtbl.create (List.length reg_indices_members) in + List.iteri + (fun i arg_name -> + if List.mem i reg_indices_members then Hashtbl.add binding arg_name i + ) + arg_names; + binding + +let analyze_operands state _ fun_id func = + if id_to_str_noexn fun_id <> "execute" then + print_endline + ("\n\n -------------------- ENCOUNTERED " ^ id_to_str_noexn fun_id + ^ " FUNCTION, IGNORING IT \n\n" + ) + else ( + let (Pat_aux (pat, _)) = func in + let args, body = + match pat with Pat_exp (a, b) -> (a, b) | Pat_when (a, b, _) -> (a, b) + in + let case_name, arg_names = destructure_arglist args in + let reg_indices_members = + get_all_case_members_of_type_named state.analysis case_name "regidx" + in + let bound_args = bind_regidx_args reg_indices_members arg_names in + print_endline + ("+++++++++++++++++++++++++++ IN CASE " ^ case_name + ^ " +++++++++++++++++++++++++++++++" + ); + Hashtbl.iter + (fun arg_name arg_idx -> + print_endline + ("&&&&&&&&&&&&&&&&&&&&&& ARG " ^ arg_name ^ " IS ARG " + ^ string_of_int arg_idx ^ " )))))) \n\n" + ) + ) + bound_args + ) + +let gen_operand_info ast analysis = + let processor = + { default_processor with process_function_clause = analyze_operands } + in + let state = { analysis; info = Hashtbl.create 300 } in + foreach_node ast processor state; + print_endline + "\n\n\ + ================================== OPERAND ANALYSIS DONE \ + =============================================== \n\n\ + \ " diff --git a/lib/sail_analysis.ml b/lib/sail_analysis.ml index 4b5aeaf..407dbb9 100644 --- a/lib/sail_analysis.ml +++ b/lib/sail_analysis.ml @@ -429,3 +429,13 @@ let get_all_cases_with_enum_members ana = ) cases_type_sigs; cases_with_enum_members + +let get_all_case_members_of_type_named ana case_name type_name = + let cases_type_sigs = ana.type_ctx.union_cases_type_signatures in + let case_type_sig = Hashtbl.find cases_type_sigs case_name in + let case_type_sig_indexed = List.mapi (fun i t -> (i, t)) case_type_sig in + List.filter_map + (fun (i, t) -> + match t with Named_type name when name = type_name -> Some i | _ -> None + ) + case_type_sig_indexed diff --git a/lib/sail_analysis.mli b/lib/sail_analysis.mli index 2aa4539..200ec25 100644 --- a/lib/sail_analysis.mli +++ b/lib/sail_analysis.mli @@ -35,3 +35,6 @@ val get_struct2str_mapping : val get_all_cases_with_enum_members : sail_analysis_result -> (string, (int * string) list) Hashtbl.t + +val get_all_case_members_of_type_named : + sail_analysis_result -> string -> string -> int list diff --git a/lib/stringify.ml b/lib/stringify.ml index 62567c9..0637e78 100644 --- a/lib/stringify.ml +++ b/lib/stringify.ml @@ -99,7 +99,7 @@ let rec stringify_bv vars e = let rec stringify_bool vars b = match b with - | Is_eq (bv_expr, valu) -> stringify_bv vars bv_expr ^ " == " ^ valu + | Is_eq (bv_expr, valu) -> "(" ^ stringify_bv vars bv_expr ^ ") == " ^ valu | Is_enum_var_valid var -> var ^ " != 0xFFFF" ^ "FFFF" ^ "FFFF" ^ "FFFF" | Is_struct_var_valid var -> var ^ "_is_valid == 1" | And exprs -> @@ -107,6 +107,11 @@ let rec stringify_bool vars b = let rec stringify_stmt str_state stmt = match stmt with + | Start_rule rule_name -> + "\n// ---------------------------" ^ rule_name + ^ "-------------------------------\n {" + | End_rule -> + "}\n//------------------------------------------------------------\n" | Init (var, expr) -> Hashtbl.add str_state.currently_defined_bv_sizes var (bv_len str_state expr); @@ -184,10 +189,10 @@ let rec stringify_stmt str_state stmt = | Ret_ast -> "return " ^ ";" | Block stmts -> String.concat "" (List.map (stringify_stmt str_state) stmts) -let stringify_decode_procedure (Proc stmt) walker = +let stringify_decode_procedure ?(c_proc_name = "decode") (Proc stmt) walker = let procedure_start = - "void decode(struct " ^ ast_sail_def_name ^ " *" ^ ast_c_parameter - ^ ", uint64_t " ^ binary_stream_c_parameter ^ ") {" + "void " ^ c_proc_name ^ "(struct " ^ ast_sail_def_name ^ " *" + ^ ast_c_parameter ^ ", uint64_t " ^ binary_stream_c_parameter ^ ") {" in let procedure_end = "}" in let initial_state = diff --git a/riscv_disasm/riscv_ast.gen.inc b/riscv_disasm/riscv_ast.gen.inc index e842396..44491d3 100644 --- a/riscv_disasm/riscv_ast.gen.inc +++ b/riscv_disasm/riscv_ast.gen.inc @@ -1,3 +1,13 @@ +/*=======================================================================*/ +/*This code was generated by the tool riscv_disasm_from_sail (see + * https://github.com/moste00/riscv_disasm_from_sail)*/ +/*from the sail model of RISC-V (see https://github.com/riscv/sail-riscv) @ + * version 0b9c639f19da48734cbf14b61f6ad200b7c70de9.*/ +/*DO NOT MODIFY THIS CODE MANUALLY.*/ +/* */ +/*SPDX-License-Identifier: BSD-3-Clause*/ +/*=======================================================================*/ + #ifndef __Riscv_ast_gen_inc__ #define __Riscv_ast_gen_inc__ #include @@ -25,13 +35,13 @@ struct ast { RISCV_SHIFTIWOP, RISCV_FENCE, RISCV_FENCE_TSO, - RISCV_FENCEI, RISCV_ECALL, RISCV_MRET, RISCV_SRET, RISCV_EBREAK, RISCV_WFI, RISCV_SFENCE_VMA, + RISCV_FENCEI, RISCV_LOADRES, RISCV_STORECON, RISCV_AMO, @@ -76,7 +86,6 @@ struct ast { RISCV_DIVW, RISCV_REMW, RISCV_CSR, - RISCV_URET, RISCV_C_NOP_HINT, RISCV_C_ADDI_HINT, RISCV_C_LI_HINT, diff --git a/riscv_disasm/riscv_ast2str.gen.inc b/riscv_disasm/riscv_ast2str.gen.inc index 87d5ab8..86e2772 100644 --- a/riscv_disasm/riscv_ast2str.gen.inc +++ b/riscv_disasm/riscv_ast2str.gen.inc @@ -1,3 +1,13 @@ +/*=======================================================================*/ +/*This code was generated by the tool riscv_disasm_from_sail (see + * https://github.com/moste00/riscv_disasm_from_sail)*/ +/*from the sail model of RISC-V (see https://github.com/riscv/sail-riscv) @ + * version 0b9c639f19da48734cbf14b61f6ad200b7c70de9.*/ +/*DO NOT MODIFY THIS CODE MANUALLY.*/ +/* */ +/*SPDX-License-Identifier: BSD-3-Clause*/ +/*=======================================================================*/ + #ifndef __Riscv_ast2str_gen_inc__ #define __Riscv_ast2str_gen_inc__ #include @@ -516,13 +526,6 @@ void ast2str(struct ast *tree, char *buff, riscv_conf *conf) { fence_bits(tree->ast_node.fence_tso.succ, &s4, &s4_len, conf); DO_MEMCPY5; } break; - case RISCV_FENCEI: { - char *s0 = ""; - size_t s0_len = 0; - s0 = "fence.i"; - s0_len = 7; - DO_MEMCPY1; - } break; case RISCV_ECALL: { char *s0 = ""; size_t s0_len = 0; @@ -579,6 +582,13 @@ void ast2str(struct ast *tree, char *buff, riscv_conf *conf) { reg_name(tree->ast_node.sfence_vma.rs2, &s4, &s4_len); DO_MEMCPY5; } break; + case RISCV_FENCEI: { + char *s0 = ""; + size_t s0_len = 0; + s0 = "fence.i"; + s0_len = 7; + DO_MEMCPY1; + } break; case RISCV_LOADRES: { char *s0 = ""; size_t s0_len = 0; @@ -1744,13 +1754,6 @@ void ast2str(struct ast *tree, char *buff, riscv_conf *conf) { DO_MEMCPY7; } } break; - case RISCV_URET: { - char *s0 = ""; - size_t s0_len = 0; - s0 = "uret"; - s0_len = 4; - DO_MEMCPY1; - } break; case RISCV_C_NOP_HINT: { char *s0 = ""; size_t s0_len = 0; @@ -8910,6 +8913,60 @@ void ast2str(struct ast *tree, char *buff, riscv_conf *conf) { maybe_vmask(tree->ast_node.vsuxsegtype.vm, &s13, &s13_len, conf); DO_MEMCPY14; } break; + case RISCV_VSOXSEGTYPE: { + char *s0 = ""; + size_t s0_len = 0; + char *s1 = ""; + size_t s1_len = 0; + char *s2 = ""; + size_t s2_len = 0; + char *s3 = ""; + size_t s3_len = 0; + char *s4 = ""; + size_t s4_len = 0; + char s5_buffer[RISCV_TEMP_BUFFER_MAX_LEN] = {0}; + char *s5 = s5_buffer; + size_t s5_len = 0; + char *s6 = ""; + size_t s6_len = 0; + char s7_buffer[RISCV_TEMP_BUFFER_MAX_LEN] = {0}; + char *s7 = s7_buffer; + size_t s7_len = 0; + char *s8 = ""; + size_t s8_len = 0; + char *s9 = ""; + size_t s9_len = 0; + char *s10 = ""; + size_t s10_len = 0; + char s11_buffer[RISCV_TEMP_BUFFER_MAX_LEN] = {0}; + char *s11 = s11_buffer; + size_t s11_len = 0; + char *s12 = ""; + size_t s12_len = 0; + char s13_buffer[RISCV_TEMP_BUFFER_MAX_LEN] = {0}; + char *s13 = s13_buffer; + size_t s13_len = 0; + s0 = "vsox"; + s0_len = 4; + nfields_string(tree->ast_node.vsoxsegtype.nf, &s1, &s1_len); + s2 = "ei"; + s2_len = 2; + vlewidth_bitsnumberstr(tree->ast_node.vsoxsegtype.width, &s3, &s3_len); + s4 = ".v"; + s4_len = 2; + spc(&s5, &s5_len, conf); + vreg_name(tree->ast_node.vsoxsegtype.vs3, &s6, &s6_len); + sep(&s7, &s7_len, conf); + s8 = "("; + s8_len = 1; + reg_name(tree->ast_node.vsoxsegtype.rs1, &s9, &s9_len); + s10 = ")"; + s10_len = 1; + sep(&s11, &s11_len, conf); + reg_name(tree->ast_node.vsoxsegtype.vs2, &s12, &s12_len); + maybe_vmask(tree->ast_node.vsoxsegtype.vm, &s13, &s13_len, conf); + DO_MEMCPY14; + } break; case RISCV_VLRETYPE: { char *s0 = ""; size_t s0_len = 0; diff --git a/riscv_disasm/riscv_ast2str_tbls.gen.inc b/riscv_disasm/riscv_ast2str_tbls.gen.inc index 58ba21e..fd49df2 100644 --- a/riscv_disasm/riscv_ast2str_tbls.gen.inc +++ b/riscv_disasm/riscv_ast2str_tbls.gen.inc @@ -1,3 +1,13 @@ +/*=======================================================================*/ +/*This code was generated by the tool riscv_disasm_from_sail (see + * https://github.com/moste00/riscv_disasm_from_sail)*/ +/*from the sail model of RISC-V (see https://github.com/riscv/sail-riscv) @ + * version 0b9c639f19da48734cbf14b61f6ad200b7c70de9.*/ +/*DO NOT MODIFY THIS CODE MANUALLY.*/ +/* */ +/*SPDX-License-Identifier: BSD-3-Clause*/ +/*=======================================================================*/ + #ifndef __Riscv_ast2str_tbls_gen_inc__ #define __Riscv_ast2str_tbls_gen_inc__ #include diff --git a/riscv_disasm/riscv_decode.gen.inc b/riscv_disasm/riscv_decode.gen.inc index 36ff8ad..4fc6575 100644 --- a/riscv_disasm/riscv_decode.gen.inc +++ b/riscv_disasm/riscv_decode.gen.inc @@ -1,3 +1,13 @@ +/*=======================================================================*/ +/*This code was generated by the tool riscv_disasm_from_sail (see + * https://github.com/moste00/riscv_disasm_from_sail)*/ +/*from the sail model of RISC-V (see https://github.com/riscv/sail-riscv) @ + * version 0b9c639f19da48734cbf14b61f6ad200b7c70de9.*/ +/*DO NOT MODIFY THIS CODE MANUALLY.*/ +/* */ +/*SPDX-License-Identifier: BSD-3-Clause*/ +/*=======================================================================*/ + #ifndef __Riscv_decode_gen_inc__ #define __Riscv_decode_gen_inc__ #include @@ -8,7640 +18,9391 @@ #include void decode(struct ast *tree, uint64_t binary_stream) { - uint64_t op = 0xFFFFFFFFFFFFFFFF; - switch (binary_stream & 0x000000000000007F) { - case 0x37: - op = RISCV_LUI; - break; - case 0x17: - op = RISCV_AUIPC; - break; - } - if (op != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t imm = (binary_stream & 0x00000000FFFFF000) >> 12; - tree->ast_node_type = RISCV_UTYPE; - tree->ast_node.utype.imm = imm; - tree->ast_node.utype.rd = rd; - tree->ast_node.utype.op = op; - return; - } - if ((binary_stream & 0x000000000000007F == 0x6F)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t imm_7_0 = (binary_stream & 0x00000000000FF000) >> 12; - uint64_t imm_8 = (binary_stream & 0x0000000000100000) >> 20; - uint64_t imm_12_9 = (binary_stream & 0x0000000001E00000) >> 21; - uint64_t imm_18_13 = (binary_stream & 0x000000007E000000) >> 25; - uint64_t imm_19 = (binary_stream & 0x0000000080000000) >> 31; - tree->ast_node_type = RISCV_JAL; - tree->ast_node.riscv_jal.imm = (imm_19 << 23) | (imm_7_0 << 15) | - (imm_8 << 14) | (imm_18_13 << 8) | - (imm_12_9 << 4) | (0x0 << 0); - tree->ast_node.riscv_jal.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x67) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_JALR; - tree->ast_node.riscv_jalr.imm = imm; - tree->ast_node.riscv_jalr.rs1 = rs1; - tree->ast_node.riscv_jalr.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x63)) { + // ---------------------------UTYPE------------------------------- + { uint64_t op = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - op = RISCV_BGEU; - break; - case 0x5: - op = RISCV_BGE; - break; - case 0x1: - op = RISCV_BNE; - break; - case 0x4: - op = RISCV_BLT; - break; - case 0x6: - op = RISCV_BLTU; + switch (binary_stream & 0x000000000000007F) { + case 0x37: + op = RISCV_LUI; break; - case 0x0: - op = RISCV_BEQ; + case 0x17: + op = RISCV_AUIPC; break; } if (op != 0xFFFFFFFFFFFFFFFF) { - uint64_t imm5_0 = (binary_stream & 0x0000000000000080) >> 7; - uint64_t imm5_4_1 = (binary_stream & 0x0000000000000F00) >> 8; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t imm7_5_0 = (binary_stream & 0x000000007E000000) >> 25; - uint64_t imm7_6 = (binary_stream & 0x0000000080000000) >> 31; - tree->ast_node_type = RISCV_BTYPE; - tree->ast_node.btype.imm = (imm7_6 << 15) | (imm5_0 << 14) | - (imm7_5_0 << 8) | (imm5_4_1 << 4) | (0x0 << 0); - tree->ast_node.btype.rs2 = rs2; - tree->ast_node.btype.rs1 = rs1; - tree->ast_node.btype.op = op; + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t imm = (binary_stream & 0x00000000FFFFF000) >> 12; + tree->ast_node_type = RISCV_UTYPE; + tree->ast_node.utype.imm = imm; + tree->ast_node.utype.rd = rd; + tree->ast_node.utype.op = op; return; } } - if ((binary_stream & 0x000000000000007F == 0x13)) { - uint64_t op = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - op = RISCV_ANDI; - break; - case 0x3: - op = RISCV_SLTIU; - break; - case 0x2: - op = RISCV_SLTI; - break; - case 0x6: - op = RISCV_ORI; - break; - case 0x4: - op = RISCV_XORI; - break; - case 0x0: - op = RISCV_ADDI; - break; + //------------------------------------------------------------ + + // ---------------------------RISCV_JAL------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x6F)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t imm_7_0 = (binary_stream & 0x00000000000FF000) >> 12; + uint64_t imm_8 = (binary_stream & 0x0000000000100000) >> 20; + uint64_t imm_12_9 = (binary_stream & 0x0000000001E00000) >> 21; + uint64_t imm_18_13 = (binary_stream & 0x000000007E000000) >> 25; + uint64_t imm_19 = (binary_stream & 0x0000000080000000) >> 31; + tree->ast_node_type = RISCV_JAL; + tree->ast_node.riscv_jal.imm = (imm_19 << 23) | (imm_7_0 << 15) | + (imm_8 << 14) | (imm_18_13 << 8) | + (imm_12_9 << 4) | (0x0 << 0); + tree->ast_node.riscv_jal.rd = rd; + return; } - if (op != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------RISCV_JALR------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x67) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_ITYPE; - tree->ast_node.itype.imm = imm; - tree->ast_node.itype.rs1 = rs1; - tree->ast_node.itype.rd = rd; - tree->ast_node.itype.op = op; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_SHIFTIOP; - tree->ast_node.shiftiop.shamt = shamt; - tree->ast_node.shiftiop.rs1 = rs1; - tree->ast_node.shiftiop.rd = rd; - tree->ast_node.shiftiop.op = RISCV_SLLI; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_SHIFTIOP; - tree->ast_node.shiftiop.shamt = shamt; - tree->ast_node.shiftiop.rs1 = rs1; - tree->ast_node.shiftiop.rd = rd; - tree->ast_node.shiftiop.op = RISCV_SRLI; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_SHIFTIOP; - tree->ast_node.shiftiop.shamt = shamt; - tree->ast_node.shiftiop.rs1 = rs1; - tree->ast_node.shiftiop.rd = rd; - tree->ast_node.shiftiop.op = RISCV_SRAI; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_ADD; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_SLT; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_SLTU; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x7) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_AND; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_OR; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_XOR; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_SLL; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_SRL; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_SUB; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPE; - tree->ast_node.rtype.rs2 = rs2; - tree->ast_node.rtype.rs1 = rs1; - tree->ast_node.rtype.rd = rd; - tree->ast_node.rtype.op = RISCV_SRA; - return; - } - if ((binary_stream & 0x000000000000007F == 0x03)) { - uint64_t size = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000003000) >> 12) { - case 0x1: - size = RISCV_HALF; - break; - case 0x3: - size = RISCV_DOUBLE; - break; - case 0x2: - size = RISCV_WORD; - break; - case 0x0: - size = RISCV_BYTE; - break; + tree->ast_node_type = RISCV_JALR; + tree->ast_node.riscv_jalr.imm = imm; + tree->ast_node.riscv_jalr.rs1 = rs1; + tree->ast_node.riscv_jalr.rd = rd; + return; } - if (size != 0xFFFFFFFFFFFFFFFF) { - uint64_t is_unsigned = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000004000) >> 14) { + } + //------------------------------------------------------------ + + // ---------------------------BTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x63)) { + uint64_t op = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + op = RISCV_BGEU; + break; + case 0x5: + op = RISCV_BGE; + break; case 0x1: - is_unsigned = RISCV_true; + op = RISCV_BNE; + break; + case 0x4: + op = RISCV_BLT; + break; + case 0x6: + op = RISCV_BLTU; + break; + case 0x0: + op = RISCV_BEQ; + break; + } + if (op != 0xFFFFFFFFFFFFFFFF) { + uint64_t imm5_0 = (binary_stream & 0x0000000000000080) >> 7; + uint64_t imm5_4_1 = (binary_stream & 0x0000000000000F00) >> 8; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t imm7_5_0 = (binary_stream & 0x000000007E000000) >> 25; + uint64_t imm7_6 = (binary_stream & 0x0000000080000000) >> 31; + tree->ast_node_type = RISCV_BTYPE; + tree->ast_node.btype.imm = (imm7_6 << 15) | (imm5_0 << 14) | + (imm7_5_0 << 8) | (imm5_4_1 << 4) | + (0x0 << 0); + tree->ast_node.btype.rs2 = rs2; + tree->ast_node.btype.rs1 = rs1; + tree->ast_node.btype.op = op; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------ITYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13)) { + uint64_t op = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + op = RISCV_ANDI; + break; + case 0x3: + op = RISCV_SLTIU; + break; + case 0x2: + op = RISCV_SLTI; + break; + case 0x6: + op = RISCV_ORI; + break; + case 0x4: + op = RISCV_XORI; break; case 0x0: - is_unsigned = RISCV_false; + op = RISCV_ADDI; break; } - if (is_unsigned != 0xFFFFFFFFFFFFFFFF) { + if (op != 0xFFFFFFFFFFFFFFFF) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_LOAD; - tree->ast_node.load.imm = imm; - tree->ast_node.load.rs1 = rs1; - tree->ast_node.load.rd = rd; - tree->ast_node.load.is_unsigned = is_unsigned; - tree->ast_node.load.width = size; - tree->ast_node.load.aq = 0; - tree->ast_node.load.rl = 0; + tree->ast_node_type = RISCV_ITYPE; + tree->ast_node.itype.imm = imm; + tree->ast_node.itype.rs1 = rs1; + tree->ast_node.itype.rd = rd; + tree->ast_node.itype.op = op; return; } } } - if ((binary_stream & 0x000000000000007F == 0x23) && - ((binary_stream & 0x0000000000004000) >> 14 == 0x0)) { - uint64_t size = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000003000) >> 12) { - case 0x1: - size = RISCV_HALF; - break; - case 0x3: - size = RISCV_DOUBLE; - break; - case 0x2: - size = RISCV_WORD; - break; - case 0x0: - size = RISCV_BYTE; - break; - } - if (size != 0xFFFFFFFFFFFFFFFF) { - uint64_t imm5 = (binary_stream & 0x0000000000000F80) >> 7; + //------------------------------------------------------------ + + // ---------------------------SHIFTIOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t imm7 = (binary_stream & 0x00000000FE000000) >> 25; - tree->ast_node_type = RISCV_STORE; - tree->ast_node.store.imm = (imm7 << 5) | (imm5 << 0); - tree->ast_node.store.rs2 = rs2; - tree->ast_node.store.rs1 = rs1; - tree->ast_node.store.width = size; - tree->ast_node.store.aq = 0; - tree->ast_node.store.rl = 0; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_ADDIW; - tree->ast_node.addiw.imm = imm; - tree->ast_node.addiw.rs1 = rs1; - tree->ast_node.addiw.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPEW; - tree->ast_node.rtypew.rs2 = rs2; - tree->ast_node.rtypew.rs1 = rs1; - tree->ast_node.rtypew.rd = rd; - tree->ast_node.rtypew.op = RISCV_ADDW; - return; - } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPEW; - tree->ast_node.rtypew.rs2 = rs2; - tree->ast_node.rtypew.rs1 = rs1; - tree->ast_node.rtypew.rd = rd; - tree->ast_node.rtypew.op = RISCV_SUBW; - return; - } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPEW; - tree->ast_node.rtypew.rs2 = rs2; - tree->ast_node.rtypew.rs1 = rs1; - tree->ast_node.rtypew.rd = rd; - tree->ast_node.rtypew.op = RISCV_SLLW; - return; - } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPEW; - tree->ast_node.rtypew.rs2 = rs2; - tree->ast_node.rtypew.rs1 = rs1; - tree->ast_node.rtypew.rd = rd; - tree->ast_node.rtypew.op = RISCV_SRLW; - return; - } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RTYPEW; - tree->ast_node.rtypew.rs2 = rs2; - tree->ast_node.rtypew.rs1 = rs1; - tree->ast_node.rtypew.rd = rd; - tree->ast_node.rtypew.op = RISCV_SRAW; - return; - } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHIFTIWOP; - tree->ast_node.shiftiwop.shamt = shamt; - tree->ast_node.shiftiwop.rs1 = rs1; - tree->ast_node.shiftiwop.rd = rd; - tree->ast_node.shiftiwop.op = RISCV_SLLIW; - return; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_SHIFTIOP; + tree->ast_node.shiftiop.shamt = shamt; + tree->ast_node.shiftiop.rs1 = rs1; + tree->ast_node.shiftiop.rd = rd; + tree->ast_node.shiftiop.op = RISCV_SLLI; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHIFTIWOP; - tree->ast_node.shiftiwop.shamt = shamt; - tree->ast_node.shiftiwop.rs1 = rs1; - tree->ast_node.shiftiwop.rd = rd; - tree->ast_node.shiftiwop.op = RISCV_SRLIW; - return; + //------------------------------------------------------------ + + // ---------------------------SHIFTIOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_SHIFTIOP; + tree->ast_node.shiftiop.shamt = shamt; + tree->ast_node.shiftiop.rs1 = rs1; + tree->ast_node.shiftiop.rd = rd; + tree->ast_node.shiftiop.op = RISCV_SRLI; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHIFTIWOP; - tree->ast_node.shiftiwop.shamt = shamt; - tree->ast_node.shiftiwop.rs1 = rs1; - tree->ast_node.shiftiwop.rd = rd; - tree->ast_node.shiftiwop.op = RISCV_SRAIW; - return; + //------------------------------------------------------------ + + // ---------------------------SHIFTIOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_SHIFTIOP; + tree->ast_node.shiftiop.shamt = shamt; + tree->ast_node.shiftiop.rs1 = rs1; + tree->ast_node.shiftiop.rd = rd; + tree->ast_node.shiftiop.op = RISCV_SRAI; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x0F) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x00000000F0000000) >> 28 == 0x0)) { - uint64_t succ = (binary_stream & 0x0000000000F00000) >> 20; - uint64_t pred = (binary_stream & 0x000000000F000000) >> 24; - tree->ast_node_type = RISCV_FENCE; - tree->ast_node.fence.pred = pred; - tree->ast_node.fence.succ = succ; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_ADD; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x0F) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x00000000F0000000) >> 28 == 0x8)) { - uint64_t succ = (binary_stream & 0x0000000000F00000) >> 20; - uint64_t pred = (binary_stream & 0x000000000F000000) >> 24; - tree->ast_node_type = RISCV_FENCE_TSO; - tree->ast_node.fence_tso.pred = pred; - tree->ast_node.fence_tso.succ = succ; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_SLT; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x0F) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x000)) { - tree->ast_node_type = RISCV_FENCEI; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_SLTU; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x000)) { - tree->ast_node_type = RISCV_ECALL; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x7) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_AND; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x18)) { - tree->ast_node_type = RISCV_MRET; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_OR; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x08)) { - tree->ast_node_type = RISCV_SRET; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_XOR; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x001)) { - tree->ast_node_type = RISCV_EBREAK; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_SLL; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x105)) { - tree->ast_node_type = RISCV_WFI; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_SRL; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x09)) { - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SFENCE_VMA; - tree->ast_node.sfence_vma.rs1 = rs1; - tree->ast_node.sfence_vma.rs2 = rs2; - return; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_SUB; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x2F) && - ((binary_stream & 0x0000000000004000) >> 14 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000F8000000) >> 27 == 0x02)) { - uint64_t size = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000003000) >> 12) { - case 0x1: - size = RISCV_HALF; - break; - case 0x3: - size = RISCV_DOUBLE; - break; - case 0x2: - size = RISCV_WORD; - break; - case 0x0: - size = RISCV_BYTE; - break; + //------------------------------------------------------------ + + // ---------------------------RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RTYPE; + tree->ast_node.rtype.rs2 = rs2; + tree->ast_node.rtype.rs1 = rs1; + tree->ast_node.rtype.rd = rd; + tree->ast_node.rtype.op = RISCV_SRA; + return; } - if (size != 0xFFFFFFFFFFFFFFFF) { - uint64_t rl = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000002000000) >> 25) { + } + //------------------------------------------------------------ + + // ---------------------------LOAD------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x03)) { + uint64_t size = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000003000) >> 12) { case 0x1: - rl = RISCV_true; + size = RISCV_HALF; break; - case 0x0: - rl = RISCV_false; + case 0x3: + size = RISCV_DOUBLE; break; - } - if (rl != 0xFFFFFFFFFFFFFFFF) { - uint64_t aq = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000004000000) >> 26) { - case 0x1: - aq = RISCV_true; - break; - case 0x0: - aq = RISCV_false; - break; - } - if (aq != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_LOADRES; - tree->ast_node.loadres.aq = aq; - tree->ast_node.loadres.rl = rl; - tree->ast_node.loadres.rs1 = rs1; - tree->ast_node.loadres.width = size; - tree->ast_node.loadres.rd = rd; - return; - } - } - } - } - if ((binary_stream & 0x000000000000007F == 0x2F) && - ((binary_stream & 0x0000000000004000) >> 14 == 0x0) && - ((binary_stream & 0x00000000F8000000) >> 27 == 0x03)) { - uint64_t size = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000003000) >> 12) { - case 0x1: - size = RISCV_HALF; - break; - case 0x3: - size = RISCV_DOUBLE; - break; - case 0x2: - size = RISCV_WORD; - break; - case 0x0: - size = RISCV_BYTE; - break; - } - if (size != 0xFFFFFFFFFFFFFFFF) { - uint64_t rl = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000002000000) >> 25) { - case 0x1: - rl = RISCV_true; + case 0x2: + size = RISCV_WORD; break; case 0x0: - rl = RISCV_false; + size = RISCV_BYTE; break; } - if (rl != 0xFFFFFFFFFFFFFFFF) { - uint64_t aq = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000004000000) >> 26) { + if (size != 0xFFFFFFFFFFFFFFFF) { + uint64_t is_unsigned = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000004000) >> 14) { case 0x1: - aq = RISCV_true; + is_unsigned = RISCV_true; break; case 0x0: - aq = RISCV_false; + is_unsigned = RISCV_false; break; } - if (aq != 0xFFFFFFFFFFFFFFFF) { + if (is_unsigned != 0xFFFFFFFFFFFFFFFF) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_STORECON; - tree->ast_node.storecon.aq = aq; - tree->ast_node.storecon.rl = rl; - tree->ast_node.storecon.rs2 = rs2; - tree->ast_node.storecon.rs1 = rs1; - tree->ast_node.storecon.width = size; - tree->ast_node.storecon.rd = rd; + uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; + tree->ast_node_type = RISCV_LOAD; + tree->ast_node.load.imm = imm; + tree->ast_node.load.rs1 = rs1; + tree->ast_node.load.rd = rd; + tree->ast_node.load.is_unsigned = is_unsigned; + tree->ast_node.load.width = size; + tree->ast_node.load.aq = 0; + tree->ast_node.load.rl = 0; return; } } } } - if ((binary_stream & 0x000000000000007F == 0x2F) && - ((binary_stream & 0x0000000000004000) >> 14 == 0x0)) { - uint64_t size = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000003000) >> 12) { - case 0x1: - size = RISCV_HALF; - break; - case 0x3: - size = RISCV_DOUBLE; - break; - case 0x2: - size = RISCV_WORD; - break; - case 0x0: - size = RISCV_BYTE; - break; - } - if (size != 0xFFFFFFFFFFFFFFFF) { - uint64_t rl = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000002000000) >> 25) { + //------------------------------------------------------------ + + // ---------------------------STORE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x23) && + (((binary_stream & 0x0000000000004000) >> 14) == 0x0)) { + uint64_t size = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000003000) >> 12) { case 0x1: - rl = RISCV_true; + size = RISCV_HALF; + break; + case 0x3: + size = RISCV_DOUBLE; + break; + case 0x2: + size = RISCV_WORD; break; case 0x0: - rl = RISCV_false; + size = RISCV_BYTE; break; } - if (rl != 0xFFFFFFFFFFFFFFFF) { - uint64_t aq = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000004000000) >> 26) { - case 0x1: - aq = RISCV_true; - break; - case 0x0: - aq = RISCV_false; - break; - } - if (aq != 0xFFFFFFFFFFFFFFFF) { - uint64_t op = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000F8000000) >> 27) { - case 0x08: - op = RISCV_AMOOR; - break; - case 0x01: - op = RISCV_AMOSWAP; - break; - case 0x04: - op = RISCV_AMOXOR; - break; - case 0x10: - op = RISCV_AMOMIN; - break; - case 0x1C: - op = RISCV_AMOMAXU; - break; - case 0x14: - op = RISCV_AMOMAX; - break; - case 0x00: - op = RISCV_AMOADD; - break; - case 0x0C: - op = RISCV_AMOAND; - break; - case 0x18: - op = RISCV_AMOMINU; - break; - } - if (op != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_AMO; - tree->ast_node.amo.op = op; - tree->ast_node.amo.aq = aq; - tree->ast_node.amo.rl = rl; - tree->ast_node.amo.rs2 = rs2; - tree->ast_node.amo.rs1 = rs1; - tree->ast_node.amo.width = size; - tree->ast_node.amo.rd = rd; - return; - } - } + if (size != 0xFFFFFFFFFFFFFFFF) { + uint64_t imm5 = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t imm7 = (binary_stream & 0x00000000FE000000) >> 25; + tree->ast_node_type = RISCV_STORE; + tree->ast_node.store.imm = (imm7 << 5) | (imm5 << 0); + tree->ast_node.store.rs2 = rs2; + tree->ast_node.store.rs1 = rs1; + tree->ast_node.store.width = size; + tree->ast_node.store.aq = 0; + tree->ast_node.store.rl = 0; + return; } } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x01)) { - struct mul_op mul_op; - uint8_t mul_op_is_valid = 0; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x1: - mul_op.high = 1; - mul_op.signed_rs1 = 1; - mul_op.signed_rs2 = 1; - mul_op_is_valid = 1; - break; - case 0x3: - mul_op.high = 1; - mul_op.signed_rs1 = 0; - mul_op.signed_rs2 = 0; - mul_op_is_valid = 1; - break; - case 0x2: - mul_op.high = 1; - mul_op.signed_rs1 = 1; - mul_op.signed_rs2 = 0; - mul_op_is_valid = 1; - break; - case 0x0: - mul_op.high = 0; - mul_op.signed_rs1 = 1; - mul_op.signed_rs2 = 1; - mul_op_is_valid = 1; - break; - } - if (mul_op_is_valid == 1) { + //------------------------------------------------------------ + + // ---------------------------ADDIW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_MUL; - tree->ast_node.mul.rs2 = rs2; - tree->ast_node.mul.rs1 = rs1; - tree->ast_node.mul.rd = rd; - tree->ast_node.mul.mul_op = mul_op; + uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; + tree->ast_node_type = RISCV_ADDIW; + tree->ast_node.addiw.imm = imm; + tree->ast_node.addiw.rs1 = rs1; + tree->ast_node.addiw.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000006000) >> 13 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x01)) { - uint64_t s = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000001000) >> 12) { - case 0x1: - s = RISCV_false; - break; - case 0x0: - s = RISCV_true; - break; - } - if (s != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RTYPEW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_DIV; - tree->ast_node.div.rs2 = rs2; - tree->ast_node.div.rs1 = rs1; - tree->ast_node.div.rd = rd; - tree->ast_node.div.s = s; + tree->ast_node_type = RISCV_RTYPEW; + tree->ast_node.rtypew.rs2 = rs2; + tree->ast_node.rtypew.rs1 = rs1; + tree->ast_node.rtypew.rd = rd; + tree->ast_node.rtypew.op = RISCV_ADDW; return; } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000006000) >> 13 == 0x3) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x01)) { - uint64_t s = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000001000) >> 12) { - case 0x1: - s = RISCV_false; - break; - case 0x0: - s = RISCV_true; - break; - } - if (s != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_REM; - tree->ast_node.rem.rs2 = rs2; - tree->ast_node.rem.rs1 = rs1; - tree->ast_node.rem.rd = rd; - tree->ast_node.rem.s = s; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x01)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_MULW; - tree->ast_node.mulw.rs2 = rs2; - tree->ast_node.mulw.rs1 = rs1; - tree->ast_node.mulw.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000006000) >> 13 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x01)) { - uint64_t s = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000001000) >> 12) { - case 0x1: - s = RISCV_false; - break; - case 0x0: - s = RISCV_true; - break; - } - if (s != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RTYPEW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_DIVW; - tree->ast_node.divw.rs2 = rs2; - tree->ast_node.divw.rs1 = rs1; - tree->ast_node.divw.rd = rd; - tree->ast_node.divw.s = s; + tree->ast_node_type = RISCV_RTYPEW; + tree->ast_node.rtypew.rs2 = rs2; + tree->ast_node.rtypew.rs1 = rs1; + tree->ast_node.rtypew.rd = rd; + tree->ast_node.rtypew.op = RISCV_SUBW; return; } } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000006000) >> 13 == 0x3) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x01)) { - uint64_t s = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000001000) >> 12) { - case 0x1: - s = RISCV_false; - break; - case 0x0: - s = RISCV_true; - break; - } - if (s != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RTYPEW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_REMW; - tree->ast_node.remw.rs2 = rs2; - tree->ast_node.remw.rs1 = rs1; - tree->ast_node.remw.rd = rd; - tree->ast_node.remw.s = s; + tree->ast_node_type = RISCV_RTYPEW; + tree->ast_node.rtypew.rs2 = rs2; + tree->ast_node.rtypew.rs1 = rs1; + tree->ast_node.rtypew.rd = rd; + tree->ast_node.rtypew.op = RISCV_SLLW; return; } } - if ((binary_stream & 0x000000000000007F == 0x73)) { - uint64_t op = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000003000) >> 12) { - case 0x1: - op = RISCV_CSRRW; - break; - case 0x3: - op = RISCV_CSRRC; - break; - case 0x2: - op = RISCV_CSRRS; - break; - } - if (op != 0xFFFFFFFFFFFFFFFF) { - uint64_t is_imm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000004000) >> 14) { - case 0x1: - is_imm = RISCV_true; - break; - case 0x0: - is_imm = RISCV_false; - break; - } - if (is_imm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t csr = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_CSR; - tree->ast_node.csr.csr = csr; - tree->ast_node.csr.rs1 = rs1; - tree->ast_node.csr.rd = rd; - tree->ast_node.csr.is_imm = is_imm; - tree->ast_node.csr.op = op; - return; - } - } - } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - tree->ast_node_type = RISCV_URET; - return; - } - if ((binary_stream & 0x000000000000007F == 0x0F) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t succ = (binary_stream & 0x0000000000F00000) >> 20; - uint64_t pred = (binary_stream & 0x000000000F000000) >> 24; - uint64_t fm = (binary_stream & 0x00000000F0000000) >> 28; - tree->ast_node_type = RISCV_FENCE_RESERVED; - tree->ast_node.fence_reserved.fm = fm; - tree->ast_node.fence_reserved.pred = pred; - tree->ast_node.fence_reserved.succ = succ; - tree->ast_node.fence_reserved.rs = rs; - tree->ast_node.fence_reserved.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x0F) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_FENCEI_RESERVED; - tree->ast_node.fencei_reserved.imm = imm; - tree->ast_node.fencei_reserved.rs = rs; - tree->ast_node.fencei_reserved.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_LOAD_FP; - tree->ast_node.load_fp.imm = imm; - tree->ast_node.load_fp.rs1 = rs1; - tree->ast_node.load_fp.rd = rd; - tree->ast_node.load_fp.width = RISCV_HALF; - return; - } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_LOAD_FP; - tree->ast_node.load_fp.imm = imm; - tree->ast_node.load_fp.rs1 = rs1; - tree->ast_node.load_fp.rd = rd; - tree->ast_node.load_fp.width = RISCV_WORD; - return; - } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; - tree->ast_node_type = RISCV_LOAD_FP; - tree->ast_node.load_fp.imm = imm; - tree->ast_node.load_fp.rs1 = rs1; - tree->ast_node.load_fp.rd = rd; - tree->ast_node.load_fp.width = RISCV_DOUBLE; - return; - } - if ((binary_stream & 0x000000000000007F == 0x27) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t imm5 = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t imm7 = (binary_stream & 0x00000000FE000000) >> 25; - tree->ast_node_type = RISCV_STORE_FP; - tree->ast_node.store_fp.imm = (imm7 << 5) | (imm5 << 0); - tree->ast_node.store_fp.rs2 = rs2; - tree->ast_node.store_fp.rs1 = rs1; - tree->ast_node.store_fp.width = RISCV_HALF; - return; - } - if ((binary_stream & 0x000000000000007F == 0x27) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t imm5 = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t imm7 = (binary_stream & 0x00000000FE000000) >> 25; - tree->ast_node_type = RISCV_STORE_FP; - tree->ast_node.store_fp.imm = (imm7 << 5) | (imm5 << 0); - tree->ast_node.store_fp.rs2 = rs2; - tree->ast_node.store_fp.rs1 = rs1; - tree->ast_node.store_fp.width = RISCV_WORD; - return; - } - if ((binary_stream & 0x000000000000007F == 0x27) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3)) { - uint64_t imm5 = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t imm7 = (binary_stream & 0x00000000FE000000) >> 25; - tree->ast_node_type = RISCV_STORE_FP; - tree->ast_node.store_fp.imm = (imm7 << 5) | (imm5 << 0); - tree->ast_node.store_fp.rs2 = rs2; - tree->ast_node.store_fp.rs1 = rs1; - tree->ast_node.store_fp.width = RISCV_DOUBLE; - return; - } - if ((binary_stream & 0x000000000000007F == 0x43) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x0)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_S; - tree->ast_node.f_madd_type_s.rs3 = rs3; - tree->ast_node.f_madd_type_s.rs2 = rs2; - tree->ast_node.f_madd_type_s.rs1 = rs1; - tree->ast_node.f_madd_type_s.rm = rm; - tree->ast_node.f_madd_type_s.rd = rd; - tree->ast_node.f_madd_type_s.op = RISCV_FMADD_S; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x47) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x0)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_S; - tree->ast_node.f_madd_type_s.rs3 = rs3; - tree->ast_node.f_madd_type_s.rs2 = rs2; - tree->ast_node.f_madd_type_s.rs1 = rs1; - tree->ast_node.f_madd_type_s.rm = rm; - tree->ast_node.f_madd_type_s.rd = rd; - tree->ast_node.f_madd_type_s.op = RISCV_FMSUB_S; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x4B) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x0)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_S; - tree->ast_node.f_madd_type_s.rs3 = rs3; - tree->ast_node.f_madd_type_s.rs2 = rs2; - tree->ast_node.f_madd_type_s.rs1 = rs1; - tree->ast_node.f_madd_type_s.rm = rm; - tree->ast_node.f_madd_type_s.rd = rd; - tree->ast_node.f_madd_type_s.op = RISCV_FNMSUB_S; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x4F) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x0)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_S; - tree->ast_node.f_madd_type_s.rs3 = rs3; - tree->ast_node.f_madd_type_s.rs2 = rs2; - tree->ast_node.f_madd_type_s.rs1 = rs1; - tree->ast_node.f_madd_type_s.rm = rm; - tree->ast_node.f_madd_type_s.rd = rd; - tree->ast_node.f_madd_type_s.op = RISCV_FNMADD_S; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x00)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RTYPEW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_S; - tree->ast_node.f_bin_rm_type_s.rs2 = rs2; - tree->ast_node.f_bin_rm_type_s.rs1 = rs1; - tree->ast_node.f_bin_rm_type_s.rm = rm; - tree->ast_node.f_bin_rm_type_s.rd = rd; - tree->ast_node.f_bin_rm_type_s.op = RISCV_FADD_S; + tree->ast_node_type = RISCV_RTYPEW; + tree->ast_node.rtypew.rs2 = rs2; + tree->ast_node.rtypew.rs1 = rs1; + tree->ast_node.rtypew.rd = rd; + tree->ast_node.rtypew.op = RISCV_SRLW; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x04)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RTYPEW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_S; - tree->ast_node.f_bin_rm_type_s.rs2 = rs2; - tree->ast_node.f_bin_rm_type_s.rs1 = rs1; - tree->ast_node.f_bin_rm_type_s.rm = rm; - tree->ast_node.f_bin_rm_type_s.rd = rd; - tree->ast_node.f_bin_rm_type_s.op = RISCV_FSUB_S; + tree->ast_node_type = RISCV_RTYPEW; + tree->ast_node.rtypew.rs2 = rs2; + tree->ast_node.rtypew.rs1 = rs1; + tree->ast_node.rtypew.rd = rd; + tree->ast_node.rtypew.op = RISCV_SRAW; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x08)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------SHIFTIWOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_S; - tree->ast_node.f_bin_rm_type_s.rs2 = rs2; - tree->ast_node.f_bin_rm_type_s.rs1 = rs1; - tree->ast_node.f_bin_rm_type_s.rm = rm; - tree->ast_node.f_bin_rm_type_s.rd = rd; - tree->ast_node.f_bin_rm_type_s.op = RISCV_FMUL_S; + uint64_t shamt = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHIFTIWOP; + tree->ast_node.shiftiwop.shamt = shamt; + tree->ast_node.shiftiwop.rs1 = rs1; + tree->ast_node.shiftiwop.rd = rd; + tree->ast_node.shiftiwop.op = RISCV_SLLIW; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x0C)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_S; - tree->ast_node.f_bin_rm_type_s.rs2 = rs2; - tree->ast_node.f_bin_rm_type_s.rs1 = rs1; - tree->ast_node.f_bin_rm_type_s.rm = rm; - tree->ast_node.f_bin_rm_type_s.rd = rd; - tree->ast_node.f_bin_rm_type_s.op = RISCV_FDIV_S; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x2C)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------SHIFTIWOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FSQRT_S; + uint64_t shamt = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHIFTIWOP; + tree->ast_node.shiftiwop.shamt = shamt; + tree->ast_node.shiftiwop.rs1 = rs1; + tree->ast_node.shiftiwop.rd = rd; + tree->ast_node.shiftiwop.op = RISCV_SRLIW; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x60)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------SHIFTIWOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_W_S; + uint64_t shamt = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHIFTIWOP; + tree->ast_node.shiftiwop.shamt = shamt; + tree->ast_node.shiftiwop.rs1 = rs1; + tree->ast_node.shiftiwop.rd = rd; + tree->ast_node.shiftiwop.op = RISCV_SRAIW; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x60)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_WU_S; + //------------------------------------------------------------ + + // ---------------------------FENCE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x0F) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x00000000F0000000) >> 28) == 0x0)) { + uint64_t succ = (binary_stream & 0x0000000000F00000) >> 20; + uint64_t pred = (binary_stream & 0x000000000F000000) >> 24; + tree->ast_node_type = RISCV_FENCE; + tree->ast_node.fence.pred = pred; + tree->ast_node.fence.succ = succ; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------FENCE_TSO------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x0F) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x00000000F0000000) >> 28) == 0x8)) { + uint64_t succ = (binary_stream & 0x0000000000F00000) >> 20; + uint64_t pred = (binary_stream & 0x000000000F000000) >> 24; + tree->ast_node_type = RISCV_FENCE_TSO; + tree->ast_node.fence_tso.pred = pred; + tree->ast_node.fence_tso.succ = succ; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ECALL------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x000)) { + tree->ast_node_type = RISCV_ECALL; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x68)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_S_W; + //------------------------------------------------------------ + + // ---------------------------MRET------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x18)) { + tree->ast_node_type = RISCV_MRET; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x68)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_S_WU; + //------------------------------------------------------------ + + // ---------------------------SRET------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x08)) { + tree->ast_node_type = RISCV_SRET; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x60)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_L_S; + //------------------------------------------------------------ + + // ---------------------------EBREAK------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x001)) { + tree->ast_node_type = RISCV_EBREAK; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x03) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x60)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_LU_S; + //------------------------------------------------------------ + + // ---------------------------WFI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x105)) { + tree->ast_node_type = RISCV_WFI; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x68)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + //------------------------------------------------------------ + + // ---------------------------SFENCE_VMA------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x09)) { uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_S_L; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SFENCE_VMA; + tree->ast_node.sfence_vma.rs1 = rs1; + tree->ast_node.sfence_vma.rs2 = rs2; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x03) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x68)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; - tree->ast_node.f_un_rm_type_s.rs1 = rs1; - tree->ast_node.f_un_rm_type_s.rm = rm; - tree->ast_node.f_un_rm_type_s.rd = rd; - tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_S_LU; + //------------------------------------------------------------ + + // ---------------------------FENCEI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x0F) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x000)) { + tree->ast_node_type = RISCV_FENCEI; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_S; - tree->ast_node.f_bin_type_s.rs2 = rs2; - tree->ast_node.f_bin_type_s.rs1 = rs1; - tree->ast_node.f_bin_type_s.rd = rd; - tree->ast_node.f_bin_type_s.fle_s = RISCV_FSGNJ_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_S; - tree->ast_node.f_bin_type_s.rs2 = rs2; - tree->ast_node.f_bin_type_s.rs1 = rs1; - tree->ast_node.f_bin_type_s.rd = rd; - tree->ast_node.f_bin_type_s.fle_s = RISCV_FSGNJN_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_S; - tree->ast_node.f_bin_type_s.rs2 = rs2; - tree->ast_node.f_bin_type_s.rs1 = rs1; - tree->ast_node.f_bin_type_s.rd = rd; - tree->ast_node.f_bin_type_s.fle_s = RISCV_FSGNJX_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x14)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_S; - tree->ast_node.f_bin_type_s.rs2 = rs2; - tree->ast_node.f_bin_type_s.rs1 = rs1; - tree->ast_node.f_bin_type_s.rd = rd; - tree->ast_node.f_bin_type_s.fle_s = RISCV_FMIN_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x14)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_S; - tree->ast_node.f_bin_type_s.rs2 = rs2; - tree->ast_node.f_bin_type_s.rs1 = rs1; - tree->ast_node.f_bin_type_s.rd = rd; - tree->ast_node.f_bin_type_s.fle_s = RISCV_FMAX_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x50)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_S; - tree->ast_node.f_bin_type_s.rs2 = rs2; - tree->ast_node.f_bin_type_s.rs1 = rs1; - tree->ast_node.f_bin_type_s.rd = rd; - tree->ast_node.f_bin_type_s.fle_s = RISCV_FEQ_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x50)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_S; - tree->ast_node.f_bin_type_s.rs2 = rs2; - tree->ast_node.f_bin_type_s.rs1 = rs1; - tree->ast_node.f_bin_type_s.rd = rd; - tree->ast_node.f_bin_type_s.fle_s = RISCV_FLT_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x50)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_S; - tree->ast_node.f_bin_type_s.rs2 = rs2; - tree->ast_node.f_bin_type_s.rs1 = rs1; - tree->ast_node.f_bin_type_s.rd = rd; - tree->ast_node.f_bin_type_s.fle_s = RISCV_FLE_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x70)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_S; - tree->ast_node.f_un_type_s.rs1 = rs1; - tree->ast_node.f_un_type_s.rd = rd; - tree->ast_node.f_un_type_s.fmv_w_x = RISCV_FCLASS_S; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x70)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_S; - tree->ast_node.f_un_type_s.rs1 = rs1; - tree->ast_node.f_un_type_s.rd = rd; - tree->ast_node.f_un_type_s.fmv_w_x = RISCV_FMV_X_W; - return; + //------------------------------------------------------------ + + // ---------------------------LOADRES------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x2F) && + (((binary_stream & 0x0000000000004000) >> 14) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000F8000000) >> 27) == 0x02)) { + uint64_t size = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000003000) >> 12) { + case 0x1: + size = RISCV_HALF; + break; + case 0x3: + size = RISCV_DOUBLE; + break; + case 0x2: + size = RISCV_WORD; + break; + case 0x0: + size = RISCV_BYTE; + break; + } + if (size != 0xFFFFFFFFFFFFFFFF) { + uint64_t rl = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000002000000) >> 25) { + case 0x1: + rl = RISCV_true; + break; + case 0x0: + rl = RISCV_false; + break; + } + if (rl != 0xFFFFFFFFFFFFFFFF) { + uint64_t aq = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000004000000) >> 26) { + case 0x1: + aq = RISCV_true; + break; + case 0x0: + aq = RISCV_false; + break; + } + if (aq != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_LOADRES; + tree->ast_node.loadres.aq = aq; + tree->ast_node.loadres.rl = rl; + tree->ast_node.loadres.rs1 = rs1; + tree->ast_node.loadres.width = size; + tree->ast_node.loadres.rd = rd; + return; + } + } + } + } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x78)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_S; - tree->ast_node.f_un_type_s.rs1 = rs1; - tree->ast_node.f_un_type_s.rd = rd; - tree->ast_node.f_un_type_s.fmv_w_x = RISCV_FMV_W_X; - return; - } - if ((binary_stream & 0x000000000000007F == 0x43) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x1)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------STORECON------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x2F) && + (((binary_stream & 0x0000000000004000) >> 14) == 0x0) && + (((binary_stream & 0x00000000F8000000) >> 27) == 0x03)) { + uint64_t size = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000003000) >> 12) { + case 0x1: + size = RISCV_HALF; + break; + case 0x3: + size = RISCV_DOUBLE; + break; + case 0x2: + size = RISCV_WORD; + break; + case 0x0: + size = RISCV_BYTE; + break; + } + if (size != 0xFFFFFFFFFFFFFFFF) { + uint64_t rl = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000002000000) >> 25) { + case 0x1: + rl = RISCV_true; + break; + case 0x0: + rl = RISCV_false; + break; + } + if (rl != 0xFFFFFFFFFFFFFFFF) { + uint64_t aq = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000004000000) >> 26) { + case 0x1: + aq = RISCV_true; + break; + case 0x0: + aq = RISCV_false; + break; + } + if (aq != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_STORECON; + tree->ast_node.storecon.aq = aq; + tree->ast_node.storecon.rl = rl; + tree->ast_node.storecon.rs2 = rs2; + tree->ast_node.storecon.rs1 = rs1; + tree->ast_node.storecon.width = size; + tree->ast_node.storecon.rd = rd; + return; + } + } + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_D; - tree->ast_node.f_madd_type_d.rs3 = rs3; - tree->ast_node.f_madd_type_d.rs2 = rs2; - tree->ast_node.f_madd_type_d.rs1 = rs1; - tree->ast_node.f_madd_type_d.rm = rm; - tree->ast_node.f_madd_type_d.rd = rd; - tree->ast_node.f_madd_type_d.op = RISCV_FMADD_D; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x47) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x1)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + } + //------------------------------------------------------------ + + // ---------------------------AMO------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x2F) && + (((binary_stream & 0x0000000000004000) >> 14) == 0x0)) { + uint64_t size = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000003000) >> 12) { + case 0x1: + size = RISCV_HALF; + break; + case 0x3: + size = RISCV_DOUBLE; + break; + case 0x2: + size = RISCV_WORD; + break; + case 0x0: + size = RISCV_BYTE; + break; + } + if (size != 0xFFFFFFFFFFFFFFFF) { + uint64_t rl = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000002000000) >> 25) { + case 0x1: + rl = RISCV_true; + break; + case 0x0: + rl = RISCV_false; + break; + } + if (rl != 0xFFFFFFFFFFFFFFFF) { + uint64_t aq = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000004000000) >> 26) { + case 0x1: + aq = RISCV_true; + break; + case 0x0: + aq = RISCV_false; + break; + } + if (aq != 0xFFFFFFFFFFFFFFFF) { + uint64_t op = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000F8000000) >> 27) { + case 0x08: + op = RISCV_AMOOR; + break; + case 0x01: + op = RISCV_AMOSWAP; + break; + case 0x04: + op = RISCV_AMOXOR; + break; + case 0x10: + op = RISCV_AMOMIN; + break; + case 0x1C: + op = RISCV_AMOMAXU; + break; + case 0x14: + op = RISCV_AMOMAX; + break; + case 0x00: + op = RISCV_AMOADD; + break; + case 0x0C: + op = RISCV_AMOAND; + break; + case 0x18: + op = RISCV_AMOMINU; + break; + } + if (op != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_AMO; + tree->ast_node.amo.op = op; + tree->ast_node.amo.aq = aq; + tree->ast_node.amo.rl = rl; + tree->ast_node.amo.rs2 = rs2; + tree->ast_node.amo.rs1 = rs1; + tree->ast_node.amo.width = size; + tree->ast_node.amo.rd = rd; + return; + } + } + } + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_D; - tree->ast_node.f_madd_type_d.rs3 = rs3; - tree->ast_node.f_madd_type_d.rs2 = rs2; - tree->ast_node.f_madd_type_d.rs1 = rs1; - tree->ast_node.f_madd_type_d.rm = rm; - tree->ast_node.f_madd_type_d.rd = rd; - tree->ast_node.f_madd_type_d.op = RISCV_FMSUB_D; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x4B) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x1)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + } + //------------------------------------------------------------ + + // ---------------------------MUL------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x01)) { + struct mul_op mul_op; + uint8_t mul_op_is_valid = 0; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x1: + mul_op.high = 1; + mul_op.signed_rs1 = 1; + mul_op.signed_rs2 = 1; + mul_op_is_valid = 1; + break; + case 0x3: + mul_op.high = 1; + mul_op.signed_rs1 = 0; + mul_op.signed_rs2 = 0; + mul_op_is_valid = 1; + break; + case 0x2: + mul_op.high = 1; + mul_op.signed_rs1 = 1; + mul_op.signed_rs2 = 0; + mul_op_is_valid = 1; + break; + case 0x0: + mul_op.high = 0; + mul_op.signed_rs1 = 1; + mul_op.signed_rs2 = 1; + mul_op_is_valid = 1; + break; + } + if (mul_op_is_valid == 1) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_MUL; + tree->ast_node.mul.rs2 = rs2; + tree->ast_node.mul.rs1 = rs1; + tree->ast_node.mul.rd = rd; + tree->ast_node.mul.mul_op = mul_op; + return; + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_D; - tree->ast_node.f_madd_type_d.rs3 = rs3; - tree->ast_node.f_madd_type_d.rs2 = rs2; - tree->ast_node.f_madd_type_d.rs1 = rs1; - tree->ast_node.f_madd_type_d.rm = rm; - tree->ast_node.f_madd_type_d.rd = rd; - tree->ast_node.f_madd_type_d.op = RISCV_FNMSUB_D; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x4F) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x1)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + } + //------------------------------------------------------------ + + // ---------------------------DIV------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000006000) >> 13) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x01)) { + uint64_t s = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000001000) >> 12) { + case 0x1: + s = RISCV_false; + break; + case 0x0: + s = RISCV_true; + break; + } + if (s != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_DIV; + tree->ast_node.div.rs2 = rs2; + tree->ast_node.div.rs1 = rs1; + tree->ast_node.div.rd = rd; + tree->ast_node.div.s = s; + return; + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_D; - tree->ast_node.f_madd_type_d.rs3 = rs3; - tree->ast_node.f_madd_type_d.rs2 = rs2; - tree->ast_node.f_madd_type_d.rs1 = rs1; - tree->ast_node.f_madd_type_d.rm = rm; - tree->ast_node.f_madd_type_d.rd = rd; - tree->ast_node.f_madd_type_d.op = RISCV_FNMADD_D; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x01)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + } + //------------------------------------------------------------ + + // ---------------------------REM------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000006000) >> 13) == 0x3) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x01)) { + uint64_t s = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000001000) >> 12) { + case 0x1: + s = RISCV_false; + break; + case 0x0: + s = RISCV_true; + break; + } + if (s != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_REM; + tree->ast_node.rem.rs2 = rs2; + tree->ast_node.rem.rs1 = rs1; + tree->ast_node.rem.rd = rd; + tree->ast_node.rem.s = s; + return; + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------MULW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x01)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_D; - tree->ast_node.f_bin_rm_type_d.rs2 = rs2; - tree->ast_node.f_bin_rm_type_d.rs1 = rs1; - tree->ast_node.f_bin_rm_type_d.rm = rm; - tree->ast_node.f_bin_rm_type_d.rd = rd; - tree->ast_node.f_bin_rm_type_d.op = RISCV_FADD_D; + tree->ast_node_type = RISCV_MULW; + tree->ast_node.mulw.rs2 = rs2; + tree->ast_node.mulw.rs1 = rs1; + tree->ast_node.mulw.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x05)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------DIVW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000006000) >> 13) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x01)) { + uint64_t s = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000001000) >> 12) { + case 0x1: + s = RISCV_false; + break; + case 0x0: + s = RISCV_true; + break; + } + if (s != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_DIVW; + tree->ast_node.divw.rs2 = rs2; + tree->ast_node.divw.rs1 = rs1; + tree->ast_node.divw.rd = rd; + tree->ast_node.divw.s = s; + return; + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_D; - tree->ast_node.f_bin_rm_type_d.rs2 = rs2; - tree->ast_node.f_bin_rm_type_d.rs1 = rs1; - tree->ast_node.f_bin_rm_type_d.rm = rm; - tree->ast_node.f_bin_rm_type_d.rd = rd; - tree->ast_node.f_bin_rm_type_d.op = RISCV_FSUB_D; - return; + } + //------------------------------------------------------------ + + // ---------------------------REMW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000006000) >> 13) == 0x3) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x01)) { + uint64_t s = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000001000) >> 12) { + case 0x1: + s = RISCV_false; + break; + case 0x0: + s = RISCV_true; + break; + } + if (s != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_REMW; + tree->ast_node.remw.rs2 = rs2; + tree->ast_node.remw.rs1 = rs1; + tree->ast_node.remw.rd = rd; + tree->ast_node.remw.s = s; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x09)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------CSR------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73)) { + uint64_t op = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000003000) >> 12) { + case 0x1: + op = RISCV_CSRRW; + break; + case 0x3: + op = RISCV_CSRRC; + break; + case 0x2: + op = RISCV_CSRRS; + break; + } + if (op != 0xFFFFFFFFFFFFFFFF) { + uint64_t is_imm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000004000) >> 14) { + case 0x1: + is_imm = RISCV_true; + break; + case 0x0: + is_imm = RISCV_false; + break; + } + if (is_imm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t csr = (binary_stream & 0x00000000FFF00000) >> 20; + tree->ast_node_type = RISCV_CSR; + tree->ast_node.csr.csr = csr; + tree->ast_node.csr.rs1 = rs1; + tree->ast_node.csr.rd = rd; + tree->ast_node.csr.is_imm = is_imm; + tree->ast_node.csr.op = op; + return; + } + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------FENCE_RESERVED------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x0F) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_D; - tree->ast_node.f_bin_rm_type_d.rs2 = rs2; - tree->ast_node.f_bin_rm_type_d.rs1 = rs1; - tree->ast_node.f_bin_rm_type_d.rm = rm; - tree->ast_node.f_bin_rm_type_d.rd = rd; - tree->ast_node.f_bin_rm_type_d.op = RISCV_FMUL_D; + uint64_t rs = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t succ = (binary_stream & 0x0000000000F00000) >> 20; + uint64_t pred = (binary_stream & 0x000000000F000000) >> 24; + uint64_t fm = (binary_stream & 0x00000000F0000000) >> 28; + tree->ast_node_type = RISCV_FENCE_RESERVED; + tree->ast_node.fence_reserved.fm = fm; + tree->ast_node.fence_reserved.pred = pred; + tree->ast_node.fence_reserved.succ = succ; + tree->ast_node.fence_reserved.rs = rs; + tree->ast_node.fence_reserved.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x0D)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------FENCEI_RESERVED------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x0F) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_D; - tree->ast_node.f_bin_rm_type_d.rs2 = rs2; - tree->ast_node.f_bin_rm_type_d.rs1 = rs1; - tree->ast_node.f_bin_rm_type_d.rm = rm; - tree->ast_node.f_bin_rm_type_d.rd = rd; - tree->ast_node.f_bin_rm_type_d.op = RISCV_FDIV_D; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x2D)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + uint64_t rs = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; + tree->ast_node_type = RISCV_FENCEI_RESERVED; + tree->ast_node.fencei_reserved.imm = imm; + tree->ast_node.fencei_reserved.rs = rs; + tree->ast_node.fencei_reserved.rd = rd; + return; } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------LOAD_FP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FSQRT_D; + uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; + tree->ast_node_type = RISCV_LOAD_FP; + tree->ast_node.load_fp.imm = imm; + tree->ast_node.load_fp.rs1 = rs1; + tree->ast_node.load_fp.rd = rd; + tree->ast_node.load_fp.width = RISCV_HALF; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x61)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------LOAD_FP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_W_D; + uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; + tree->ast_node_type = RISCV_LOAD_FP; + tree->ast_node.load_fp.imm = imm; + tree->ast_node.load_fp.rs1 = rs1; + tree->ast_node.load_fp.rd = rd; + tree->ast_node.load_fp.width = RISCV_WORD; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x61)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------LOAD_FP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_WU_D; + uint64_t imm = (binary_stream & 0x00000000FFF00000) >> 20; + tree->ast_node_type = RISCV_LOAD_FP; + tree->ast_node.load_fp.imm = imm; + tree->ast_node.load_fp.rs1 = rs1; + tree->ast_node.load_fp.rd = rd; + tree->ast_node.load_fp.width = RISCV_DOUBLE; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x69)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + //------------------------------------------------------------ + + // ---------------------------STORE_FP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x27) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { + uint64_t imm5 = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_W; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t imm7 = (binary_stream & 0x00000000FE000000) >> 25; + tree->ast_node_type = RISCV_STORE_FP; + tree->ast_node.store_fp.imm = (imm7 << 5) | (imm5 << 0); + tree->ast_node.store_fp.rs2 = rs2; + tree->ast_node.store_fp.rs1 = rs1; + tree->ast_node.store_fp.width = RISCV_HALF; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x69)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + //------------------------------------------------------------ + + // ---------------------------STORE_FP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x27) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { + uint64_t imm5 = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_WU; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t imm7 = (binary_stream & 0x00000000FE000000) >> 25; + tree->ast_node_type = RISCV_STORE_FP; + tree->ast_node.store_fp.imm = (imm7 << 5) | (imm5 << 0); + tree->ast_node.store_fp.rs2 = rs2; + tree->ast_node.store_fp.rs1 = rs1; + tree->ast_node.store_fp.width = RISCV_WORD; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + //------------------------------------------------------------ + + // ---------------------------STORE_FP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x27) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3)) { + uint64_t imm5 = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_S_D; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t imm7 = (binary_stream & 0x00000000FE000000) >> 25; + tree->ast_node_type = RISCV_STORE_FP; + tree->ast_node.store_fp.imm = (imm7 << 5) | (imm5 << 0); + tree->ast_node.store_fp.rs2 = rs2; + tree->ast_node.store_fp.rs1 = rs1; + tree->ast_node.store_fp.width = RISCV_DOUBLE; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x21)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x43) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x0)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_S; + tree->ast_node.f_madd_type_s.rs3 = rs3; + tree->ast_node.f_madd_type_s.rs2 = rs2; + tree->ast_node.f_madd_type_s.rs1 = rs1; + tree->ast_node.f_madd_type_s.rm = rm; + tree->ast_node.f_madd_type_s.rd = rd; + tree->ast_node.f_madd_type_s.op = RISCV_FMADD_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x47) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x0)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_S; + tree->ast_node.f_madd_type_s.rs3 = rs3; + tree->ast_node.f_madd_type_s.rs2 = rs2; + tree->ast_node.f_madd_type_s.rs1 = rs1; + tree->ast_node.f_madd_type_s.rm = rm; + tree->ast_node.f_madd_type_s.rd = rd; + tree->ast_node.f_madd_type_s.op = RISCV_FMSUB_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x4B) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x0)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_S; + tree->ast_node.f_madd_type_s.rs3 = rs3; + tree->ast_node.f_madd_type_s.rs2 = rs2; + tree->ast_node.f_madd_type_s.rs1 = rs1; + tree->ast_node.f_madd_type_s.rm = rm; + tree->ast_node.f_madd_type_s.rd = rd; + tree->ast_node.f_madd_type_s.op = RISCV_FNMSUB_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x4F) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x0)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_S; + tree->ast_node.f_madd_type_s.rs3 = rs3; + tree->ast_node.f_madd_type_s.rs2 = rs2; + tree->ast_node.f_madd_type_s.rs1 = rs1; + tree->ast_node.f_madd_type_s.rm = rm; + tree->ast_node.f_madd_type_s.rd = rd; + tree->ast_node.f_madd_type_s.op = RISCV_FNMADD_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x00)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_S; + tree->ast_node.f_bin_rm_type_s.rs2 = rs2; + tree->ast_node.f_bin_rm_type_s.rs1 = rs1; + tree->ast_node.f_bin_rm_type_s.rm = rm; + tree->ast_node.f_bin_rm_type_s.rd = rd; + tree->ast_node.f_bin_rm_type_s.op = RISCV_FADD_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x04)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_S; + tree->ast_node.f_bin_rm_type_s.rs2 = rs2; + tree->ast_node.f_bin_rm_type_s.rs1 = rs1; + tree->ast_node.f_bin_rm_type_s.rm = rm; + tree->ast_node.f_bin_rm_type_s.rd = rd; + tree->ast_node.f_bin_rm_type_s.op = RISCV_FSUB_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x08)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_S; + tree->ast_node.f_bin_rm_type_s.rs2 = rs2; + tree->ast_node.f_bin_rm_type_s.rs1 = rs1; + tree->ast_node.f_bin_rm_type_s.rm = rm; + tree->ast_node.f_bin_rm_type_s.rd = rd; + tree->ast_node.f_bin_rm_type_s.op = RISCV_FMUL_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x0C)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_S; + tree->ast_node.f_bin_rm_type_s.rs2 = rs2; + tree->ast_node.f_bin_rm_type_s.rs1 = rs1; + tree->ast_node.f_bin_rm_type_s.rm = rm; + tree->ast_node.f_bin_rm_type_s.rd = rd; + tree->ast_node.f_bin_rm_type_s.op = RISCV_FDIV_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x2C)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FSQRT_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x60)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_W_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x60)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_WU_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x68)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_S_W; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x68)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_S_WU; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x60)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_L_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x03) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x60)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_LU_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x68)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_S_L; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x03) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x68)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_S; + tree->ast_node.f_un_rm_type_s.rs1 = rs1; + tree->ast_node.f_un_rm_type_s.rm = rm; + tree->ast_node.f_un_rm_type_s.rd = rd; + tree->ast_node.f_un_rm_type_s.fcvt_s_lu = RISCV_FCVT_S_LU; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_S; + tree->ast_node.f_bin_type_s.rs2 = rs2; + tree->ast_node.f_bin_type_s.rs1 = rs1; + tree->ast_node.f_bin_type_s.rd = rd; + tree->ast_node.f_bin_type_s.fle_s = RISCV_FSGNJ_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_S; + tree->ast_node.f_bin_type_s.rs2 = rs2; + tree->ast_node.f_bin_type_s.rs1 = rs1; + tree->ast_node.f_bin_type_s.rd = rd; + tree->ast_node.f_bin_type_s.fle_s = RISCV_FSGNJN_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_S; + tree->ast_node.f_bin_type_s.rs2 = rs2; + tree->ast_node.f_bin_type_s.rs1 = rs1; + tree->ast_node.f_bin_type_s.rd = rd; + tree->ast_node.f_bin_type_s.fle_s = RISCV_FSGNJX_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x14)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_S; + tree->ast_node.f_bin_type_s.rs2 = rs2; + tree->ast_node.f_bin_type_s.rs1 = rs1; + tree->ast_node.f_bin_type_s.rd = rd; + tree->ast_node.f_bin_type_s.fle_s = RISCV_FMIN_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x14)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_S; + tree->ast_node.f_bin_type_s.rs2 = rs2; + tree->ast_node.f_bin_type_s.rs1 = rs1; + tree->ast_node.f_bin_type_s.rd = rd; + tree->ast_node.f_bin_type_s.fle_s = RISCV_FMAX_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x50)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_S; + tree->ast_node.f_bin_type_s.rs2 = rs2; + tree->ast_node.f_bin_type_s.rs1 = rs1; + tree->ast_node.f_bin_type_s.rd = rd; + tree->ast_node.f_bin_type_s.fle_s = RISCV_FEQ_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x50)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_S; + tree->ast_node.f_bin_type_s.rs2 = rs2; + tree->ast_node.f_bin_type_s.rs1 = rs1; + tree->ast_node.f_bin_type_s.rd = rd; + tree->ast_node.f_bin_type_s.fle_s = RISCV_FLT_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x50)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_S; + tree->ast_node.f_bin_type_s.rs2 = rs2; + tree->ast_node.f_bin_type_s.rs1 = rs1; + tree->ast_node.f_bin_type_s.rd = rd; + tree->ast_node.f_bin_type_s.fle_s = RISCV_FLE_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x70)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_TYPE_S; + tree->ast_node.f_un_type_s.rs1 = rs1; + tree->ast_node.f_un_type_s.rd = rd; + tree->ast_node.f_un_type_s.fmv_w_x = RISCV_FCLASS_S; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x70)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_TYPE_S; + tree->ast_node.f_un_type_s.rs1 = rs1; + tree->ast_node.f_un_type_s.rd = rd; + tree->ast_node.f_un_type_s.fmv_w_x = RISCV_FMV_X_W; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x78)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_TYPE_S; + tree->ast_node.f_un_type_s.rs1 = rs1; + tree->ast_node.f_un_type_s.rd = rd; + tree->ast_node.f_un_type_s.fmv_w_x = RISCV_FMV_W_X; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x43) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x1)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_D; + tree->ast_node.f_madd_type_d.rs3 = rs3; + tree->ast_node.f_madd_type_d.rs2 = rs2; + tree->ast_node.f_madd_type_d.rs1 = rs1; + tree->ast_node.f_madd_type_d.rm = rm; + tree->ast_node.f_madd_type_d.rd = rd; + tree->ast_node.f_madd_type_d.op = RISCV_FMADD_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x47) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x1)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_D; + tree->ast_node.f_madd_type_d.rs3 = rs3; + tree->ast_node.f_madd_type_d.rs2 = rs2; + tree->ast_node.f_madd_type_d.rs1 = rs1; + tree->ast_node.f_madd_type_d.rm = rm; + tree->ast_node.f_madd_type_d.rd = rd; + tree->ast_node.f_madd_type_d.op = RISCV_FMSUB_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x4B) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x1)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_D; + tree->ast_node.f_madd_type_d.rs3 = rs3; + tree->ast_node.f_madd_type_d.rs2 = rs2; + tree->ast_node.f_madd_type_d.rs1 = rs1; + tree->ast_node.f_madd_type_d.rm = rm; + tree->ast_node.f_madd_type_d.rd = rd; + tree->ast_node.f_madd_type_d.op = RISCV_FNMSUB_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x4F) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x1)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_D; + tree->ast_node.f_madd_type_d.rs3 = rs3; + tree->ast_node.f_madd_type_d.rs2 = rs2; + tree->ast_node.f_madd_type_d.rs1 = rs1; + tree->ast_node.f_madd_type_d.rm = rm; + tree->ast_node.f_madd_type_d.rd = rd; + tree->ast_node.f_madd_type_d.op = RISCV_FNMADD_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x01)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_D; + tree->ast_node.f_bin_rm_type_d.rs2 = rs2; + tree->ast_node.f_bin_rm_type_d.rs1 = rs1; + tree->ast_node.f_bin_rm_type_d.rm = rm; + tree->ast_node.f_bin_rm_type_d.rd = rd; + tree->ast_node.f_bin_rm_type_d.op = RISCV_FADD_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x05)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_D; + tree->ast_node.f_bin_rm_type_d.rs2 = rs2; + tree->ast_node.f_bin_rm_type_d.rs1 = rs1; + tree->ast_node.f_bin_rm_type_d.rm = rm; + tree->ast_node.f_bin_rm_type_d.rd = rd; + tree->ast_node.f_bin_rm_type_d.op = RISCV_FSUB_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x09)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_D; + tree->ast_node.f_bin_rm_type_d.rs2 = rs2; + tree->ast_node.f_bin_rm_type_d.rs1 = rs1; + tree->ast_node.f_bin_rm_type_d.rm = rm; + tree->ast_node.f_bin_rm_type_d.rd = rd; + tree->ast_node.f_bin_rm_type_d.op = RISCV_FMUL_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x0D)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_D; + tree->ast_node.f_bin_rm_type_d.rs2 = rs2; + tree->ast_node.f_bin_rm_type_d.rs1 = rs1; + tree->ast_node.f_bin_rm_type_d.rm = rm; + tree->ast_node.f_bin_rm_type_d.rd = rd; + tree->ast_node.f_bin_rm_type_d.op = RISCV_FDIV_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x2D)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FSQRT_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x61)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_W_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x61)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_WU_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x69)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_W; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x69)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_WU; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_S_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x21)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_S; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x61)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_L_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x03) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x61)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_LU_D; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x69)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_L; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x03) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x69)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; + tree->ast_node.f_un_rm_type_d.rs1 = rs1; + tree->ast_node.f_un_rm_type_d.rm = rm; + tree->ast_node.f_un_rm_type_d.rd = rd; + tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_LU; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x11)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_D; + tree->ast_node.f_bin_type_d.rs2 = rs2; + tree->ast_node.f_bin_type_d.rs1 = rs1; + tree->ast_node.f_bin_type_d.rd = rd; + tree->ast_node.f_bin_type_d.fle_d = RISCV_FSGNJ_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x11)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_D; + tree->ast_node.f_bin_type_d.rs2 = rs2; + tree->ast_node.f_bin_type_d.rs1 = rs1; + tree->ast_node.f_bin_type_d.rd = rd; + tree->ast_node.f_bin_type_d.fle_d = RISCV_FSGNJN_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x11)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_D; + tree->ast_node.f_bin_type_d.rs2 = rs2; + tree->ast_node.f_bin_type_d.rs1 = rs1; + tree->ast_node.f_bin_type_d.rd = rd; + tree->ast_node.f_bin_type_d.fle_d = RISCV_FSGNJX_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x15)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_D; + tree->ast_node.f_bin_type_d.rs2 = rs2; + tree->ast_node.f_bin_type_d.rs1 = rs1; + tree->ast_node.f_bin_type_d.rd = rd; + tree->ast_node.f_bin_type_d.fle_d = RISCV_FMIN_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x15)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_D; + tree->ast_node.f_bin_type_d.rs2 = rs2; + tree->ast_node.f_bin_type_d.rs1 = rs1; + tree->ast_node.f_bin_type_d.rd = rd; + tree->ast_node.f_bin_type_d.fle_d = RISCV_FMAX_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x51)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_D; + tree->ast_node.f_bin_type_d.rs2 = rs2; + tree->ast_node.f_bin_type_d.rs1 = rs1; + tree->ast_node.f_bin_type_d.rd = rd; + tree->ast_node.f_bin_type_d.fle_d = RISCV_FEQ_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x51)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_D; + tree->ast_node.f_bin_type_d.rs2 = rs2; + tree->ast_node.f_bin_type_d.rs1 = rs1; + tree->ast_node.f_bin_type_d.rd = rd; + tree->ast_node.f_bin_type_d.fle_d = RISCV_FLT_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x51)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_D; + tree->ast_node.f_bin_type_d.rs2 = rs2; + tree->ast_node.f_bin_type_d.rs1 = rs1; + tree->ast_node.f_bin_type_d.rd = rd; + tree->ast_node.f_bin_type_d.fle_d = RISCV_FLE_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x71)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_TYPE_D; + tree->ast_node.f_un_type_d.rs1 = rs1; + tree->ast_node.f_un_type_d.rd = rd; + tree->ast_node.f_un_type_d.fmv_d_x = RISCV_FCLASS_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x71)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_TYPE_D; + tree->ast_node.f_un_type_d.rs1 = rs1; + tree->ast_node.f_un_type_d.rd = rd; + tree->ast_node.f_un_type_d.fmv_d_x = RISCV_FMV_X_D; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x79)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_TYPE_D; + tree->ast_node.f_un_type_d.rs1 = rs1; + tree->ast_node.f_un_type_d.rd = rd; + tree->ast_node.f_un_type_d.fmv_d_x = RISCV_FMV_D_X; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------SINVAL_VMA------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x0B)) { + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SINVAL_VMA; + tree->ast_node.sinval_vma.rs1 = rs1; + tree->ast_node.sinval_vma.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------SFENCE_W_INVAL------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x0C)) { + tree->ast_node_type = RISCV_SFENCE_W_INVAL; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------SFENCE_INVAL_IR------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x73) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x0C)) { + tree->ast_node_type = RISCV_SFENCE_INVAL_IR; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------RISCV_SLLIUW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x02)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_SLLIUW; + tree->ast_node.riscv_slliuw.shamt = shamt; + tree->ast_node.riscv_slliuw.rs1 = rs1; + tree->ast_node.riscv_slliuw.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBA_RTYPEUW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x04)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBA_RTYPEUW; + tree->ast_node.zba_rtypeuw.rs2 = rs2; + tree->ast_node.zba_rtypeuw.rs1 = rs1; + tree->ast_node.zba_rtypeuw.rd = rd; + tree->ast_node.zba_rtypeuw.op = RISCV_ADDUW; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBA_RTYPEUW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBA_RTYPEUW; + tree->ast_node.zba_rtypeuw.rs2 = rs2; + tree->ast_node.zba_rtypeuw.rs1 = rs1; + tree->ast_node.zba_rtypeuw.rd = rd; + tree->ast_node.zba_rtypeuw.op = RISCV_SH1ADDUW; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBA_RTYPEUW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBA_RTYPEUW; + tree->ast_node.zba_rtypeuw.rs2 = rs2; + tree->ast_node.zba_rtypeuw.rs1 = rs1; + tree->ast_node.zba_rtypeuw.rd = rd; + tree->ast_node.zba_rtypeuw.op = RISCV_SH2ADDUW; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBA_RTYPEUW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBA_RTYPEUW; + tree->ast_node.zba_rtypeuw.rs2 = rs2; + tree->ast_node.zba_rtypeuw.rs1 = rs1; + tree->ast_node.zba_rtypeuw.rd = rd; + tree->ast_node.zba_rtypeuw.op = RISCV_SH3ADDUW; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBA_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBA_RTYPE; + tree->ast_node.zba_rtype.rs2 = rs2; + tree->ast_node.zba_rtype.rs1 = rs1; + tree->ast_node.zba_rtype.rd = rd; + tree->ast_node.zba_rtype.op = RISCV_SH1ADD; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBA_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBA_RTYPE; + tree->ast_node.zba_rtype.rs2 = rs2; + tree->ast_node.zba_rtype.rs1 = rs1; + tree->ast_node.zba_rtype.rd = rd; + tree->ast_node.zba_rtype.op = RISCV_SH2ADD; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBA_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBA_RTYPE; + tree->ast_node.zba_rtype.rs2 = rs2; + tree->ast_node.zba_rtype.rs1 = rs1; + tree->ast_node.zba_rtype.rd = rd; + tree->ast_node.zba_rtype.op = RISCV_SH3ADD; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------RISCV_RORIW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x30)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_RORIW; + tree->ast_node.riscv_roriw.shamt = shamt; + tree->ast_node.riscv_roriw.rs1 = rs1; + tree->ast_node.riscv_roriw.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------RISCV_RORI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x18)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_RORI; + tree->ast_node.riscv_rori.shamt = shamt; + tree->ast_node.riscv_rori.rs1 = rs1; + tree->ast_node.riscv_rori.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPEW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x30)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPEW; + tree->ast_node.zbb_rtypew.rs2 = rs2; + tree->ast_node.zbb_rtypew.rs1 = rs1; + tree->ast_node.zbb_rtypew.rd = rd; + tree->ast_node.zbb_rtypew.op = RISCV_ROLW; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPEW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x30)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPEW; + tree->ast_node.zbb_rtypew.rs2 = rs2; + tree->ast_node.zbb_rtypew.rs1 = rs1; + tree->ast_node.zbb_rtypew.rd = rd; + tree->ast_node.zbb_rtypew.op = RISCV_RORW; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x7) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_ANDN; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_ORN; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_XNOR; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x05)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_MAX; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x7) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x05)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_MAXU; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x05)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_MIN; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x05)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_MINU; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x30)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_ROL; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x30)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBB_RTYPE; + tree->ast_node.zbb_rtype.rs2 = rs2; + tree->ast_node.zbb_rtype.rs1 = rs1; + tree->ast_node.zbb_rtype.rd = rd; + tree->ast_node.zbb_rtype.op = RISCV_ROR; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_EXTOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x04) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x30)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_ZBB_EXTOP; + tree->ast_node.zbb_extop.rs1 = rs1; + tree->ast_node.zbb_extop.rd = rd; + tree->ast_node.zbb_extop.op = RISCV_SEXTB; + return; } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------ZBB_EXTOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x05) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x30)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_ZBB_EXTOP; + tree->ast_node.zbb_extop.rs1 = rs1; + tree->ast_node.zbb_extop.rd = rd; + tree->ast_node.zbb_extop.op = RISCV_SEXTH; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------ZBB_EXTOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x04)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_S; + tree->ast_node_type = RISCV_ZBB_EXTOP; + tree->ast_node.zbb_extop.rs1 = rs1; + tree->ast_node.zbb_extop.rd = rd; + tree->ast_node.zbb_extop.op = RISCV_ZEXTH; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x61)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------ZBB_EXTOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x04)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_L_D; + tree->ast_node_type = RISCV_ZBB_EXTOP; + tree->ast_node.zbb_extop.rs1 = rs1; + tree->ast_node.zbb_extop.rd = rd; + tree->ast_node.zbb_extop.op = RISCV_ZEXTH; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x03) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x61)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_REV8------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x698)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_LU_D; + tree->ast_node_type = RISCV_REV8; + tree->ast_node.riscv_rev8.rs1 = rs1; + tree->ast_node.riscv_rev8.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x69)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_REV8------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x6B8)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_L; + tree->ast_node_type = RISCV_REV8; + tree->ast_node.riscv_rev8.rs1 = rs1; + tree->ast_node.riscv_rev8.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x03) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x69)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_ORCB------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x287)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_D; - tree->ast_node.f_un_rm_type_d.rs1 = rs1; - tree->ast_node.f_un_rm_type_d.rm = rm; - tree->ast_node.f_un_rm_type_d.rd = rd; - tree->ast_node.f_un_rm_type_d.fcvt_d_lu = RISCV_FCVT_D_LU; + tree->ast_node_type = RISCV_ORCB; + tree->ast_node.riscv_orcb.rs1 = rs1; + tree->ast_node.riscv_orcb.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x11)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_D; - tree->ast_node.f_bin_type_d.rs2 = rs2; - tree->ast_node.f_bin_type_d.rs1 = rs1; - tree->ast_node.f_bin_type_d.rd = rd; - tree->ast_node.f_bin_type_d.fle_d = RISCV_FSGNJ_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x11)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_D; - tree->ast_node.f_bin_type_d.rs2 = rs2; - tree->ast_node.f_bin_type_d.rs1 = rs1; - tree->ast_node.f_bin_type_d.rd = rd; - tree->ast_node.f_bin_type_d.fle_d = RISCV_FSGNJN_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x11)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_D; - tree->ast_node.f_bin_type_d.rs2 = rs2; - tree->ast_node.f_bin_type_d.rs1 = rs1; - tree->ast_node.f_bin_type_d.rd = rd; - tree->ast_node.f_bin_type_d.fle_d = RISCV_FSGNJX_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x15)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_D; - tree->ast_node.f_bin_type_d.rs2 = rs2; - tree->ast_node.f_bin_type_d.rs1 = rs1; - tree->ast_node.f_bin_type_d.rd = rd; - tree->ast_node.f_bin_type_d.fle_d = RISCV_FMIN_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x15)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_D; - tree->ast_node.f_bin_type_d.rs2 = rs2; - tree->ast_node.f_bin_type_d.rs1 = rs1; - tree->ast_node.f_bin_type_d.rd = rd; - tree->ast_node.f_bin_type_d.fle_d = RISCV_FMAX_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x51)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_D; - tree->ast_node.f_bin_type_d.rs2 = rs2; - tree->ast_node.f_bin_type_d.rs1 = rs1; - tree->ast_node.f_bin_type_d.rd = rd; - tree->ast_node.f_bin_type_d.fle_d = RISCV_FEQ_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x51)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_D; - tree->ast_node.f_bin_type_d.rs2 = rs2; - tree->ast_node.f_bin_type_d.rs1 = rs1; - tree->ast_node.f_bin_type_d.rd = rd; - tree->ast_node.f_bin_type_d.fle_d = RISCV_FLT_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x51)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_D; - tree->ast_node.f_bin_type_d.rs2 = rs2; - tree->ast_node.f_bin_type_d.rs1 = rs1; - tree->ast_node.f_bin_type_d.rd = rd; - tree->ast_node.f_bin_type_d.fle_d = RISCV_FLE_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x71)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_D; - tree->ast_node.f_un_type_d.rs1 = rs1; - tree->ast_node.f_un_type_d.rd = rd; - tree->ast_node.f_un_type_d.fmv_d_x = RISCV_FCLASS_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x71)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_D; - tree->ast_node.f_un_type_d.rs1 = rs1; - tree->ast_node.f_un_type_d.rd = rd; - tree->ast_node.f_un_type_d.fmv_d_x = RISCV_FMV_X_D; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x79)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_D; - tree->ast_node.f_un_type_d.rs1 = rs1; - tree->ast_node.f_un_type_d.rd = rd; - tree->ast_node.f_un_type_d.fmv_d_x = RISCV_FMV_D_X; - return; - } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x0B)) { - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SINVAL_VMA; - tree->ast_node.sinval_vma.rs1 = rs1; - tree->ast_node.sinval_vma.rs2 = rs2; - return; - } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x0C)) { - tree->ast_node_type = RISCV_SFENCE_W_INVAL; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CPOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x602)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_CPOP; + tree->ast_node.riscv_cpop.rs1 = rs1; + tree->ast_node.riscv_cpop.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x73) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x0C)) { - tree->ast_node_type = RISCV_SFENCE_INVAL_IR; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CPOPW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x602)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_CPOPW; + tree->ast_node.riscv_cpopw.rs1 = rs1; + tree->ast_node.riscv_cpopw.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x02)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_SLLIUW; - tree->ast_node.riscv_slliuw.shamt = shamt; - tree->ast_node.riscv_slliuw.rs1 = rs1; - tree->ast_node.riscv_slliuw.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CLZ------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x600)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_CLZ; + tree->ast_node.riscv_clz.rs1 = rs1; + tree->ast_node.riscv_clz.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x04)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBA_RTYPEUW; - tree->ast_node.zba_rtypeuw.rs2 = rs2; - tree->ast_node.zba_rtypeuw.rs1 = rs1; - tree->ast_node.zba_rtypeuw.rd = rd; - tree->ast_node.zba_rtypeuw.op = RISCV_ADDUW; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CLZW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x600)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_CLZW; + tree->ast_node.riscv_clzw.rs1 = rs1; + tree->ast_node.riscv_clzw.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBA_RTYPEUW; - tree->ast_node.zba_rtypeuw.rs2 = rs2; - tree->ast_node.zba_rtypeuw.rs1 = rs1; - tree->ast_node.zba_rtypeuw.rd = rd; - tree->ast_node.zba_rtypeuw.op = RISCV_SH1ADDUW; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CTZ------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x601)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_CTZ; + tree->ast_node.riscv_ctz.rs1 = rs1; + tree->ast_node.riscv_ctz.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBA_RTYPEUW; - tree->ast_node.zba_rtypeuw.rs2 = rs2; - tree->ast_node.zba_rtypeuw.rs1 = rs1; - tree->ast_node.zba_rtypeuw.rd = rd; - tree->ast_node.zba_rtypeuw.op = RISCV_SH2ADDUW; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CTZW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x1B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x601)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_CTZW; + tree->ast_node.riscv_ctzw.rs1 = rs1; + tree->ast_node.riscv_ctzw.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBA_RTYPEUW; - tree->ast_node.zba_rtypeuw.rs2 = rs2; - tree->ast_node.zba_rtypeuw.rs1 = rs1; - tree->ast_node.zba_rtypeuw.rd = rd; - tree->ast_node.zba_rtypeuw.op = RISCV_SH3ADDUW; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CLMUL------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x05)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_CLMUL; + tree->ast_node.riscv_clmul.rs2 = rs2; + tree->ast_node.riscv_clmul.rs1 = rs1; + tree->ast_node.riscv_clmul.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBA_RTYPE; - tree->ast_node.zba_rtype.rs2 = rs2; - tree->ast_node.zba_rtype.rs1 = rs1; - tree->ast_node.zba_rtype.rd = rd; - tree->ast_node.zba_rtype.op = RISCV_SH1ADD; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CLMULH------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x05)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_CLMULH; + tree->ast_node.riscv_clmulh.rs2 = rs2; + tree->ast_node.riscv_clmulh.rs1 = rs1; + tree->ast_node.riscv_clmulh.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBA_RTYPE; - tree->ast_node.zba_rtype.rs2 = rs2; - tree->ast_node.zba_rtype.rs1 = rs1; - tree->ast_node.zba_rtype.rd = rd; - tree->ast_node.zba_rtype.op = RISCV_SH2ADD; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_CLMULR------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x05)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_CLMULR; + tree->ast_node.riscv_clmulr.rs2 = rs2; + tree->ast_node.riscv_clmulr.rs1 = rs1; + tree->ast_node.riscv_clmulr.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBA_RTYPE; - tree->ast_node.zba_rtype.rs2 = rs2; - tree->ast_node.zba_rtype.rs1 = rs1; - tree->ast_node.zba_rtype.rd = rd; - tree->ast_node.zba_rtype.op = RISCV_SH3ADD; - return; + //------------------------------------------------------------ + + // ---------------------------ZBS_IOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x12)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_ZBS_IOP; + tree->ast_node.zbs_iop.shamt = shamt; + tree->ast_node.zbs_iop.rs1 = rs1; + tree->ast_node.zbs_iop.rd = rd; + tree->ast_node.zbs_iop.op = RISCV_BCLRI; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x30)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_RORIW; - tree->ast_node.riscv_roriw.shamt = shamt; - tree->ast_node.riscv_roriw.rs1 = rs1; - tree->ast_node.riscv_roriw.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------ZBS_IOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x12)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_ZBS_IOP; + tree->ast_node.zbs_iop.shamt = shamt; + tree->ast_node.zbs_iop.rs1 = rs1; + tree->ast_node.zbs_iop.rd = rd; + tree->ast_node.zbs_iop.op = RISCV_BEXTI; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x18)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_RORI; - tree->ast_node.riscv_rori.shamt = shamt; - tree->ast_node.riscv_rori.rs1 = rs1; - tree->ast_node.riscv_rori.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------ZBS_IOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x1A)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_ZBS_IOP; + tree->ast_node.zbs_iop.shamt = shamt; + tree->ast_node.zbs_iop.rs1 = rs1; + tree->ast_node.zbs_iop.rd = rd; + tree->ast_node.zbs_iop.op = RISCV_BINVI; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x30)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPEW; - tree->ast_node.zbb_rtypew.rs2 = rs2; - tree->ast_node.zbb_rtypew.rs1 = rs1; - tree->ast_node.zbb_rtypew.rd = rd; - tree->ast_node.zbb_rtypew.op = RISCV_ROLW; - return; + //------------------------------------------------------------ + + // ---------------------------ZBS_IOP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x0A)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; + tree->ast_node_type = RISCV_ZBS_IOP; + tree->ast_node.zbs_iop.shamt = shamt; + tree->ast_node.zbs_iop.rs1 = rs1; + tree->ast_node.zbs_iop.rd = rd; + tree->ast_node.zbs_iop.op = RISCV_BSETI; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x30)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPEW; - tree->ast_node.zbb_rtypew.rs2 = rs2; - tree->ast_node.zbb_rtypew.rs1 = rs1; - tree->ast_node.zbb_rtypew.rd = rd; - tree->ast_node.zbb_rtypew.op = RISCV_RORW; - return; + //------------------------------------------------------------ + + // ---------------------------ZBS_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x24)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBS_RTYPE; + tree->ast_node.zbs_rtype.rs2 = rs2; + tree->ast_node.zbs_rtype.rs1 = rs1; + tree->ast_node.zbs_rtype.rd = rd; + tree->ast_node.zbs_rtype.op = RISCV_BCLR; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x7) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_ANDN; - return; + //------------------------------------------------------------ + + // ---------------------------ZBS_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x24)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBS_RTYPE; + tree->ast_node.zbs_rtype.rs2 = rs2; + tree->ast_node.zbs_rtype.rs1 = rs1; + tree->ast_node.zbs_rtype.rd = rd; + tree->ast_node.zbs_rtype.op = RISCV_BEXT; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_ORN; - return; + //------------------------------------------------------------ + + // ---------------------------ZBS_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x34)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBS_RTYPE; + tree->ast_node.zbs_rtype.rs2 = rs2; + tree->ast_node.zbs_rtype.rs1 = rs1; + tree->ast_node.zbs_rtype.rd = rd; + tree->ast_node.zbs_rtype.op = RISCV_BINV; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_XNOR; - return; + //------------------------------------------------------------ + + // ---------------------------ZBS_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x14)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBS_RTYPE; + tree->ast_node.zbs_rtype.rs2 = rs2; + tree->ast_node.zbs_rtype.rs1 = rs1; + tree->ast_node.zbs_rtype.rd = rd; + tree->ast_node.zbs_rtype.op = RISCV_BSET; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x05)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_MAX; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x02)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_H; + tree->ast_node.f_bin_rm_type_h.rs2 = rs2; + tree->ast_node.f_bin_rm_type_h.rs1 = rs1; + tree->ast_node.f_bin_rm_type_h.rm = rm; + tree->ast_node.f_bin_rm_type_h.rd = rd; + tree->ast_node.f_bin_rm_type_h.op = RISCV_FADD_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x7) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x05)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_MAXU; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x06)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_H; + tree->ast_node.f_bin_rm_type_h.rs2 = rs2; + tree->ast_node.f_bin_rm_type_h.rs1 = rs1; + tree->ast_node.f_bin_rm_type_h.rm = rm; + tree->ast_node.f_bin_rm_type_h.rd = rd; + tree->ast_node.f_bin_rm_type_h.op = RISCV_FSUB_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x05)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_MIN; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x0A)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_H; + tree->ast_node.f_bin_rm_type_h.rs2 = rs2; + tree->ast_node.f_bin_rm_type_h.rs1 = rs1; + tree->ast_node.f_bin_rm_type_h.rm = rm; + tree->ast_node.f_bin_rm_type_h.rd = rd; + tree->ast_node.f_bin_rm_type_h.op = RISCV_FMUL_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x05)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_MINU; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x0E)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_RM_TYPE_H; + tree->ast_node.f_bin_rm_type_h.rs2 = rs2; + tree->ast_node.f_bin_rm_type_h.rs1 = rs1; + tree->ast_node.f_bin_rm_type_h.rm = rm; + tree->ast_node.f_bin_rm_type_h.rd = rd; + tree->ast_node.f_bin_rm_type_h.op = RISCV_FDIV_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x30)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_ROL; - return; + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x43) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x2)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_H; + tree->ast_node.f_madd_type_h.rs3 = rs3; + tree->ast_node.f_madd_type_h.rs2 = rs2; + tree->ast_node.f_madd_type_h.rs1 = rs1; + tree->ast_node.f_madd_type_h.rm = rm; + tree->ast_node.f_madd_type_h.rd = rd; + tree->ast_node.f_madd_type_h.op = RISCV_FMADD_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x30)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBB_RTYPE; - tree->ast_node.zbb_rtype.rs2 = rs2; - tree->ast_node.zbb_rtype.rs1 = rs1; - tree->ast_node.zbb_rtype.rd = rd; - tree->ast_node.zbb_rtype.op = RISCV_ROR; - return; + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x47) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x2)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_H; + tree->ast_node.f_madd_type_h.rs3 = rs3; + tree->ast_node.f_madd_type_h.rs2 = rs2; + tree->ast_node.f_madd_type_h.rs1 = rs1; + tree->ast_node.f_madd_type_h.rm = rm; + tree->ast_node.f_madd_type_h.rd = rd; + tree->ast_node.f_madd_type_h.op = RISCV_FMSUB_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x04) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x30)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_ZBB_EXTOP; - tree->ast_node.zbb_extop.rs1 = rs1; - tree->ast_node.zbb_extop.rd = rd; - tree->ast_node.zbb_extop.op = RISCV_SEXTB; - return; + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x4B) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x2)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_H; + tree->ast_node.f_madd_type_h.rs3 = rs3; + tree->ast_node.f_madd_type_h.rs2 = rs2; + tree->ast_node.f_madd_type_h.rs1 = rs1; + tree->ast_node.f_madd_type_h.rm = rm; + tree->ast_node.f_madd_type_h.rd = rd; + tree->ast_node.f_madd_type_h.op = RISCV_FNMSUB_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x05) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x30)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_ZBB_EXTOP; - tree->ast_node.zbb_extop.rs1 = rs1; - tree->ast_node.zbb_extop.rd = rd; - tree->ast_node.zbb_extop.op = RISCV_SEXTH; - return; + //------------------------------------------------------------ + + // ---------------------------F_MADD_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x4F) && + (((binary_stream & 0x0000000006000000) >> 25) == 0x2)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; + tree->ast_node_type = RISCV_F_MADD_TYPE_H; + tree->ast_node.f_madd_type_h.rs3 = rs3; + tree->ast_node.f_madd_type_h.rs2 = rs2; + tree->ast_node.f_madd_type_h.rs1 = rs1; + tree->ast_node.f_madd_type_h.rm = rm; + tree->ast_node.f_madd_type_h.rd = rd; + tree->ast_node.f_madd_type_h.op = RISCV_FNMADD_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x04)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_ZBB_EXTOP; - tree->ast_node.zbb_extop.rs1 = rs1; - tree->ast_node.zbb_extop.rd = rd; - tree->ast_node.zbb_extop.op = RISCV_ZEXTH; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x12)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_H; + tree->ast_node.f_bin_type_h.rs2 = rs2; + tree->ast_node.f_bin_type_h.rs1 = rs1; + tree->ast_node.f_bin_type_h.rd = rd; + tree->ast_node.f_bin_type_h.fle_h = RISCV_FSGNJ_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x04)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_ZBB_EXTOP; - tree->ast_node.zbb_extop.rs1 = rs1; - tree->ast_node.zbb_extop.rd = rd; - tree->ast_node.zbb_extop.op = RISCV_ZEXTH; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x12)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_H; + tree->ast_node.f_bin_type_h.rs2 = rs2; + tree->ast_node.f_bin_type_h.rs1 = rs1; + tree->ast_node.f_bin_type_h.rd = rd; + tree->ast_node.f_bin_type_h.fle_h = RISCV_FSGNJN_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x698)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_REV8; - tree->ast_node.riscv_rev8.rs1 = rs1; - tree->ast_node.riscv_rev8.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x12)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_H; + tree->ast_node.f_bin_type_h.rs2 = rs2; + tree->ast_node.f_bin_type_h.rs1 = rs1; + tree->ast_node.f_bin_type_h.rd = rd; + tree->ast_node.f_bin_type_h.fle_h = RISCV_FSGNJX_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x6B8)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_REV8; - tree->ast_node.riscv_rev8.rs1 = rs1; - tree->ast_node.riscv_rev8.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x16)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_H; + tree->ast_node.f_bin_type_h.rs2 = rs2; + tree->ast_node.f_bin_type_h.rs1 = rs1; + tree->ast_node.f_bin_type_h.rd = rd; + tree->ast_node.f_bin_type_h.fle_h = RISCV_FMIN_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x287)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_ORCB; - tree->ast_node.riscv_orcb.rs1 = rs1; - tree->ast_node.riscv_orcb.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x16)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_H; + tree->ast_node.f_bin_type_h.rs2 = rs2; + tree->ast_node.f_bin_type_h.rs1 = rs1; + tree->ast_node.f_bin_type_h.rd = rd; + tree->ast_node.f_bin_type_h.fle_h = RISCV_FMAX_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x602)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_CPOP; - tree->ast_node.riscv_cpop.rs1 = rs1; - tree->ast_node.riscv_cpop.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x52)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_H; + tree->ast_node.f_bin_type_h.rs2 = rs2; + tree->ast_node.f_bin_type_h.rs1 = rs1; + tree->ast_node.f_bin_type_h.rd = rd; + tree->ast_node.f_bin_type_h.fle_h = RISCV_FEQ_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x602)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_CPOPW; - tree->ast_node.riscv_cpopw.rs1 = rs1; - tree->ast_node.riscv_cpopw.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x52)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_H; + tree->ast_node.f_bin_type_h.rs2 = rs2; + tree->ast_node.f_bin_type_h.rs1 = rs1; + tree->ast_node.f_bin_type_h.rd = rd; + tree->ast_node.f_bin_type_h.fle_h = RISCV_FLT_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x600)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_CLZ; - tree->ast_node.riscv_clz.rs1 = rs1; - tree->ast_node.riscv_clz.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_BIN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x52)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_F_BIN_TYPE_H; + tree->ast_node.f_bin_type_h.rs2 = rs2; + tree->ast_node.f_bin_type_h.rs1 = rs1; + tree->ast_node.f_bin_type_h.rd = rd; + tree->ast_node.f_bin_type_h.fle_h = RISCV_FLE_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x600)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_CLZW; - tree->ast_node.riscv_clzw.rs1 = rs1; - tree->ast_node.riscv_clzw.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x2E)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FSQRT_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x601)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_CTZ; - tree->ast_node.riscv_ctz.rs1 = rs1; - tree->ast_node.riscv_ctz.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x62)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_W_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x1B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x601)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_CTZW; - tree->ast_node.riscv_ctzw.rs1 = rs1; - tree->ast_node.riscv_ctzw.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x62)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_WU_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x05)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_CLMUL; - tree->ast_node.riscv_clmul.rs2 = rs2; - tree->ast_node.riscv_clmul.rs1 = rs1; - tree->ast_node.riscv_clmul.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x6A)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_W; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x05)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_CLMULH; - tree->ast_node.riscv_clmulh.rs2 = rs2; - tree->ast_node.riscv_clmulh.rs1 = rs1; - tree->ast_node.riscv_clmulh.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x6A)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_WU; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x05)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_CLMULR; - tree->ast_node.riscv_clmulr.rs2 = rs2; - tree->ast_node.riscv_clmulr.rs1 = rs1; - tree->ast_node.riscv_clmulr.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x22)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_S; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x12)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_ZBS_IOP; - tree->ast_node.zbs_iop.shamt = shamt; - tree->ast_node.zbs_iop.rs1 = rs1; - tree->ast_node.zbs_iop.rd = rd; - tree->ast_node.zbs_iop.op = RISCV_BCLRI; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x22)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_D; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x12)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_ZBS_IOP; - tree->ast_node.zbs_iop.shamt = shamt; - tree->ast_node.zbs_iop.rs1 = rs1; - tree->ast_node.zbs_iop.rd = rd; - tree->ast_node.zbs_iop.op = RISCV_BEXTI; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_S_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x1A)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_ZBS_IOP; - tree->ast_node.zbs_iop.shamt = shamt; - tree->ast_node.zbs_iop.rs1 = rs1; - tree->ast_node.zbs_iop.rd = rd; - tree->ast_node.zbs_iop.op = RISCV_BINVI; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x21)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_D_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x0A)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t shamt = (binary_stream & 0x0000000003F00000) >> 20; - tree->ast_node_type = RISCV_ZBS_IOP; - tree->ast_node.zbs_iop.shamt = shamt; - tree->ast_node.zbs_iop.rs1 = rs1; - tree->ast_node.zbs_iop.rd = rd; - tree->ast_node.zbs_iop.op = RISCV_BSETI; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x62)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_L_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x24)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBS_RTYPE; - tree->ast_node.zbs_rtype.rs2 = rs2; - tree->ast_node.zbs_rtype.rs1 = rs1; - tree->ast_node.zbs_rtype.rd = rd; - tree->ast_node.zbs_rtype.op = RISCV_BCLR; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x03) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x62)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_LU_H; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x24)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBS_RTYPE; - tree->ast_node.zbs_rtype.rs2 = rs2; - tree->ast_node.zbs_rtype.rs1 = rs1; - tree->ast_node.zbs_rtype.rd = rd; - tree->ast_node.zbs_rtype.op = RISCV_BEXT; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x6A)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_L; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x34)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBS_RTYPE; - tree->ast_node.zbs_rtype.rs2 = rs2; - tree->ast_node.zbs_rtype.rs1 = rs1; - tree->ast_node.zbs_rtype.rd = rd; - tree->ast_node.zbs_rtype.op = RISCV_BINV; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_RM_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x03) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x6A)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; + tree->ast_node.f_un_rm_type_h.rs1 = rs1; + tree->ast_node.f_un_rm_type_h.rm = rm; + tree->ast_node.f_un_rm_type_h.rd = rd; + tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_LU; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x14)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBS_RTYPE; - tree->ast_node.zbs_rtype.rs2 = rs2; - tree->ast_node.zbs_rtype.rs1 = rs1; - tree->ast_node.zbs_rtype.rd = rd; - tree->ast_node.zbs_rtype.op = RISCV_BSET; - return; + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x72)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_TYPE_H; + tree->ast_node.f_un_type_h.rs1 = rs1; + tree->ast_node.f_un_type_h.rd = rd; + tree->ast_node.f_un_type_h.fmv_h_x = RISCV_FCLASS_H; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x02)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x72)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_F_UN_TYPE_H; + tree->ast_node.f_un_type_h.rs1 = rs1; + tree->ast_node.f_un_type_h.rd = rd; + tree->ast_node.f_un_type_h.fmv_h_x = RISCV_FMV_X_H; + return; } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------F_UN_TYPE_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x7A)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_H; - tree->ast_node.f_bin_rm_type_h.rs2 = rs2; - tree->ast_node.f_bin_rm_type_h.rs1 = rs1; - tree->ast_node.f_bin_rm_type_h.rm = rm; - tree->ast_node.f_bin_rm_type_h.rd = rd; - tree->ast_node.f_bin_rm_type_h.op = RISCV_FADD_H; + tree->ast_node_type = RISCV_F_UN_TYPE_H; + tree->ast_node.f_un_type_h.rs1 = rs1; + tree->ast_node.f_un_type_h.rd = rd; + tree->ast_node.f_un_type_h.fmv_h_x = RISCV_FMV_H_X; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x06)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------RISCV_FLI_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x7A)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_FLI_H; + tree->ast_node.riscv_fli_h.constantidx = rs1; + tree->ast_node.riscv_fli_h.rd = rd; + return; } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------RISCV_FLI_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x78)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_H; - tree->ast_node.f_bin_rm_type_h.rs2 = rs2; - tree->ast_node.f_bin_rm_type_h.rs1 = rs1; - tree->ast_node.f_bin_rm_type_h.rm = rm; - tree->ast_node.f_bin_rm_type_h.rd = rd; - tree->ast_node.f_bin_rm_type_h.op = RISCV_FSUB_H; + tree->ast_node_type = RISCV_FLI_S; + tree->ast_node.riscv_fli_s.constantidx = rs1; + tree->ast_node.riscv_fli_s.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x0A)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------RISCV_FLI_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x79)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_FLI_D; + tree->ast_node.riscv_fli_d.constantidx = rs1; + tree->ast_node.riscv_fli_d.rd = rd; + return; } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------RISCV_FMINM_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x16)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_H; - tree->ast_node.f_bin_rm_type_h.rs2 = rs2; - tree->ast_node.f_bin_rm_type_h.rs1 = rs1; - tree->ast_node.f_bin_rm_type_h.rm = rm; - tree->ast_node.f_bin_rm_type_h.rd = rd; - tree->ast_node.f_bin_rm_type_h.op = RISCV_FMUL_H; + tree->ast_node_type = RISCV_FMINM_H; + tree->ast_node.riscv_fminm_h.rs2 = rs2; + tree->ast_node.riscv_fminm_h.rs1 = rs1; + tree->ast_node.riscv_fminm_h.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x0E)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FMAXM_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x16)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_RM_TYPE_H; - tree->ast_node.f_bin_rm_type_h.rs2 = rs2; - tree->ast_node.f_bin_rm_type_h.rs1 = rs1; - tree->ast_node.f_bin_rm_type_h.rm = rm; - tree->ast_node.f_bin_rm_type_h.rd = rd; - tree->ast_node.f_bin_rm_type_h.op = RISCV_FDIV_H; + tree->ast_node_type = RISCV_FMAXM_H; + tree->ast_node.riscv_fmaxm_h.rs2 = rs2; + tree->ast_node.riscv_fmaxm_h.rs1 = rs1; + tree->ast_node.riscv_fmaxm_h.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x43) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x2)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FMINM_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x14)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_H; - tree->ast_node.f_madd_type_h.rs3 = rs3; - tree->ast_node.f_madd_type_h.rs2 = rs2; - tree->ast_node.f_madd_type_h.rs1 = rs1; - tree->ast_node.f_madd_type_h.rm = rm; - tree->ast_node.f_madd_type_h.rd = rd; - tree->ast_node.f_madd_type_h.op = RISCV_FMADD_H; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x47) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x2)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + tree->ast_node_type = RISCV_FMINM_S; + tree->ast_node.riscv_fminm_s.rs2 = rs2; + tree->ast_node.riscv_fminm_s.rs1 = rs1; + tree->ast_node.riscv_fminm_s.rd = rd; + return; } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------RISCV_FMAXM_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x14)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_H; - tree->ast_node.f_madd_type_h.rs3 = rs3; - tree->ast_node.f_madd_type_h.rs2 = rs2; - tree->ast_node.f_madd_type_h.rs1 = rs1; - tree->ast_node.f_madd_type_h.rm = rm; - tree->ast_node.f_madd_type_h.rd = rd; - tree->ast_node.f_madd_type_h.op = RISCV_FMSUB_H; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x4B) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x2)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + tree->ast_node_type = RISCV_FMAXM_S; + tree->ast_node.riscv_fmaxm_s.rs2 = rs2; + tree->ast_node.riscv_fmaxm_s.rs1 = rs1; + tree->ast_node.riscv_fmaxm_s.rd = rd; + return; } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------RISCV_FMINM_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x15)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_H; - tree->ast_node.f_madd_type_h.rs3 = rs3; - tree->ast_node.f_madd_type_h.rs2 = rs2; - tree->ast_node.f_madd_type_h.rs1 = rs1; - tree->ast_node.f_madd_type_h.rm = rm; - tree->ast_node.f_madd_type_h.rd = rd; - tree->ast_node.f_madd_type_h.op = RISCV_FNMSUB_H; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x4F) && - ((binary_stream & 0x0000000006000000) >> 25 == 0x2)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + tree->ast_node_type = RISCV_FMINM_D; + tree->ast_node.riscv_fminm_d.rs2 = rs2; + tree->ast_node.riscv_fminm_d.rs1 = rs1; + tree->ast_node.riscv_fminm_d.rd = rd; + return; } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------RISCV_FMAXM_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x15)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t rs3 = (binary_stream & 0x00000000F8000000) >> 27; - tree->ast_node_type = RISCV_F_MADD_TYPE_H; - tree->ast_node.f_madd_type_h.rs3 = rs3; - tree->ast_node.f_madd_type_h.rs2 = rs2; - tree->ast_node.f_madd_type_h.rs1 = rs1; - tree->ast_node.f_madd_type_h.rm = rm; - tree->ast_node.f_madd_type_h.rd = rd; - tree->ast_node.f_madd_type_h.op = RISCV_FNMADD_H; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x12)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_H; - tree->ast_node.f_bin_type_h.rs2 = rs2; - tree->ast_node.f_bin_type_h.rs1 = rs1; - tree->ast_node.f_bin_type_h.rd = rd; - tree->ast_node.f_bin_type_h.fle_h = RISCV_FSGNJ_H; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x12)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_H; - tree->ast_node.f_bin_type_h.rs2 = rs2; - tree->ast_node.f_bin_type_h.rs1 = rs1; - tree->ast_node.f_bin_type_h.rd = rd; - tree->ast_node.f_bin_type_h.fle_h = RISCV_FSGNJN_H; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x12)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_H; - tree->ast_node.f_bin_type_h.rs2 = rs2; - tree->ast_node.f_bin_type_h.rs1 = rs1; - tree->ast_node.f_bin_type_h.rd = rd; - tree->ast_node.f_bin_type_h.fle_h = RISCV_FSGNJX_H; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x16)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_H; - tree->ast_node.f_bin_type_h.rs2 = rs2; - tree->ast_node.f_bin_type_h.rs1 = rs1; - tree->ast_node.f_bin_type_h.rd = rd; - tree->ast_node.f_bin_type_h.fle_h = RISCV_FMIN_H; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x16)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_H; - tree->ast_node.f_bin_type_h.rs2 = rs2; - tree->ast_node.f_bin_type_h.rs1 = rs1; - tree->ast_node.f_bin_type_h.rd = rd; - tree->ast_node.f_bin_type_h.fle_h = RISCV_FMAX_H; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x52)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_H; - tree->ast_node.f_bin_type_h.rs2 = rs2; - tree->ast_node.f_bin_type_h.rs1 = rs1; - tree->ast_node.f_bin_type_h.rd = rd; - tree->ast_node.f_bin_type_h.fle_h = RISCV_FEQ_H; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x52)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_H; - tree->ast_node.f_bin_type_h.rs2 = rs2; - tree->ast_node.f_bin_type_h.rs1 = rs1; - tree->ast_node.f_bin_type_h.rd = rd; - tree->ast_node.f_bin_type_h.fle_h = RISCV_FLT_H; - return; + tree->ast_node_type = RISCV_FMAXM_D; + tree->ast_node.riscv_fmaxm_d.rs2 = rs2; + tree->ast_node.riscv_fmaxm_d.rs1 = rs1; + tree->ast_node.riscv_fmaxm_d.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x52)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_F_BIN_TYPE_H; - tree->ast_node.f_bin_type_h.rs2 = rs2; - tree->ast_node.f_bin_type_h.rs1 = rs1; - tree->ast_node.f_bin_type_h.rd = rd; - tree->ast_node.f_bin_type_h.fle_h = RISCV_FLE_H; - return; + //------------------------------------------------------------ + + // ---------------------------RISCV_FROUND_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x04) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x22)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_FROUND_H; + tree->ast_node.riscv_fround_h.rs1 = rs1; + tree->ast_node.riscv_fround_h.rm = rm; + tree->ast_node.riscv_fround_h.rd = rd; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x2E)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------RISCV_FROUNDNX_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x05) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x22)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_FROUNDNX_H; + tree->ast_node.riscv_froundnx_h.rs1 = rs1; + tree->ast_node.riscv_froundnx_h.rm = rm; + tree->ast_node.riscv_froundnx_h.rd = rd; + return; + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FSQRT_H; - return; + } + //------------------------------------------------------------ + + // ---------------------------RISCV_FROUND_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x04) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_FROUND_S; + tree->ast_node.riscv_fround_s.rs1 = rs1; + tree->ast_node.riscv_fround_s.rm = rm; + tree->ast_node.riscv_fround_s.rd = rd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x62)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------RISCV_FROUNDNX_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x05) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x20)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_FROUNDNX_S; + tree->ast_node.riscv_froundnx_s.rs1 = rs1; + tree->ast_node.riscv_froundnx_s.rm = rm; + tree->ast_node.riscv_froundnx_s.rd = rd; + return; + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_W_H; - return; + } + //------------------------------------------------------------ + + // ---------------------------RISCV_FROUND_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x04) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x21)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_FROUND_D; + tree->ast_node.riscv_fround_d.rs1 = rs1; + tree->ast_node.riscv_fround_d.rm = rm; + tree->ast_node.riscv_fround_d.rd = rd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x62)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; + //------------------------------------------------------------ + + // ---------------------------RISCV_FROUNDNX_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x05) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x21)) { + uint64_t rm = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + rm = RISCV_RM_DYN; + break; + case 0x1: + rm = RISCV_RM_RTZ; + break; + case 0x3: + rm = RISCV_RM_RUP; + break; + case 0x2: + rm = RISCV_RM_RDN; + break; + case 0x4: + rm = RISCV_RM_RMM; + break; + case 0x0: + rm = RISCV_RM_RNE; + break; + } + if (rm != 0xFFFFFFFFFFFFFFFF) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_FROUNDNX_D; + tree->ast_node.riscv_froundnx_d.rs1 = rs1; + tree->ast_node.riscv_froundnx_d.rm = rm; + tree->ast_node.riscv_froundnx_d.rd = rd; + return; + } } - if (rm != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------RISCV_FMVH_X_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x71)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_WU_H; + tree->ast_node_type = RISCV_FMVH_X_D; + tree->ast_node.riscv_fmvh_x_d.rs1 = rs1; + tree->ast_node.riscv_fmvh_x_d.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x6A)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FMVP_D_X------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x59)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_W; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_FMVP_D_X; + tree->ast_node.riscv_fmvp_d_x.rs2 = rs2; + tree->ast_node.riscv_fmvp_d_x.rs1 = rs1; + tree->ast_node.riscv_fmvp_d_x.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x6A)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FLEQ_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x52)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_WU; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_FLEQ_H; + tree->ast_node.riscv_fleq_h.rs2 = rs2; + tree->ast_node.riscv_fleq_h.rs1 = rs1; + tree->ast_node.riscv_fleq_h.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x22)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FLTQ_H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x52)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_S; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_FLTQ_H; + tree->ast_node.riscv_fltq_h.rs2 = rs2; + tree->ast_node.riscv_fltq_h.rs1 = rs1; + tree->ast_node.riscv_fltq_h.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x22)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FLEQ_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x50)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_D; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_FLEQ_S; + tree->ast_node.riscv_fleq_s.rs2 = rs2; + tree->ast_node.riscv_fleq_s.rs1 = rs1; + tree->ast_node.riscv_fleq_s.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FLTQ_S------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x50)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_S_H; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_FLTQ_S; + tree->ast_node.riscv_fltq_s.rs2 = rs2; + tree->ast_node.riscv_fltq_s.rs1 = rs1; + tree->ast_node.riscv_fltq_s.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x21)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FLEQ_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x51)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_D_H; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_FLEQ_D; + tree->ast_node.riscv_fleq_d.rs2 = rs2; + tree->ast_node.riscv_fleq_d.rs1 = rs1; + tree->ast_node.riscv_fleq_d.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x62)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FLTQ_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x51)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_L_H; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_FLTQ_D; + tree->ast_node.riscv_fltq_d.rs2 = rs2; + tree->ast_node.riscv_fltq_d.rs1 = rs1; + tree->ast_node.riscv_fltq_d.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x03) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x62)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------RISCV_FCVTMOD_W_D------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x53) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x08) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x61)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_LU_H; + tree->ast_node_type = RISCV_FCVTMOD_W_D; + tree->ast_node.riscv_fcvtmod_w_d.rs1 = rs1; + tree->ast_node.riscv_fcvtmod_w_d.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x6A)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------SHA256SUM0------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_L; + tree->ast_node_type = RISCV_SHA256SUM0; + tree->ast_node.sha256sum0.rs1 = rs1; + tree->ast_node.sha256sum0.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x03) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x6A)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------SHA256SUM1------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x01) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_RM_TYPE_H; - tree->ast_node.f_un_rm_type_h.rs1 = rs1; - tree->ast_node.f_un_rm_type_h.rm = rm; - tree->ast_node.f_un_rm_type_h.rd = rd; - tree->ast_node.f_un_rm_type_h.fcvt_h_lu = RISCV_FCVT_H_LU; + tree->ast_node_type = RISCV_SHA256SUM1; + tree->ast_node.sha256sum1.rs1 = rs1; + tree->ast_node.sha256sum1.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x72)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_H; - tree->ast_node.f_un_type_h.rs1 = rs1; - tree->ast_node.f_un_type_h.rd = rd; - tree->ast_node.f_un_type_h.fmv_h_x = RISCV_FCLASS_H; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x72)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_H; - tree->ast_node.f_un_type_h.rs1 = rs1; - tree->ast_node.f_un_type_h.rd = rd; - tree->ast_node.f_un_type_h.fmv_h_x = RISCV_FMV_X_H; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x7A)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_F_UN_TYPE_H; - tree->ast_node.f_un_type_h.rs1 = rs1; - tree->ast_node.f_un_type_h.rd = rd; - tree->ast_node.f_un_type_h.fmv_h_x = RISCV_FMV_H_X; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x7A)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FLI_H; - tree->ast_node.riscv_fli_h.constantidx = rs1; - tree->ast_node.riscv_fli_h.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x78)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FLI_S; - tree->ast_node.riscv_fli_s.constantidx = rs1; - tree->ast_node.riscv_fli_s.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x79)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FLI_D; - tree->ast_node.riscv_fli_d.constantidx = rs1; - tree->ast_node.riscv_fli_d.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x16)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FMINM_H; - tree->ast_node.riscv_fminm_h.rs2 = rs2; - tree->ast_node.riscv_fminm_h.rs1 = rs1; - tree->ast_node.riscv_fminm_h.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x16)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FMAXM_H; - tree->ast_node.riscv_fmaxm_h.rs2 = rs2; - tree->ast_node.riscv_fmaxm_h.rs1 = rs1; - tree->ast_node.riscv_fmaxm_h.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x14)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FMINM_S; - tree->ast_node.riscv_fminm_s.rs2 = rs2; - tree->ast_node.riscv_fminm_s.rs1 = rs1; - tree->ast_node.riscv_fminm_s.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x14)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FMAXM_S; - tree->ast_node.riscv_fmaxm_s.rs2 = rs2; - tree->ast_node.riscv_fmaxm_s.rs1 = rs1; - tree->ast_node.riscv_fmaxm_s.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x15)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FMINM_D; - tree->ast_node.riscv_fminm_d.rs2 = rs2; - tree->ast_node.riscv_fminm_d.rs1 = rs1; - tree->ast_node.riscv_fminm_d.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x15)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FMAXM_D; - tree->ast_node.riscv_fmaxm_d.rs2 = rs2; - tree->ast_node.riscv_fmaxm_d.rs1 = rs1; - tree->ast_node.riscv_fmaxm_d.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x04) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x22)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------SHA256SIG0------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x02) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FROUND_H; - tree->ast_node.riscv_fround_h.rs1 = rs1; - tree->ast_node.riscv_fround_h.rm = rm; - tree->ast_node.riscv_fround_h.rd = rd; + tree->ast_node_type = RISCV_SHA256SIG0; + tree->ast_node.sha256sig0.rs1 = rs1; + tree->ast_node.sha256sig0.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x05) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x22)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------SHA256SIG1------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x03) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FROUNDNX_H; - tree->ast_node.riscv_froundnx_h.rs1 = rs1; - tree->ast_node.riscv_froundnx_h.rm = rm; - tree->ast_node.riscv_froundnx_h.rd = rd; + tree->ast_node_type = RISCV_SHA256SIG1; + tree->ast_node.sha256sig1.rs1 = rs1; + tree->ast_node.sha256sig1.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x04) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------AES32ESMI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x13)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FROUND_S; - tree->ast_node.riscv_fround_s.rs1 = rs1; - tree->ast_node.riscv_fround_s.rm = rm; - tree->ast_node.riscv_fround_s.rd = rd; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; + tree->ast_node_type = RISCV_AES32ESMI; + tree->ast_node.aes32esmi.bs = bs; + tree->ast_node.aes32esmi.rs2 = rs2; + tree->ast_node.aes32esmi.rs1 = rs1; + tree->ast_node.aes32esmi.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x05) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x20)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------AES32ESI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x11)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FROUNDNX_S; - tree->ast_node.riscv_froundnx_s.rs1 = rs1; - tree->ast_node.riscv_froundnx_s.rm = rm; - tree->ast_node.riscv_froundnx_s.rd = rd; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; + tree->ast_node_type = RISCV_AES32ESI; + tree->ast_node.aes32esi.bs = bs; + tree->ast_node.aes32esi.rs2 = rs2; + tree->ast_node.aes32esi.rs1 = rs1; + tree->ast_node.aes32esi.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x04) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x21)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------AES32DSMI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x17)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FROUND_D; - tree->ast_node.riscv_fround_d.rs1 = rs1; - tree->ast_node.riscv_fround_d.rm = rm; - tree->ast_node.riscv_fround_d.rd = rd; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; + tree->ast_node_type = RISCV_AES32DSMI; + tree->ast_node.aes32dsmi.bs = bs; + tree->ast_node.aes32dsmi.rs2 = rs2; + tree->ast_node.aes32dsmi.rs1 = rs1; + tree->ast_node.aes32dsmi.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x05) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x21)) { - uint64_t rm = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - rm = RISCV_RM_DYN; - break; - case 0x1: - rm = RISCV_RM_RTZ; - break; - case 0x3: - rm = RISCV_RM_RUP; - break; - case 0x2: - rm = RISCV_RM_RDN; - break; - case 0x4: - rm = RISCV_RM_RMM; - break; - case 0x0: - rm = RISCV_RM_RNE; - break; - } - if (rm != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------AES32DSI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x15)) { uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FROUNDNX_D; - tree->ast_node.riscv_froundnx_d.rs1 = rs1; - tree->ast_node.riscv_froundnx_d.rm = rm; - tree->ast_node.riscv_froundnx_d.rd = rd; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; + tree->ast_node_type = RISCV_AES32DSI; + tree->ast_node.aes32dsi.bs = bs; + tree->ast_node.aes32dsi.rs2 = rs2; + tree->ast_node.aes32dsi.rs1 = rs1; + tree->ast_node.aes32dsi.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x71)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FMVH_X_D; - tree->ast_node.riscv_fmvh_x_d.rs1 = rs1; - tree->ast_node.riscv_fmvh_x_d.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x59)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FMVP_D_X; - tree->ast_node.riscv_fmvp_d_x.rs2 = rs2; - tree->ast_node.riscv_fmvp_d_x.rs1 = rs1; - tree->ast_node.riscv_fmvp_d_x.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x52)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FLEQ_H; - tree->ast_node.riscv_fleq_h.rs2 = rs2; - tree->ast_node.riscv_fleq_h.rs1 = rs1; - tree->ast_node.riscv_fleq_h.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x52)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FLTQ_H; - tree->ast_node.riscv_fltq_h.rs2 = rs2; - tree->ast_node.riscv_fltq_h.rs1 = rs1; - tree->ast_node.riscv_fltq_h.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x50)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FLEQ_S; - tree->ast_node.riscv_fleq_s.rs2 = rs2; - tree->ast_node.riscv_fleq_s.rs1 = rs1; - tree->ast_node.riscv_fleq_s.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x50)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FLTQ_S; - tree->ast_node.riscv_fltq_s.rs2 = rs2; - tree->ast_node.riscv_fltq_s.rs1 = rs1; - tree->ast_node.riscv_fltq_s.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x51)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FLEQ_D; - tree->ast_node.riscv_fleq_d.rs2 = rs2; - tree->ast_node.riscv_fleq_d.rs1 = rs1; - tree->ast_node.riscv_fleq_d.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x51)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_FLTQ_D; - tree->ast_node.riscv_fltq_d.rs2 = rs2; - tree->ast_node.riscv_fltq_d.rs1 = rs1; - tree->ast_node.riscv_fltq_d.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x53) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x08) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x61)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_FCVTMOD_W_D; - tree->ast_node.riscv_fcvtmod_w_d.rs1 = rs1; - tree->ast_node.riscv_fcvtmod_w_d.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SHA256SUM0; - tree->ast_node.sha256sum0.rs1 = rs1; - tree->ast_node.sha256sum0.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x01) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SHA256SUM1; - tree->ast_node.sha256sum1.rs1 = rs1; - tree->ast_node.sha256sum1.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x02) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SHA256SIG0; - tree->ast_node.sha256sig0.rs1 = rs1; - tree->ast_node.sha256sig0.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x03) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SHA256SIG1; - tree->ast_node.sha256sig1.rs1 = rs1; - tree->ast_node.sha256sig1.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x13)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; - tree->ast_node_type = RISCV_AES32ESMI; - tree->ast_node.aes32esmi.bs = bs; - tree->ast_node.aes32esmi.rs2 = rs2; - tree->ast_node.aes32esmi.rs1 = rs1; - tree->ast_node.aes32esmi.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x11)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; - tree->ast_node_type = RISCV_AES32ESI; - tree->ast_node.aes32esi.bs = bs; - tree->ast_node.aes32esi.rs2 = rs2; - tree->ast_node.aes32esi.rs1 = rs1; - tree->ast_node.aes32esi.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x17)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; - tree->ast_node_type = RISCV_AES32DSMI; - tree->ast_node.aes32dsmi.bs = bs; - tree->ast_node.aes32dsmi.rs2 = rs2; - tree->ast_node.aes32dsmi.rs1 = rs1; - tree->ast_node.aes32dsmi.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x15)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; - tree->ast_node_type = RISCV_AES32DSI; - tree->ast_node.aes32dsi.bs = bs; - tree->ast_node.aes32dsi.rs2 = rs2; - tree->ast_node.aes32dsi.rs1 = rs1; - tree->ast_node.aes32dsi.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHA512SUM0R; - tree->ast_node.sha512sum0r.rs2 = rs2; - tree->ast_node.sha512sum0r.rs1 = rs1; - tree->ast_node.sha512sum0r.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x09) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHA512SUM1R; - tree->ast_node.sha512sum1r.rs2 = rs2; - tree->ast_node.sha512sum1r.rs1 = rs1; - tree->ast_node.sha512sum1r.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x0A) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHA512SIG0L; - tree->ast_node.sha512sig0l.rs2 = rs2; - tree->ast_node.sha512sig0l.rs1 = rs1; - tree->ast_node.sha512sig0l.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x0E) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHA512SIG0H; - tree->ast_node.sha512sig0h.rs2 = rs2; - tree->ast_node.sha512sig0h.rs1 = rs1; - tree->ast_node.sha512sig0h.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x0B) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHA512SIG1L; - tree->ast_node.sha512sig1l.rs2 = rs2; - tree->ast_node.sha512sig1l.rs1 = rs1; - tree->ast_node.sha512sig1l.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x0F) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_SHA512SIG1H; - tree->ast_node.sha512sig1h.rs2 = rs2; - tree->ast_node.sha512sig1h.rs1 = rs1; - tree->ast_node.sha512sig1h.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001000000) >> 24 == 0x1) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x18) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rnum = (binary_stream & 0x0000000000F00000) >> 20; - tree->ast_node_type = RISCV_AES64KS1I; - tree->ast_node.aes64ks1i.rnum = rnum; - tree->ast_node.aes64ks1i.rs1 = rs1; - tree->ast_node.aes64ks1i.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x18) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_AES64IM; - tree->ast_node.aes64im.rs1 = rs1; - tree->ast_node.aes64im.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x1F) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x1)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_AES64KS2; - tree->ast_node.aes64ks2.rs2 = rs2; - tree->ast_node.aes64ks2.rs1 = rs1; - tree->ast_node.aes64ks2.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x1B) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_AES64ESM; - tree->ast_node.aes64esm.rs2 = rs2; - tree->ast_node.aes64esm.rs1 = rs1; - tree->ast_node.aes64esm.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x19) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_AES64ES; - tree->ast_node.aes64es.rs2 = rs2; - tree->ast_node.aes64es.rs1 = rs1; - tree->ast_node.aes64es.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x1F) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_AES64DSM; - tree->ast_node.aes64dsm.rs2 = rs2; - tree->ast_node.aes64dsm.rs1 = rs1; - tree->ast_node.aes64dsm.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x1D) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_AES64DS; - tree->ast_node.aes64ds.rs2 = rs2; - tree->ast_node.aes64ds.rs1 = rs1; - tree->ast_node.aes64ds.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x04) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SHA512SUM0; - tree->ast_node.sha512sum0.rs1 = rs1; - tree->ast_node.sha512sum0.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x05) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SHA512SUM1; - tree->ast_node.sha512sum1.rs1 = rs1; - tree->ast_node.sha512sum1.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x06) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SHA512SIG0; - tree->ast_node.sha512sig0.rs1 = rs1; - tree->ast_node.sha512sig0.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x07) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SHA512SIG1; - tree->ast_node.sha512sig1.rs1 = rs1; - tree->ast_node.sha512sig1.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x08) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SM3P0; - tree->ast_node.sm3p0.rs1 = rs1; - tree->ast_node.sm3p0.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x09) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x08) && - ((binary_stream & 0x00000000C0000000) >> 30 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_SM3P1; - tree->ast_node.sm3p1.rs1 = rs1; - tree->ast_node.sm3p1.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x18)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; - tree->ast_node_type = RISCV_SM4ED; - tree->ast_node.sm4ed.bs = bs; - tree->ast_node.sm4ed.rs2 = rs2; - tree->ast_node.sm4ed.rs1 = rs1; - tree->ast_node.sm4ed.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x000000003E000000) >> 25 == 0x1A)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; - tree->ast_node_type = RISCV_SM4KS; - tree->ast_node.sm4ks.bs = bs; - tree->ast_node.sm4ks.rs2 = rs2; - tree->ast_node.sm4ks.rs1 = rs1; - tree->ast_node.sm4ks.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x04)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBKB_RTYPE; - tree->ast_node.zbkb_rtype.rs2 = rs2; - tree->ast_node.zbkb_rtype.rs1 = rs1; - tree->ast_node.zbkb_rtype.rd = rd; - tree->ast_node.zbkb_rtype.op = RISCV_PACK; - return; - } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x7) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x04)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBKB_RTYPE; - tree->ast_node.zbkb_rtype.rs2 = rs2; - tree->ast_node.zbkb_rtype.rs1 = rs1; - tree->ast_node.zbkb_rtype.rd = rd; - tree->ast_node.zbkb_rtype.op = RISCV_PACKH; - return; - } - if ((binary_stream & 0x000000000000007F == 0x3B) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x04)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZBKB_PACKW; - tree->ast_node.zbkb_packw.rs2 = rs2; - tree->ast_node.zbkb_packw.rs1 = rs1; - tree->ast_node.zbkb_packw.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x08F)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_ZIP; - tree->ast_node.riscv_zip.rs1 = rs1; - tree->ast_node.riscv_zip.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x08F)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_UNZIP; - tree->ast_node.riscv_unzip.rs1 = rs1; - tree->ast_node.riscv_unzip.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x13) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x687)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_BREV8; - tree->ast_node.riscv_brev8.rs1 = rs1; - tree->ast_node.riscv_brev8.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------SHA512SUM0R------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x1)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHA512SUM0R; + tree->ast_node.sha512sum0r.rs2 = rs2; + tree->ast_node.sha512sum0r.rs1 = rs1; + tree->ast_node.sha512sum0r.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x14)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_XPERM8; - tree->ast_node.riscv_xperm8.rs2 = rs2; - tree->ast_node.riscv_xperm8.rs1 = rs1; - tree->ast_node.riscv_xperm8.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------SHA512SUM1R------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x09) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x1)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHA512SUM1R; + tree->ast_node.sha512sum1r.rs2 = rs2; + tree->ast_node.sha512sum1r.rs1 = rs1; + tree->ast_node.sha512sum1r.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x14)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_XPERM4; - tree->ast_node.riscv_xperm4.rs2 = rs2; - tree->ast_node.riscv_xperm4.rs1 = rs1; - tree->ast_node.riscv_xperm4.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------SHA512SIG0L------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x0A) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x1)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHA512SIG0L; + tree->ast_node.sha512sig0l.rs2 = rs2; + tree->ast_node.sha512sig0l.rs1 = rs1; + tree->ast_node.sha512sig0l.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x07)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZICOND_RTYPE; - tree->ast_node.zicond_rtype.rs2 = rs2; - tree->ast_node.zicond_rtype.rs1 = rs1; - tree->ast_node.zicond_rtype.rd = rd; - tree->ast_node.zicond_rtype.riscv_czero_nez = RISCV_CZERO_EQZ; - return; + //------------------------------------------------------------ + + // ---------------------------SHA512SIG0H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x0E) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x1)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHA512SIG0H; + tree->ast_node.sha512sig0h.rs2 = rs2; + tree->ast_node.sha512sig0h.rs1 = rs1; + tree->ast_node.sha512sig0h.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x33) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x7) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x07)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_ZICOND_RTYPE; - tree->ast_node.zicond_rtype.rs2 = rs2; - tree->ast_node.zicond_rtype.rs1 = rs1; - tree->ast_node.zicond_rtype.rd = rd; - tree->ast_node.zicond_rtype.riscv_czero_nez = RISCV_CZERO_NEZ; - return; + //------------------------------------------------------------ + + // ---------------------------SHA512SIG1L------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x0B) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x1)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHA512SIG1L; + tree->ast_node.sha512sig1l.rs2 = rs2; + tree->ast_node.sha512sig1l.rs1 = rs1; + tree->ast_node.sha512sig1l.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x7) && - ((binary_stream & 0x00000000F0000000) >> 28 == 0x0)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t lmul = (binary_stream & 0x0000000000700000) >> 20; - uint64_t sew = (binary_stream & 0x0000000003800000) >> 23; - uint64_t ta = (binary_stream & 0x0000000004000000) >> 26; - uint64_t ma = (binary_stream & 0x0000000008000000) >> 27; - tree->ast_node_type = RISCV_VSETVLI; - tree->ast_node.vsetvli.ma = ma; - tree->ast_node.vsetvli.ta = ta; - tree->ast_node.vsetvli.sew = sew; - tree->ast_node.vsetvli.lmul = lmul; - tree->ast_node.vsetvli.rs1 = rs1; - tree->ast_node.vsetvli.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------SHA512SIG1H------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x0F) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x1)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_SHA512SIG1H; + tree->ast_node.sha512sig1h.rs2 = rs2; + tree->ast_node.sha512sig1h.rs1 = rs1; + tree->ast_node.sha512sig1h.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x7) && - ((binary_stream & 0x00000000FE000000) >> 25 == 0x40)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VSETVL; - tree->ast_node.vsetvl.rs2 = rs2; - tree->ast_node.vsetvl.rs1 = rs1; - tree->ast_node.vsetvl.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------AES64KS1I------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001000000) >> 24) == 0x1) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x18) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rnum = (binary_stream & 0x0000000000F00000) >> 20; + tree->ast_node_type = RISCV_AES64KS1I; + tree->ast_node.aes64ks1i.rnum = rnum; + tree->ast_node.aes64ks1i.rs1 = rs1; + tree->ast_node.aes64ks1i.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x7) && - ((binary_stream & 0x00000000F0000000) >> 28 == 0xC)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t uimm = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t lmul = (binary_stream & 0x0000000000700000) >> 20; - uint64_t sew = (binary_stream & 0x0000000003800000) >> 23; - uint64_t ta = (binary_stream & 0x0000000004000000) >> 26; - uint64_t ma = (binary_stream & 0x0000000008000000) >> 27; - tree->ast_node_type = RISCV_VSETIVLI; - tree->ast_node.vsetivli.ma = ma; - tree->ast_node.vsetivli.ta = ta; - tree->ast_node.vsetivli.sew = sew; - tree->ast_node.vsetivli.lmul = lmul; - tree->ast_node.vsetivli.uimm = uimm; - tree->ast_node.vsetivli.rd = rd; - return; + //------------------------------------------------------------ + + // ---------------------------AES64IM------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x18) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_AES64IM; + tree->ast_node.aes64im.rs1 = rs1; + tree->ast_node.aes64im.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x06: - funct6 = RISCV_VV_VMAXU; - break; - case 0x25: - funct6 = RISCV_VV_VSLL; - break; - case 0x23: - funct6 = RISCV_VV_VSSUB; - break; - case 0x09: - funct6 = RISCV_VV_VAND; - break; - case 0x00: - funct6 = RISCV_VV_VADD; - break; - case 0x0A: - funct6 = RISCV_VV_VOR; - break; - case 0x0C: - funct6 = RISCV_VV_VRGATHER; - break; - case 0x2B: - funct6 = RISCV_VV_VSSRA; - break; - case 0x02: - funct6 = RISCV_VV_VSUB; - break; - case 0x20: - funct6 = RISCV_VV_VSADDU; - break; - case 0x28: - funct6 = RISCV_VV_VSRL; - break; - case 0x0B: - funct6 = RISCV_VV_VXOR; - break; - case 0x07: - funct6 = RISCV_VV_VMAX; - break; - case 0x04: - funct6 = RISCV_VV_VMINU; - break; - case 0x22: - funct6 = RISCV_VV_VSSUBU; - break; - case 0x27: - funct6 = RISCV_VV_VSMUL; - break; - case 0x0E: - funct6 = RISCV_VV_VRGATHEREI16; - break; - case 0x2A: - funct6 = RISCV_VV_VSSRL; - break; - case 0x05: - funct6 = RISCV_VV_VMIN; - break; - case 0x21: - funct6 = RISCV_VV_VSADD; - break; - case 0x29: - funct6 = RISCV_VV_VSRA; - break; + //------------------------------------------------------------ + + // ---------------------------AES64KS2------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x1F) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x1)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_AES64KS2; + tree->ast_node.aes64ks2.rs2 = rs2; + tree->ast_node.aes64ks2.rs1 = rs1; + tree->ast_node.aes64ks2.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VVTYPE; - tree->ast_node.vvtype.funct6 = funct6; - tree->ast_node.vvtype.vm = vm; - tree->ast_node.vvtype.vs2 = vs2; - tree->ast_node.vvtype.vs1 = vs1; - tree->ast_node.vvtype.vd = vd; + } + //------------------------------------------------------------ + + // ---------------------------AES64ESM------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x1B) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_AES64ESM; + tree->ast_node.aes64esm.rs2 = rs2; + tree->ast_node.aes64esm.rs1 = rs1; + tree->ast_node.aes64esm.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x2C: - funct6 = RISCV_NVS_VNSRL; - break; - case 0x2D: - funct6 = RISCV_NVS_VNSRA; - break; + //------------------------------------------------------------ + + // ---------------------------AES64ES------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x19) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_AES64ES; + tree->ast_node.aes64es.rs2 = rs2; + tree->ast_node.aes64es.rs1 = rs1; + tree->ast_node.aes64es.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_NVSTYPE; - tree->ast_node.nvstype.funct6 = funct6; - tree->ast_node.nvstype.vm = vm; - tree->ast_node.nvstype.vs2 = vs2; - tree->ast_node.nvstype.vs1 = vs1; - tree->ast_node.nvstype.vd = vd; + } + //------------------------------------------------------------ + + // ---------------------------AES64DSM------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x1F) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_AES64DSM; + tree->ast_node.aes64dsm.rs2 = rs2; + tree->ast_node.aes64dsm.rs1 = rs1; + tree->ast_node.aes64dsm.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x2E: - funct6 = RISCV_NV_VNCLIPU; - break; - case 0x2F: - funct6 = RISCV_NV_VNCLIP; - break; + //------------------------------------------------------------ + + // ---------------------------AES64DS------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x1D) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_AES64DS; + tree->ast_node.aes64ds.rs2 = rs2; + tree->ast_node.aes64ds.rs1 = rs1; + tree->ast_node.aes64ds.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_NVTYPE; - tree->ast_node.nvtype.funct6 = funct6; - tree->ast_node.nvtype.vm = vm; - tree->ast_node.nvtype.vs2 = vs2; - tree->ast_node.nvtype.vs1 = vs1; - tree->ast_node.nvtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_MASKTYPEV; - tree->ast_node.masktypev.vs2 = vs2; - tree->ast_node.masktypev.vs1 = vs1; - tree->ast_node.masktypev.vd = vd; - return; } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_MOVETYPEV; - tree->ast_node.movetypev.vs1 = vs1; - tree->ast_node.movetypev.vd = vd; - return; + //------------------------------------------------------------ + + // ---------------------------SHA512SUM0------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x04) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_SHA512SUM0; + tree->ast_node.sha512sum0.rs1 = rs1; + tree->ast_node.sha512sum0.rd = rd; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x06: - funct6 = RISCV_VX_VMAXU; - break; - case 0x25: - funct6 = RISCV_VX_VSLL; - break; - case 0x23: - funct6 = RISCV_VX_VSSUB; - break; - case 0x09: - funct6 = RISCV_VX_VAND; - break; - case 0x00: - funct6 = RISCV_VX_VADD; - break; - case 0x0A: - funct6 = RISCV_VX_VOR; - break; - case 0x2B: - funct6 = RISCV_VX_VSSRA; - break; - case 0x02: - funct6 = RISCV_VX_VSUB; - break; - case 0x20: - funct6 = RISCV_VX_VSADDU; - break; - case 0x28: - funct6 = RISCV_VX_VSRL; - break; - case 0x0B: - funct6 = RISCV_VX_VXOR; - break; - case 0x07: - funct6 = RISCV_VX_VMAX; - break; - case 0x04: - funct6 = RISCV_VX_VMINU; - break; - case 0x22: - funct6 = RISCV_VX_VSSUBU; - break; - case 0x27: - funct6 = RISCV_VX_VSMUL; - break; - case 0x2A: - funct6 = RISCV_VX_VSSRL; - break; - case 0x03: - funct6 = RISCV_VX_VRSUB; - break; - case 0x05: - funct6 = RISCV_VX_VMIN; - break; - case 0x21: - funct6 = RISCV_VX_VSADD; - break; - case 0x29: - funct6 = RISCV_VX_VSRA; - break; + //------------------------------------------------------------ + + // ---------------------------SHA512SUM1------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x05) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_SHA512SUM1; + tree->ast_node.sha512sum1.rs1 = rs1; + tree->ast_node.sha512sum1.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + } + //------------------------------------------------------------ + + // ---------------------------SHA512SIG0------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x06) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VXTYPE; - tree->ast_node.vxtype.funct6 = funct6; - tree->ast_node.vxtype.vm = vm; - tree->ast_node.vxtype.vs2 = vs2; - tree->ast_node.vxtype.rs1 = rs1; - tree->ast_node.vxtype.vd = vd; + tree->ast_node_type = RISCV_SHA512SIG0; + tree->ast_node.sha512sig0.rs1 = rs1; + tree->ast_node.sha512sig0.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x2C: - funct6 = RISCV_NXS_VNSRL; - break; - case 0x2D: - funct6 = RISCV_NXS_VNSRA; - break; + //------------------------------------------------------------ + + // ---------------------------SHA512SIG1------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x07) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_SHA512SIG1; + tree->ast_node.sha512sig1.rs1 = rs1; + tree->ast_node.sha512sig1.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + } + //------------------------------------------------------------ + + // ---------------------------SM3P0------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x08) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_NXSTYPE; - tree->ast_node.nxstype.funct6 = funct6; - tree->ast_node.nxstype.vm = vm; - tree->ast_node.nxstype.vs2 = vs2; - tree->ast_node.nxstype.rs1 = rs1; - tree->ast_node.nxstype.vd = vd; + tree->ast_node_type = RISCV_SM3P0; + tree->ast_node.sm3p0.rs1 = rs1; + tree->ast_node.sm3p0.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x2E: - funct6 = RISCV_NX_VNCLIPU; - break; - case 0x2F: - funct6 = RISCV_NX_VNCLIP; - break; + //------------------------------------------------------------ + + // ---------------------------SM3P1------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x09) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x08) && + (((binary_stream & 0x00000000C0000000) >> 30) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_SM3P1; + tree->ast_node.sm3p1.rs1 = rs1; + tree->ast_node.sm3p1.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + } + //------------------------------------------------------------ + + // ---------------------------SM4ED------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x18)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_NXTYPE; - tree->ast_node.nxtype.funct6 = funct6; - tree->ast_node.nxtype.vm = vm; - tree->ast_node.nxtype.vs2 = vs2; - tree->ast_node.nxtype.rs1 = rs1; - tree->ast_node.nxtype.vd = vd; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; + tree->ast_node_type = RISCV_SM4ED; + tree->ast_node.sm4ed.bs = bs; + tree->ast_node.sm4ed.rs2 = rs2; + tree->ast_node.sm4ed.rs1 = rs1; + tree->ast_node.sm4ed.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x0E: - funct6 = RISCV_VX_VSLIDEUP; - break; - case 0x0C: - funct6 = RISCV_VX_VRGATHER; - break; - case 0x0F: - funct6 = RISCV_VX_VSLIDEDOWN; - break; + //------------------------------------------------------------ + + // ---------------------------SM4KS------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x000000003E000000) >> 25) == 0x1A)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t bs = (binary_stream & 0x00000000C0000000) >> 30; + tree->ast_node_type = RISCV_SM4KS; + tree->ast_node.sm4ks.bs = bs; + tree->ast_node.sm4ks.rs2 = rs2; + tree->ast_node.sm4ks.rs1 = rs1; + tree->ast_node.sm4ks.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + } + //------------------------------------------------------------ + + // ---------------------------ZBKB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x04)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VXSG; - tree->ast_node.vxsg.funct6 = funct6; - tree->ast_node.vxsg.vm = vm; - tree->ast_node.vxsg.vs2 = vs2; - tree->ast_node.vxsg.rs1 = rs1; - tree->ast_node.vxsg.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_MASKTYPEX; - tree->ast_node.masktypex.vs2 = vs2; - tree->ast_node.masktypex.rs1 = rs1; - tree->ast_node.masktypex.vd = vd; - return; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBKB_RTYPE; + tree->ast_node.zbkb_rtype.rs2 = rs2; + tree->ast_node.zbkb_rtype.rs1 = rs1; + tree->ast_node.zbkb_rtype.rd = rd; + tree->ast_node.zbkb_rtype.op = RISCV_PACK; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_MOVETYPEX; - tree->ast_node.movetypex.rs1 = rs1; - tree->ast_node.movetypex.vd = vd; - return; + //------------------------------------------------------------ + + // ---------------------------ZBKB_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x7) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x04)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBKB_RTYPE; + tree->ast_node.zbkb_rtype.rs2 = rs2; + tree->ast_node.zbkb_rtype.rs1 = rs1; + tree->ast_node.zbkb_rtype.rd = rd; + tree->ast_node.zbkb_rtype.op = RISCV_PACKH; + return; + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x28: - funct6 = RISCV_VI_VSRL; - break; - case 0x0B: - funct6 = RISCV_VI_VXOR; - break; - case 0x25: - funct6 = RISCV_VI_VSLL; - break; - case 0x09: - funct6 = RISCV_VI_VAND; - break; - case 0x00: - funct6 = RISCV_VI_VADD; - break; - case 0x0A: - funct6 = RISCV_VI_VOR; - break; - case 0x2A: - funct6 = RISCV_VI_VSSRL; - break; - case 0x03: - funct6 = RISCV_VI_VRSUB; - break; - case 0x21: - funct6 = RISCV_VI_VSADD; - break; - case 0x2B: - funct6 = RISCV_VI_VSSRA; - break; - case 0x29: - funct6 = RISCV_VI_VSRA; - break; - case 0x20: - funct6 = RISCV_VI_VSADDU; - break; + //------------------------------------------------------------ + + // ---------------------------ZBKB_PACKW------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x3B) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x04)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZBKB_PACKW; + tree->ast_node.zbkb_packw.rs2 = rs2; + tree->ast_node.zbkb_packw.rs1 = rs1; + tree->ast_node.zbkb_packw.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VITYPE; - tree->ast_node.vitype.funct6 = funct6; - tree->ast_node.vitype.vm = vm; - tree->ast_node.vitype.vs2 = vs2; - tree->ast_node.vitype.simm = simm; - tree->ast_node.vitype.vd = vd; + } + //------------------------------------------------------------ + + // ---------------------------RISCV_ZIP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x08F)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_ZIP; + tree->ast_node.riscv_zip.rs1 = rs1; + tree->ast_node.riscv_zip.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x2C: - funct6 = RISCV_NIS_VNSRL; - break; - case 0x2D: - funct6 = RISCV_NIS_VNSRA; - break; + //------------------------------------------------------------ + + // ---------------------------RISCV_UNZIP------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x08F)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_UNZIP; + tree->ast_node.riscv_unzip.rs1 = rs1; + tree->ast_node.riscv_unzip.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_NISTYPE; - tree->ast_node.nistype.funct6 = funct6; - tree->ast_node.nistype.vm = vm; - tree->ast_node.nistype.vs2 = vs2; - tree->ast_node.nistype.simm = simm; - tree->ast_node.nistype.vd = vd; + } + //------------------------------------------------------------ + + // ---------------------------RISCV_BREV8------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x13) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x687)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_BREV8; + tree->ast_node.riscv_brev8.rs1 = rs1; + tree->ast_node.riscv_brev8.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x2E: - funct6 = RISCV_NI_VNCLIPU; - break; - case 0x2F: - funct6 = RISCV_NI_VNCLIP; - break; + //------------------------------------------------------------ + + // ---------------------------RISCV_XPERM8------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x14)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_XPERM8; + tree->ast_node.riscv_xperm8.rs2 = rs2; + tree->ast_node.riscv_xperm8.rs1 = rs1; + tree->ast_node.riscv_xperm8.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_NITYPE; - tree->ast_node.nitype.funct6 = funct6; - tree->ast_node.nitype.vm = vm; - tree->ast_node.nitype.vs2 = vs2; - tree->ast_node.nitype.simm = simm; - tree->ast_node.nitype.vd = vd; + } + //------------------------------------------------------------ + + // ---------------------------RISCV_XPERM4------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x14)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_XPERM4; + tree->ast_node.riscv_xperm4.rs2 = rs2; + tree->ast_node.riscv_xperm4.rs1 = rs1; + tree->ast_node.riscv_xperm4.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x0E: - funct6 = RISCV_VI_VSLIDEUP; - break; - case 0x0C: - funct6 = RISCV_VI_VRGATHER; - break; - case 0x0F: - funct6 = RISCV_VI_VSLIDEDOWN; - break; + //------------------------------------------------------------ + + // ---------------------------ZICOND_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x07)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZICOND_RTYPE; + tree->ast_node.zicond_rtype.rs2 = rs2; + tree->ast_node.zicond_rtype.rs1 = rs1; + tree->ast_node.zicond_rtype.rd = rd; + tree->ast_node.zicond_rtype.riscv_czero_nez = RISCV_CZERO_EQZ; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VISG; - tree->ast_node.visg.funct6 = funct6; - tree->ast_node.visg.vm = vm; - tree->ast_node.visg.vs2 = vs2; - tree->ast_node.visg.simm = simm; - tree->ast_node.visg.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_MASKTYPEI; - tree->ast_node.masktypei.vs2 = vs2; - tree->ast_node.masktypei.simm = simm; - tree->ast_node.masktypei.vd = vd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_MOVETYPEI; - tree->ast_node.movetypei.vd = vd; - tree->ast_node.movetypei.simm = simm; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x27)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VMVRTYPE; - tree->ast_node.vmvrtype.vs2 = vs2; - tree->ast_node.vmvrtype.simm = simm; - tree->ast_node.vmvrtype.vd = vd; - return; } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x08: - funct6 = RISCV_MVV_VAADDU; - break; - case 0x0B: - funct6 = RISCV_MVV_VASUB; - break; - case 0x25: - funct6 = RISCV_MVV_VMUL; - break; - case 0x23: - funct6 = RISCV_MVV_VREM; - break; - case 0x09: - funct6 = RISCV_MVV_VAADD; - break; - case 0x27: - funct6 = RISCV_MVV_VMULH; - break; - case 0x22: - funct6 = RISCV_MVV_VREMU; - break; - case 0x0A: - funct6 = RISCV_MVV_VASUBU; - break; - case 0x24: - funct6 = RISCV_MVV_VMULHU; - break; - case 0x26: - funct6 = RISCV_MVV_VMULHSU; - break; - case 0x21: - funct6 = RISCV_MVV_VDIV; - break; - case 0x20: - funct6 = RISCV_MVV_VDIVU; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_MVVTYPE; - tree->ast_node.mvvtype.funct6 = funct6; - tree->ast_node.mvvtype.vm = vm; - tree->ast_node.mvvtype.vs2 = vs2; - tree->ast_node.mvvtype.vs1 = vs1; - tree->ast_node.mvvtype.vd = vd; + //------------------------------------------------------------ + + // ---------------------------ZICOND_RTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x33) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x7) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x07)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_ZICOND_RTYPE; + tree->ast_node.zicond_rtype.rs2 = rs2; + tree->ast_node.zicond_rtype.rs1 = rs1; + tree->ast_node.zicond_rtype.rd = rd; + tree->ast_node.zicond_rtype.riscv_czero_nez = RISCV_CZERO_NEZ; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x2D: - funct6 = RISCV_MVV_VMACC; - break; - case 0x2F: - funct6 = RISCV_MVV_VNMSAC; - break; - case 0x2B: - funct6 = RISCV_MVV_VNMSUB; - break; - case 0x29: - funct6 = RISCV_MVV_VMADD; - break; + //------------------------------------------------------------ + + // ---------------------------VSETVLI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x7) && + (((binary_stream & 0x00000000F0000000) >> 28) == 0x0)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t lmul = (binary_stream & 0x0000000000700000) >> 20; + uint64_t sew = (binary_stream & 0x0000000003800000) >> 23; + uint64_t ta = (binary_stream & 0x0000000004000000) >> 26; + uint64_t ma = (binary_stream & 0x0000000008000000) >> 27; + tree->ast_node_type = RISCV_VSETVLI; + tree->ast_node.vsetvli.ma = ma; + tree->ast_node.vsetvli.ta = ta; + tree->ast_node.vsetvli.sew = sew; + tree->ast_node.vsetvli.lmul = lmul; + tree->ast_node.vsetvli.rs1 = rs1; + tree->ast_node.vsetvli.rd = rd; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_MVVMATYPE; - tree->ast_node.mvvmatype.funct6 = funct6; - tree->ast_node.mvvmatype.vm = vm; - tree->ast_node.mvvmatype.vs2 = vs2; - tree->ast_node.mvvmatype.vs1 = vs1; - tree->ast_node.mvvmatype.vd = vd; + } + //------------------------------------------------------------ + + // ---------------------------VSETVL------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x7) && + (((binary_stream & 0x00000000FE000000) >> 25) == 0x40)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VSETVL; + tree->ast_node.vsetvl.rs2 = rs2; + tree->ast_node.vsetvl.rs1 = rs1; + tree->ast_node.vsetvl.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x3B: - funct6 = RISCV_WVV_VWMUL; - break; - case 0x33: - funct6 = RISCV_WVV_VSUB; - break; - case 0x3A: - funct6 = RISCV_WVV_VWMULSU; - break; - case 0x31: - funct6 = RISCV_WVV_VADD; - break; - case 0x30: - funct6 = RISCV_WVV_VADDU; - break; - case 0x32: - funct6 = RISCV_WVV_VSUBU; - break; - case 0x38: - funct6 = RISCV_WVV_VWMULU; - break; + //------------------------------------------------------------ + + // ---------------------------VSETIVLI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x7) && + (((binary_stream & 0x00000000F0000000) >> 28) == 0xC)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t uimm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t lmul = (binary_stream & 0x0000000000700000) >> 20; + uint64_t sew = (binary_stream & 0x0000000003800000) >> 23; + uint64_t ta = (binary_stream & 0x0000000004000000) >> 26; + uint64_t ma = (binary_stream & 0x0000000008000000) >> 27; + tree->ast_node_type = RISCV_VSETIVLI; + tree->ast_node.vsetivli.ma = ma; + tree->ast_node.vsetivli.ta = ta; + tree->ast_node.vsetivli.sew = sew; + tree->ast_node.vsetivli.lmul = lmul; + tree->ast_node.vsetivli.uimm = uimm; + tree->ast_node.vsetivli.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------VVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x06: + funct6 = RISCV_VV_VMAXU; + break; + case 0x25: + funct6 = RISCV_VV_VSLL; + break; + case 0x23: + funct6 = RISCV_VV_VSSUB; + break; + case 0x09: + funct6 = RISCV_VV_VAND; + break; + case 0x00: + funct6 = RISCV_VV_VADD; + break; + case 0x0A: + funct6 = RISCV_VV_VOR; + break; + case 0x0C: + funct6 = RISCV_VV_VRGATHER; + break; + case 0x2B: + funct6 = RISCV_VV_VSSRA; + break; + case 0x02: + funct6 = RISCV_VV_VSUB; + break; + case 0x20: + funct6 = RISCV_VV_VSADDU; + break; + case 0x28: + funct6 = RISCV_VV_VSRL; + break; + case 0x0B: + funct6 = RISCV_VV_VXOR; + break; + case 0x07: + funct6 = RISCV_VV_VMAX; + break; + case 0x04: + funct6 = RISCV_VV_VMINU; + break; + case 0x22: + funct6 = RISCV_VV_VSSUBU; + break; + case 0x27: + funct6 = RISCV_VV_VSMUL; + break; + case 0x0E: + funct6 = RISCV_VV_VRGATHEREI16; + break; + case 0x2A: + funct6 = RISCV_VV_VSSRL; + break; + case 0x05: + funct6 = RISCV_VV_VMIN; + break; + case 0x21: + funct6 = RISCV_VV_VSADD; + break; + case 0x29: + funct6 = RISCV_VV_VSRA; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VVTYPE; + tree->ast_node.vvtype.funct6 = funct6; + tree->ast_node.vvtype.vm = vm; + tree->ast_node.vvtype.vs2 = vs2; + tree->ast_node.vvtype.vs1 = vs1; + tree->ast_node.vvtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_WVVTYPE; - tree->ast_node.wvvtype.funct6 = funct6; - tree->ast_node.wvvtype.vm = vm; - tree->ast_node.wvvtype.vs2 = vs2; - tree->ast_node.wvvtype.vs1 = vs1; - tree->ast_node.wvvtype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------NVSTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x2C: + funct6 = RISCV_NVS_VNSRL; + break; + case 0x2D: + funct6 = RISCV_NVS_VNSRA; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_NVSTYPE; + tree->ast_node.nvstype.funct6 = funct6; + tree->ast_node.nvstype.vm = vm; + tree->ast_node.nvstype.vs2 = vs2; + tree->ast_node.nvstype.vs1 = vs1; + tree->ast_node.nvstype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x36: - funct6 = RISCV_WV_VSUBU; - break; - case 0x35: - funct6 = RISCV_WV_VADD; - break; - case 0x37: - funct6 = RISCV_WV_VSUB; - break; - case 0x34: - funct6 = RISCV_WV_VADDU; - break; + //------------------------------------------------------------ + + // ---------------------------NVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x2E: + funct6 = RISCV_NV_VNCLIPU; + break; + case 0x2F: + funct6 = RISCV_NV_VNCLIP; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_NVTYPE; + tree->ast_node.nvtype.funct6 = funct6; + tree->ast_node.nvtype.vm = vm; + tree->ast_node.nvtype.vs2 = vs2; + tree->ast_node.nvtype.vs1 = vs1; + tree->ast_node.nvtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------MASKTYPEV------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_WVTYPE; - tree->ast_node.wvtype.funct6 = funct6; - tree->ast_node.wvtype.vm = vm; - tree->ast_node.wvtype.vs2 = vs2; - tree->ast_node.wvtype.vs1 = vs1; - tree->ast_node.wvtype.vd = vd; + tree->ast_node_type = RISCV_MASKTYPEV; + tree->ast_node.masktypev.vs2 = vs2; + tree->ast_node.masktypev.vs1 = vs1; + tree->ast_node.masktypev.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x3D: - funct6 = RISCV_WMVV_VWMACC; - break; - case 0x3C: - funct6 = RISCV_WMVV_VWMACCU; - break; - case 0x3F: - funct6 = RISCV_WMVV_VWMACCSU; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------MOVETYPEV------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_WMVVTYPE; - tree->ast_node.wmvvtype.funct6 = funct6; - tree->ast_node.wmvvtype.vm = vm; - tree->ast_node.wmvvtype.vs2 = vs2; - tree->ast_node.wmvvtype.vs1 = vs1; - tree->ast_node.wmvvtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x12)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000000F8000) >> 15) { - case 0x06: - funct6 = RISCV_VEXT2_ZVF2; - break; - case 0x07: - funct6 = RISCV_VEXT2_SVF2; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VEXT2TYPE; - tree->ast_node.vext2type.funct6 = funct6; - tree->ast_node.vext2type.vm = vm; - tree->ast_node.vext2type.vs2 = vs2; - tree->ast_node.vext2type.vd = vd; + tree->ast_node_type = RISCV_MOVETYPEV; + tree->ast_node.movetypev.vs1 = vs1; + tree->ast_node.movetypev.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x12)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000000F8000) >> 15) { - case 0x04: - funct6 = RISCV_VEXT4_ZVF4; - break; - case 0x05: - funct6 = RISCV_VEXT4_SVF4; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VEXT4TYPE; - tree->ast_node.vext4type.funct6 = funct6; - tree->ast_node.vext4type.vm = vm; - tree->ast_node.vext4type.vs2 = vs2; - tree->ast_node.vext4type.vd = vd; - return; + //------------------------------------------------------------ + + // ---------------------------VXTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x06: + funct6 = RISCV_VX_VMAXU; + break; + case 0x25: + funct6 = RISCV_VX_VSLL; + break; + case 0x23: + funct6 = RISCV_VX_VSSUB; + break; + case 0x09: + funct6 = RISCV_VX_VAND; + break; + case 0x00: + funct6 = RISCV_VX_VADD; + break; + case 0x0A: + funct6 = RISCV_VX_VOR; + break; + case 0x2B: + funct6 = RISCV_VX_VSSRA; + break; + case 0x02: + funct6 = RISCV_VX_VSUB; + break; + case 0x20: + funct6 = RISCV_VX_VSADDU; + break; + case 0x28: + funct6 = RISCV_VX_VSRL; + break; + case 0x0B: + funct6 = RISCV_VX_VXOR; + break; + case 0x07: + funct6 = RISCV_VX_VMAX; + break; + case 0x04: + funct6 = RISCV_VX_VMINU; + break; + case 0x22: + funct6 = RISCV_VX_VSSUBU; + break; + case 0x27: + funct6 = RISCV_VX_VSMUL; + break; + case 0x2A: + funct6 = RISCV_VX_VSSRL; + break; + case 0x03: + funct6 = RISCV_VX_VRSUB; + break; + case 0x05: + funct6 = RISCV_VX_VMIN; + break; + case 0x21: + funct6 = RISCV_VX_VSADD; + break; + case 0x29: + funct6 = RISCV_VX_VSRA; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VXTYPE; + tree->ast_node.vxtype.funct6 = funct6; + tree->ast_node.vxtype.vm = vm; + tree->ast_node.vxtype.vs2 = vs2; + tree->ast_node.vxtype.rs1 = rs1; + tree->ast_node.vxtype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x12)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000000F8000) >> 15) { - case 0x03: - funct6 = RISCV_VEXT8_SVF8; - break; - case 0x02: - funct6 = RISCV_VEXT8_ZVF8; - break; + //------------------------------------------------------------ + + // ---------------------------NXSTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x2C: + funct6 = RISCV_NXS_VNSRL; + break; + case 0x2D: + funct6 = RISCV_NXS_VNSRA; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_NXSTYPE; + tree->ast_node.nxstype.funct6 = funct6; + tree->ast_node.nxstype.vm = vm; + tree->ast_node.nxstype.vs2 = vs2; + tree->ast_node.nxstype.rs1 = rs1; + tree->ast_node.nxstype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VEXT8TYPE; - tree->ast_node.vext8type.funct6 = funct6; - tree->ast_node.vext8type.vm = vm; - tree->ast_node.vext8type.vs2 = vs2; - tree->ast_node.vext8type.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VMVXS; - tree->ast_node.vmvxs.vs2 = vs2; - tree->ast_node.vmvxs.rd = rd; - return; } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_MVVCOMPRESS; - tree->ast_node.mvvcompress.vs2 = vs2; - tree->ast_node.mvvcompress.vs1 = vs1; - tree->ast_node.mvvcompress.vd = vd; - return; + //------------------------------------------------------------ + + // ---------------------------NXTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x2E: + funct6 = RISCV_NX_VNCLIPU; + break; + case 0x2F: + funct6 = RISCV_NX_VNCLIP; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_NXTYPE; + tree->ast_node.nxtype.funct6 = funct6; + tree->ast_node.nxtype.vm = vm; + tree->ast_node.nxtype.vs2 = vs2; + tree->ast_node.nxtype.rs1 = rs1; + tree->ast_node.nxtype.vd = vd; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x08: - funct6 = RISCV_MVX_VAADDU; - break; - case 0x0B: - funct6 = RISCV_MVX_VASUB; - break; - case 0x25: - funct6 = RISCV_MVX_VMUL; - break; - case 0x23: - funct6 = RISCV_MVX_VREM; - break; - case 0x09: - funct6 = RISCV_MVX_VAADD; - break; - case 0x27: - funct6 = RISCV_MVX_VMULH; - break; - case 0x22: - funct6 = RISCV_MVX_VREMU; - break; - case 0x0A: - funct6 = RISCV_MVX_VASUBU; - break; - case 0x24: - funct6 = RISCV_MVX_VMULHU; - break; - case 0x0E: - funct6 = RISCV_MVX_VSLIDE1UP; - break; - case 0x26: - funct6 = RISCV_MVX_VMULHSU; - break; - case 0x21: - funct6 = RISCV_MVX_VDIV; - break; - case 0x0F: - funct6 = RISCV_MVX_VSLIDE1DOWN; - break; - case 0x20: - funct6 = RISCV_MVX_VDIVU; - break; + //------------------------------------------------------------ + + // ---------------------------VXSG------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x0E: + funct6 = RISCV_VX_VSLIDEUP; + break; + case 0x0C: + funct6 = RISCV_VX_VRGATHER; + break; + case 0x0F: + funct6 = RISCV_VX_VSLIDEDOWN; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VXSG; + tree->ast_node.vxsg.funct6 = funct6; + tree->ast_node.vxsg.vm = vm; + tree->ast_node.vxsg.vs2 = vs2; + tree->ast_node.vxsg.rs1 = rs1; + tree->ast_node.vxsg.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------MASKTYPEX------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_MVXTYPE; - tree->ast_node.mvxtype.funct6 = funct6; - tree->ast_node.mvxtype.vm = vm; - tree->ast_node.mvxtype.vs2 = vs2; - tree->ast_node.mvxtype.rs1 = rs1; - tree->ast_node.mvxtype.vd = vd; + tree->ast_node_type = RISCV_MASKTYPEX; + tree->ast_node.masktypex.vs2 = vs2; + tree->ast_node.masktypex.rs1 = rs1; + tree->ast_node.masktypex.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x2D: - funct6 = RISCV_MVX_VMACC; - break; - case 0x2F: - funct6 = RISCV_MVX_VNMSAC; - break; - case 0x2B: - funct6 = RISCV_MVX_VNMSUB; - break; - case 0x29: - funct6 = RISCV_MVX_VMADD; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------MOVETYPEX------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_MVXMATYPE; - tree->ast_node.mvxmatype.funct6 = funct6; - tree->ast_node.mvxmatype.vm = vm; - tree->ast_node.mvxmatype.vs2 = vs2; - tree->ast_node.mvxmatype.rs1 = rs1; - tree->ast_node.mvxmatype.vd = vd; + tree->ast_node_type = RISCV_MOVETYPEX; + tree->ast_node.movetypex.rs1 = rs1; + tree->ast_node.movetypex.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x3B: - funct6 = RISCV_WVX_VWMUL; - break; - case 0x33: - funct6 = RISCV_WVX_VSUB; - break; - case 0x3A: - funct6 = RISCV_WVX_VWMULSU; - break; - case 0x31: - funct6 = RISCV_WVX_VADD; - break; - case 0x30: - funct6 = RISCV_WVX_VADDU; - break; - case 0x32: - funct6 = RISCV_WVX_VSUBU; - break; - case 0x38: - funct6 = RISCV_WVX_VWMULU; - break; + //------------------------------------------------------------ + + // ---------------------------VITYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x28: + funct6 = RISCV_VI_VSRL; + break; + case 0x0B: + funct6 = RISCV_VI_VXOR; + break; + case 0x25: + funct6 = RISCV_VI_VSLL; + break; + case 0x09: + funct6 = RISCV_VI_VAND; + break; + case 0x00: + funct6 = RISCV_VI_VADD; + break; + case 0x0A: + funct6 = RISCV_VI_VOR; + break; + case 0x2A: + funct6 = RISCV_VI_VSSRL; + break; + case 0x03: + funct6 = RISCV_VI_VRSUB; + break; + case 0x21: + funct6 = RISCV_VI_VSADD; + break; + case 0x2B: + funct6 = RISCV_VI_VSSRA; + break; + case 0x29: + funct6 = RISCV_VI_VSRA; + break; + case 0x20: + funct6 = RISCV_VI_VSADDU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VITYPE; + tree->ast_node.vitype.funct6 = funct6; + tree->ast_node.vitype.vm = vm; + tree->ast_node.vitype.vs2 = vs2; + tree->ast_node.vitype.simm = simm; + tree->ast_node.vitype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_WVXTYPE; - tree->ast_node.wvxtype.funct6 = funct6; - tree->ast_node.wvxtype.vm = vm; - tree->ast_node.wvxtype.vs2 = vs2; - tree->ast_node.wvxtype.rs1 = rs1; - tree->ast_node.wvxtype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------NISTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x2C: + funct6 = RISCV_NIS_VNSRL; + break; + case 0x2D: + funct6 = RISCV_NIS_VNSRA; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_NISTYPE; + tree->ast_node.nistype.funct6 = funct6; + tree->ast_node.nistype.vm = vm; + tree->ast_node.nistype.vs2 = vs2; + tree->ast_node.nistype.simm = simm; + tree->ast_node.nistype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------NITYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x2E: + funct6 = RISCV_NI_VNCLIPU; + break; + case 0x2F: + funct6 = RISCV_NI_VNCLIP; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_NITYPE; + tree->ast_node.nitype.funct6 = funct6; + tree->ast_node.nitype.vm = vm; + tree->ast_node.nitype.vs2 = vs2; + tree->ast_node.nitype.simm = simm; + tree->ast_node.nitype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x36: - funct6 = RISCV_WX_VSUBU; - break; - case 0x35: - funct6 = RISCV_WX_VADD; - break; - case 0x37: - funct6 = RISCV_WX_VSUB; - break; - case 0x34: - funct6 = RISCV_WX_VADDU; - break; + //------------------------------------------------------------ + + // ---------------------------VISG------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x0E: + funct6 = RISCV_VI_VSLIDEUP; + break; + case 0x0C: + funct6 = RISCV_VI_VRGATHER; + break; + case 0x0F: + funct6 = RISCV_VI_VSLIDEDOWN; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VISG; + tree->ast_node.visg.funct6 = funct6; + tree->ast_node.visg.vm = vm; + tree->ast_node.visg.vs2 = vs2; + tree->ast_node.visg.simm = simm; + tree->ast_node.visg.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------MASKTYPEI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_WXTYPE; - tree->ast_node.wxtype.funct6 = funct6; - tree->ast_node.wxtype.vm = vm; - tree->ast_node.wxtype.vs2 = vs2; - tree->ast_node.wxtype.rs1 = rs1; - tree->ast_node.wxtype.vd = vd; + tree->ast_node_type = RISCV_MASKTYPEI; + tree->ast_node.masktypei.vs2 = vs2; + tree->ast_node.masktypei.simm = simm; + tree->ast_node.masktypei.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x3E: - funct6 = RISCV_WMVX_VWMACCUS; - break; - case 0x3D: - funct6 = RISCV_WMVX_VWMACC; - break; - case 0x3C: - funct6 = RISCV_WMVX_VWMACCU; - break; - case 0x3F: - funct6 = RISCV_WMVX_VWMACCSU; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------MOVETYPEI------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_WMVXTYPE; - tree->ast_node.wmvxtype.funct6 = funct6; - tree->ast_node.wmvxtype.vm = vm; - tree->ast_node.wmvxtype.vs2 = vs2; - tree->ast_node.wmvxtype.rs1 = rs1; - tree->ast_node.wmvxtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x6) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x10)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_VMVSX; - tree->ast_node.vmvsx.rs1 = rs1; - tree->ast_node.vmvsx.vd = vd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x08: - funct6 = RISCV_FVV_VSGNJ; - break; - case 0x06: - funct6 = RISCV_FVV_VMAX; - break; - case 0x04: - funct6 = RISCV_FVV_VMIN; - break; - case 0x09: - funct6 = RISCV_FVV_VSGNJN; - break; - case 0x00: - funct6 = RISCV_FVV_VADD; - break; - case 0x0A: - funct6 = RISCV_FVV_VSGNJX; - break; - case 0x24: - funct6 = RISCV_FVV_VMUL; - break; - case 0x02: - funct6 = RISCV_FVV_VSUB; - break; - case 0x20: - funct6 = RISCV_FVV_VDIV; - break; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_MOVETYPEI; + tree->ast_node.movetypei.vd = vd; + tree->ast_node.movetypei.simm = simm; + return; } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------VMVRTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x27)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FVVTYPE; - tree->ast_node.fvvtype.funct6 = funct6; - tree->ast_node.fvvtype.vm = vm; - tree->ast_node.fvvtype.vs2 = vs2; - tree->ast_node.fvvtype.vs1 = vs1; - tree->ast_node.fvvtype.vd = vd; + tree->ast_node_type = RISCV_VMVRTYPE; + tree->ast_node.vmvrtype.vs2 = vs2; + tree->ast_node.vmvrtype.simm = simm; + tree->ast_node.vmvrtype.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x28: - funct6 = RISCV_FVV_VMADD; - break; - case 0x2C: - funct6 = RISCV_FVV_VMACC; - break; - case 0x2D: - funct6 = RISCV_FVV_VNMACC; - break; - case 0x2E: - funct6 = RISCV_FVV_VMSAC; - break; - case 0x2F: - funct6 = RISCV_FVV_VNMSAC; - break; - case 0x2A: - funct6 = RISCV_FVV_VMSUB; - break; - case 0x2B: - funct6 = RISCV_FVV_VNMSUB; - break; - case 0x29: - funct6 = RISCV_FVV_VNMADD; - break; + //------------------------------------------------------------ + + // ---------------------------MVVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x08: + funct6 = RISCV_MVV_VAADDU; + break; + case 0x0B: + funct6 = RISCV_MVV_VASUB; + break; + case 0x25: + funct6 = RISCV_MVV_VMUL; + break; + case 0x23: + funct6 = RISCV_MVV_VREM; + break; + case 0x09: + funct6 = RISCV_MVV_VAADD; + break; + case 0x27: + funct6 = RISCV_MVV_VMULH; + break; + case 0x22: + funct6 = RISCV_MVV_VREMU; + break; + case 0x0A: + funct6 = RISCV_MVV_VASUBU; + break; + case 0x24: + funct6 = RISCV_MVV_VMULHU; + break; + case 0x26: + funct6 = RISCV_MVV_VMULHSU; + break; + case 0x21: + funct6 = RISCV_MVV_VDIV; + break; + case 0x20: + funct6 = RISCV_MVV_VDIVU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_MVVTYPE; + tree->ast_node.mvvtype.funct6 = funct6; + tree->ast_node.mvvtype.vm = vm; + tree->ast_node.mvvtype.vs2 = vs2; + tree->ast_node.mvvtype.vs1 = vs1; + tree->ast_node.mvvtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FVVMATYPE; - tree->ast_node.fvvmatype.funct6 = funct6; - tree->ast_node.fvvmatype.vm = vm; - tree->ast_node.fvvmatype.vs2 = vs2; - tree->ast_node.fvvmatype.vs1 = vs1; - tree->ast_node.fvvmatype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------MVVMATYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x2D: + funct6 = RISCV_MVV_VMACC; + break; + case 0x2F: + funct6 = RISCV_MVV_VNMSAC; + break; + case 0x2B: + funct6 = RISCV_MVV_VNMSUB; + break; + case 0x29: + funct6 = RISCV_MVV_VMADD; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_MVVMATYPE; + tree->ast_node.mvvmatype.funct6 = funct6; + tree->ast_node.mvvmatype.vm = vm; + tree->ast_node.mvvmatype.vs2 = vs2; + tree->ast_node.mvvmatype.vs1 = vs1; + tree->ast_node.mvvmatype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x30: - funct6 = RISCV_FWVV_VADD; - break; - case 0x32: - funct6 = RISCV_FWVV_VSUB; - break; - case 0x38: - funct6 = RISCV_FWVV_VMUL; - break; + //------------------------------------------------------------ + + // ---------------------------WVVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x3B: + funct6 = RISCV_WVV_VWMUL; + break; + case 0x33: + funct6 = RISCV_WVV_VSUB; + break; + case 0x3A: + funct6 = RISCV_WVV_VWMULSU; + break; + case 0x31: + funct6 = RISCV_WVV_VADD; + break; + case 0x30: + funct6 = RISCV_WVV_VADDU; + break; + case 0x32: + funct6 = RISCV_WVV_VSUBU; + break; + case 0x38: + funct6 = RISCV_WVV_VWMULU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_WVVTYPE; + tree->ast_node.wvvtype.funct6 = funct6; + tree->ast_node.wvvtype.vm = vm; + tree->ast_node.wvvtype.vs2 = vs2; + tree->ast_node.wvvtype.vs1 = vs1; + tree->ast_node.wvvtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FWVVTYPE; - tree->ast_node.fwvvtype.funct6 = funct6; - tree->ast_node.fwvvtype.vm = vm; - tree->ast_node.fwvvtype.vs2 = vs2; - tree->ast_node.fwvvtype.vs1 = vs1; - tree->ast_node.fwvvtype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------WVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x36: + funct6 = RISCV_WV_VSUBU; + break; + case 0x35: + funct6 = RISCV_WV_VADD; + break; + case 0x37: + funct6 = RISCV_WV_VSUB; + break; + case 0x34: + funct6 = RISCV_WV_VADDU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_WVTYPE; + tree->ast_node.wvtype.funct6 = funct6; + tree->ast_node.wvtype.vm = vm; + tree->ast_node.wvtype.vs2 = vs2; + tree->ast_node.wvtype.vs1 = vs1; + tree->ast_node.wvtype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x3E: - funct6 = RISCV_FWVV_VMSAC; - break; - case 0x3D: - funct6 = RISCV_FWVV_VNMACC; - break; - case 0x3C: - funct6 = RISCV_FWVV_VMACC; - break; - case 0x3F: - funct6 = RISCV_FWVV_VNMSAC; - break; + //------------------------------------------------------------ + + // ---------------------------WMVVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x3D: + funct6 = RISCV_WMVV_VWMACC; + break; + case 0x3C: + funct6 = RISCV_WMVV_VWMACCU; + break; + case 0x3F: + funct6 = RISCV_WMVV_VWMACCSU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_WMVVTYPE; + tree->ast_node.wmvvtype.funct6 = funct6; + tree->ast_node.wmvvtype.vm = vm; + tree->ast_node.wmvvtype.vs2 = vs2; + tree->ast_node.wmvvtype.vs1 = vs1; + tree->ast_node.wmvvtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs1 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FWVVMATYPE; - tree->ast_node.fwvvmatype.funct6 = funct6; - tree->ast_node.fwvvmatype.vm = vm; - tree->ast_node.fwvvmatype.vs1 = vs1; - tree->ast_node.fwvvmatype.vs2 = vs2; - tree->ast_node.fwvvmatype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------VEXT2TYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x12)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000000F8000) >> 15) { + case 0x06: + funct6 = RISCV_VEXT2_ZVF2; + break; + case 0x07: + funct6 = RISCV_VEXT2_SVF2; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VEXT2TYPE; + tree->ast_node.vext2type.funct6 = funct6; + tree->ast_node.vext2type.vm = vm; + tree->ast_node.vext2type.vs2 = vs2; + tree->ast_node.vext2type.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x36: - funct6 = RISCV_FWV_VSUB; - break; - case 0x34: - funct6 = RISCV_FWV_VADD; - break; + //------------------------------------------------------------ + + // ---------------------------VEXT4TYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x12)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000000F8000) >> 15) { + case 0x04: + funct6 = RISCV_VEXT4_ZVF4; + break; + case 0x05: + funct6 = RISCV_VEXT4_SVF4; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VEXT4TYPE; + tree->ast_node.vext4type.funct6 = funct6; + tree->ast_node.vext4type.vm = vm; + tree->ast_node.vext4type.vs2 = vs2; + tree->ast_node.vext4type.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FWVTYPE; - tree->ast_node.fwvtype.funct6 = funct6; - tree->ast_node.fwvtype.vm = vm; - tree->ast_node.fwvtype.vs2 = vs2; - tree->ast_node.fwvtype.vs1 = vs1; - tree->ast_node.fwvtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x12)) { - uint64_t vfunary0 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000000F8000) >> 15) { - case 0x01: - vfunary0 = RISCV_FV_CVT_X_F; - break; - case 0x06: - vfunary0 = RISCV_FV_CVT_RTZ_XU_F; - break; - case 0x07: - vfunary0 = RISCV_FV_CVT_RTZ_X_F; - break; - case 0x00: - vfunary0 = RISCV_FV_CVT_XU_F; - break; - case 0x03: - vfunary0 = RISCV_FV_CVT_F_X; - break; - case 0x02: - vfunary0 = RISCV_FV_CVT_F_XU; - break; + } + //------------------------------------------------------------ + + // ---------------------------VEXT8TYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x12)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000000F8000) >> 15) { + case 0x03: + funct6 = RISCV_VEXT8_SVF8; + break; + case 0x02: + funct6 = RISCV_VEXT8_ZVF8; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VEXT8TYPE; + tree->ast_node.vext8type.funct6 = funct6; + tree->ast_node.vext8type.vm = vm; + tree->ast_node.vext8type.vs2 = vs2; + tree->ast_node.vext8type.vd = vd; + return; + } } - if (vfunary0 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + } + //------------------------------------------------------------ + + // ---------------------------VMVXS------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VFUNARY0; - tree->ast_node.vfunary0.vm = vm; - tree->ast_node.vfunary0.vs2 = vs2; - tree->ast_node.vfunary0.vfunary0 = vfunary0; - tree->ast_node.vfunary0.vd = vd; + tree->ast_node_type = RISCV_VMVXS; + tree->ast_node.vmvxs.vs2 = vs2; + tree->ast_node.vmvxs.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x12)) { - uint64_t vfwunary0 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000000F8000) >> 15) { - case 0x08: - vfwunary0 = RISCV_FWV_CVT_XU_F; - break; - case 0x0B: - vfwunary0 = RISCV_FWV_CVT_F_X; - break; - case 0x09: - vfwunary0 = RISCV_FWV_CVT_X_F; - break; - case 0x0A: - vfwunary0 = RISCV_FWV_CVT_F_XU; - break; - case 0x0E: - vfwunary0 = RISCV_FWV_CVT_RTZ_XU_F; - break; - case 0x0C: - vfwunary0 = RISCV_FWV_CVT_F_F; - break; - case 0x0F: - vfwunary0 = RISCV_FWV_CVT_RTZ_X_F; - break; - } - if (vfwunary0 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------MVVCOMPRESS------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VFWUNARY0; - tree->ast_node.vfwunary0.vm = vm; - tree->ast_node.vfwunary0.vs2 = vs2; - tree->ast_node.vfwunary0.vfwunary0 = vfwunary0; - tree->ast_node.vfwunary0.vd = vd; + tree->ast_node_type = RISCV_MVVCOMPRESS; + tree->ast_node.mvvcompress.vs2 = vs2; + tree->ast_node.mvvcompress.vs1 = vs1; + tree->ast_node.mvvcompress.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x12)) { - uint64_t vfnunary0 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000000F8000) >> 15) { - case 0x15: - vfnunary0 = RISCV_FNV_CVT_ROD_F_F; - break; - case 0x13: - vfnunary0 = RISCV_FNV_CVT_F_X; - break; - case 0x10: - vfnunary0 = RISCV_FNV_CVT_XU_F; - break; - case 0x12: - vfnunary0 = RISCV_FNV_CVT_F_XU; - break; - case 0x14: - vfnunary0 = RISCV_FNV_CVT_F_F; - break; - case 0x16: - vfnunary0 = RISCV_FNV_CVT_RTZ_XU_F; - break; - case 0x11: - vfnunary0 = RISCV_FNV_CVT_X_F; - break; - case 0x17: - vfnunary0 = RISCV_FNV_CVT_RTZ_X_F; - break; + //------------------------------------------------------------ + + // ---------------------------MVXTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x08: + funct6 = RISCV_MVX_VAADDU; + break; + case 0x0B: + funct6 = RISCV_MVX_VASUB; + break; + case 0x25: + funct6 = RISCV_MVX_VMUL; + break; + case 0x23: + funct6 = RISCV_MVX_VREM; + break; + case 0x09: + funct6 = RISCV_MVX_VAADD; + break; + case 0x27: + funct6 = RISCV_MVX_VMULH; + break; + case 0x22: + funct6 = RISCV_MVX_VREMU; + break; + case 0x0A: + funct6 = RISCV_MVX_VASUBU; + break; + case 0x24: + funct6 = RISCV_MVX_VMULHU; + break; + case 0x0E: + funct6 = RISCV_MVX_VSLIDE1UP; + break; + case 0x26: + funct6 = RISCV_MVX_VMULHSU; + break; + case 0x21: + funct6 = RISCV_MVX_VDIV; + break; + case 0x0F: + funct6 = RISCV_MVX_VSLIDE1DOWN; + break; + case 0x20: + funct6 = RISCV_MVX_VDIVU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_MVXTYPE; + tree->ast_node.mvxtype.funct6 = funct6; + tree->ast_node.mvxtype.vm = vm; + tree->ast_node.mvxtype.vs2 = vs2; + tree->ast_node.mvxtype.rs1 = rs1; + tree->ast_node.mvxtype.vd = vd; + return; + } } - if (vfnunary0 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VFNUNARY0; - tree->ast_node.vfnunary0.vm = vm; - tree->ast_node.vfnunary0.vs2 = vs2; - tree->ast_node.vfnunary0.vfnunary0 = vfnunary0; - tree->ast_node.vfnunary0.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------MVXMATYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x2D: + funct6 = RISCV_MVX_VMACC; + break; + case 0x2F: + funct6 = RISCV_MVX_VNMSAC; + break; + case 0x2B: + funct6 = RISCV_MVX_VNMSUB; + break; + case 0x29: + funct6 = RISCV_MVX_VMADD; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_MVXMATYPE; + tree->ast_node.mvxmatype.funct6 = funct6; + tree->ast_node.mvxmatype.vm = vm; + tree->ast_node.mvxmatype.vs2 = vs2; + tree->ast_node.mvxmatype.rs1 = rs1; + tree->ast_node.mvxmatype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x13)) { - uint64_t vfunary1 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000000F8000) >> 15) { - case 0x04: - vfunary1 = RISCV_FVV_VRSQRT7; - break; - case 0x10: - vfunary1 = RISCV_FVV_VCLASS; - break; - case 0x00: - vfunary1 = RISCV_FVV_VSQRT; - break; - case 0x05: - vfunary1 = RISCV_FVV_VREC7; - break; + //------------------------------------------------------------ + + // ---------------------------WVXTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x3B: + funct6 = RISCV_WVX_VWMUL; + break; + case 0x33: + funct6 = RISCV_WVX_VSUB; + break; + case 0x3A: + funct6 = RISCV_WVX_VWMULSU; + break; + case 0x31: + funct6 = RISCV_WVX_VADD; + break; + case 0x30: + funct6 = RISCV_WVX_VADDU; + break; + case 0x32: + funct6 = RISCV_WVX_VSUBU; + break; + case 0x38: + funct6 = RISCV_WVX_VWMULU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_WVXTYPE; + tree->ast_node.wvxtype.funct6 = funct6; + tree->ast_node.wvxtype.vm = vm; + tree->ast_node.wvxtype.vs2 = vs2; + tree->ast_node.wvxtype.rs1 = rs1; + tree->ast_node.wvxtype.vd = vd; + return; + } } - if (vfunary1 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VFUNARY1; - tree->ast_node.vfunary1.vm = vm; - tree->ast_node.vfunary1.vs2 = vs2; - tree->ast_node.vfunary1.vfunary1 = vfunary1; - tree->ast_node.vfunary1.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x00) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VFMVFS; - tree->ast_node.vfmvfs.vs2 = vs2; - tree->ast_node.vfmvfs.rd = rd; - return; } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x08: - funct6 = RISCV_VF_VSGNJ; - break; - case 0x06: - funct6 = RISCV_VF_VMAX; - break; - case 0x04: - funct6 = RISCV_VF_VMIN; - break; - case 0x09: - funct6 = RISCV_VF_VSGNJN; - break; - case 0x27: - funct6 = RISCV_VF_VRSUB; - break; - case 0x00: - funct6 = RISCV_VF_VADD; - break; - case 0x0A: - funct6 = RISCV_VF_VSGNJX; - break; - case 0x24: - funct6 = RISCV_VF_VMUL; - break; - case 0x0E: - funct6 = RISCV_VF_VSLIDE1UP; - break; - case 0x21: - funct6 = RISCV_VF_VRDIV; - break; - case 0x02: - funct6 = RISCV_VF_VSUB; - break; - case 0x0F: - funct6 = RISCV_VF_VSLIDE1DOWN; - break; - case 0x20: - funct6 = RISCV_VF_VDIV; - break; + //------------------------------------------------------------ + + // ---------------------------WXTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x36: + funct6 = RISCV_WX_VSUBU; + break; + case 0x35: + funct6 = RISCV_WX_VADD; + break; + case 0x37: + funct6 = RISCV_WX_VSUB; + break; + case 0x34: + funct6 = RISCV_WX_VADDU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_WXTYPE; + tree->ast_node.wxtype.funct6 = funct6; + tree->ast_node.wxtype.vm = vm; + tree->ast_node.wxtype.vs2 = vs2; + tree->ast_node.wxtype.rs1 = rs1; + tree->ast_node.wxtype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------WMVXTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x3E: + funct6 = RISCV_WMVX_VWMACCUS; + break; + case 0x3D: + funct6 = RISCV_WMVX_VWMACC; + break; + case 0x3C: + funct6 = RISCV_WMVX_VWMACCU; + break; + case 0x3F: + funct6 = RISCV_WMVX_VWMACCSU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_WMVXTYPE; + tree->ast_node.wmvxtype.funct6 = funct6; + tree->ast_node.wmvxtype.vm = vm; + tree->ast_node.wmvxtype.vs2 = vs2; + tree->ast_node.wmvxtype.rs1 = rs1; + tree->ast_node.wmvxtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------VMVSX------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x6) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x10)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FVFTYPE; - tree->ast_node.fvftype.funct6 = funct6; - tree->ast_node.fvftype.vm = vm; - tree->ast_node.fvftype.vs2 = vs2; - tree->ast_node.fvftype.rs1 = rs1; - tree->ast_node.fvftype.vd = vd; + tree->ast_node_type = RISCV_VMVSX; + tree->ast_node.vmvsx.rs1 = rs1; + tree->ast_node.vmvsx.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x28: - funct6 = RISCV_VF_VMADD; - break; - case 0x2C: - funct6 = RISCV_VF_VMACC; - break; - case 0x2D: - funct6 = RISCV_VF_VNMACC; - break; - case 0x2E: - funct6 = RISCV_VF_VMSAC; - break; - case 0x2F: - funct6 = RISCV_VF_VNMSAC; - break; - case 0x2A: - funct6 = RISCV_VF_VMSUB; - break; - case 0x2B: - funct6 = RISCV_VF_VNMSUB; - break; - case 0x29: - funct6 = RISCV_VF_VNMADD; - break; + //------------------------------------------------------------ + + // ---------------------------FVVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x08: + funct6 = RISCV_FVV_VSGNJ; + break; + case 0x06: + funct6 = RISCV_FVV_VMAX; + break; + case 0x04: + funct6 = RISCV_FVV_VMIN; + break; + case 0x09: + funct6 = RISCV_FVV_VSGNJN; + break; + case 0x00: + funct6 = RISCV_FVV_VADD; + break; + case 0x0A: + funct6 = RISCV_FVV_VSGNJX; + break; + case 0x24: + funct6 = RISCV_FVV_VMUL; + break; + case 0x02: + funct6 = RISCV_FVV_VSUB; + break; + case 0x20: + funct6 = RISCV_FVV_VDIV; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FVVTYPE; + tree->ast_node.fvvtype.funct6 = funct6; + tree->ast_node.fvvtype.vm = vm; + tree->ast_node.fvvtype.vs2 = vs2; + tree->ast_node.fvvtype.vs1 = vs1; + tree->ast_node.fvvtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FVFMATYPE; - tree->ast_node.fvfmatype.funct6 = funct6; - tree->ast_node.fvfmatype.vm = vm; - tree->ast_node.fvfmatype.vs2 = vs2; - tree->ast_node.fvfmatype.rs1 = rs1; - tree->ast_node.fvfmatype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------FVVMATYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x28: + funct6 = RISCV_FVV_VMADD; + break; + case 0x2C: + funct6 = RISCV_FVV_VMACC; + break; + case 0x2D: + funct6 = RISCV_FVV_VNMACC; + break; + case 0x2E: + funct6 = RISCV_FVV_VMSAC; + break; + case 0x2F: + funct6 = RISCV_FVV_VNMSAC; + break; + case 0x2A: + funct6 = RISCV_FVV_VMSUB; + break; + case 0x2B: + funct6 = RISCV_FVV_VNMSUB; + break; + case 0x29: + funct6 = RISCV_FVV_VNMADD; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FVVMATYPE; + tree->ast_node.fvvmatype.funct6 = funct6; + tree->ast_node.fvvmatype.vm = vm; + tree->ast_node.fvvmatype.vs2 = vs2; + tree->ast_node.fvvmatype.vs1 = vs1; + tree->ast_node.fvvmatype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x30: - funct6 = RISCV_FWVF_VADD; - break; - case 0x32: - funct6 = RISCV_FWVF_VSUB; - break; - case 0x38: - funct6 = RISCV_FWVF_VMUL; - break; + //------------------------------------------------------------ + + // ---------------------------FWVVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x30: + funct6 = RISCV_FWVV_VADD; + break; + case 0x32: + funct6 = RISCV_FWVV_VSUB; + break; + case 0x38: + funct6 = RISCV_FWVV_VMUL; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FWVVTYPE; + tree->ast_node.fwvvtype.funct6 = funct6; + tree->ast_node.fwvvtype.vm = vm; + tree->ast_node.fwvvtype.vs2 = vs2; + tree->ast_node.fwvvtype.vs1 = vs1; + tree->ast_node.fwvvtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FWVFTYPE; - tree->ast_node.fwvftype.funct6 = funct6; - tree->ast_node.fwvftype.vm = vm; - tree->ast_node.fwvftype.vs2 = vs2; - tree->ast_node.fwvftype.rs1 = rs1; - tree->ast_node.fwvftype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------FWVVMATYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x3E: + funct6 = RISCV_FWVV_VMSAC; + break; + case 0x3D: + funct6 = RISCV_FWVV_VNMACC; + break; + case 0x3C: + funct6 = RISCV_FWVV_VMACC; + break; + case 0x3F: + funct6 = RISCV_FWVV_VNMSAC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs1 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FWVVMATYPE; + tree->ast_node.fwvvmatype.funct6 = funct6; + tree->ast_node.fwvvmatype.vm = vm; + tree->ast_node.fwvvmatype.vs1 = vs1; + tree->ast_node.fwvvmatype.vs2 = vs2; + tree->ast_node.fwvvmatype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x3E: - funct6 = RISCV_FWVF_VMSAC; - break; - case 0x3D: - funct6 = RISCV_FWVF_VNMACC; - break; - case 0x3C: - funct6 = RISCV_FWVF_VMACC; - break; - case 0x3F: - funct6 = RISCV_FWVF_VNMSAC; - break; + //------------------------------------------------------------ + + // ---------------------------FWVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x36: + funct6 = RISCV_FWV_VSUB; + break; + case 0x34: + funct6 = RISCV_FWV_VADD; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FWVTYPE; + tree->ast_node.fwvtype.funct6 = funct6; + tree->ast_node.fwvtype.vm = vm; + tree->ast_node.fwvtype.vs2 = vs2; + tree->ast_node.fwvtype.vs1 = vs1; + tree->ast_node.fwvtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FWVFMATYPE; - tree->ast_node.fwvfmatype.funct6 = funct6; - tree->ast_node.fwvfmatype.vm = vm; - tree->ast_node.fwvfmatype.rs1 = rs1; - tree->ast_node.fwvfmatype.vs2 = vs2; - tree->ast_node.fwvfmatype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------VFUNARY0------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x12)) { + uint64_t vfunary0 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000000F8000) >> 15) { + case 0x01: + vfunary0 = RISCV_FV_CVT_X_F; + break; + case 0x06: + vfunary0 = RISCV_FV_CVT_RTZ_XU_F; + break; + case 0x07: + vfunary0 = RISCV_FV_CVT_RTZ_X_F; + break; + case 0x00: + vfunary0 = RISCV_FV_CVT_XU_F; + break; + case 0x03: + vfunary0 = RISCV_FV_CVT_F_X; + break; + case 0x02: + vfunary0 = RISCV_FV_CVT_F_XU; + break; + } + if (vfunary0 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VFUNARY0; + tree->ast_node.vfunary0.vm = vm; + tree->ast_node.vfunary0.vs2 = vs2; + tree->ast_node.vfunary0.vfunary0 = vfunary0; + tree->ast_node.vfunary0.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x36: - funct6 = RISCV_FWF_VSUB; - break; - case 0x34: - funct6 = RISCV_FWF_VADD; - break; + //------------------------------------------------------------ + + // ---------------------------VFWUNARY0------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x12)) { + uint64_t vfwunary0 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000000F8000) >> 15) { + case 0x08: + vfwunary0 = RISCV_FWV_CVT_XU_F; + break; + case 0x0B: + vfwunary0 = RISCV_FWV_CVT_F_X; + break; + case 0x09: + vfwunary0 = RISCV_FWV_CVT_X_F; + break; + case 0x0A: + vfwunary0 = RISCV_FWV_CVT_F_XU; + break; + case 0x0E: + vfwunary0 = RISCV_FWV_CVT_RTZ_XU_F; + break; + case 0x0C: + vfwunary0 = RISCV_FWV_CVT_F_F; + break; + case 0x0F: + vfwunary0 = RISCV_FWV_CVT_RTZ_X_F; + break; + } + if (vfwunary0 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VFWUNARY0; + tree->ast_node.vfwunary0.vm = vm; + tree->ast_node.vfwunary0.vs2 = vs2; + tree->ast_node.vfwunary0.vfwunary0 = vfwunary0; + tree->ast_node.vfwunary0.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FWFTYPE; - tree->ast_node.fwftype.funct6 = funct6; - tree->ast_node.fwftype.vm = vm; - tree->ast_node.fwftype.vs2 = vs2; - tree->ast_node.fwftype.rs1 = rs1; - tree->ast_node.fwftype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VFMERGE; - tree->ast_node.vfmerge.vs2 = vs2; - tree->ast_node.vfmerge.rs1 = rs1; - tree->ast_node.vfmerge.vd = vd; - return; } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x17)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_VFMV; - tree->ast_node.vfmv.rs1 = rs1; - tree->ast_node.vfmv.vd = vd; - return; + //------------------------------------------------------------ + + // ---------------------------VFNUNARY0------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x12)) { + uint64_t vfnunary0 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000000F8000) >> 15) { + case 0x15: + vfnunary0 = RISCV_FNV_CVT_ROD_F_F; + break; + case 0x13: + vfnunary0 = RISCV_FNV_CVT_F_X; + break; + case 0x10: + vfnunary0 = RISCV_FNV_CVT_XU_F; + break; + case 0x12: + vfnunary0 = RISCV_FNV_CVT_F_XU; + break; + case 0x14: + vfnunary0 = RISCV_FNV_CVT_F_F; + break; + case 0x16: + vfnunary0 = RISCV_FNV_CVT_RTZ_XU_F; + break; + case 0x11: + vfnunary0 = RISCV_FNV_CVT_X_F; + break; + case 0x17: + vfnunary0 = RISCV_FNV_CVT_RTZ_X_F; + break; + } + if (vfnunary0 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VFNUNARY0; + tree->ast_node.vfnunary0.vm = vm; + tree->ast_node.vfnunary0.vs2 = vs2; + tree->ast_node.vfnunary0.vfnunary0 = vfnunary0; + tree->ast_node.vfnunary0.vd = vd; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x10)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_VFMVSF; - tree->ast_node.vfmvsf.rs1 = rs1; - tree->ast_node.vfmvsf.vd = vd; - return; + //------------------------------------------------------------ + + // ---------------------------VFUNARY1------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x13)) { + uint64_t vfunary1 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000000F8000) >> 15) { + case 0x04: + vfunary1 = RISCV_FVV_VRSQRT7; + break; + case 0x10: + vfunary1 = RISCV_FVV_VCLASS; + break; + case 0x00: + vfunary1 = RISCV_FVV_VSQRT; + break; + case 0x05: + vfunary1 = RISCV_FVV_VREC7; + break; + } + if (vfunary1 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VFUNARY1; + tree->ast_node.vfunary1.vm = vm; + tree->ast_node.vfunary1.vs2 = vs2; + tree->ast_node.vfunary1.vfunary1 = vfunary1; + tree->ast_node.vfunary1.vd = vd; + return; + } + } } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x0) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; + //------------------------------------------------------------ + + // ---------------------------VFMVFS------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x00) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VFMVFS; + tree->ast_node.vfmvfs.vs2 = vs2; + tree->ast_node.vfmvfs.rd = rd; + return; } - if (width != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VLSEGTYPE; - tree->ast_node.vlsegtype.nf = nf; - tree->ast_node.vlsegtype.vm = vm; - tree->ast_node.vlsegtype.rs1 = rs1; - tree->ast_node.vlsegtype.width = width; - tree->ast_node.vlsegtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x10) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x0) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; + } + //------------------------------------------------------------ + + // ---------------------------FVFTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x08: + funct6 = RISCV_VF_VSGNJ; + break; + case 0x06: + funct6 = RISCV_VF_VMAX; + break; + case 0x04: + funct6 = RISCV_VF_VMIN; + break; + case 0x09: + funct6 = RISCV_VF_VSGNJN; + break; + case 0x27: + funct6 = RISCV_VF_VRSUB; + break; + case 0x00: + funct6 = RISCV_VF_VADD; + break; + case 0x0A: + funct6 = RISCV_VF_VSGNJX; + break; + case 0x24: + funct6 = RISCV_VF_VMUL; + break; + case 0x0E: + funct6 = RISCV_VF_VSLIDE1UP; + break; + case 0x21: + funct6 = RISCV_VF_VRDIV; + break; + case 0x02: + funct6 = RISCV_VF_VSUB; + break; + case 0x0F: + funct6 = RISCV_VF_VSLIDE1DOWN; + break; + case 0x20: + funct6 = RISCV_VF_VDIV; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FVFTYPE; + tree->ast_node.fvftype.funct6 = funct6; + tree->ast_node.fvftype.vm = vm; + tree->ast_node.fvftype.vs2 = vs2; + tree->ast_node.fvftype.rs1 = rs1; + tree->ast_node.fvftype.vd = vd; + return; + } } - if (width != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VLSEGFFTYPE; - tree->ast_node.vlsegfftype.nf = nf; - tree->ast_node.vlsegfftype.vm = vm; - tree->ast_node.vlsegfftype.rs1 = rs1; - tree->ast_node.vlsegfftype.width = width; - tree->ast_node.vlsegfftype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x27) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x0) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; + } + //------------------------------------------------------------ + + // ---------------------------FVFMATYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x28: + funct6 = RISCV_VF_VMADD; + break; + case 0x2C: + funct6 = RISCV_VF_VMACC; + break; + case 0x2D: + funct6 = RISCV_VF_VNMACC; + break; + case 0x2E: + funct6 = RISCV_VF_VMSAC; + break; + case 0x2F: + funct6 = RISCV_VF_VNMSAC; + break; + case 0x2A: + funct6 = RISCV_VF_VMSUB; + break; + case 0x2B: + funct6 = RISCV_VF_VNMSUB; + break; + case 0x29: + funct6 = RISCV_VF_VNMADD; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FVFMATYPE; + tree->ast_node.fvfmatype.funct6 = funct6; + tree->ast_node.fvfmatype.vm = vm; + tree->ast_node.fvfmatype.vs2 = vs2; + tree->ast_node.fvfmatype.rs1 = rs1; + tree->ast_node.fvfmatype.vd = vd; + return; + } } - if (width != 0xFFFFFFFFFFFFFFFF) { - uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VSSEGTYPE; - tree->ast_node.vssegtype.nf = nf; - tree->ast_node.vssegtype.vm = vm; - tree->ast_node.vssegtype.rs1 = rs1; - tree->ast_node.vssegtype.width = width; - tree->ast_node.vssegtype.vs3 = vs3; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x2) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; + } + //------------------------------------------------------------ + + // ---------------------------FWVFTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x30: + funct6 = RISCV_FWVF_VADD; + break; + case 0x32: + funct6 = RISCV_FWVF_VSUB; + break; + case 0x38: + funct6 = RISCV_FWVF_VMUL; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FWVFTYPE; + tree->ast_node.fwvftype.funct6 = funct6; + tree->ast_node.fwvftype.vm = vm; + tree->ast_node.fwvftype.vs2 = vs2; + tree->ast_node.fwvftype.rs1 = rs1; + tree->ast_node.fwvftype.vd = vd; + return; + } } - if (width != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VLSSEGTYPE; - tree->ast_node.vlssegtype.nf = nf; - tree->ast_node.vlssegtype.vm = vm; - tree->ast_node.vlssegtype.rs2 = rs2; - tree->ast_node.vlssegtype.rs1 = rs1; - tree->ast_node.vlssegtype.width = width; - tree->ast_node.vlssegtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x27) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x2) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; + } + //------------------------------------------------------------ + + // ---------------------------FWVFMATYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x3E: + funct6 = RISCV_FWVF_VMSAC; + break; + case 0x3D: + funct6 = RISCV_FWVF_VNMACC; + break; + case 0x3C: + funct6 = RISCV_FWVF_VMACC; + break; + case 0x3F: + funct6 = RISCV_FWVF_VNMSAC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FWVFMATYPE; + tree->ast_node.fwvfmatype.funct6 = funct6; + tree->ast_node.fwvfmatype.vm = vm; + tree->ast_node.fwvfmatype.rs1 = rs1; + tree->ast_node.fwvfmatype.vs2 = vs2; + tree->ast_node.fwvfmatype.vd = vd; + return; + } } - if (width != 0xFFFFFFFFFFFFFFFF) { - uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VSSSEGTYPE; - tree->ast_node.vsssegtype.nf = nf; - tree->ast_node.vsssegtype.vm = vm; - tree->ast_node.vsssegtype.rs2 = rs2; - tree->ast_node.vsssegtype.rs1 = rs1; - tree->ast_node.vsssegtype.width = width; - tree->ast_node.vsssegtype.vs3 = vs3; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x1) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; + } + //------------------------------------------------------------ + + // ---------------------------FWFTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x36: + funct6 = RISCV_FWF_VSUB; + break; + case 0x34: + funct6 = RISCV_FWF_VADD; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FWFTYPE; + tree->ast_node.fwftype.funct6 = funct6; + tree->ast_node.fwftype.vm = vm; + tree->ast_node.fwftype.vs2 = vs2; + tree->ast_node.fwftype.rs1 = rs1; + tree->ast_node.fwftype.vd = vd; + return; + } } - if (width != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------VFMERGE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VLUXSEGTYPE; - tree->ast_node.vluxsegtype.nf = nf; - tree->ast_node.vluxsegtype.vm = vm; - tree->ast_node.vluxsegtype.vs2 = vs2; - tree->ast_node.vluxsegtype.rs1 = rs1; - tree->ast_node.vluxsegtype.width = width; - tree->ast_node.vluxsegtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x3) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; + tree->ast_node_type = RISCV_VFMERGE; + tree->ast_node.vfmerge.vs2 = vs2; + tree->ast_node.vfmerge.rs1 = rs1; + tree->ast_node.vfmerge.vd = vd; + return; } - if (width != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------VFMV------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x17)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VLOXSEGTYPE; - tree->ast_node.vloxsegtype.nf = nf; - tree->ast_node.vloxsegtype.vm = vm; - tree->ast_node.vloxsegtype.vs2 = vs2; - tree->ast_node.vloxsegtype.rs1 = rs1; - tree->ast_node.vloxsegtype.width = width; - tree->ast_node.vloxsegtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x27) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x1) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; - } - if (width != 0xFFFFFFFFFFFFFFFF) { - uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VSUXSEGTYPE; - tree->ast_node.vsuxsegtype.nf = nf; - tree->ast_node.vsuxsegtype.vm = vm; - tree->ast_node.vsuxsegtype.vs2 = vs2; - tree->ast_node.vsuxsegtype.rs1 = rs1; - tree->ast_node.vsuxsegtype.width = width; - tree->ast_node.vsuxsegtype.vs3 = vs3; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x27) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x3) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; - } - if (width != 0xFFFFFFFFFFFFFFFF) { - uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VSOXSEGTYPE; - tree->ast_node.vsoxsegtype.nf = nf; - tree->ast_node.vsoxsegtype.vm = vm; - tree->ast_node.vsoxsegtype.vs2 = vs2; - tree->ast_node.vsoxsegtype.rs1 = rs1; - tree->ast_node.vsoxsegtype.width = width; - tree->ast_node.vsoxsegtype.vs3 = vs3; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x07) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x08) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x0) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t width = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x0000000000007000) >> 12) { - case 0x7: - width = RISCV_VLE64; - break; - case 0x5: - width = RISCV_VLE16; - break; - case 0x6: - width = RISCV_VLE32; - break; - case 0x0: - width = RISCV_VLE8; - break; + tree->ast_node_type = RISCV_VFMV; + tree->ast_node.vfmv.rs1 = rs1; + tree->ast_node.vfmv.vd = vd; + return; } - if (width != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VLRETYPE; - tree->ast_node.vlretype.nf = nf; - tree->ast_node.vlretype.rs1 = rs1; - tree->ast_node.vlretype.width = width; - tree->ast_node.vlretype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x27) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x08) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x0) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0)) { - uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; - tree->ast_node_type = RISCV_VSRETYPE; - tree->ast_node.vsretype.nf = nf; - tree->ast_node.vsretype.rs1 = rs1; - tree->ast_node.vsretype.vs3 = vs3; - return; } - if (((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x0B) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1) && - ((binary_stream & 0x000000000C000000) >> 26 == 0x0) && - ((binary_stream & 0x0000000010000000) >> 28 == 0x0) && - ((binary_stream & 0x00000000E0000000) >> 29 == 0x0)) { - uint64_t op = 0xFFFFFFFFFFFFFFFF; - switch (binary_stream & 0x000000000000007F) { - case 0x07: - op = RISCV_VLM; - break; - case 0x27: - op = RISCV_VSM; - break; - } - if (op != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd_or_vs3 = (binary_stream & 0x0000000000000F80) >> 7; + //------------------------------------------------------------ + + // ---------------------------VFMVSF------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x10)) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_VMTYPE; - tree->ast_node.vmtype.rs1 = rs1; - tree->ast_node.vmtype.vd_or_vs3 = vd_or_vs3; - tree->ast_node.vmtype.op = op; + tree->ast_node_type = RISCV_VFMVSF; + tree->ast_node.vfmvsf.rs1 = rs1; + tree->ast_node.vfmvsf.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x19: - funct6 = RISCV_MM_VMAND; - break; - case 0x1B: - funct6 = RISCV_MM_VMXOR; - break; - case 0x1C: - funct6 = RISCV_MM_VMORN; - break; - case 0x1A: - funct6 = RISCV_MM_VMOR; - break; - case 0x1E: - funct6 = RISCV_MM_VMNOR; - break; - case 0x1D: - funct6 = RISCV_MM_VMNAND; - break; - case 0x18: - funct6 = RISCV_MM_VMANDN; - break; - case 0x1F: - funct6 = RISCV_MM_VMXNOR; - break; + //------------------------------------------------------------ + + // ---------------------------VLSEGTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x0) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VLSEGTYPE; + tree->ast_node.vlsegtype.nf = nf; + tree->ast_node.vlsegtype.vm = vm; + tree->ast_node.vlsegtype.rs1 = rs1; + tree->ast_node.vlsegtype.width = width; + tree->ast_node.vlsegtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_MMTYPE; - tree->ast_node.mmtype.funct6 = funct6; - tree->ast_node.mmtype.vs2 = vs2; - tree->ast_node.mmtype.vs1 = vs1; - tree->ast_node.mmtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x10) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VCPOP_M; - tree->ast_node.vcpop_m.vm = vm; - tree->ast_node.vcpop_m.vs2 = vs2; - tree->ast_node.vcpop_m.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x11) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x10)) { - uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VFIRST_M; - tree->ast_node.vfirst_m.vm = vm; - tree->ast_node.vfirst_m.vs2 = vs2; - tree->ast_node.vfirst_m.rd = rd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x01) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x14)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VMSBF_M; - tree->ast_node.vmsbf_m.vm = vm; - tree->ast_node.vmsbf_m.vs2 = vs2; - tree->ast_node.vmsbf_m.vd = vd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x03) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x14)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VMSIF_M; - tree->ast_node.vmsif_m.vm = vm; - tree->ast_node.vmsif_m.vs2 = vs2; - tree->ast_node.vmsif_m.vd = vd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x02) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x14)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VMSOF_M; - tree->ast_node.vmsof_m.vm = vm; - tree->ast_node.vmsof_m.vs2 = vs2; - tree->ast_node.vmsof_m.vd = vd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x10) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x14)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VIOTA_M; - tree->ast_node.viota_m.vm = vm; - tree->ast_node.viota_m.vs2 = vs2; - tree->ast_node.viota_m.vd = vd; - return; - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000000F8000) >> 15 == 0x11) && - ((binary_stream & 0x0000000001F00000) >> 20 == 0x00) && - ((binary_stream & 0x00000000FC000000) >> 26 == 0x14)) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VID_V; - tree->ast_node.vid_v.vm = vm; - tree->ast_node.vid_v.vd = vd; - return; } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x13: - funct6 = RISCV_VVM_VMSBC; - break; - case 0x11: - funct6 = RISCV_VVM_VMADC; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VVMTYPE; - tree->ast_node.vvmtype.funct6 = funct6; - tree->ast_node.vvmtype.vs2 = vs2; - tree->ast_node.vvmtype.vs1 = vs1; - tree->ast_node.vvmtype.vd = vd; - return; + //------------------------------------------------------------ + + // ---------------------------VLSEGFFTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x10) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x0) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VLSEGFFTYPE; + tree->ast_node.vlsegfftype.nf = nf; + tree->ast_node.vlsegfftype.vm = vm; + tree->ast_node.vlsegfftype.rs1 = rs1; + tree->ast_node.vlsegfftype.width = width; + tree->ast_node.vlsegfftype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x13: - funct6 = RISCV_VVMC_VMSBC; - break; - case 0x11: - funct6 = RISCV_VVMC_VMADC; - break; + //------------------------------------------------------------ + + // ---------------------------VSSEGTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x27) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x0) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VSSEGTYPE; + tree->ast_node.vssegtype.nf = nf; + tree->ast_node.vssegtype.vm = vm; + tree->ast_node.vssegtype.rs1 = rs1; + tree->ast_node.vssegtype.width = width; + tree->ast_node.vssegtype.vs3 = vs3; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VVMCTYPE; - tree->ast_node.vvmctype.funct6 = funct6; - tree->ast_node.vvmctype.vs2 = vs2; - tree->ast_node.vvmctype.vs1 = vs1; - tree->ast_node.vvmctype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------VLSSEGTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x2) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VLSSEGTYPE; + tree->ast_node.vlssegtype.nf = nf; + tree->ast_node.vlssegtype.vm = vm; + tree->ast_node.vlssegtype.rs2 = rs2; + tree->ast_node.vlssegtype.rs1 = rs1; + tree->ast_node.vlssegtype.width = width; + tree->ast_node.vlssegtype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x10: - funct6 = RISCV_VVMS_VADC; - break; - case 0x12: - funct6 = RISCV_VVMS_VSBC; - break; + //------------------------------------------------------------ + + // ---------------------------VSSSEGTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x27) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x2) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t rs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VSSSEGTYPE; + tree->ast_node.vsssegtype.nf = nf; + tree->ast_node.vsssegtype.vm = vm; + tree->ast_node.vsssegtype.rs2 = rs2; + tree->ast_node.vsssegtype.rs1 = rs1; + tree->ast_node.vsssegtype.width = width; + tree->ast_node.vsssegtype.vs3 = vs3; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VVMSTYPE; - tree->ast_node.vvmstype.funct6 = funct6; - tree->ast_node.vvmstype.vs2 = vs2; - tree->ast_node.vvmstype.vs1 = vs1; - tree->ast_node.vvmstype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------VLUXSEGTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x1) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VLUXSEGTYPE; + tree->ast_node.vluxsegtype.nf = nf; + tree->ast_node.vluxsegtype.vm = vm; + tree->ast_node.vluxsegtype.vs2 = vs2; + tree->ast_node.vluxsegtype.rs1 = rs1; + tree->ast_node.vluxsegtype.width = width; + tree->ast_node.vluxsegtype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x19: - funct6 = RISCV_VVCMP_VMSNE; - break; - case 0x1B: - funct6 = RISCV_VVCMP_VMSLT; - break; - case 0x1C: - funct6 = RISCV_VVCMP_VMSLEU; - break; - case 0x1A: - funct6 = RISCV_VVCMP_VMSLTU; - break; - case 0x18: - funct6 = RISCV_VVCMP_VMSEQ; - break; - case 0x1D: - funct6 = RISCV_VVCMP_VMSLE; - break; + //------------------------------------------------------------ + + // ---------------------------VLOXSEGTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x3) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VLOXSEGTYPE; + tree->ast_node.vloxsegtype.nf = nf; + tree->ast_node.vloxsegtype.vm = vm; + tree->ast_node.vloxsegtype.vs2 = vs2; + tree->ast_node.vloxsegtype.rs1 = rs1; + tree->ast_node.vloxsegtype.width = width; + tree->ast_node.vloxsegtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VVCMPTYPE; - tree->ast_node.vvcmptype.funct6 = funct6; - tree->ast_node.vvcmptype.vm = vm; - tree->ast_node.vvcmptype.vs2 = vs2; - tree->ast_node.vvcmptype.vs1 = vs1; - tree->ast_node.vvcmptype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x13: - funct6 = RISCV_VXM_VMSBC; - break; - case 0x11: - funct6 = RISCV_VXM_VMADC; - break; + } + //------------------------------------------------------------ + + // ---------------------------VSUXSEGTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x27) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x1) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VSUXSEGTYPE; + tree->ast_node.vsuxsegtype.nf = nf; + tree->ast_node.vsuxsegtype.vm = vm; + tree->ast_node.vsuxsegtype.vs2 = vs2; + tree->ast_node.vsuxsegtype.rs1 = rs1; + tree->ast_node.vsuxsegtype.width = width; + tree->ast_node.vsuxsegtype.vs3 = vs3; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VXMTYPE; - tree->ast_node.vxmtype.funct6 = funct6; - tree->ast_node.vxmtype.vs2 = vs2; - tree->ast_node.vxmtype.rs1 = rs1; - tree->ast_node.vxmtype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------VSOXSEGTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x27) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x3) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VSOXSEGTYPE; + tree->ast_node.vsoxsegtype.nf = nf; + tree->ast_node.vsoxsegtype.vm = vm; + tree->ast_node.vsoxsegtype.vs2 = vs2; + tree->ast_node.vsoxsegtype.rs1 = rs1; + tree->ast_node.vsoxsegtype.width = width; + tree->ast_node.vsoxsegtype.vs3 = vs3; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x13: - funct6 = RISCV_VXMC_VMSBC; - break; - case 0x11: - funct6 = RISCV_VXMC_VMADC; - break; + //------------------------------------------------------------ + + // ---------------------------VLRETYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x07) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x08) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x0) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t width = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x0000000000007000) >> 12) { + case 0x7: + width = RISCV_VLE64; + break; + case 0x5: + width = RISCV_VLE16; + break; + case 0x6: + width = RISCV_VLE32; + break; + case 0x0: + width = RISCV_VLE8; + break; + } + if (width != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VLRETYPE; + tree->ast_node.vlretype.nf = nf; + tree->ast_node.vlretype.rs1 = rs1; + tree->ast_node.vlretype.width = width; + tree->ast_node.vlretype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + } + //------------------------------------------------------------ + + // ---------------------------VSRETYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x27) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x08) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x0) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0)) { + uint64_t vs3 = (binary_stream & 0x0000000000000F80) >> 7; uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VXMCTYPE; - tree->ast_node.vxmctype.funct6 = funct6; - tree->ast_node.vxmctype.vs2 = vs2; - tree->ast_node.vxmctype.rs1 = rs1; - tree->ast_node.vxmctype.vd = vd; + uint64_t nf = (binary_stream & 0x00000000E0000000) >> 29; + tree->ast_node_type = RISCV_VSRETYPE; + tree->ast_node.vsretype.nf = nf; + tree->ast_node.vsretype.rs1 = rs1; + tree->ast_node.vsretype.vs3 = vs3; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x10: - funct6 = RISCV_VXMS_VADC; - break; - case 0x12: - funct6 = RISCV_VXMS_VSBC; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VXMSTYPE; - tree->ast_node.vxmstype.funct6 = funct6; - tree->ast_node.vxmstype.vs2 = vs2; - tree->ast_node.vxmstype.rs1 = rs1; - tree->ast_node.vxmstype.vd = vd; - return; + //------------------------------------------------------------ + + // ---------------------------VMTYPE------------------------------- + { + if ((((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x0B) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1) && + (((binary_stream & 0x000000000C000000) >> 26) == 0x0) && + (((binary_stream & 0x0000000010000000) >> 28) == 0x0) && + (((binary_stream & 0x00000000E0000000) >> 29) == 0x0)) { + uint64_t op = 0xFFFFFFFFFFFFFFFF; + switch (binary_stream & 0x000000000000007F) { + case 0x07: + op = RISCV_VLM; + break; + case 0x27: + op = RISCV_VSM; + break; + } + if (op != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd_or_vs3 = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_VMTYPE; + tree->ast_node.vmtype.rs1 = rs1; + tree->ast_node.vmtype.vd_or_vs3 = vd_or_vs3; + tree->ast_node.vmtype.op = op; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x4)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x19: - funct6 = RISCV_VXCMP_VMSNE; - break; - case 0x1B: - funct6 = RISCV_VXCMP_VMSLT; - break; - case 0x1C: - funct6 = RISCV_VXCMP_VMSLEU; - break; - case 0x1A: - funct6 = RISCV_VXCMP_VMSLTU; - break; - case 0x1E: - funct6 = RISCV_VXCMP_VMSGTU; - break; - case 0x18: - funct6 = RISCV_VXCMP_VMSEQ; - break; - case 0x1D: - funct6 = RISCV_VXCMP_VMSLE; - break; - case 0x1F: - funct6 = RISCV_VXCMP_VMSGT; - break; + //------------------------------------------------------------ + + // ---------------------------MMTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x19: + funct6 = RISCV_MM_VMAND; + break; + case 0x1B: + funct6 = RISCV_MM_VMXOR; + break; + case 0x1C: + funct6 = RISCV_MM_VMORN; + break; + case 0x1A: + funct6 = RISCV_MM_VMOR; + break; + case 0x1E: + funct6 = RISCV_MM_VMNOR; + break; + case 0x1D: + funct6 = RISCV_MM_VMNAND; + break; + case 0x18: + funct6 = RISCV_MM_VMANDN; + break; + case 0x1F: + funct6 = RISCV_MM_VMXNOR; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_MMTYPE; + tree->ast_node.mmtype.funct6 = funct6; + tree->ast_node.mmtype.vs2 = vs2; + tree->ast_node.mmtype.vs1 = vs1; + tree->ast_node.mmtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + } + //------------------------------------------------------------ + + // ---------------------------VCPOP_M------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x10) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VXCMPTYPE; - tree->ast_node.vxcmptype.funct6 = funct6; - tree->ast_node.vxcmptype.vm = vm; - tree->ast_node.vxcmptype.vs2 = vs2; - tree->ast_node.vxcmptype.rs1 = rs1; - tree->ast_node.vxcmptype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x11: - funct6 = RISCV_VIM_VMADC; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VIMTYPE; - tree->ast_node.vimtype.funct6 = funct6; - tree->ast_node.vimtype.vs2 = vs2; - tree->ast_node.vimtype.simm = simm; - tree->ast_node.vimtype.vd = vd; + tree->ast_node_type = RISCV_VCPOP_M; + tree->ast_node.vcpop_m.vm = vm; + tree->ast_node.vcpop_m.vs2 = vs2; + tree->ast_node.vcpop_m.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x11: - funct6 = RISCV_VIMC_VMADC; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + //------------------------------------------------------------ + + // ---------------------------VFIRST_M------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x11) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x10)) { + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VIMCTYPE; - tree->ast_node.vimctype.funct6 = funct6; - tree->ast_node.vimctype.vs2 = vs2; - tree->ast_node.vimctype.simm = simm; - tree->ast_node.vimctype.vd = vd; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VFIRST_M; + tree->ast_node.vfirst_m.vm = vm; + tree->ast_node.vfirst_m.vs2 = vs2; + tree->ast_node.vfirst_m.rd = rd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3) && - ((binary_stream & 0x0000000002000000) >> 25 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x10: - funct6 = RISCV_VIMS_VADC; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------VMSBF_M------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x01) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x14)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - tree->ast_node_type = RISCV_VIMSTYPE; - tree->ast_node.vimstype.funct6 = funct6; - tree->ast_node.vimstype.vs2 = vs2; - tree->ast_node.vimstype.simm = simm; - tree->ast_node.vimstype.vd = vd; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VMSBF_M; + tree->ast_node.vmsbf_m.vm = vm; + tree->ast_node.vmsbf_m.vs2 = vs2; + tree->ast_node.vmsbf_m.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x3)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x19: - funct6 = RISCV_VICMP_VMSNE; - break; - case 0x1C: - funct6 = RISCV_VICMP_VMSLEU; - break; - case 0x1E: - funct6 = RISCV_VICMP_VMSGTU; - break; - case 0x18: - funct6 = RISCV_VICMP_VMSEQ; - break; - case 0x1D: - funct6 = RISCV_VICMP_VMSLE; - break; - case 0x1F: - funct6 = RISCV_VICMP_VMSGT; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------VMSIF_M------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x03) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x14)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_VICMPTYPE; - tree->ast_node.vicmptype.funct6 = funct6; - tree->ast_node.vicmptype.vm = vm; - tree->ast_node.vicmptype.vs2 = vs2; - tree->ast_node.vicmptype.simm = simm; - tree->ast_node.vicmptype.vd = vd; + tree->ast_node_type = RISCV_VMSIF_M; + tree->ast_node.vmsif_m.vm = vm; + tree->ast_node.vmsif_m.vs2 = vs2; + tree->ast_node.vmsif_m.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x19: - funct6 = RISCV_FVVM_VMFLE; - break; - case 0x1B: - funct6 = RISCV_FVVM_VMFLT; - break; - case 0x1C: - funct6 = RISCV_FVVM_VMFNE; - break; - case 0x18: - funct6 = RISCV_FVVM_VMFEQ; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------VMSOF_M------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x02) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x14)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FVVMTYPE; - tree->ast_node.fvvmtype.funct6 = funct6; - tree->ast_node.fvvmtype.vm = vm; - tree->ast_node.fvvmtype.vs2 = vs2; - tree->ast_node.fvvmtype.vs1 = vs1; - tree->ast_node.fvvmtype.vd = vd; + tree->ast_node_type = RISCV_VMSOF_M; + tree->ast_node.vmsof_m.vm = vm; + tree->ast_node.vmsof_m.vs2 = vs2; + tree->ast_node.vmsof_m.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x5)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x19: - funct6 = RISCV_VFM_VMFLE; - break; - case 0x1B: - funct6 = RISCV_VFM_VMFLT; - break; - case 0x1C: - funct6 = RISCV_VFM_VMFNE; - break; - case 0x18: - funct6 = RISCV_VFM_VMFEQ; - break; - case 0x1D: - funct6 = RISCV_VFM_VMFGT; - break; - case 0x1F: - funct6 = RISCV_VFM_VMFGE; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------VIOTA_M------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x10) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x14)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_FVFMTYPE; - tree->ast_node.fvfmtype.funct6 = funct6; - tree->ast_node.fvfmtype.vm = vm; - tree->ast_node.fvfmtype.vs2 = vs2; - tree->ast_node.fvfmtype.rs1 = rs1; - tree->ast_node.fvfmtype.vd = vd; + tree->ast_node_type = RISCV_VIOTA_M; + tree->ast_node.viota_m.vm = vm; + tree->ast_node.viota_m.vs2 = vs2; + tree->ast_node.viota_m.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x0)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x31: - funct6 = RISCV_IVV_VWREDSUM; - break; - case 0x30: - funct6 = RISCV_IVV_VWREDSUMU; - break; - } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { + //------------------------------------------------------------ + + // ---------------------------VID_V------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000000F8000) >> 15) == 0x11) && + (((binary_stream & 0x0000000001F00000) >> 20) == 0x00) && + (((binary_stream & 0x00000000FC000000) >> 26) == 0x14)) { uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_RIVVTYPE; - tree->ast_node.rivvtype.funct6 = funct6; - tree->ast_node.rivvtype.vm = vm; - tree->ast_node.rivvtype.vs2 = vs2; - tree->ast_node.rivvtype.vs1 = vs1; - tree->ast_node.rivvtype.vd = vd; + tree->ast_node_type = RISCV_VID_V; + tree->ast_node.vid_v.vm = vm; + tree->ast_node.vid_v.vd = vd; return; } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x01: - funct6 = RISCV_MVV_VREDAND; - break; - case 0x06: - funct6 = RISCV_MVV_VREDMAXU; - break; - case 0x07: - funct6 = RISCV_MVV_VREDMAX; - break; - case 0x04: - funct6 = RISCV_MVV_VREDMINU; - break; - case 0x00: - funct6 = RISCV_MVV_VREDSUM; - break; - case 0x03: - funct6 = RISCV_MVV_VREDXOR; - break; - case 0x05: - funct6 = RISCV_MVV_VREDMIN; - break; - case 0x02: - funct6 = RISCV_MVV_VREDOR; - break; + //------------------------------------------------------------ + + // ---------------------------VVMTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x13: + funct6 = RISCV_VVM_VMSBC; + break; + case 0x11: + funct6 = RISCV_VVM_VMADC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VVMTYPE; + tree->ast_node.vvmtype.funct6 = funct6; + tree->ast_node.vvmtype.vs2 = vs2; + tree->ast_node.vvmtype.vs1 = vs1; + tree->ast_node.vvmtype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_RMVVTYPE; - tree->ast_node.rmvvtype.funct6 = funct6; - tree->ast_node.rmvvtype.vm = vm; - tree->ast_node.rmvvtype.vs2 = vs2; - tree->ast_node.rmvvtype.vs1 = vs1; - tree->ast_node.rmvvtype.vd = vd; - return; + } + //------------------------------------------------------------ + + // ---------------------------VVMCTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x13: + funct6 = RISCV_VVMC_VMSBC; + break; + case 0x11: + funct6 = RISCV_VVMC_VMADC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VVMCTYPE; + tree->ast_node.vvmctype.funct6 = funct6; + tree->ast_node.vvmctype.vs2 = vs2; + tree->ast_node.vvmctype.vs1 = vs1; + tree->ast_node.vvmctype.vd = vd; + return; + } } } - if ((binary_stream & 0x000000000000007F == 0x57) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x1)) { - uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FC000000) >> 26) { - case 0x33: - funct6 = RISCV_FVV_VFWREDOSUM; - break; - case 0x01: - funct6 = RISCV_FVV_VFREDUSUM; - break; - case 0x31: - funct6 = RISCV_FVV_VFWREDUSUM; - break; - case 0x07: - funct6 = RISCV_FVV_VFREDMAX; - break; - case 0x03: - funct6 = RISCV_FVV_VFREDOSUM; - break; - case 0x05: - funct6 = RISCV_FVV_VFREDMIN; - break; + //------------------------------------------------------------ + + // ---------------------------VVMSTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x10: + funct6 = RISCV_VVMS_VADC; + break; + case 0x12: + funct6 = RISCV_VVMS_VSBC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VVMSTYPE; + tree->ast_node.vvmstype.funct6 = funct6; + tree->ast_node.vvmstype.vs2 = vs2; + tree->ast_node.vvmstype.vs1 = vs1; + tree->ast_node.vvmstype.vd = vd; + return; + } } - if (funct6 != 0xFFFFFFFFFFFFFFFF) { - uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; - uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; - uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; - uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; - tree->ast_node_type = RISCV_RFVVTYPE; - tree->ast_node.rfvvtype.funct6 = funct6; - tree->ast_node.rfvvtype.vm = vm; - tree->ast_node.rfvvtype.vs2 = vs2; - tree->ast_node.rfvvtype.vs1 = vs1; - tree->ast_node.rfvvtype.vd = vd; - return; - } - } - if ((binary_stream & 0x000000000000007F == 0x0F) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2)) { - uint64_t cbop = 0xFFFFFFFFFFFFFFFF; - switch ((binary_stream & 0x00000000FFF00000) >> 20) { - case 0x000: - cbop = RISCV_CBO_INVAL; - break; - case 0x002: - cbop = RISCV_CBO_FLUSH; - break; - case 0x001: - cbop = RISCV_CBO_CLEAN; - break; + } + //------------------------------------------------------------ + + // ---------------------------VVCMPTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x19: + funct6 = RISCV_VVCMP_VMSNE; + break; + case 0x1B: + funct6 = RISCV_VVCMP_VMSLT; + break; + case 0x1C: + funct6 = RISCV_VVCMP_VMSLEU; + break; + case 0x1A: + funct6 = RISCV_VVCMP_VMSLTU; + break; + case 0x18: + funct6 = RISCV_VVCMP_VMSEQ; + break; + case 0x1D: + funct6 = RISCV_VVCMP_VMSLE; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VVCMPTYPE; + tree->ast_node.vvcmptype.funct6 = funct6; + tree->ast_node.vvcmptype.vm = vm; + tree->ast_node.vvcmptype.vs2 = vs2; + tree->ast_node.vvcmptype.vs1 = vs1; + tree->ast_node.vvcmptype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------VXMTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x13: + funct6 = RISCV_VXM_VMSBC; + break; + case 0x11: + funct6 = RISCV_VXM_VMADC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VXMTYPE; + tree->ast_node.vxmtype.funct6 = funct6; + tree->ast_node.vxmtype.vs2 = vs2; + tree->ast_node.vxmtype.rs1 = rs1; + tree->ast_node.vxmtype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------VXMCTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x13: + funct6 = RISCV_VXMC_VMSBC; + break; + case 0x11: + funct6 = RISCV_VXMC_VMADC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VXMCTYPE; + tree->ast_node.vxmctype.funct6 = funct6; + tree->ast_node.vxmctype.vs2 = vs2; + tree->ast_node.vxmctype.rs1 = rs1; + tree->ast_node.vxmctype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------VXMSTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x10: + funct6 = RISCV_VXMS_VADC; + break; + case 0x12: + funct6 = RISCV_VXMS_VSBC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VXMSTYPE; + tree->ast_node.vxmstype.funct6 = funct6; + tree->ast_node.vxmstype.vs2 = vs2; + tree->ast_node.vxmstype.rs1 = rs1; + tree->ast_node.vxmstype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------VXCMPTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x4)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x19: + funct6 = RISCV_VXCMP_VMSNE; + break; + case 0x1B: + funct6 = RISCV_VXCMP_VMSLT; + break; + case 0x1C: + funct6 = RISCV_VXCMP_VMSLEU; + break; + case 0x1A: + funct6 = RISCV_VXCMP_VMSLTU; + break; + case 0x1E: + funct6 = RISCV_VXCMP_VMSGTU; + break; + case 0x18: + funct6 = RISCV_VXCMP_VMSEQ; + break; + case 0x1D: + funct6 = RISCV_VXCMP_VMSLE; + break; + case 0x1F: + funct6 = RISCV_VXCMP_VMSGT; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VXCMPTYPE; + tree->ast_node.vxcmptype.funct6 = funct6; + tree->ast_node.vxcmptype.vm = vm; + tree->ast_node.vxcmptype.vs2 = vs2; + tree->ast_node.vxcmptype.rs1 = rs1; + tree->ast_node.vxcmptype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------VIMTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x11: + funct6 = RISCV_VIM_VMADC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VIMTYPE; + tree->ast_node.vimtype.funct6 = funct6; + tree->ast_node.vimtype.vs2 = vs2; + tree->ast_node.vimtype.simm = simm; + tree->ast_node.vimtype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------VIMCTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x11: + funct6 = RISCV_VIMC_VMADC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VIMCTYPE; + tree->ast_node.vimctype.funct6 = funct6; + tree->ast_node.vimctype.vs2 = vs2; + tree->ast_node.vimctype.simm = simm; + tree->ast_node.vimctype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------VIMSTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3) && + (((binary_stream & 0x0000000002000000) >> 25) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x10: + funct6 = RISCV_VIMS_VADC; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + tree->ast_node_type = RISCV_VIMSTYPE; + tree->ast_node.vimstype.funct6 = funct6; + tree->ast_node.vimstype.vs2 = vs2; + tree->ast_node.vimstype.simm = simm; + tree->ast_node.vimstype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------VICMPTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x3)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x19: + funct6 = RISCV_VICMP_VMSNE; + break; + case 0x1C: + funct6 = RISCV_VICMP_VMSLEU; + break; + case 0x1E: + funct6 = RISCV_VICMP_VMSGTU; + break; + case 0x18: + funct6 = RISCV_VICMP_VMSEQ; + break; + case 0x1D: + funct6 = RISCV_VICMP_VMSLE; + break; + case 0x1F: + funct6 = RISCV_VICMP_VMSGT; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t simm = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_VICMPTYPE; + tree->ast_node.vicmptype.funct6 = funct6; + tree->ast_node.vicmptype.vm = vm; + tree->ast_node.vicmptype.vs2 = vs2; + tree->ast_node.vicmptype.simm = simm; + tree->ast_node.vicmptype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------FVVMTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x19: + funct6 = RISCV_FVVM_VMFLE; + break; + case 0x1B: + funct6 = RISCV_FVVM_VMFLT; + break; + case 0x1C: + funct6 = RISCV_FVVM_VMFNE; + break; + case 0x18: + funct6 = RISCV_FVVM_VMFEQ; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FVVMTYPE; + tree->ast_node.fvvmtype.funct6 = funct6; + tree->ast_node.fvvmtype.vm = vm; + tree->ast_node.fvvmtype.vs2 = vs2; + tree->ast_node.fvvmtype.vs1 = vs1; + tree->ast_node.fvvmtype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------FVFMTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x5)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x19: + funct6 = RISCV_VFM_VMFLE; + break; + case 0x1B: + funct6 = RISCV_VFM_VMFLT; + break; + case 0x1C: + funct6 = RISCV_VFM_VMFNE; + break; + case 0x18: + funct6 = RISCV_VFM_VMFEQ; + break; + case 0x1D: + funct6 = RISCV_VFM_VMFGT; + break; + case 0x1F: + funct6 = RISCV_VFM_VMFGE; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_FVFMTYPE; + tree->ast_node.fvfmtype.funct6 = funct6; + tree->ast_node.fvfmtype.vm = vm; + tree->ast_node.fvfmtype.vs2 = vs2; + tree->ast_node.fvfmtype.rs1 = rs1; + tree->ast_node.fvfmtype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------RIVVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x0)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x31: + funct6 = RISCV_IVV_VWREDSUM; + break; + case 0x30: + funct6 = RISCV_IVV_VWREDSUMU; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_RIVVTYPE; + tree->ast_node.rivvtype.funct6 = funct6; + tree->ast_node.rivvtype.vm = vm; + tree->ast_node.rivvtype.vs2 = vs2; + tree->ast_node.rivvtype.vs1 = vs1; + tree->ast_node.rivvtype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------RMVVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x01: + funct6 = RISCV_MVV_VREDAND; + break; + case 0x06: + funct6 = RISCV_MVV_VREDMAXU; + break; + case 0x07: + funct6 = RISCV_MVV_VREDMAX; + break; + case 0x04: + funct6 = RISCV_MVV_VREDMINU; + break; + case 0x00: + funct6 = RISCV_MVV_VREDSUM; + break; + case 0x03: + funct6 = RISCV_MVV_VREDXOR; + break; + case 0x05: + funct6 = RISCV_MVV_VREDMIN; + break; + case 0x02: + funct6 = RISCV_MVV_VREDOR; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_RMVVTYPE; + tree->ast_node.rmvvtype.funct6 = funct6; + tree->ast_node.rmvvtype.vm = vm; + tree->ast_node.rmvvtype.vs2 = vs2; + tree->ast_node.rmvvtype.vs1 = vs1; + tree->ast_node.rmvvtype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------RFVVTYPE------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x57) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x1)) { + uint64_t funct6 = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FC000000) >> 26) { + case 0x33: + funct6 = RISCV_FVV_VFWREDOSUM; + break; + case 0x01: + funct6 = RISCV_FVV_VFREDUSUM; + break; + case 0x31: + funct6 = RISCV_FVV_VFWREDUSUM; + break; + case 0x07: + funct6 = RISCV_FVV_VFREDMAX; + break; + case 0x03: + funct6 = RISCV_FVV_VFREDOSUM; + break; + case 0x05: + funct6 = RISCV_FVV_VFREDMIN; + break; + } + if (funct6 != 0xFFFFFFFFFFFFFFFF) { + uint64_t vd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t vs1 = (binary_stream & 0x00000000000F8000) >> 15; + uint64_t vs2 = (binary_stream & 0x0000000001F00000) >> 20; + uint64_t vm = (binary_stream & 0x0000000002000000) >> 25; + tree->ast_node_type = RISCV_RFVVTYPE; + tree->ast_node.rfvvtype.funct6 = funct6; + tree->ast_node.rfvvtype.vm = vm; + tree->ast_node.rfvvtype.vs2 = vs2; + tree->ast_node.rfvvtype.vs1 = vs1; + tree->ast_node.rfvvtype.vd = vd; + return; + } + } + } + //------------------------------------------------------------ + + // ---------------------------RISCV_ZICBOM------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x0F) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2)) { + uint64_t cbop = 0xFFFFFFFFFFFFFFFF; + switch ((binary_stream & 0x00000000FFF00000) >> 20) { + case 0x000: + cbop = RISCV_CBO_INVAL; + break; + case 0x002: + cbop = RISCV_CBO_FLUSH; + break; + case 0x001: + cbop = RISCV_CBO_CLEAN; + break; + } + if (cbop != 0xFFFFFFFFFFFFFFFF) { + uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; + tree->ast_node_type = RISCV_ZICBOM; + tree->ast_node.riscv_zicbom.cbop = cbop; + tree->ast_node.riscv_zicbom.rs1 = rs1; + return; + } } - if (cbop != 0xFFFFFFFFFFFFFFFF) { + } + //------------------------------------------------------------ + + // ---------------------------RISCV_ZICBOZ------------------------------- + { + if (((binary_stream & 0x000000000000007F) == 0x0F) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000007000) >> 12) == 0x2) && + (((binary_stream & 0x00000000FFF00000) >> 20) == 0x004)) { uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_ZICBOM; - tree->ast_node.riscv_zicbom.cbop = cbop; - tree->ast_node.riscv_zicbom.rs1 = rs1; + tree->ast_node_type = RISCV_ZICBOZ; + tree->ast_node.riscv_zicboz = rs1; return; } } - if ((binary_stream & 0x000000000000007F == 0x0F) && - ((binary_stream & 0x0000000000000F80) >> 7 == 0x00) && - ((binary_stream & 0x0000000000007000) >> 12 == 0x2) && - ((binary_stream & 0x00000000FFF00000) >> 20 == 0x004)) { - uint64_t rs1 = (binary_stream & 0x00000000000F8000) >> 15; - tree->ast_node_type = RISCV_ZICBOZ; - tree->ast_node.riscv_zicboz = rs1; + //------------------------------------------------------------ + + // ---------------------------ILLEGAL------------------------------- + { + uint64_t s = binary_stream & 0x00000000FFFFFFFF; + tree->ast_node_type = RISCV_ILLEGAL; + tree->ast_node.illegal = s; return; } - uint64_t s = binary_stream & 0x00000000FFFFFFFF; - tree->ast_node_type = RISCV_ILLEGAL; - tree->ast_node.illegal = s; - return; + //------------------------------------------------------------ } #endif diff --git a/riscv_disasm/riscv_decode_compressed.gen.inc b/riscv_disasm/riscv_decode_compressed.gen.inc new file mode 100644 index 0000000..cacac74 --- /dev/null +++ b/riscv_disasm/riscv_decode_compressed.gen.inc @@ -0,0 +1,1043 @@ +/*=======================================================================*/ +/*This code was generated by the tool riscv_disasm_from_sail (see + * https://github.com/moste00/riscv_disasm_from_sail)*/ +/*from the sail model of RISC-V (see https://github.com/riscv/sail-riscv) @ + * version 0b9c639f19da48734cbf14b61f6ad200b7c70de9.*/ +/*DO NOT MODIFY THIS CODE MANUALLY.*/ +/* */ +/*SPDX-License-Identifier: BSD-3-Clause*/ +/*=======================================================================*/ + +#ifndef __Riscv_decode_compressed_gen_inc__ +#define __Riscv_decode_compressed_gen_inc__ +#include + +#include + +#include "riscv_ast.gen.inc" +#include + +void decode_compressed(struct ast *tree, uint64_t binary_stream) { + // ---------------------------C_NOP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000007C) >> 2) == 0x00) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x0)) { + tree->ast_node_type = RISCV_C_NOP; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ADDI4SPN------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x0)) { + uint64_t rd = (binary_stream & 0x000000000000001C) >> 2; + uint64_t nz3 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t nz2 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t nz96 = (binary_stream & 0x0000000000000780) >> 7; + uint64_t nz54 = (binary_stream & 0x0000000000001800) >> 11; + tree->ast_node_type = RISCV_C_ADDI4SPN; + tree->ast_node.c_addi4spn.rdc = rd; + tree->ast_node.c_addi4spn.nzimm = + (nz96 << 4) | (nz54 << 2) | (nz3 << 1) | (nz2 << 0); + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LW------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x2)) { + uint64_t rd = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui6 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t ui2 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t rs1 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_LW; + tree->ast_node.c_lw.uimm = (ui6 << 4) | (ui53 << 1) | (ui2 << 0); + tree->ast_node.c_lw.rsc = rs1; + tree->ast_node.c_lw.rdc = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LD------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x3)) { + uint64_t rd = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui76 = (binary_stream & 0x0000000000000060) >> 5; + uint64_t rs1 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_LD; + tree->ast_node.c_ld.uimm = (ui76 << 3) | (ui53 << 0); + tree->ast_node.c_ld.rsc = rs1; + tree->ast_node.c_ld.rdc = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SW------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x6)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui6 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t ui2 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t rs1 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_SW; + tree->ast_node.c_sw.uimm = (ui6 << 4) | (ui53 << 1) | (ui2 << 0); + tree->ast_node.c_sw.rsc1 = rs1; + tree->ast_node.c_sw.rsc2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SD------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x7)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui76 = (binary_stream & 0x0000000000000060) >> 5; + uint64_t rs1 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_SD; + tree->ast_node.c_sd.uimm = (ui76 << 3) | (ui53 << 0); + tree->ast_node.c_sd.rsc1 = rs1; + tree->ast_node.c_sd.rsc2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ADDI------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x0)) { + uint64_t nzi40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t nzi5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_ADDI; + tree->ast_node.c_addi.nzi = (nzi5 << 5) | (nzi40 << 0); + tree->ast_node.c_addi.rsd = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_JAL------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x1)) { + uint64_t i5 = (binary_stream & 0x0000000000000004) >> 2; + uint64_t i31 = (binary_stream & 0x0000000000000038) >> 3; + uint64_t i7 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t i6 = (binary_stream & 0x0000000000000080) >> 7; + uint64_t i10 = (binary_stream & 0x0000000000000100) >> 8; + uint64_t i98 = (binary_stream & 0x0000000000000600) >> 9; + uint64_t i4 = (binary_stream & 0x0000000000000800) >> 11; + uint64_t i11 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_JAL; + tree->ast_node.c_jal = (i11 << 10) | (i10 << 9) | (i98 << 7) | (i7 << 6) | + (i6 << 5) | (i5 << 4) | (i4 << 3) | (i31 << 0); + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ADDIW------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x1)) { + uint64_t imm40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t imm5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_ADDIW; + tree->ast_node.c_addiw.imm = (imm5 << 5) | (imm40 << 0); + tree->ast_node.c_addiw.rsd = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LI------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x2)) { + uint64_t imm40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t imm5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_LI; + tree->ast_node.c_li.imm = (imm5 << 5) | (imm40 << 0); + tree->ast_node.c_li.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ADDI16SP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x02) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x3)) { + uint64_t nzi5 = (binary_stream & 0x0000000000000004) >> 2; + uint64_t nzi87 = (binary_stream & 0x0000000000000018) >> 3; + uint64_t nzi6 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t nzi4 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t nzi9 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_ADDI16SP; + tree->ast_node.c_addi16sp = + (nzi9 << 5) | (nzi87 << 3) | (nzi6 << 2) | (nzi5 << 1) | (nzi4 << 0); + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LUI------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x3)) { + uint64_t imm1612 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t imm17 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_LUI; + tree->ast_node.c_lui.imm = (imm17 << 5) | (imm1612 << 0); + tree->ast_node.c_lui.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SRLI------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t nzui40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + uint64_t nzui5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_SRLI; + tree->ast_node.c_srli.shamt = (nzui5 << 5) | (nzui40 << 0); + tree->ast_node.c_srli.rsd = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SRAI------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t nzui40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + uint64_t nzui5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_SRAI; + tree->ast_node.c_srai.shamt = (nzui5 << 5) | (nzui40 << 0); + tree->ast_node.c_srai.rsd = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ANDI------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t i40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + uint64_t i5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_ANDI; + tree->ast_node.c_andi.imm = (i5 << 5) | (i40 << 0); + tree->ast_node.c_andi.rsd = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SUB------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x0) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x3) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_SUB; + tree->ast_node.c_sub.rsd = rsd; + tree->ast_node.c_sub.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_XOR------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x1) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x3) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_XOR; + tree->ast_node.c_xor.rsd = rsd; + tree->ast_node.c_xor.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_OR------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x2) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x3) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_OR; + tree->ast_node.c_or.rsd = rsd; + tree->ast_node.c_or.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_AND------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x3) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x3) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_AND; + tree->ast_node.c_and.rsd = rsd; + tree->ast_node.c_and.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SUBW------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x0) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x3) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_SUBW; + tree->ast_node.c_subw.rsd = rsd; + tree->ast_node.c_subw.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ADDW------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x1) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x3) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_ADDW; + tree->ast_node.c_addw.rsd = rsd; + tree->ast_node.c_addw.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_J------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x5)) { + uint64_t i5 = (binary_stream & 0x0000000000000004) >> 2; + uint64_t i31 = (binary_stream & 0x0000000000000038) >> 3; + uint64_t i7 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t i6 = (binary_stream & 0x0000000000000080) >> 7; + uint64_t i10 = (binary_stream & 0x0000000000000100) >> 8; + uint64_t i98 = (binary_stream & 0x0000000000000600) >> 9; + uint64_t i4 = (binary_stream & 0x0000000000000800) >> 11; + uint64_t i11 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_J; + tree->ast_node.c_j = (i11 << 10) | (i10 << 9) | (i98 << 7) | (i7 << 6) | + (i6 << 5) | (i5 << 4) | (i4 << 3) | (i31 << 0); + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_BEQZ------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x6)) { + uint64_t i5 = (binary_stream & 0x0000000000000004) >> 2; + uint64_t i21 = (binary_stream & 0x0000000000000018) >> 3; + uint64_t i76 = (binary_stream & 0x0000000000000060) >> 5; + uint64_t rs = (binary_stream & 0x0000000000000380) >> 7; + uint64_t i43 = (binary_stream & 0x0000000000000C00) >> 10; + uint64_t i8 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_BEQZ; + tree->ast_node.c_beqz.imm = + (i8 << 7) | (i76 << 5) | (i5 << 4) | (i43 << 2) | (i21 << 0); + tree->ast_node.c_beqz.rs = rs; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_BNEZ------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x7)) { + uint64_t i5 = (binary_stream & 0x0000000000000004) >> 2; + uint64_t i21 = (binary_stream & 0x0000000000000018) >> 3; + uint64_t i76 = (binary_stream & 0x0000000000000060) >> 5; + uint64_t rs = (binary_stream & 0x0000000000000380) >> 7; + uint64_t i43 = (binary_stream & 0x0000000000000C00) >> 10; + uint64_t i8 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_BNEZ; + tree->ast_node.c_bnez.imm = + (i8 << 7) | (i76 << 5) | (i5 << 4) | (i43 << 2) | (i21 << 0); + tree->ast_node.c_bnez.rs = rs; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SLLI------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x0)) { + uint64_t nzui40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t nzui5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_SLLI; + tree->ast_node.c_slli.shamt = (nzui5 << 5) | (nzui40 << 0); + tree->ast_node.c_slli.rsd = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LWSP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x2)) { + uint64_t ui76 = (binary_stream & 0x000000000000000C) >> 2; + uint64_t ui42 = (binary_stream & 0x0000000000000070) >> 4; + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t ui5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_LWSP; + tree->ast_node.c_lwsp.uimm = (ui76 << 4) | (ui5 << 3) | (ui42 << 0); + tree->ast_node.c_lwsp.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LDSP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x3)) { + uint64_t ui86 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui43 = (binary_stream & 0x0000000000000060) >> 5; + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t ui5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_LDSP; + tree->ast_node.c_ldsp.uimm = (ui86 << 3) | (ui5 << 2) | (ui43 << 0); + tree->ast_node.c_ldsp.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SWSP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x6)) { + uint64_t rs2 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t ui76 = (binary_stream & 0x0000000000000180) >> 7; + uint64_t ui52 = (binary_stream & 0x0000000000001E00) >> 9; + tree->ast_node_type = RISCV_C_SWSP; + tree->ast_node.c_swsp.uimm = (ui76 << 4) | (ui52 << 0); + tree->ast_node.c_swsp.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SDSP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x7)) { + uint64_t rs2 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t ui86 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_SDSP; + tree->ast_node.c_sdsp.uimm = (ui86 << 3) | (ui53 << 0); + tree->ast_node.c_sdsp.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_JR------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000007C) >> 2) == 0x00) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs1 = (binary_stream & 0x0000000000000F80) >> 7; + tree->ast_node_type = RISCV_C_JR; + tree->ast_node.c_jr = rs1; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_JALR------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000007C) >> 2) == 0x00) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs1 = (binary_stream & 0x0000000000000F80) >> 7; + tree->ast_node_type = RISCV_C_JALR; + tree->ast_node.c_jalr = rs1; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_MV------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + tree->ast_node_type = RISCV_C_MV; + tree->ast_node.c_mv.rd = rd; + tree->ast_node.c_mv.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_EBREAK------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000007C) >> 2) == 0x00) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + tree->ast_node_type = RISCV_C_EBREAK; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ADD------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000F80) >> 7; + tree->ast_node_type = RISCV_C_ADD; + tree->ast_node.c_add.rsd = rsd; + tree->ast_node.c_add.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_NOP_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x0)) { + uint64_t im40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t im5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_NOP_HINT; + tree->ast_node.c_nop_hint = (im5 << 5) | (im40 << 0); + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ADDI_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000007C) >> 2) == 0x00) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x0)) { + uint64_t rsd = (binary_stream & 0x0000000000000F80) >> 7; + tree->ast_node_type = RISCV_C_ADDI_HINT; + tree->ast_node.c_addi_hint = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LI_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x2)) { + uint64_t imm40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t imm5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_LI_HINT; + tree->ast_node.c_li_hint = (imm5 << 5) | (imm40 << 0); + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LUI_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x3)) { + uint64_t imm1612 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t imm17 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_LUI_HINT; + tree->ast_node.c_lui_hint = (imm17 << 5) | (imm1612 << 0); + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_MV_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000007C) >> 2; + tree->ast_node_type = RISCV_C_MV_HINT; + tree->ast_node.c_mv_hint = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ADD_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x0000000000000F80) >> 7) == 0x00) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2 = (binary_stream & 0x000000000000007C) >> 2; + tree->ast_node_type = RISCV_C_ADD_HINT; + tree->ast_node.c_add_hint = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SLLI_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x0)) { + uint64_t nzui40 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t rsd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t nzui5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_SLLI_HINT; + tree->ast_node.c_slli_hint.shamt = (nzui5 << 5) | (nzui40 << 0); + tree->ast_node.c_slli_hint.rsd = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SRLI_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000007C) >> 2) == 0x00) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x0) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_SRLI_HINT; + tree->ast_node.c_srli_hint = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SRAI_HINT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000007C) >> 2) == 0x00) && + (((binary_stream & 0x0000000000000C00) >> 10) == 0x1) && + (((binary_stream & 0x0000000000001000) >> 12) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rsd = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_SRAI_HINT; + tree->ast_node.c_srai_hint = rsd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_FLWSP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x3)) { + uint64_t ui76 = (binary_stream & 0x000000000000000C) >> 2; + uint64_t ui42 = (binary_stream & 0x0000000000000070) >> 4; + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t ui5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_FLWSP; + tree->ast_node.c_flwsp.imm = (ui76 << 4) | (ui5 << 3) | (ui42 << 0); + tree->ast_node.c_flwsp.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_FSWSP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x7)) { + uint64_t rs2 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t ui76 = (binary_stream & 0x0000000000000180) >> 7; + uint64_t ui52 = (binary_stream & 0x0000000000001E00) >> 9; + tree->ast_node_type = RISCV_C_FSWSP; + tree->ast_node.c_fswsp.uimm = (ui76 << 4) | (ui52 << 0); + tree->ast_node.c_fswsp.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_FLW------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x3)) { + uint64_t rd = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui6 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t ui2 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t rs1 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_FLW; + tree->ast_node.c_flw.uimm = (ui6 << 4) | (ui53 << 1) | (ui2 << 0); + tree->ast_node.c_flw.rsc = rs1; + tree->ast_node.c_flw.rdc = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_FSW------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x7)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui6 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t ui2 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t rs1 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_FSW; + tree->ast_node.c_fsw.uimm = (ui6 << 4) | (ui53 << 1) | (ui2 << 0); + tree->ast_node.c_fsw.rsc1 = rs1; + tree->ast_node.c_fsw.rsc2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_FLDSP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x1)) { + uint64_t ui86 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui43 = (binary_stream & 0x0000000000000060) >> 5; + uint64_t rd = (binary_stream & 0x0000000000000F80) >> 7; + uint64_t ui5 = (binary_stream & 0x0000000000001000) >> 12; + tree->ast_node_type = RISCV_C_FLDSP; + tree->ast_node.c_fldsp.uimm = (ui86 << 3) | (ui5 << 2) | (ui43 << 0); + tree->ast_node.c_fldsp.rd = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_FSDSP------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x5)) { + uint64_t rs2 = (binary_stream & 0x000000000000007C) >> 2; + uint64_t ui86 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_FSDSP; + tree->ast_node.c_fsdsp.uimm = (ui86 << 3) | (ui53 << 0); + tree->ast_node.c_fsdsp.rs2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_FLD------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x1)) { + uint64_t rd = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui76 = (binary_stream & 0x0000000000000060) >> 5; + uint64_t rs1 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_FLD; + tree->ast_node.c_fld.uimm = (ui76 << 3) | (ui53 << 0); + tree->ast_node.c_fld.rsc = rs1; + tree->ast_node.c_fld.rdc = rd; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_FSD------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x5)) { + uint64_t rs2 = (binary_stream & 0x000000000000001C) >> 2; + uint64_t ui76 = (binary_stream & 0x0000000000000060) >> 5; + uint64_t rs1 = (binary_stream & 0x0000000000000380) >> 7; + uint64_t ui53 = (binary_stream & 0x0000000000001C00) >> 10; + tree->ast_node_type = RISCV_C_FSD; + tree->ast_node.c_fsd.uimm = (ui76 << 3) | (ui53 << 0); + tree->ast_node.c_fsd.rsc1 = rs1; + tree->ast_node.c_fsd.rsc2 = rs2; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LBU------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x0) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rdc = (binary_stream & 0x000000000000001C) >> 2; + uint64_t uimm1 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t uimm0 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t rs1c = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_LBU; + tree->ast_node.c_lbu.uimm = (uimm1 << 1) | (uimm0 << 0); + tree->ast_node.c_lbu.rdc = rdc; + tree->ast_node.c_lbu.rs1c = rs1c; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LHU------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x0000000000000040) >> 6) == 0x0) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rdc = (binary_stream & 0x000000000000001C) >> 2; + uint64_t uimm1 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t rs1c = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_LHU; + tree->ast_node.c_lhu.uimm = (uimm1 << 4) | (0x0 << 0); + tree->ast_node.c_lhu.rdc = rdc; + tree->ast_node.c_lhu.rs1c = rs1c; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_LH------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x0000000000000040) >> 6) == 0x1) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x1) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rdc = (binary_stream & 0x000000000000001C) >> 2; + uint64_t uimm1 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t rs1c = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_LH; + tree->ast_node.c_lh.uimm = (uimm1 << 4) | (0x0 << 0); + tree->ast_node.c_lh.rdc = rdc; + tree->ast_node.c_lh.rs1c = rs1c; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SB------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x2) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2c = (binary_stream & 0x000000000000001C) >> 2; + uint64_t uimm1 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t uimm0 = (binary_stream & 0x0000000000000040) >> 6; + uint64_t rs1c = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_SB; + tree->ast_node.c_sb.uimm = (uimm1 << 1) | (uimm0 << 0); + tree->ast_node.c_sb.rs1c = rs1c; + tree->ast_node.c_sb.rs2c = rs2c; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SH------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x0) && + (((binary_stream & 0x0000000000000040) >> 6) == 0x0) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x3) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2c = (binary_stream & 0x000000000000001C) >> 2; + uint64_t uimm1 = (binary_stream & 0x0000000000000020) >> 5; + uint64_t rs1c = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_SH; + tree->ast_node.c_sh.uimm = (uimm1 << 4) | (0x0 << 0); + tree->ast_node.c_sh.rs1c = rs1c; + tree->ast_node.c_sh.rs2c = rs2c; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ZEXT_B------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000001C) >> 2) == 0x0) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x3) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x7) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rsdc = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_ZEXT_B; + tree->ast_node.c_zext_b = rsdc; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SEXT_B------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000001C) >> 2) == 0x1) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x3) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x7) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rsdc = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_SEXT_B; + tree->ast_node.c_sext_b = rsdc; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ZEXT_H------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000001C) >> 2) == 0x2) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x3) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x7) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rsdc = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_ZEXT_H; + tree->ast_node.c_zext_h = rsdc; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_SEXT_H------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000001C) >> 2) == 0x3) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x3) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x7) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rsdc = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_SEXT_H; + tree->ast_node.c_sext_h = rsdc; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ZEXT_W------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000001C) >> 2) == 0x4) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x3) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x7) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rsdc = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_ZEXT_W; + tree->ast_node.c_zext_w = rsdc; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_NOT------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x000000000000001C) >> 2) == 0x5) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x3) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x7) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rsdc = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_NOT; + tree->ast_node.c_not = rsdc; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_MUL------------------------------- + { + if (((binary_stream & 0x0000000000000003) == 0x1) && + (((binary_stream & 0x0000000000000060) >> 5) == 0x2) && + (((binary_stream & 0x0000000000001C00) >> 10) == 0x7) && + (((binary_stream & 0x000000000000E000) >> 13) == 0x4)) { + uint64_t rs2c = (binary_stream & 0x000000000000001C) >> 2; + uint64_t rsdc = (binary_stream & 0x0000000000000380) >> 7; + tree->ast_node_type = RISCV_C_MUL; + tree->ast_node.c_mul.rsdc = rsdc; + tree->ast_node.c_mul.rs2c = rs2c; + return; + } + } + //------------------------------------------------------------ + + // ---------------------------C_ILLEGAL------------------------------- + { + uint64_t s = binary_stream & 0x00000000FFFFFFFF; + tree->ast_node_type = RISCV_C_ILLEGAL; + tree->ast_node.c_illegal = s; + return; + } + //------------------------------------------------------------ +} + +#endif diff --git a/riscv_disasm/riscv_insn.gen.inc b/riscv_disasm/riscv_insn.gen.inc index 20bd82b..bdf93c6 100644 --- a/riscv_disasm/riscv_insn.gen.inc +++ b/riscv_disasm/riscv_insn.gen.inc @@ -1,10 +1,19 @@ +/*=======================================================================*/ +/*This code was generated by the tool riscv_disasm_from_sail (see + * https://github.com/moste00/riscv_disasm_from_sail)*/ +/*from the sail model of RISC-V (see https://github.com/riscv/sail-riscv) @ + * version 0b9c639f19da48734cbf14b61f6ad200b7c70de9.*/ +/*DO NOT MODIFY THIS CODE MANUALLY.*/ +/* */ +/*SPDX-License-Identifier: BSD-3-Clause*/ +/*=======================================================================*/ + #ifndef __Riscv_insn_gen_inc__ #define __Riscv_insn_gen_inc__ #include #include -#include "riscv_ast.gen.inc" #include enum riscv_insn { @@ -900,8 +909,6 @@ enum riscv_insn { RISCV_INSN_WVV_VADD, //--------------------- RISCV_AES64DSM--------------------- RISCV_INSN_AES64DSM, - //--------------------- RISCV_URET--------------------- - RISCV_INSN_URET, //--------------------- RISCV_C_LI--------------------- RISCV_INSN_C_LI, //--------------------- RISCV_CSR--------------------- diff --git a/riscv_disasm/riscv_insn_mapping.gen.inc b/riscv_disasm/riscv_insn_mapping.gen.inc index aeb40be..55bdb03 100644 --- a/riscv_disasm/riscv_insn_mapping.gen.inc +++ b/riscv_disasm/riscv_insn_mapping.gen.inc @@ -1,3 +1,13 @@ +/*=======================================================================*/ +/*This code was generated by the tool riscv_disasm_from_sail (see + * https://github.com/moste00/riscv_disasm_from_sail)*/ +/*from the sail model of RISC-V (see https://github.com/riscv/sail-riscv) @ + * version 0b9c639f19da48734cbf14b61f6ad200b7c70de9.*/ +/*DO NOT MODIFY THIS CODE MANUALLY.*/ +/* */ +/*SPDX-License-Identifier: BSD-3-Clause*/ +/*=======================================================================*/ + #ifndef __Riscv_insn_mapping_gen_inc__ #define __Riscv_insn_mapping_gen_inc__ #include @@ -7,7 +17,7 @@ #include "riscv_insn.gen.inc" #include -static const uint16_t to_insn[295][21] = { +static const uint16_t to_insn[294][21] = { [RISCV_REV8] = {RISCV_REV8}, [RISCV_WXTYPE] = {RISCV_WX_VSUBU, RISCV_WX_VSUB, RISCV_WX_VADDU, RISCV_WX_VADD}, @@ -373,7 +383,6 @@ static const uint16_t to_insn[295][21] = { RISCV_WVV_VSUBU, RISCV_WVV_VSUB, RISCV_WVV_VADDU, RISCV_WVV_VADD}, [RISCV_AES64DSM] = {RISCV_AES64DSM}, - [RISCV_URET] = {RISCV_URET}, [RISCV_C_LI] = {RISCV_C_LI}, [RISCV_CSR] = {RISCV_CSRRW, RISCV_CSRRS, RISCV_CSRRC}, [RISCV_C_SRAI] = {RISCV_C_SRAI}, diff --git a/sail.filepaths.txt b/sail.filepaths.txt index e9d82b4..161e9ad 100644 --- a/sail.filepaths.txt +++ b/sail.filepaths.txt @@ -1,4 +1,5 @@ ../sail-riscv/model/prelude.sail +../sail-riscv/model/riscv_errors.sail ../sail-riscv/model/riscv_xlen64.sail ../sail-riscv/model/riscv_xlen.sail ../sail-riscv/model/riscv_flen_D.sail @@ -24,10 +25,8 @@ ../sail-riscv/model/riscv_vext_regs.sail ../sail-riscv/model/riscv_csr_begin.sail ../sail-riscv/model/riscv_vext_control.sail -../sail-riscv/model/riscv_next_regs.sail ../sail-riscv/model/riscv_sys_exceptions.sail ../sail-riscv/model/riscv_sync_exception.sail -../sail-riscv/model/riscv_next_control.sail ../sail-riscv/model/riscv_softfloat_interface.sail ../sail-riscv/model/riscv_fdext_regs.sail ../sail-riscv/model/riscv_fdext_control.sail @@ -42,11 +41,11 @@ ../sail-riscv/model/riscv_types_kext.sail ../sail-riscv/model/riscv_insts_begin.sail ../sail-riscv/model/riscv_insts_base.sail +../sail-riscv/model/riscv_insts_zifencei.sail ../sail-riscv/model/riscv_insts_aext.sail ../sail-riscv/model/riscv_insts_zca.sail ../sail-riscv/model/riscv_insts_mext.sail ../sail-riscv/model/riscv_insts_zicsr.sail -../sail-riscv/model/riscv_insts_next.sail ../sail-riscv/model/riscv_insts_hints.sail ../sail-riscv/model/riscv_insts_fext.sail ../sail-riscv/model/riscv_insts_zcf.sail diff --git a/sail.hash.txt b/sail.hash.txt index 5f5d881..dbf5d8f 100644 --- a/sail.hash.txt +++ b/sail.hash.txt @@ -1 +1 @@ -b90ec7881eb0a0ecea6521e3d6cc03bf0b057e41 \ No newline at end of file +0b9c639f19da48734cbf14b61f6ad200b7c70de9