code wiki / _hdl_build / nx_decoder_select.nx

nx_decoder_select.nx

buildroot/runtime/_hdl_build/nx_decoder_select.nx

8423 B159 linesdepth 7pulls 7 transitivereach 4 importersview sourcekind librarytopic decoder
docsdependenciesstructsconstsfunctions

about

nx_decoder_select.nx -- sink-based RV64IM DECODER builder (.nxgate / gsim). The next per-module synth after ALU + regfile. Drives the SAME NxCellSink the ALU uses (MEM sink -> Verifier proves; TEXT sink -> ships the .nxgate). Mirrors nx_alu_select.nx. RUNG 1: 6 field extracts (opcode/rd/funct3/rs1/rs2/funct7) as SHR+AND gates. RUNG 2: opcode -> KIND classifier (11 direct opcodes + 0x33/0x3b M-extension overlays). Both mirror the behavioral oracles in rv64im_min_decoder.nx. Immediate decoders = next rung. MUX convention (per nx_nxgate_sim.nx line 86 + nx_alu_emit_mux_step): fanin (sel, if_true, if_false), out = sel ? if_true : if_false. Flat idiom (loop + intermediate lets) for nx_cc robustness. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 4 importers

nx_cell_sink.nx nx_decoder_select.nx nx_cpu_rtype_exec_test.nx nx_decoder_fields_mem_test.nx nx_decoder_imm_mem_test.nx nx_decoder_kind_mem_test.nx

imports: nx_cell_sink.nx

imported by: nx_cpu_rtype_exec_test.nxnx_decoder_fields_mem_test.nxnx_decoder_imm_mem_test.nxnx_decoder_kind_mem_test.nx

structs

none

consts

12const K_MAGIC_4095: i64 = 4095
13const K_MAGIC_2048: i64 = 2048
14const K_MAGIC_4096: i64 = 4096
15const K_MAGIC_8192: i64 = 8192
16const K_MAGIC_1048575: i64 = 1048575
17const K_MAGIC_1048576: i64 = 1048576
18const K_MAGIC_2097152: i64 = 2097152

functions

22func nx_dec_field(k: *NxCellSink, n_inst: i64, shift: i64, mask: i64) -> i64
30func nx_decoder_fields_build(k: *NxCellSink, n_inst: i64, outs: *i64) -> i64
called by 3: mainmainmain calls 1: nx_dec_field
44func nx_decoder_kind_build(k: *NxCellSink, n_op: i64, n_f7: i64, n_f3: i64) -> i64
called by 1: main calls 2: nx_sink_constnx_sink_cell
107func nx_dec_part(k: *NxCellSink, n_inst: i64, shr: i64, mask: i64, shl: i64) -> i64
116func nx_dec_or(k: *NxCellSink, x: i64, y: i64) -> i64
called by 1: nx_decoder_imm_build calls 1: nx_sink_cell
120func nx_dec_sext(k: *NxCellSink, raw: i64, signmask: i64, extmask: i64) -> i64
129func nx_decoder_imm_build(k: *NxCellSink, n_inst: i64, outs: *i64) -> i64