CIRCT  19.0.0git
VerifOps.cpp
Go to the documentation of this file.
1 //===- VerifOps.cpp -------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
13 #include "mlir/IR/Builders.h"
14 #include "mlir/IR/OpImplementation.h"
15 #include "mlir/IR/PatternMatch.h"
16 #include "mlir/IR/SymbolTable.h"
17 #include "mlir/Interfaces/FunctionImplementation.h"
18 #include "mlir/Interfaces/SideEffectInterfaces.h"
19 
20 using namespace circt;
21 using namespace verif;
22 using namespace mlir;
23 
24 //===----------------------------------------------------------------------===//
25 // HasBeenResetOp
26 //===----------------------------------------------------------------------===//
27 
28 OpFoldResult HasBeenResetOp::fold(FoldAdaptor adaptor) {
29  // Fold to zero if the reset is a constant. In this case the op is either
30  // permanently in reset or never resets. Both mean that the reset never
31  // finishes, so this op never returns true.
32  if (adaptor.getReset())
33  return BoolAttr::get(getContext(), false);
34 
35  // Fold to zero if the clock is a constant and the reset is synchronous. In
36  // that case the reset will never be started.
37  if (!adaptor.getAsync() && adaptor.getClock())
38  return BoolAttr::get(getContext(), false);
39 
40  return {};
41 }
42 
43 //===----------------------------------------------------------------------===//
44 // LogicalEquivalenceCheckingOp
45 //===----------------------------------------------------------------------===//
46 
47 LogicalResult LogicEquivalenceCheckingOp::verifyRegions() {
48  if (getFirstCircuit().getArgumentTypes() !=
49  getSecondCircuit().getArgumentTypes())
50  return emitOpError() << "block argument types of both regions must match";
51  if (getFirstCircuit().front().getTerminator()->getOperandTypes() !=
52  getSecondCircuit().front().getTerminator()->getOperandTypes())
53  return emitOpError()
54  << "types of the yielded values of both regions must match";
55 
56  return success();
57 }
58 
59 //===----------------------------------------------------------------------===//
60 // Generated code
61 //===----------------------------------------------------------------------===//
62 
63 #define GET_OP_CLASSES
64 #include "circt/Dialect/Verif/Verif.cpp.inc"
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
Definition: CalyxOps.cpp:54
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: verif.py:1