`timescale 1ns/1ps // ================================================================ // C.6 probe (NOT a certified bug entry by itself -- see file header // note below and docs/validation/06-graph-engine.md): does // num_neurons_graph=0 reproduce the same class of issue as BUG-005 // (rtl/layer_sequencer.v)? // // Structural analysis: rtl/graph_engine.v's neuron_idx (line 159) is // a full 16-bit register, and the termination check // `neuron_idx == num_neurons_graph-16'd1` (lines 527/561) wraps to // 65535 for num_neurons_graph=0 -- a value neuron_idx CAN naturally // reach, structurally identical to BUG-005's layer_idx pattern. This // probe checks empirically what actually happens within a BOUNDED // window (a full 65536-iteration run was not attempted -- would take // far longer per iteration than layer_sequencer's simpler dispatch, // impractical for this campaign's effort budget; see docs/validation/ // 06-graph-engine.md for the honesty note about this limitation). // ================================================================ module tb; localparam ADDR_WIDTH = 23; localparam DATA_WIDTH = 8; localparam ACC_WIDTH = 32; localparam PARALLEL = 4; localparam MAX_CONN = 8; localparam N_TOTAL = 4096; reg clk, rst; reg run_start; wire busy, done, err; reg [ADDR_WIDTH-1:0] x_base, table_base, out_base; reg [15:0] n_inputs_graph, num_neurons_graph, n_out; wire ram_req, ram_wr; wire [ADDR_WIDTH-1:0] ram_addr; wire signed [7:0] ram_wdata; reg signed [7:0] ram_rdata; reg ram_ready; graph_engine #( .ADDR_WIDTH(ADDR_WIDTH), .DATA_WIDTH(DATA_WIDTH), .ACC_WIDTH(ACC_WIDTH), .PARALLEL(PARALLEL), .MAX_CONN(MAX_CONN), .N_TOTAL(N_TOTAL) ) dut ( .clk(clk), .rst(rst), .run_start(run_start), .busy(busy), .done(done), .err(err), .x_base(x_base), .table_base(table_base), .out_base(out_base), .n_inputs_graph(n_inputs_graph), .num_neurons_graph(num_neurons_graph), .n_out(n_out), .ram_req(ram_req), .ram_wr(ram_wr), .ram_addr(ram_addr), .ram_wdata(ram_wdata), .ram_rdata(ram_rdata), .ram_ready(ram_ready) ); initial begin clk = 0; forever #5 clk = ~clk; end // Non-trivial (not all-zero) "garbage" pattern: a repeating ramp, // deliberately NOT chosen to make the src_id