This is the sample workspace. We wrote the sample project and its bugs. The findings are real review output. On your own install, this list shows your repositories.
Breakspec posts these findings as comments on the pull request on GitHub. This page keeps the history of each review.
Reproduced in simulation, rerun by Breakspec: an agent wrote a testbench and Breakspec ran it again and saw the reported output. Hazard shown in simulation, rerun by Breakspec: the rerun showed a condition that can fail on hardware, and no wrong value. Confirmed by reading the code, not run: a second agent checked the code and no simulation ran. Raised by a reviewer, not examined: one AI reviewer raised it and nothing checked it. A reviewer is one of Breakspec's AI agents.
Severity: P0: must be fixed before merging. P1: a real defect in the changed code. P2: a correctness problem worth fixing. P3: minor.
When firmware submits a chained transfer (sg_count != 0, which makes axon_dma_submit set SG_EN), only the first descriptor's len bytes are moved. The engine still raises DONE with ERR clear, and BYTES_DONE shows only the first segment. The rest of the segments are dropped silently, while firmware and host are told the transfer succeeded.
| 102 | if (beat_valid) bytes_issued <= bytes_issued + 32'd4; |
| 103 | if (bytes_issued + (beat_valid ? 32'd4 : 32'd0) >= desc_q.len) state <= S_DRAIN; |
| 104 | end |
| 105 | end |
| 106 | S_DRAIN: if (buf_empty) state <= S_DONE; |
| 107 | default: state <= S_IDLE; |
| 108 | endcase |
| 109 | if (state == S_FETCH && fetch_pending && fetch_idx == LAST_WORD) |
| 110 | desc_q <= desc_flat; |
| 17 | { |
| 18 | if (desc->len == 0 || (desc->len & 3u)) |
| 19 | return AXON_ERR_INVAL; |
| 20 | uint32_t ctrl = AXON_CTRL_IRQ_EN | AXON_CTRL_START; |
| 21 | if (desc->sg_count) |
| 22 | ctrl |= AXON_CTRL_SG_EN; |
| 23 | axon_mem_write(desc_bus_addr, desc, sizeof *desc); |
| 24 | axon_write32(AXON_REG_DESC_ADDR, desc_bus_addr); |
| 25 | axon_write32(AXON_REG_CTRL, ctrl); |
I tried to refute this and could not. The PR adds sg_count and next_idx to axon_desc_pkg::dma_desc_t (rtl/axon_desc_pkg.sv:8-9) and adds CTRL.sg_en (rtl/axon_regs_pkg.sv:21, commented 'follow next_idx chain'). Spec rev 1.5 (docs/axon_dma_spec.md:23) says CTRL.sg_en enables scatter-gather chaining. Firmware sets AXON_CTRL_SG_EN whenever desc->sg_count != 0 (fw/src/axon_dma.c:21-22). The RTL never acts on any of this: - axon_dma_engine has no sg_en input port. - In axon_dma_top, the ctrl struct only drives irq_en inside axon_regs (axon_regs.sv:83). Nothing else reads ctrl.sg_en. - In the engine, desc_q is only used for .len and .src_addr. The FSM is S_IDLE -> S_FETCH (one 5-word descriptor at desc_addr) -> S_RUN (len bytes) -> S_DRAIN -> S_DONE (axon_dma_engine.sv:77-107). No transition goes back to fetch the next descriptor. - The desc_q output goes to a wire in the top level that nothing reads. The repo has no other RTL module (the only modules are engine, top, regs, cdc_sync2, cdc_pulse and sync_fifo), and no ifdef or generated code adds chaining. The engine header even says 'Fetches one descriptor'. So a chained submit raises DONE with ERR clear after the first segment. I confirmed this with a short iverilog simulation of the engine: a descriptor with sg_count=2 and next_idx=1 plus two following descriptors, each with len=16.
$ iverilog -g2012 -o sim.vvp $REPO/rtl/axon_desc_pkg.sv $REPO/rtl/sync_fifo.sv $REPO/rtl/axon_dma_engine.sv tb.sv [exit code 0]
$ vvp sim.vvp VCD info: dumpfile wave.vcd opened for output. sg_count=2 next_idx=1 len=16 DONE=1 ERR=0 beats=4 bytes_done=16 highest_desc_addr_read=0x110 expected for 3-segment chain: beats=12 bytes_done=48 tb.sv:39: $finish called at 162000 (1ps) [exit code 0]
| 1 | `timescale 1ns/1ps |
| 2 | module tb; |
| 3 | import axon_desc_pkg::*; |
| 4 | logic clk = 0, rst_n = 0, start = 0; |
| 5 | always #2 clk = ~clk; |
| 6 | logic mem_rd; logic [31:0] mem_addr, mem_rdata; |
| 7 | logic [31:0] out_data; logic out_valid; logic out_ready = 1; |
| 8 | logic busy, done, err; logic [31:0] bytes_done; |
| 9 | dma_desc_t desc_q; |
| 10 | logic [31:0] mem [0:255]; |
| 11 | integer beats = 0, max_addr = 0, i; |
| 12 | // 1-cycle latency read port |
| 13 | always_ff @(posedge clk) mem_rdata <= mem[mem_addr[9:2]]; |
| 14 | always_ff @(posedge clk) if (mem_rd && mem_addr > max_addr) max_addr <= mem_addr; |
| 15 | always_ff @(posedge clk) if (out_valid && out_ready) beats <= beats + 1; |
| 16 | |
| 17 | axon_dma_engine dut (.clk_core(clk), .rst_n(rst_n), .start(start), .desc_addr(32'h100), |
| 18 | .mem_rd(mem_rd), .mem_addr(mem_addr), .mem_rdata(mem_rdata), |
| 19 | .out_data(out_data), .out_valid(out_valid), .out_ready(out_ready), |
| 20 | .busy(busy), .done(done), .err(err), .bytes_done(bytes_done), .desc_q(desc_q)); |
| 21 | |
| 22 | initial begin |
| 23 | $dumpfile("wave.vcd"); $dumpvars(0, tb); |
| 24 | for (i = 0; i < 256; i++) mem[i] = 0; |
| 25 | // descriptor 0 at 0x100: src=0x1000 dst=0x2000 len=16 flags=0 next_idx=1 sg_count=2 |
| 26 | mem[64] = 32'h1000; mem[65] = 32'h2000; mem[66] = 16; |
| 27 | mem[67] = {16'd1, 16'd0}; mem[68] = 32'd2; |
| 28 | // descriptors 1 and 2 follow contiguously (0x114, 0x128), len=16 each |
| 29 | mem[69] = 32'h3000; mem[70] = 32'h4000; mem[71] = 16; mem[72] = {16'd2,16'd0}; mem[73] = 1; |
| 30 | mem[74] = 32'h5000; mem[75] = 32'h6000; mem[76] = 16; mem[77] = 0; mem[78] = 0; |
| 31 | #10 rst_n = 1; |
| 32 | @(posedge clk); start <= 1; @(posedge clk); start <= 0; |
| 33 | wait (done); |
| 34 | repeat (20) @(posedge clk); |
| 35 | $display("sg_count=%0d next_idx=%0d len=%0d", desc_q.sg_count, desc_q.next_idx, desc_q.len); |
| 36 | $display("DONE=%0b ERR=%0b beats=%0d bytes_done=%0d highest_desc_addr_read=0x%0h", |
| 37 | done, err, beats, bytes_done, max_addr); |
| 38 | $display("expected for 3-segment chain: beats=12 bytes_done=48"); |
| 39 | $finish; |
| 40 | end |
| 41 | initial begin #20000 $display("TIMEOUT"); $finish; end |
| 42 | endmodule |
cd $WORK && iverilog -g2012 -o sim.vvp $REPO/rtl/axon_desc_pkg.sv $REPO/rtl/sync_fifo.sv $REPO/rtl/axon_dma_engine.sv tb.sv && vvp sim.vvp
One other suspicion was checked against the code and dropped.