Skip to content

Conversation

@brianhuffman
Copy link
Contributor

Also do a bunch of code style changes and refactorings.

Fixes #2828.

Note that because this branch does a lot of code reformatting and reindentation that touches a huge number of lines of code, it is probably easiest to review by looking at individual commits.

Copy link
Contributor

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

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

Is it reasonable to add a test case for this?

, ("$bmux" , CellTypeBmux)
, ("$dff" , CellTypeDff)
, ("$ff" , CellTypeFf)
, ("$_BUF_" , CellTypeBUF)
Copy link
Contributor

Choose a reason for hiding this comment

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

This adds just one of the cell types listed here. Do you foresee the need to add support for the others? (If so, I'd be fine with deferring that to a separate issue.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It really depends on what kinds of output we see from our synthesis tools. We could go ahead and implement all of the gate types listed in the Yosys cell library, but if we don't have any generated circuits that use a particular gate type, then we can't really test the implementation properly. It might be the case that $_BUF_ is the only additional gate type that TabbyCAD ever adds, and if so it might be best to hold off on implementing the others.

@brianhuffman
Copy link
Contributor Author

Yes, we should definitely add a test case for this. The thread for #2828 doesn't include a proof script, but it says it's based on an example from a tutorial, so I should be able to put something together.

Map.empty
sorted
convertYosysIR sc ir =
do let mg = yosysIRModgraph ir
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, I rather prefer the do positioning the other way. Which is not to say you shouldn't change it here. But maybe we should talk about it offline...

@podhrmic
Copy link
Contributor

With this patch, I can indeed load the TabbyCAD generated adder.json file from the turorial, thanks!

@RyanGlScott
Copy link
Contributor

For what it's worth, the already-existing test_yosys_adder test case essentially just checks in adder_yosys.json from #2828 (comment). For testing purposes, I think it would suffice to use adder_tabby.json from that comment.

@RyanGlScott RyanGlScott added the subsystem: hardware Issues related to verification of hardware label Nov 21, 2025
@brianhuffman
Copy link
Contributor Author

I added a new test case that loads both .json files and proves that the add4 functions from each are the same. This ensures not only that $_BUF_ is imported without error, but that it is given the correct semantics.

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

Labels

subsystem: hardware Issues related to verification of hardware

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAW not supporting JSON generated by TabbyCAD

5 participants