code wiki / _hdl_build / nx_decoder_select.nx
nx_decoder_select.nx
buildroot/runtime/_hdl_build/nx_decoder_select.nx
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
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
| 12 | const K_MAGIC_4095: i64 = 4095 |
| 13 | const K_MAGIC_2048: i64 = 2048 |
| 14 | const K_MAGIC_4096: i64 = 4096 |
| 15 | const K_MAGIC_8192: i64 = 8192 |
| 16 | const K_MAGIC_1048575: i64 = 1048575 |
| 17 | const K_MAGIC_1048576: i64 = 1048576 |
| 18 | const K_MAGIC_2097152: i64 = 2097152 |
functions
| 22 | func nx_dec_field(k: *NxCellSink, n_inst: i64, shift: i64, mask: i64) -> i64 |
| 30 | func nx_decoder_fields_build(k: *NxCellSink, n_inst: i64, outs: *i64) -> i64 |
| 44 | func nx_decoder_kind_build(k: *NxCellSink, n_op: i64, n_f7: i64, n_f3: i64) -> i64 |
| 107 | func nx_dec_part(k: *NxCellSink, n_inst: i64, shr: i64, mask: i64, shl: i64) -> i64 |
| 116 | func nx_dec_or(k: *NxCellSink, x: i64, y: i64) -> i64 |
| 120 | func nx_dec_sext(k: *NxCellSink, raw: i64, signmask: i64, extmask: i64) -> i64 |
| 129 | func nx_decoder_imm_build(k: *NxCellSink, n_inst: i64, outs: *i64) -> i64 |