Skip to content

Check VLEN against the minimum VRF address stride - #484

Open
om-mahesh wants to merge 1 commit into
pulp-platform:mainfrom
om-mahesh:fix/vlen-vrf-zero-stride
Open

Check VLEN against the minimum VRF address stride#484
om-mahesh wants to merge 1 commit into
pulp-platform:mainfrom
om-mahesh:fix/vlen-vrf-zero-stride

Conversation

@om-mahesh

Copy link
Copy Markdown

Summary

Add a configuration check for VLEN/NrLanes combinations that produce a zero vector-register address stride.

Ara's vector-register addressing uses vaddr = vid * (vlenb / NrLanes / 8) with vlenb = VLEN / 8, so the per-register stride is VLEN / (64 * NrLanes) and must be non-zero.

For example VLEN=128, NrLanes=4 currently satisfies the existing VLEN checks and reports vlenb = 16, but 16 / 4 / 8 = 0, so all architectural vector registers map to the same VRF address. Reproduced by writing distinct values into v0, v1, v2, v3, v8, v16, v31 before storing any of them: all seven read back the value written last (v31). Elaboration is clean and vlenb reads correctly, so nothing currently reports the problem.

The check requires VLEN >= 64 * NrLanes so the unsupported configuration is diagnosed explicitly. Consistent with the neighbouring parameter checks this uses $error; note Ara's Verilator flow passes -Wno-fatal, so like the existing checks it emits a diagnostic rather than halting the build.

Boundary checks

VLEN NrLanes stride result
128 2 1 valid, unchanged
256 4 1 valid, unchanged
512 8 1 valid, unchanged
2048 2 16 valid, unchanged (stock config)
128 4 0 diagnosed
256 8 0 diagnosed

The vector-register address calculation uses vlenb / NrLanes / 8 as
the per-register stride. If VLEN is smaller than 64 * NrLanes, this
integer expression becomes zero and all architectural vector registers
map to the same VRF address.

For example, VLEN=128 with four lanes currently passes the existing
VLEN configuration checks and reports vlenb=16, but its vector-register
stride is zero.

Add a configuration check requiring VLEN >= 64 * NrLanes so this
invalid configuration is diagnosed explicitly.
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