[hw] Keep the VFU in the FPU state until the result has drained - #126
Open
emiliengnr wants to merge 1 commit into
Open
[hw] Keep the VFU in the FPU state until the result has drained#126emiliengnr wants to merge 1 commit into
emiliengnr wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hello, here is a pull request for a bug I found.
Problem
A vector op followed by a scalar FP op that writes an FP register can wedge the core with no trap.
The VFU state machine leaves
VFU_RunningFPUwhenis_fpu_busyis low (spatz_vfu.sv:279), butis_fpu_busyis|fpu_busy_q(:341), a registered copy of fpnew'sbusy_othat lags one cycle,and it has no term for a result still in flight. So the machine transitions too early, and once
state_qisVFU_RunningIPUthe state-keyed result mux (:582) returns the IPU side and the FPwriteback is swallowed. The FPU sequencer keeps the destination register scoreboarded forever, and
the next instruction that reads or writes it stalls. With both cores stalled Verilator reports
Resource deadlock avoided.Two windows open the hole. On the cycle fpnew picks up the op,
busy_orises butfpu_busy_qisstill 0, so the gate sees 0 and transitions. On the cycle fpnew emits,
busy_ofalls whilefpu_result_validis still asserted waiting forresult_ready, and the transition one cycle laterhides the result the same way.
Fix
Wait on the combinational
fpu_busy_das well asfpu_busy_q, and addfpu_result_validto theFPU-state exit gate:
The IPU side is untouched (
is_ipu_busyis already combinational).gen_no_fpuis unaffected, bothnew terms are 0 there. No new state.