Files
FPGA-Neural/hardware/v2/logs/errors.log
T
micheleandClaude Sonnet 5 3026dcd997 feat(v2): M2 Neural Processor Array, N_PROCESSORS resource sweep
Implements M2 of the V2 roadmap: neural_processor_array.v instantiates
N_PROCESSORS independent neural_processor (M1) units, each with its
own dedicated point-to-point job/operand/result interface -- no shared
bus or mux at this level (arbitration is explicitly the Neural
Director's job, M5).

Verified with Verilator (tb_neural_processor_array.v, N_PROCESSORS=4):
7/7 tests pass, including a same-cycle 4-way concurrent launch with
different tile counts and a staggered-start test where a
later-launched, shorter job completes before an earlier-launched,
longer one -- confirming genuine independent concurrent execution
(§18/§34: a blocked/busy processor must not block the others).

Real resource/timing sweep for N_PROCESSORS in {1,2,4,8} (Yosys +
nextpnr-ecp5, real place&route): Fmax stays above the 80MHz target
throughout (159.11 -> 134.70 MHz), but MULT18X18D usage scales
linearly and reaches 88% of the LFE5U-45F's 72 DSPs at N=8 while
LUT/FF stay under 6% -- DSP, not LUT/FF/routing, is the first hard
ceiling on N_PROCESSORS at P_IN=8 (decisions.log DEC-0005). Measured
via a dedicated synthesis-only timing harness after the array's wide
per-processor buses were found to exhaust the device's TRELLIS_IO pin
budget as a bare top-level module beyond N=1 (errors.log ERR-0005) --
not a logic limit, an artifact of testing the array in isolation
before the Memory Manager/Director (M4/M5) exist to consume those
ports on-chip.

Full log trail (development/experiments/errors/decisions/simulation/
synthesis/timing/benchmark.log) in hardware/v2/logs/ per the project's
logging mandate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013xXuuRUWZScuo1DeYJxs3v
2026-09-05 14:15:11 +02:00

127 lines
7.3 KiB
Plaintext

# V2 errors log -- solo append, mai troncato/sovrascritto (vedi README.md)
# Nessuna entry ancora -- popolato incrementalmente man mano che avanza lo sviluppo V2.
ERR-0001 (Icarus Verilog v13.0 toolchain bug, TASK/SCOPE-ENTRY DESYNC)
DATE: 2026-09-05
MODULE: hardware/v2/sim/tb_neural_processor.v (M1 testbench development)
SYMPTOM: a task (or any named `begin:label` block) whose FIRST executable
statement is a blocking assignment to a signal read by another module's
`always @(posedge clk)`, when the task/block is entered immediately after
a time-consuming statement in the caller with no intervening
`@(posedge clk)`, can make that FIRST assignment invisible to the DUT at
the very next clock edge (the DUT's own always block behaves as if the
signal never changed). Confirmed at V1's own frozen `neuron_parallel.v`
(unmodified, already certified) via a minimal 3-statement task
(`v1_start=1; @(posedge clk); v1_start=0;`) -- `busy` never asserted.
REPRODUCTION: /tmp/mt6.v-style repro (not committed, transient scratch
file) -- see conversation record for the exact minimal case.
DIAGNOSIS METHOD: bisected from the full dual-DUT testbench down to a
standalone ~15-line repro, ruling out RTL, port connections, and
operator precedence one at a time.
WORKAROUND: always begin such a task with an explicit `@(posedge clk);`
before its first assignment (matches the pre-existing convention in
hardware/v1/sim's own tasks, e.g. neuron_parallel_tb.v's run_neuron,
which is presumably why V1's own test suite was never affected).
STATUS: WORKAROUND APPLIED in hardware/v2/sim/tb_neural_processor.v's
run_case. NOT reported upstream (out of scope for this session). See
ERR-0004 for the broader consequence of this finding.
ERR-0002 (Icarus Verilog v13.0 toolchain bug, SPURIOUS CONDITION EVALUATION)
DATE: 2026-09-05
MODULE: hardware/v2/rtl/neural_processor.v (protocol-violation guard,
removed -- see decisions.log DEC-0003)
SYMPTOM: `if (operand_valid && !operand_ready && (state-is-one-of-four))`
inside `always @(posedge clk)` evaluated TRUE at an edge where
`operand_valid` was independently confirmed (via $display in the same
timestep, and via the testbench's own port-connected signal) to be 0.
Bisected term-by-term: even `if (operand_valid && !operand_ready)`
alone, and even `if (operand_valid)` alone with explicit `== 1'b1`
comparisons, still fired spuriously. Confirmed NOT a precedence issue
(parens are unambiguous) and NOT specific to this exact expression
shape (multiple simplified variants all reproduced it).
CROSS-CHECK: root-caused further via a minimal 2-state FSM
(`if (go) st<=B;`) with NO relation to the removed guard -- Icarus
failed to transition on an ODD-numbered testbench clock edge
(`repeat(3)` before the pulse) but succeeded on an EVEN-numbered one
(`repeat(4)`), reproduced identically with both `always #5 clk=~clk`
and `initial ... forever #5 clk=~clk` clock generators. VERILATOR
5.050 gives the CORRECT result for the same repro in both cases.
This suggests ERR-0001 and ERR-0002 are two symptoms of the same
underlying VVP scheduling defect (edge-count/thread-parity dependent),
not two unrelated bugs.
STATUS: the offending RTL block (protocol-violation detection) was
REMOVED rather than chased further -- see DEC-0003. Root cause not
fully isolated (documented honestly, not overclaimed).
ERR-0003 (real RTL bug in hardware/v2/rtl/neural_processor.v, FOUND AND FIXED)
DATE: 2026-09-05
MODULE: hardware/v2/rtl/neural_processor.v, stage 0 (input
alignment/register)
SYMPTOM: back-to-back single-tile jobs (and some multi-tile jobs)
produced result_data=0 instead of the correct value, while the
internal `y7` register (one stage upstream of the FSM's capture)
showed the CORRECT value one cycle later than `valid7` first asserted.
ROOT CAUSE: `last0 <= tile_last;` was unconditional, while
`valid0 <= operand_valid && operand_ready;` was correctly gated. A
master asserting `tile_last` before `operand_ready` rises (legal
valid-before-ready behavior) let a "last" tag propagate through the
pipeline (last1, last_tree[], last5, last6) with NO corresponding
valid tile behind it, arriving at stage 7 one cycle ahead of the
real valid/data pair and causing the FSM to capture a stale/wrong
`y7`.
EVIDENCE: isolated to a single-DUT, no-task, no-V1 repro
(hardware/v2/sim/tb_neural_processor.v run under Verilator, with a
cycle-by-cycle dump of valid5/last5/valid6/last6/valid7/y7) --
`last5=1` while `valid5=0` on the same cycle, confirmed the
desync's exact origin at stage 0.
FIX: `last0 <= (operand_valid && operand_ready) ? tile_last : 1'b0;`
-- last0 is now gated identically to valid0.
VERIFICATION: full 7-test bit-exact-vs-V1 regression
(hardware/v2/sim/tb_neural_processor.v under Verilator) -- 7/7 PASS
after the fix, including the back-to-back and single-tile-after-
multi-tile cases that exposed it.
STATUS: FIXED, verified.
ERR-0004 (methodology consequence of ERR-0001/ERR-0002)
DATE: 2026-09-05
NOTE: this session's V1 certification campaign (docs/validation/,
hardware/v1/docs/validation/) was verified exclusively with Icarus
Verilog v13.0, the ONLY simulator available on this machine at the
time. ERR-0001/ERR-0002 show that v13.0 has at least one real,
reproducible scheduling defect around clock-edge/task-entry timing.
V1's own testbenches were NOT observed to trigger it in this session
(V1's `run_neuron`-style tasks already begin with `@(posedge clk)`,
which incidentally avoids ERR-0001's trigger condition), and V1
remains frozen/untouched regardless. This is flagged here for
honesty, not to imply V1's certification is wrong -- re-verifying
the full V1 suite under Verilator was explicitly OUT OF SCOPE for
this V2-kickoff session (V1 is frozen, not to be touched) and was
not performed. See decisions.log DEC-0004.
STATUS: OPEN CAVEAT, not actioned in this session by design.
ERR-0005 (synthesis measurement artifact, WORKED AROUND, not an RTL bug)
DATE: 2026-09-05
MODULE: hardware/v2/rtl/neural_processor_array.v
SYMPTOM: synthesizing neural_processor_array as a bare top-level
module (every per-processor job/operand/result field exposed as a
real TRELLIS_IO pin) works at N_PROCESSORS=1 but fails place&route
at N_PROCESSORS=2 with "Unable to place cell ...$tr_io, no BELs
remaining to implement cell type 'TRELLIS_IO'".
ROOT CAUSE: not a logic/timing limit -- the LFE5U-45F-8BG381 package
has 245 TRELLIS_IO pins total; the array's wide per-processor buses
(input_data/weight_data alone are DATA_WIDTH*P_IN*N_PROCESSORS bits)
exceed that budget once N_PROCESSORS>=2, purely because these ports
have no on-chip consumer yet (the Memory Manager/M4 and Neural
Director/M5 that will drive them in the real system don't exist
yet).
WORKAROUND: hardware/v2/synthesis/harness_neural_processor_array.v --
a synthesis-only wrapper (NOT part of rtl/, not a functional
deliverable) that drives all wide buses from an internal free-
running LFSR and reduces outputs to a small checksum, keeping only
clk/rst/seed/checksum as real top-level pins. See its own header
comment and experiments.log EXP-0003 for the resulting real
resource/Fmax numbers.
STATUS: WORKED AROUND. Will become moot once M4/M5 exist and the array
is synthesized as part of a larger design with on-chip ports instead
of a bare top-level module.