Fix VFU: Use ELEN instead of vsew for scalar/reduction operations #62
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Description
The instruction vmv.x.s (vector-to-scalar move) caused a deadlock when executed with
RVD=0configuration (ELEN=32). The system would hang indefinitely waiting for result that would never arrive.Root Cause
The bug was in spatz_vfu.sv, which used logic based on
vsewto determine byte-enable masks for scalar operations. Scalar registers always have widthELEN(32 bits whenRVD=0, 64 bits whenRVD=1).vsewdescribes vector element size (8/16/32/64 bits), but vmv.x.s transfers an entire scalar register (ELENbits), not a vector element (vsewbits).Deadlock Mechanism
With RVD=0 (ELEN=32):
vsew=EW_8pending_results = 8'hff(8 bytes, based on wrong vsew check)result_valid = 4'hf(4 bytes, limited byELEN=32)&(result_valid | ~pending_results) = &(4'hf | ~8'hff) = &(0b11110000_1111) = 0The bug didn't manifest with
RVD=1(ELEN=64) because the IPU produces 8 bytes, coincidentally matching the incorrect expectation.