21#include "mlir/Pass/Pass.h"
22#include "llvm/ADT/TypeSwitch.h"
26#define GEN_PASS_DEF_VERIFYCLOCKEDASSERTLIKEPASS
27#include "circt/Dialect/Verif/Passes.h.inc"
39struct VerifyClockedAssertLikePass
40 : verif::impl::VerifyClockedAssertLikePassBase<
41 VerifyClockedAssertLikePass> {
45 llvm::SmallMapVector<Operation *, OperandRange::iterator, 16> worklist;
48 llvm::DenseSet<Operation *> handledOps;
51 void runOnOperation()
override;
54 void verify(Operation *clockedAssertLikeOp) {
56 Operation *
property = clockedAssertLikeOp->getOperand(0).getDefiningOp();
62 worklist.insert({property,
property->operand_begin()});
65 while (!worklist.empty()) {
66 auto &[op, operandIt] = worklist.back();
68 if (operandIt == op->operand_end()) {
70 if (isa<ltl::ClockOp>(op)) {
71 op->emitError(
"Nested clock or disable operations are not "
72 "allowed for clock_assertlike operations.");
77 handledOps.insert(op);
84 Value operand = *(operandIt++);
85 auto *defOp = operand.getDefiningOp();
88 if (!defOp || handledOps.contains(defOp))
91 worklist.insert({defOp, defOp->operand_begin()});
101void VerifyClockedAssertLikePass::runOnOperation() {
102 getOperation()->walk([&](Operation *op) {
103 llvm::TypeSwitch<Operation *, void>(op)
104 .Case<verif::ClockedAssertOp, verif::ClockedAssumeOp,
105 verif::ClockedCoverOp>([&](
auto clockedOp) { verify(clockedOp); })
106 .Default([&](
auto) {});
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.