Skip to content

Conversation

@fabianschuiki
Copy link
Contributor

Add new moore.global_variable and moore.get_global_variable ops to the Moore dialect, which define global variables as a symbol and return a reference to a global variable given its symbol, respectively.

Add support for variables at the root level and within packages in SV inputs. Both of these get converted to moore.global_variables. When referring to a global variable by name, create get_global_variable ops to resolve the symbol name to a !moore.ref<T> which can then be read.

Lowering to the core dialects is not yet supported. We very likely need an equivalent global signal construct in LLHD.

@fabianschuiki fabianschuiki requested a review from uenoku November 3, 2025 21:27
Add new `moore.global_variable` and `moore.get_global_variable` ops to
the Moore dialect, which define global variables as a symbol and return
a reference to a global variable given its symbol, respectively.

Add support for variables at the root level and within packages in SV
inputs. Both of these get converted to `moore.global_variable`s. When
referring to a global variable by name, create `get_global_variable` ops
to resolve the symbol name to a `!moore.ref<T>` which can then be read.

Lowering to the core dialects is not yet supported. We very likely need
an equivalent global signal construct in LLHD.
Copy link
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fabianschuiki fabianschuiki merged commit a04eac9 into main Nov 4, 2025
7 checks passed
@fabianschuiki fabianschuiki deleted the fschuiki/global-vars branch November 4, 2025 01:31
TaoBi22 pushed a commit to TaoBi22/circt that referenced this pull request Nov 5, 2025
Add new `moore.global_variable` and `moore.get_global_variable` ops to
the Moore dialect, which define global variables as a symbol and return
a reference to a global variable given its symbol, respectively.

Add support for variables at the root level and within packages in SV
inputs. Both of these get converted to `moore.global_variable`s. When
referring to a global variable by name, create `get_global_variable` ops
to resolve the symbol name to a `!moore.ref<T>` which can then be read.

Lowering to the core dialects is not yet supported. We very likely need
an equivalent global signal construct in LLHD.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants