Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIRRTL] Lower firrtl.simulation to verif.simulation #8312

Merged
merged 2 commits into from
Mar 27, 2025

Conversation

fabianschuiki
Copy link
Contributor

Add a lowering from firrtl.simulation to verif.simulation in the FIRRTL-to-HW conversion. The lowering creates a verif.simulation op that simply instantiates the module pointed to by firrtl.simulation, connecting its clock and init ports to the simulation op's block arguments, and yielding the done and success ports back. We may want to inline the instance in the future, but that is purely cosmetic.

This now allows FIR files to contain simulation unit tests that can be lowered to HW through firtool and then executed using arcilator.

@fabianschuiki fabianschuiki added the FIRRTL Involving the `firrtl` dialect label Mar 12, 2025
@fabianschuiki fabianschuiki requested a review from leonardt March 12, 2025 20:51
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

LGTM!

Add the `firrtl.simulation` op, which declares a simulation unit test
and references a module to act as the top-level for the simulation. The
target module must have exactly four ports, clock, init, done, and
success, with corresponding directions and types. This new op is
analogous to the `firrtl.formal` op.

Also add support for a `simulation` construct in the parser, also
analogous to the `formal` construct.

A later commit will add a lowering to `verif.formal`.
@fabianschuiki fabianschuiki force-pushed the fschuiki/firrtl-lower-simulation branch from 6159415 to 9f4f4ef Compare March 26, 2025 18:51
@fabianschuiki fabianschuiki force-pushed the fschuiki/firrtl-add-simulation branch from 50e1c38 to b80e79b Compare March 26, 2025 18:51
@fabianschuiki fabianschuiki force-pushed the fschuiki/firrtl-lower-simulation branch from 9f4f4ef to 8a479d7 Compare March 26, 2025 18:52
Add a lowering from `firrtl.simulation` to `verif.simulation` in the
FIRRTL-to-HW conversion. The lowering creates a `verif.simulation` op
that simply instantiates the module pointed to by `firrtl.simulation`,
connecting its `clock` and `init` ports to the simulation op's block
arguments, and yielding the `done` and `success` ports back. We may want
to inline the instance in the future, but that is purely cosmetic.

This now allows FIR files to contain `simulation` unit tests that can be
lowered to HW through `firtool` and then executed using `arcilator`.
@fabianschuiki fabianschuiki force-pushed the fschuiki/firrtl-lower-simulation branch from 8a479d7 to f216fb4 Compare March 26, 2025 19:20
Base automatically changed from fschuiki/firrtl-add-simulation to main March 27, 2025 16:01
@fabianschuiki fabianschuiki merged commit 8389379 into main Mar 27, 2025
5 checks passed
@fabianschuiki fabianschuiki deleted the fschuiki/firrtl-lower-simulation branch March 27, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FIRRTL Involving the `firrtl` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants