Skip to content

[ImportVerilog][Sim] Added remaining Moore instructions for dynamic arrays, as well as the corresponding Sim dialect instructions#9944

Open
yuriyKulinchenko wants to merge 30 commits intollvm:mainfrom
yuriyKulinchenko:yuriyk-dynamic-array-core
Open

[ImportVerilog][Sim] Added remaining Moore instructions for dynamic arrays, as well as the corresponding Sim dialect instructions#9944
yuriyKulinchenko wants to merge 30 commits intollvm:mainfrom
yuriyKulinchenko:yuriyk-dynamic-array-core

Conversation

@yuriyKulinchenko
Copy link
Copy Markdown
Contributor

Moore Operations

  • Added the 'OpenUArrayAssignOp' moore instruction, which performs an assignment to an index of a dynamic array
  • Modified the 'OpenUArrayDeleteOp' moore instruction to take a reference to a dynamic array, instead of a raw dynamic array (useful for conversion to the Sim dialect)
  • Added appropriate type constraints to all dynamic array Moore operations
  • Added support for the initializer expression for a dynamic array

Sim Operations

  • Added the 'DynamicArrayEmptyOp', 'DynamicArrayCreateOp', 'DynamicArrayExtractOp', 'DynamicArrayAssignOp', 'DynamicArrayDeleteOp', and 'DynamicArraySizeOp' Sim instructions
  • Implemented the dialect conversion for dynamic array instructions in 'MooreToCore.cpp', using value semantics for the dynamic array Sim operations

Modified and added test cases to reflect changes made to the Moore ops for dynamic arrays

yuriyKulinchenko and others added 30 commits March 14, 2026 14:25
…ructions to the moore dialect

- Added the 'OpenUArrayCreateOp' moore instruction, which creates a new dynamic array
- Added the 'OpenUArraySizeOp' moore instruction, which fetches the size of a dynamic array
- Added the 'OpenUArrayDeleteOp' moore instruction, which deletes a dynamic array

Currently, this commit does not include support for the optional initializer expression when creating a new array: arr = new [n](init_expr);
…ructions to the moore dialect

- Added the 'OpenUArrayCreateOp' moore instruction, which creates a new dynamic array
- Added the 'OpenUArraySizeOp' moore instruction, which fetches the size of a dynamic array
- Added the 'OpenUArrayDeleteOp' moore instruction, which deletes a dynamic array

Currently, this commit does not include support for the optional initializer expression when creating a new array: arr = new [n](init_expr);
…ructions to the moore dialect

- Added the 'OpenUArrayCreateOp' moore instruction, which creates a new dynamic array

Currently, this commit does not include support for the optional initializer expression when creating a new array: arr = new [n](init_expr);
…l expression parameter.

Modified codegen to support the expression parameter
Note: This requires a bug fix in Slang to work as expected (PR for this will be made soon)
…s in the Moore dialect. Added conversion between the Moore and Sim dynamic array types, as well as the dynamic array creation instruction. Currently, extract ops, size ops and the delete op are not supported.
…he corresponding conversion from the Moore dialect to the Sim dialect.
… a value to a specified index of an open unpacked array. This replaces the previously used blocking assign instruction, which I have found is not suitable for dynamic arrays.

Added appropriate handling for dynamic array assignment expressions in expressions.cpp.

I will likely need to modify the existing moore instructions for array manipulation to operate on array references instead of the raw array: This will be relatively easy compared to implementing the afformentioned assign instruction.
…ed corresponding conversion between the moore "OpenUArrayAssignOp" instruction and the new sim instruction .
…consistent.

Added the "DynamicArrayDeleteOp" instruction to the sim dialect.

Modified the type signature of the "OpenUArrayDeleteOp" so that it is possible to convert into the sim dialect. Consequently, I have modified the handling of the delete op in "Expressions.cpp".

Added conversion between the "OpenUArrayDeleteOp" and "DynamicArrayDeleteOp".
…nversion from the "OpenUArraySizeOp" instruction in "MooreToCore.cpp".
…ther test case for dynamic array assignment.
Removed unnecessary imports
Removed unnecessary imports from MooreToCore
@TaoBi22
Copy link
Copy Markdown
Contributor

TaoBi22 commented Mar 27, 2026

@yuriyKulinchenko looks like some test failures have made their way in here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants