arp_resolver: match case literal width to counter signal width#3
Open
UnsignedChad wants to merge 1 commit into
Open
arp_resolver: match case literal width to counter signal width#3UnsignedChad wants to merge 1 commit into
UnsignedChad wants to merge 1 commit into
Conversation
The case statement in the main process compares against an unsigned(1
downto 0) signal — i.e. a 2-bit value — but the branches use 3-bit
string literals ('000', '001', '010'). GHDL rejects this with:
error: string length does not match that of anonymous integer
subtype defined at arp_resolver.vhd:84:31
error: incorrect length for the choice value
Vivado/XST accepted it historically (likely silently truncating the
extra leading zero), which is presumably why the bug hasn't surfaced
in synthesis runs. Strict simulators (GHDL, NVC) refuse.
The fix shrinks the literals to 2 bits to match the signal type.
Behaviour is unchanged.
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.
Summary
In
hdl/arp/arp_resolver.vhd, the case statement in the main process branches againstunsigned(1 downto 0)(a 2-bit signal, declared at line 84) but the branch literals are 3 bits wide ("000","001","010"). Strict simulators (GHDL, NVC) reject this:Vivado / XST appear to accept it historically (likely silently truncating the leading zero), which is presumably why the bug hasn't surfaced in synthesis runs.
This PR shrinks the literals to 2 bits to match the signal type. Run-time behaviour is unchanged.
Test
Before:
After:
Note
This patch was identified while exercising the project through a third-party VHDL → WebAssembly pipeline. The diagnosis and minimal fix were AI-assisted (large-language-model code review) and verified manually before submission.