Skip to content

[hardware] Fix inactive values for legal integer-extension overlap - #545

Open
lionelZhaowy wants to merge 2 commits into
pulp-platform:mainfrom
lionelZhaowy:fix-extension-tail
Open

lionelZhaowy wants to merge 2 commits into
pulp-platform:mainfrom
lionelZhaowy:fix-extension-tail

Conversation

@lionelZhaowy

@lionelZhaowy lionelZhaowy commented Nov 7, 2026 •

Copy link
Copy Markdown

Legal integer-extension overlap can corrupt inactive destination elements when VL is below VLMAX. The smaller-EEW source occupies the high part of the destination register group. Main changes the destination EEW without rewriting those inactive elements.

This patch detects that overlap for the six integer-extension selectors, drains older work, and sends the original request with an internal fill flag. The VALU writes inactive and tail elements as all ones under the same instruction ID. Operand and mask lengths stay unchanged. The dispatcher waits for the request handshake and final completion. VL=0 and vstart>=VL create no fill or reshuffle work.

Related: #421 and #531 discuss reshuffling and retained elements. This patch handles different-EEW overlap with VL below VLMAX. It does not include #421's full source-group scan or #531's full-VL shortcut.

The official 2024-04-11 RVV 1.0 text makes different-EEW overlap mask- and tail-agnostic.
Its Vector Operands section defines legal high-part overlap. Section 3.4.3 permits old-value or all-ones agnostic elements.
The older repository v1.0 tag lacks this explicit overlap clarification. This test follows the published 2024 rule.
The test still requires exact active elements and complete old values for no-body controls.

The same six-case ELF improves from 98 errors to zero across 1842 checks. The seven listed unmodified official tests also pass.

Validation, reproduction and scope

Validation on official main 34bd3bc152421b4601a7bf3d6e8e91ffb545c99e, two lanes, VLEN=2048:

  • Real ara_tb, CVA6, locked dependencies, LLVM 20.1.0, VCS W-2024.09-SP1.
  • Same ELF before/after: six cases, 1842 checks, 98 errors become zero.
  • Unmasked zero/sign extension, alternating/all-zero masks, VL=0, and vstart=VL.
  • Both finish normally. Candidate returns tohost=0, with no assertion error.
  • Passive observation: four original fill IDs complete per lane, 256 full-BE writes per lane, zero late writes or observer errors.
  • Seven unmodified official tests pass: vadd, vsext, vzext, vwmul, vmv, vmerge, vfmvfs.
  • Effective VCS lint has the same 427 normalized diagnostics before/after.
  • Real dispatcher, Ara sequencer, lane sequencer, and VALU pass generic DC structure checks with zero latches.
  • Dispatcher flip-flops: 738 to 741. Design and loop checks pass. No mapped timing or area claim.

The source, passive observer, exact commands, ELF SHA256, expected values, and limitations are in apps/extension_tail/README.md.
The test fixes the scalar export base to x5 to isolate a separate whole-store register-name collision.
It preserves the independent golden values. That separate export defect is outside this patch.

This test does not establish all extension selectors, every overlap placement, nonzero-vstart restart, or other lane counts.
Original RTL authors and licenses remain. New test and observer files use Apache-2.0.
AI assistance was used for the patch adaptation, tests, and text.
An independent AI review checks the diff and actual results. It is not represented as human review.

extension_tail now runs in the existing CI matrix at 2 lanes / VLEN2048, with a native 10000000-cycle limit. The fixed-size application is not added to the larger-VLEN simulation entries. It compiles in all four configurations. Local verification uses the locked LLVM 20.1.0/newlib sources and Verilator commit 06263ec7: the new application passes at 2 lanes, and HelloWorld plus the affected original instruction tests pass at 2/4/8/16 lanes. All 13 local runs finish with tohost = 0, exit 0 and no runtime assertion errors. License checks pass. This update leaves the RTL and dependency lock unchanged.

lionelZhaowy and others added 2 commits November 7, 2026 11:23
Carry the internal fill flag under the original instruction ID.
Drain older work and wait for the real handshake and final writes.
Keep source-group scan and generic whole-store mask issues separate.

Same official two-lane ELF: 98 errors before, zero after in 1842 checks.
Seven official regressions, unchanged lint diagnostics, and real-module
generic DC structure checks pass. Add the public test and passive observer.
The patch adaptation, tests, and text used AI assistance. An independent
AI review checked the source, input bindings, raw results, and structure.

This branch has not been deployed

No deployments
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