12 #include "mlir/CAPI/IR.h"
13 #include "mlir/CAPI/Registration.h"
14 #include "mlir/CAPI/Support.h"
16 using namespace circt;
38 llvm_unreachable(
"All cases should be covered.");
44 return IntType::Kind::Bit;
46 return IntType::Kind::Logic;
48 return IntType::Kind::Reg;
51 return IntType::Kind::Byte;
53 return IntType::Kind::ShortInt;
55 return IntType::Kind::Int;
57 return IntType::Kind::LongInt;
59 return IntType::Kind::Integer;
61 return IntType::Kind::Time;
63 llvm_unreachable(
"All cases should be covered.");
75 llvm_unreachable(
"All cases should be covered.");
163 MlirType indexType) {
165 unwrap(indexType).cast<UnpackedType>()));
187 unwrap(base).cast<PackedType>()));
192 bool isSigned,
unsigned size) {
return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements))
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
MlirType mooreEnumTypeGet(MlirAttribute name, MlirLocation loc)
Create a enum type without base.
MlirType mooreRealTypeGet(MlirContext ctx, enum MooreRealKind kind)
Create a real type.
static std::optional< Sign > convertMooreSign(enum MooreSign sign)
MlirType mooreVoidTypeGet(MlirContext ctx)
Create a void type.
bool mooreIsSimpleBitVectorType(MlirType type)
Checks whether the passed type is a simple bit-vector.
MlirType mooreUnpackedAssocDimTypeGet(MlirType inner)
Create a unpacked assoc dimension type without index.
MlirType mooreEnumTypeGetWithBase(MlirAttribute name, MlirLocation loc, MlirType base)
Create a enum type width base.
MlirType mooreChandleTypeGet(MlirContext ctx)
Create a chandle type.
MlirType moorePackedRangeDimTypeGet(MlirType inner, unsigned size, bool upDir, int offset)
Create a packed range dimension type.
MlirType mooreUnpackedQueueDimTypeGet(MlirType inner)
Create a unpacked queue dimension type without bound.
MlirType mooreIntTypeGet(MlirContext ctx, enum MooreIntKind kind, enum MooreSign sign)
Create an int type.
static IntType::Kind convertMooreIntKind(enum MooreIntKind kind)
unsigned mooreGetSimpleBitVectorSize(MlirType type)
Returns the size of a simple bit-vector type in bits.
bool mooreIsFourValuedType(MlirType type)
Checks whether the passed UnpackedType is a four-valued type.
MlirType mooreUnpackedUnsizedDimTypeGet(MlirType inner)
Create a unpacked unsized dimension type.
MlirType mooreEventTypeGet(MlirContext ctx)
Create a event type.
MlirType mooreUnpackedRangeDimTypeGet(MlirType inner, unsigned size, bool upDir, int offset)
Create a unpacked range dimension type.
MlirType mooreIntTypeGetLogic(MlirContext ctx)
Create a logic type.
MlirType moorePackedUnsizedDimTypeGet(MlirType inner)
Create a packed unsized dimension type.
MlirType mooreUnpackedArrayDimTypeGet(MlirType inner, unsigned size)
Create a unpacked array dimension type.
MlirType mooreIntTypeGetInt(MlirContext ctx)
Create an int type.
MlirType mooreStringTypeGet(MlirContext ctx)
Create a string type.
MlirType mooreUnpackedQueueDimTypeGetWithBound(MlirType inner, unsigned bound)
Create a unpacked queue dimension type with bound.
static RealType::Kind convertMooreRealKind(enum MooreRealKind kind)
MlirType mooreIntTypeGetTime(MlirContext ctx)
Create a time type.
MlirType mooreUnpackedAssocDimTypeGetWithIndex(MlirType inner, MlirType indexType)
Create a unpacked assoc dimension type with index.
MlirType mooreSimpleBitVectorTypeGet(MlirContext ctx, bool isFourValued, bool isSigned, unsigned size)
Create a simple bit-vector type.
@ MooreInteger
An integer.
@ MooreShortInt
A shortint.
@ MooreUnsigned
Explicitly marked to be unsigned.
@ MooreNone
No sign is explicitly given.
@ MooreSigned
Explicitly marked to be signed.
@ MooreRealTime
A realtime.
@ MooreShortReal
A shortreal.
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
static ChandleType get(MLIRContext *context)
static EnumType get(StringAttr name, Location loc, PackedType base={})
static EventType get(MLIRContext *context)
static IntType getLogic(MLIRContext *context)
Create a logic type.
static IntType getTime(MLIRContext *context)
Create a time type.
static IntType getInt(MLIRContext *context)
Create a int type.
static IntType get(MLIRContext *context, Kind kind, std::optional< Sign > sign={})
static PackedRangeDim get(PackedType inner, Range range)
static PackedUnsizedDim get(PackedType inner)
static RealType get(MLIRContext *context, Kind kind)
static StringType get(MLIRContext *context)
static UnpackedArrayDim get(UnpackedType inner, unsigned size)
static UnpackedAssocDim get(UnpackedType inner, UnpackedType indexType={})
static UnpackedQueueDim get(UnpackedType inner, std::optional< unsigned > bound={})
static UnpackedRangeDim get(UnpackedType inner, Range range)
An unpacked SystemVerilog type.
static UnpackedUnsizedDim get(UnpackedType inner)
static VoidType get(MLIRContext *context)
Domain
The number of values each bit of a type can assume.
@ FourValued
Four-valued types such as logic or integer.
@ TwoValued
Two-valued types such as bit or int.
RangeDir
Which side is greater in a range [a:b].
Sign
Whether a type is signed or unsigned.
@ Unsigned
An unsigned type.
This file defines an intermediate representation for circuits acting as an abstraction for constraint...
A simple bit vector type.