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

[circt-test] Add simple SymbiYosys test runner #7756

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

fabianschuiki
Copy link
Contributor

Extend circt-test to export the input MLIR file as Verilog and then run all discovered tests through a simple SymbiYosys runner script. This is currently very rigid: all tests are always run, and they all run through the exact same runner script. In the future, we'll want to add filtering mechanisms to include and exclude tests, and pick among multiple runner scripts for each test.

Also add a basic integration test that builds an adder from discrete logic gates and then verifies it through multiple verif.formal ops.

To run this you need to have SymbiYosys installed. In the future we'll want to have circt-bmc and other CIRCT-based verification tools available as runners as well.

Copy link
Contributor

@mikeurbach mikeurbach left a comment

Choose a reason for hiding this comment

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

This is pretty neat!

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.

Looks great!

@@ -0,0 +1,113 @@
// RUN: circt-test %s -r circt-test-runner-sby.py
// REQUIRES: sby
Copy link
Member

Choose a reason for hiding this comment

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

Can you also run Filecheck to confirm all <num> tests passed is actually printed? (If it's tricky due to color I think it's ok not to add the check though).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah cool idea, definitely!

pm.addNestedPass<hw::HWModuleOp>(createLowerVerifToSVPass());
pm.addNestedPass<hw::HWModuleOp>(sv::createHWLegalizeModulesPass());
pm.addNestedPass<hw::HWModuleOp>(sv::createPrettifyVerilogPass());
pm.addPass(createExportVerilogPass(verilogFile->os()));
Copy link
Member

Choose a reason for hiding this comment

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

Great use of ExportVerilog!

Comment on lines 248 to 249
if (auto result = llvm::sys::findProgramByName(runner))
runner = result.get();
Copy link
Member

Choose a reason for hiding this comment

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

nit: Return failure otherwise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, thanks!

Base automatically changed from fschuiki/test-discovery to main October 31, 2024 16:41
Extend circt-test to export the input MLIR file as Verilog and then run
all discovered tests through a simple SymbiYosys runner script. This is
currently very rigid: all tests are always run, and they all run through
the exact same runner script. In the future, we'll want to add filtering
mechanisms to include and exclude tests, and pick among multiple runner
scripts for each test.

Also add a basic integration test that builds an adder from discrete
logic gates and then verifies it through multiple `verif.formal` ops.

To run this you need to have SymbiYosys installed. In the future we'll
want to have `circt-bmc` and other CIRCT-based verification tools
available as runners as well.
@fabianschuiki
Copy link
Contributor Author

Landing this since the only failure is related to #7093.

@fabianschuiki fabianschuiki merged commit 9b4cc2c into main Oct 31, 2024
1 of 4 checks passed
@fabianschuiki fabianschuiki deleted the fschuiki/circt-test-sby branch October 31, 2024 17:14
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.

3 participants