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

[minor] Formal Test definitions and test harnesses #229

Merged
merged 17 commits into from
Aug 14, 2024
Merged

Conversation

dobios
Copy link
Member

@dobios dobios commented Aug 12, 2024

This PR proposes a new formal construct that allows for test harness modules to be marked as formal tests to be run using bounded model checking with a given bound. This is a first step towards enabling inline formal tests and already has support in CIRCT through the btor2 and circt-bmc backends. It also has the following approved PR that adds support for the new op in CIRCT (llvm/circt#7374)

Example:

FIRRTL version 4.0.0

circuit Foo:
  public module Foo:
    input data : UInt<32>
    input c : UInt<1>
    output out : UInt<32>
    ;; Foo body

  module FooTest:
      ;; example test
      inst foo of Foo
      ;; symbolic input -- maps to input in btor2
      input s_foo_c : UInt<1>
      input s_foo_data : UInt<32> 
      ;; feed the symbolic inputs to the instance
      connect foo.c, s_foo_c 
      connect foo.data, s_foo_data
      ;; example assertion that uses the symbolic inputs and outputs
      intrinsic(circt_verif_assert, intrinsic(
        circt_ltl_implication : UInt<1>, s_foo_c, eq(foo.out, s_foo_data))
      )

  formal testFormal of FooTest, bound = 20

Copy link
Collaborator

@mwachs5 mwachs5 left a comment

Choose a reason for hiding this comment

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

from an administrative standpoint, if this is "just" adding a new feature (vs breaking old ones) it can be minor

spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
@dobios dobios changed the title [major] Formal Test definitions and test harnesses [minor] Formal Test definitions and test harnesses Aug 12, 2024
Co-authored-by: Megan Wachs <megan@sifive.com>
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
spec.md Show resolved Hide resolved
@dobios dobios merged commit 8e5d511 into main Aug 14, 2024
1 check passed
@dobios dobios deleted the dobios/formal-op branch August 14, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants