CIRCT  20.0.0git
SeqModule.cpp
Go to the documentation of this file.
1 //===- SeqModule.cpp - Seq API pybind module ------------------------------===//
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 
9 #include "CIRCTModules.h"
10 
11 #include "circt-c/Dialect/Seq.h"
12 #include "mlir/Bindings/Python/PybindAdaptors.h"
13 
14 #include "PybindUtils.h"
15 #include "mlir-c/Support.h"
16 #include <pybind11/pybind11.h>
17 #include <pybind11/pytypes.h>
18 #include <pybind11/stl.h>
19 
20 namespace py = pybind11;
21 
22 using namespace circt;
23 using namespace mlir::python::adaptors;
24 
25 /// Populate the seq python module.
27  m.doc() = "Seq dialect Python native extension";
28 
29  mlir_type_subclass(m, "ClockType", seqTypeIsAClock)
30  .def_classmethod(
31  "get",
32  [](py::object cls, MlirContext ctx) {
33  return cls(seqClockTypeGet(ctx));
34  },
35  py::arg("cls"), py::arg("context") = py::none());
36 
37  mlir_type_subclass(m, "ImmutableType", seqTypeIsAImmutable)
38  .def_classmethod("get",
39  [](py::object cls, MlirType innerType) {
40  return cls(seqImmutableTypeGet(innerType));
41  })
42  .def_property_readonly("inner_type", [](MlirType self) {
43  return seqImmutableTypeGetInnerType(self);
44  });
45 }
MLIR_CAPI_EXPORTED bool seqTypeIsAClock(MlirType type)
If the type is an clock type.
Definition: Seq.cpp:22
MLIR_CAPI_EXPORTED MlirType seqImmutableTypeGetInnerType(MlirType type)
Creates a seq immutable type.
Definition: Seq.cpp:38
MLIR_CAPI_EXPORTED MlirType seqImmutableTypeGet(MlirType type)
Creates a seq immutable type.
Definition: Seq.cpp:34
MLIR_CAPI_EXPORTED bool seqTypeIsAImmutable(MlirType type)
If the type is an immutable type.
Definition: Seq.cpp:30
MLIR_CAPI_EXPORTED MlirType seqClockTypeGet(MlirContext ctx)
Creates an seq clock type.
Definition: Seq.cpp:26
mlir::Type innerType(mlir::Type type)
Definition: ESITypes.cpp:184
void populateDialectSeqSubmodule(pybind11::module &m)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21