Skip to content

Transpose/Test: Add support for compact transposition output matrices and a working verilator flow - #161

Open
da-gazzi wants to merge 3 commits into
pulp-platform:develfrom
mosaic-soc:pr/compact-transpose
Open

Transpose/Test: Add support for compact transposition output matrices and a working verilator flow#161
da-gazzi wants to merge 3 commits into
pulp-platform:develfrom
mosaic-soc:pr/compact-transpose

Conversation

@da-gazzi

Copy link
Copy Markdown
Contributor

Compact Transposition and Verilator Testing

Summary

  • Add optional compact storage for transposed output matrices while retaining
    the existing tile-padded layout.
  • Make partial transpose tiles memory-safe without changing the number or
    ordering of generated tile requests.
  • Add a reusable, parameterized Verilator flow and broaden the directed
    transpose and midend regression coverage.

Compact Transposition

  • Add a software-configurable compact transpose option to the request and
    register interfaces.
  • In compact mode, generate the destination row stride from the actual
    transposed row width. Legacy mode continues to use the tile-padded width.
  • Add a request replay stage after ND expansion. Requests for inactive rows of
    partial edge tiles are redirected to the first valid source or destination
    address, preventing out-of-bounds reads and unsafe zero-strobe write
    addresses while preserving the descriptor sequence expected by the
    transpose engine.
  • Clarify the transpose element-width and tile-geometry semantics in the RTL
    documentation.

Testbench Changes

  • Cover compact and padded layouts, partial edge tiles, aligned and unaligned
    matrices, 1-, 2-, and 4-byte elements, multiple bus widths, backpressure,
    and back-to-back transfers.
  • Check results against the DPI golden model and verify sentinel regions and
    generated write-address bounds.
  • Exercise full- and half-duplex transpose configurations together with the
    ND, runtime, and register frontend midends.
  • Use SystemVerilog clocking blocks for race-free ready/valid stimulus and
    handshake observation.

Verilator Flow

  • Add common Verilator build and run plumbing with independent build
    directories for each testbench parametrization.
  • Generate stable Bender file lists and track RTL sources, headers, DPI code,
    and elaboration options so binaries rebuild when their inputs change.
  • Provide explicit per-testbench parameter matrices, convenient aggregate
    targets, clean targets, optional FST tracing, and configurable compiler and
    linker flags.
  • Make the transpose DPI model link correctly when compiled as C++ by
    Verilator.

Validation

  • The directed compact/padded transpose configurations, back-to-back tests,
    on-the-fly transpose variants, and affected midend tests pass with the new
    Verilator flow.

TODO

@da-gazzi
da-gazzi changed the base branch from master to devel July 27, 2026 08:34
@da-gazzi
da-gazzi force-pushed the pr/compact-transpose branch 2 times, most recently from fea5d2c to 7463915 Compare July 31, 2026 08:34
Georg Rutishauser added 3 commits July 31, 2026 17:03
- `compute_cfg` register is added after existing registers
- Controls `enable`, `op`, `mode`, `tensor_m` and `tensor_n`
- Connected to the relevant fields of the ND request struct in the register top-level template
- Add required additional frontend IDs to CI deploy job
- Transpose-enabled iDMA would previously always read tile-sized chunks, leading to "overreads" (reading past the source matrix's backing memory)
- Also, the transposed output had its row alignment padded to the tile width (which is the bus data width)
- The `idma_transpose_req_replay` module prevents over-reading (and over-writing, although those writes are zero-strobed) by redirecting redundant reads and writes to known safe addresses, specifically src/dst addresses of the first read/write bursts
- Compact output matrix storage is achieved by changing the destination stride in the transpose midend to the actual row width of the transposed matrix
- Compact output mode is controlled by a new field `compact` in `transpose_options_t`, which is also configurable by the register frontend
- Replace the legacy Verilator elaboration target with reusable build, run,
  clean, per-testbench, and full-suite targets
- Generate stable Bender file lists and track RTL, headers, DPI sources, and
  elaboration parameters so binaries rebuild only when their inputs change.
- Add configurable tracing and C/C++ compiler and linker flags
- Register the directed transpose, ND midend, register frontend, and runtime
  midend test matrices across relevant widths and operating modes
- Extend transpose tests to cover compact and padded layouts, partial tiles,
  back-to-back requests, backpressure, and multiple bus widths
- Use clocking blocks for race-free ready/valid stimulus and sampling in the
  clocked directed testbenches
- Make the transpose DPI model link cleanly when Verilator compiles it as C++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant