CIRCT  18.0.0git
CHIRRTL.cpp
Go to the documentation of this file.
1 //===- CHIRRTL.cpp - C Interface for the CHIRRTL Dialect ------------------===//
2 //
3 //===----------------------------------------------------------------------===//
4 
7 #include "mlir/CAPI/IR.h"
8 #include "mlir/CAPI/Registration.h"
9 #include "mlir/CAPI/Support.h"
10 
11 using namespace circt;
12 using namespace chirrtl;
13 
14 //===----------------------------------------------------------------------===//
15 // Dialect API.
16 //===----------------------------------------------------------------------===//
17 
19  circt::chirrtl::CHIRRTLDialect)
20 
21 //===----------------------------------------------------------------------===//
22 // Type API.
23 //===----------------------------------------------------------------------===//
24 
25 MlirType chirrtlTypeGetCMemory(MlirContext ctx, MlirType elementType,
26  uint64_t numElements) {
27  auto baseType = unwrap(elementType).cast<firrtl::FIRRTLBaseType>();
28  assert(baseType && "element must be base type");
29 
30  return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements));
31 }
32 
33 MlirType chirrtlTypeGetCMemoryPort(MlirContext ctx) {
34  return wrap(CMemoryPortType::get(unwrap(ctx)));
35 }
assert(baseType &&"element must be base type")
return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements))
MlirType uint64_t numElements
Definition: CHIRRTL.cpp:26
MlirType elementType
Definition: CHIRRTL.cpp:25
MlirType chirrtlTypeGetCMemoryPort(MlirContext ctx)
Definition: CHIRRTL.cpp:33
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
MLIR_CAPI_EXPORTED MlirType chirrtlTypeGetCMemory(MlirContext ctx, MlirType elementType, uint64_t numElements)
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
Definition: OM.cpp:100
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
Definition: CalyxOps.cpp:53
This file defines an intermediate representation for circuits acting as an abstraction for constraint...
Definition: DebugAnalysis.h:21