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

[Verif][circt-bmc] Add verif.bmc op and circt-bmc tool #7259

Closed
wants to merge 23 commits into from

Conversation

TaoBi22
Copy link
Contributor

@TaoBi22 TaoBi22 commented Jul 2, 2024

This PR (based on an initial draft by @maerhart, thanks!) introduces a bounded model checking tool based on the SMT dialect, similar to the updated circt-lec tool.

To achieve this, a BMC op is added to the verif dialect - in order to support multiple clocks in the near future, this has init and loop regions that allow the manipulation of clocks to be specified (e.g. so that specific interleavings can be explored). These regions are allowed some extra state arguments, as is likely necessary for specifying clock interleavings (e.g. to say which clock's turn it is to be toggled next).

Sorry for the big diff!

Comment on lines +69 to +115
// Fail to convert unsupported verif ops to avoid silent failure
struct VerifCoverOpConversion : OpConversionPattern<verif::CoverOp> {
using OpConversionPattern<verif::CoverOp>::OpConversionPattern;

LogicalResult
matchAndRewrite(verif::CoverOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
return op.emitError("Conversion of CoverOps to SMT not yet supported");
};
};

struct VerifClockedAssertOpConversion
: OpConversionPattern<verif::ClockedAssertOp> {
using OpConversionPattern<verif::ClockedAssertOp>::OpConversionPattern;

LogicalResult
matchAndRewrite(verif::ClockedAssertOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
return op.emitError(
"Conversion of ClockedAssertOps to SMT not yet supported");
};
};

struct VerifClockedCoverOpConversion
: OpConversionPattern<verif::ClockedCoverOp> {
using OpConversionPattern<verif::ClockedCoverOp>::OpConversionPattern;

LogicalResult
matchAndRewrite(verif::ClockedCoverOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
return op.emitError(
"Conversion of ClockedCoverOps to SMT not yet supported");
};
};

struct VerifClockedAssumeOpConversion
: OpConversionPattern<verif::ClockedAssumeOp> {
using OpConversionPattern<verif::ClockedAssumeOp>::OpConversionPattern;

LogicalResult
matchAndRewrite(verif::ClockedAssumeOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
return op.emitError(
"Conversion of ClockedAssumeOps to SMT not yet supported");
};
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not totally sure if this is necessary, but my thinking is that without these patterns the errors produced will likely be pretty opaque to someone not familiar with CIRCT/MLIR internals, which maybe isn't ideal for this tool.

@TaoBi22 TaoBi22 added the verif label Jul 2, 2024
@darthscsi
Copy link
Contributor

Can this be split up into

  • new op
  • pr per pass being changed/added (looks like 2 changes in conversion?)
  • tool addition

@TaoBi22
Copy link
Contributor Author

TaoBi22 commented Jul 2, 2024

Can this be split up into

  • new op
  • pr per pass being changed/added (looks like 2 changes in conversion?)
  • tool addition

That should be fine, thanks for the suggestion!

@TaoBi22
Copy link
Contributor Author

TaoBi22 commented Jul 2, 2024

New op PR now up at #7263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants