-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[circt-test] Add support for contracts
Add the `LowerContracts` or `StripContracts` pass to the circt-test pipeline in order to leverage contracts during formal verification. To make this work, circ-test has to run a preparatory pass pipeline on the input MLIR, and pass the result as input to the MLIR runners instead of the original file. Also add an `--ir` option to dump the IR after the preparatory passes.
- Loading branch information
1 parent
050e628
commit 83e5e8e
Showing
2 changed files
with
77 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: circt-test --ir %s | FileCheck %s | ||
// RUN: circt-test --ir --ignore-contracts %s | FileCheck %s --check-prefix=NOCONTRACT | ||
|
||
// CHECK: hw.module @Foo | ||
// CHECK-NOT: verif.contract | ||
// CHECK: verif.formal @Foo_CheckContract | ||
|
||
// NOCONTRACT: hw.module @Foo | ||
// NOCONTRACT-NOT: verif.contract | ||
// NOCONTRACT-NOT: verif.formal @Foo | ||
|
||
hw.module @Foo(in %a: i1, in %b: i1, out z: i1) { | ||
%0 = comb.xor %a, %b : i1 | ||
%1 = verif.contract %0 : i1 { | ||
%2 = comb.add %a, %b : i1 | ||
%3 = comb.icmp eq %1, %2 : i1 | ||
verif.ensure %3 : i1 | ||
} | ||
hw.output %1 : i1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters