-
Notifications
You must be signed in to change notification settings - Fork 917
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
equiv_make: Add -assert option #3126
Conversation
As far as I can tell, your Also note that in general the check used by $equiv is not quite the same asserting $eqx. For $equiv when the A input is x, any value for B is accepted. Such a check can also be created via |
It's been a while since I worked on this so I may be misremembering parts (and I think looking at it now there are some bits that could be tidied up/may be a little buggy), but the main reasoning I had for it was that using Since having some of these internal equivalences can decrease the time to prove two circuits equivalent, the main idea behind this PR was to be able to do this type of checking at the word level instead of bit level (as Your points about $eqx are very much correct and it could be replaced by an $eq cell. There's also a few other things that I would want to look at again with this, like the fact that it doesn't pass outputs through to the outputs of the miter module. |
Ah, I forgot about internal equivalence checks and only tested it with a design that was too simple to show a difference here. Regarding $equiv vs $eqx and $eq, also $eq is not the same as $equiv. For |
Ahh that all makes sense. I am a bit busy at the moment but in a week or two I have some more time so I will have a look then at documenting those differences (it would be nice to get the semantics as close to a drop-in replacement for |
This adds a -make_assert flag to equiv_make. When used, the pass generates $eqx and $assert cells to encode equivalence instead of $equiv.
c9cd6a7
to
fbf5d89
Compare
I've tidied things up a bit, and renamed it to On the topic of exactly how to encode equivalence I had a few thoughts. I debated adding the Therefore this PR just implements the $eqx based semantics and I have tried to make this clear in the option description. |
This adds an -assert flag to equiv_make. When used, the pass generates $eqx and $assert cells to encode equivalence instead of $equiv, which means the equivalence check can be done with SymbiYosys. As these assertions are at the word level, they typically solve faster with SymbiYosys than using equiv_induct in yosys, at the cost of less helpful error messages.
I'm not certain on the name of the option as -assert is used in some other commands to mean that the command should produce an error if it fails which is different to its meaning here
You can also do something similar to this by using
equiv_make
followed byequiv_miter -assert
, however the assertions resulting from this are all one bit wide (as they are derived from equiv cells which are always only 1 bit). In my experiments these took significantly longer to solve than generating equivalences at the word level.I'm happy to make any changes as needed to make it more usable/fit the yosys codebase style more etc (or if its an already existing feature i've somehow missed)