CIRCT 23.0.0git
Loading...
Searching...
No Matches
LTL.cpp
Go to the documentation of this file.
1//===- LTL.cpp - C interface for the LTL dialect --------------------------===//
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
12
13#include "mlir/CAPI/IR.h"
14#include "mlir/CAPI/Registration.h"
15
16using namespace circt;
17using namespace circt::ltl;
18using namespace mlir;
19
20//===----------------------------------------------------------------------===//
21// Dialect API.
22//===----------------------------------------------------------------------===//
23
24MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(LTL, ltl, circt::ltl::LTLDialect)
25
26//===----------------------------------------------------------------------===//
27// Type API.
28//===----------------------------------------------------------------------===//
29
30bool ltlTypeIsASequence(MlirType type) {
31 return isa<SequenceType>(unwrap(type));
32}
33
34MlirType ltlSequenceTypeGet(MlirContext ctx) {
35 return wrap(SequenceType::get(unwrap(ctx)));
36}
37
38bool ltlTypeIsAProperty(MlirType type) {
39 return isa<PropertyType>(unwrap(type));
40}
41
42MlirType ltlPropertyTypeGet(MlirContext ctx) {
43 return wrap(PropertyType::get(unwrap(ctx)));
44}
45
46//===----------------------------------------------------------------------===//
47// Attribute API.
48//===----------------------------------------------------------------------===//
49
50static_assert(LTL_CLOCK_EDGE_POS == static_cast<unsigned>(ClockEdge::Pos));
51static_assert(LTL_CLOCK_EDGE_NEG == static_cast<unsigned>(ClockEdge::Neg));
52static_assert(LTL_CLOCK_EDGE_BOTH == static_cast<unsigned>(ClockEdge::Both));
53
54bool ltlAttrIsAClockEdgeAttr(MlirAttribute attr) {
55 return isa<ClockEdgeAttr>(unwrap(attr));
56}
57
58MlirAttribute ltlClockEdgeAttrGet(MlirContext ctx, LTLClockEdge edge) {
59 return wrap(ClockEdgeAttr::get(unwrap(ctx), static_cast<ClockEdge>(edge)));
60}
61
63 auto edge = cast<ClockEdgeAttr>(unwrap(attr)).getValue();
64 return static_cast<LTLClockEdge>(static_cast<unsigned>(edge));
65}
return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements))
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
bool ltlAttrIsAClockEdgeAttr(MlirAttribute attr)
Definition LTL.cpp:54
bool ltlTypeIsASequence(MlirType type)
Definition LTL.cpp:30
bool ltlTypeIsAProperty(MlirType type)
Definition LTL.cpp:38
LTLClockEdge ltlClockEdgeAttrGetValue(MlirAttribute attr)
Definition LTL.cpp:62
MlirType ltlPropertyTypeGet(MlirContext ctx)
Definition LTL.cpp:42
MlirType ltlSequenceTypeGet(MlirContext ctx)
Definition LTL.cpp:34
MlirAttribute ltlClockEdgeAttrGet(MlirContext ctx, LTLClockEdge edge)
Definition LTL.cpp:58
LTLClockEdge
Definition LTL.h:19
@ LTL_CLOCK_EDGE_NEG
Definition LTL.h:21
@ LTL_CLOCK_EDGE_POS
Definition LTL.h:20
@ LTL_CLOCK_EDGE_BOTH
Definition LTL.h:22
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
Definition OM.cpp:111
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition ltl.py:1