Skip to content

Verilog: fix unsigned/signed parameter without explicit range#1902

Draft
kroening wants to merge 1 commit into
mainfrom
kroening/fix-unsigned-parameter
Draft

Verilog: fix unsigned/signed parameter without explicit range#1902
kroening wants to merge 1 commit into
mainfrom
kroening/fix-unsigned-parameter

Conversation

@kroening

Copy link
Copy Markdown
Collaborator

When a parameter is declared with only a signing keyword and no explicit range (e.g., parameter unsigned P = 8'shff), the width should be derived from the value and only the signedness adjusted.

Previously, this was incorrectly elaborated as a 1-bit type, because elaborate_type(ID_unsigned) with nil subtype defaults to unsignedbv_typet{1}.

Changes:

  • src/verilog/verilog_elaborate.cpp: Handle unsigned/signed with nil subtype in elaborate_symbol_rec by deriving width from the value, then applying the signedness.
  • regression/verilog/parameters/unsigned_parameter1.desc: Changed from KNOWNBUG to CORE.

When a parameter is declared with only a signing keyword and no
explicit range (e.g., parameter unsigned P = 8'shff), the width
should be derived from the value and only the signedness adjusted.
Previously, this was incorrectly elaborated as a 1-bit type.
@kroening kroening force-pushed the kroening/fix-unsigned-parameter branch from d3af11d to 2e127f5 Compare June 16, 2026 19:47
@kroening kroening marked this pull request as draft June 16, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant