Coder Social home page Coder Social logo

Default partitioning of eqy fails to prove equivalence for circuit containing only "eq" and "neq", but succeeds if output is turned into internal wire about eqy HOT 4 OPEN

edwintorok avatar edwintorok commented on August 22, 2024
Default partitioning of eqy fails to prove equivalence for circuit containing only "eq" and "neq", but succeeds if output is turned into internal wire

from eqy.

Comments (4)

edwintorok avatar edwintorok commented on August 22, 2024

FWIW adding this to equiv.eqy makes the proof work, but that feels more like a workaround (aigmap on its own is not enough, it needs the opt too):

aigmap
opt

workaround equiv.eqy:

[gold]
read_verilog gold.v
prep -top comparators
aigmap
opt

[gate]
read_verilog gate.v
prep -top comparators
aigmap
opt

[strategy sby]
use sby
depth 10
engine smtbmc z3

from eqy.

jix avatar jix commented on August 22, 2024

This is not a bug in SBY, but a known current limitation of EQY's partitioning that we plan to improve on. When EQY passes a partition to SBY, that partition is checked in isolation, that's a core part of EQY's design, but it requires that the partitioning is done in a way that equality can still be proved. Our current partitioning code often requires some manual tuning to ensure that this is possible. In this case EQY decided to split the partitions in such a way that when checking that the gold side neq = a != b matches the gate side neq = ~eq the common logic that defines eq itself is not part of the partition. This means while checking the partition neq, it treats a, b and eq as unknowns, in which case eq == neq becomes possible without the context of the logic outside of the partition.

During partition EQY prints the following warnings as it couldn't perfectly align both sides due to structural changes between gold and gate, which is an indicator that such a problem might be present, especially if it's present for both gold and gate inputs for the same partition.

EQY 15:32:56 [equiv] Warning: Partition comparators.neq contains 1 unused gold inputs.
EQY 15:32:56 [equiv] Warning: Partition comparators.neq contains 2 unused gate inputs.

In this case I could pinpoint the problem just from the observed behavior and log output, but in general the directory created by eqy contains more detailed log, data and RTLIL files that can help diagnosing such issues, especially for larger designs.

One workaround that directly addresses this underlying reason for the false-positive equivalence-failure is to explicitly tell EQY to make the definition of eq available whenever it is used, even across a partition boundary, by adding the following section to the .eqy file:

[partition comparators]
amend eq

from eqy.

jix avatar jix commented on August 22, 2024

Actually I'll keep this issue open, even if requiring manual annotations is currently by design, as we do plan to improve this and keeping track of examples where the current approach doesn't do the right thing automatically is useful for that.

from eqy.

edwintorok avatar edwintorok commented on August 22, 2024

Thanks, the amend works. In fact this works too and is not design specific (so far I'm only using sby/eqy to prove the equiv of really small designs and was looking for a way to turn partitioning 'off', obviously for larger designs I'll have to annotate by hand):

 [partition *]
 amend *

Am I understanding correctly that whenever I see this warning Warning: Partition comparators.neq contains ... unused ... inputs.: I have to find out the names of those inputs and add an amend entry with that signal name? In which case having the warning print the list of signal names that are unconnected might be useful.

from eqy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.