Repository navigation
CompileStmt: a non-ANSI function's local arrays keep their unpacked dimension - #4204
Merged
alaindargelas merged 1 commit intoOct 4, 2026
Conversation
…imension A function whose ports are tf_item_declarations (`input [31:0] idx;`) has its following data declarations compiled by compileTfPortDecl, which rebuilt each local from its DATA TYPE alone (compileVariable on `reg [63:0]`) and dropped the unpacked dimension written after the name: `reg [63:0] tbl [0:3];` came out as a 64-bit logic_var, every `tbl[i]` a one-bit select. The ANSI body path (compileStmt -> compileDataDeclaration) keeps the dimension and makes an array_var; route the declaration through it and collect the variables it declares. The port-redeclaration case (`input a; reg [7:0] a;`, which only retypes the io_decl) is unchanged. tests/TfItemUnpackedLocal: the golden shows work@dut.f0.tbl as an array_var with four 64-bit entries. Prepared with the assistance of Claude Code.
Collaborator
Author
|
Full |
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.
What
A function whose ports are
tf_item_declarations (input [31:0] idx;inside the body) has its following data declarations compiled bycompileTfPortDecl, which rebuilt each local from its data type alone (compileVariableonreg [63:0]) and dropped the unpacked dimension written after the name:reg [63:0] tbl [0:3];came out as a 64-bitlogic_var, and everytbl[i]as a one-bit select. The ANSI body path (compileStmt→compileDataDeclaration) keeps the dimension and produces anarray_var.compileTfPortDeclnow routes the declaration throughcompileDataDeclarationand collects the variables it declares (no scope is passed, sincecompileFunctioninstalls the function's variable list from the vector returned here). The port-redeclaration case (input a; reg [7:0] a;, which only retypes theio_decl) is unchanged.Why
Constant functions written in Verilog-2001 style (most of Alex Forencich's verilog-ethernet / verilog-axis helpers) keep their tables in function-scope unpacked arrays; the UHDM consumer saw a scalar and computed nothing useful.
Test
tests/TfItemUnpackedLocal: the golden showswork@dut.f0.tblas anarray_varwith four 64-bit entries. Fullscripts/regression.pyrun: see the final comment.Prepared with the assistance of Claude Code.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XshwvRJtjR5dA48M4b1CLM