16 #include "mlir/IR/Builders.h"
17 #include "mlir/IR/BuiltinTypes.h"
18 #include "mlir/IR/Diagnostics.h"
19 #include "mlir/IR/DialectImplementation.h"
20 #include "mlir/IR/StorageUniquerSupport.h"
21 #include "mlir/IR/Types.h"
22 #include "llvm/ADT/StringExtras.h"
23 #include "llvm/ADT/TypeSwitch.h"
26 using namespace circt;
33 #define GET_TYPEDEF_CLASSES
34 #include "circt/Dialect/Seq/SeqTypes.cpp.inc"
36 void SeqDialect::registerTypes() {
38 #define GET_TYPEDEF_LIST
39 #include "circt/Dialect/Seq/SeqTypes.cpp.inc"
48 if (hw::type_isa<seq::ClockType>(ty))
59 HLMemType HLMemType::cloneWith(std::optional<ArrayRef<int64_t>> shape,
65 llvm::SmallVector<Type> HLMemType::getAddressTypes()
const {
66 auto *ctx = getContext();
67 llvm::SmallVector<Type> addressTypes;
68 for (
auto dim : getShape())
73 Type HLMemType::parse(mlir::AsmParser &odsParser) {
74 llvm::SmallVector<int64_t> shape;
76 if (odsParser.parseLess() ||
77 odsParser.parseDimensionList(shape,
false,
79 odsParser.parseType(
elementType) || odsParser.parseGreater())
85 void HLMemType::print(AsmPrinter &odsPrinter)
const {
87 for (
auto dim : getShape())
88 odsPrinter << dim <<
'x';
89 odsPrinter << getElementType();
94 HLMemType::verify(llvm::function_ref<::mlir::InFlightDiagnostic()> emitError,
95 llvm::ArrayRef<int64_t> shape, Type elementType) {
97 return emitError() << "shape must have at least one dimension.";
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
std::optional< int64_t > getBitWidth(FIRRTLBaseType type, bool ignoreFlip=false)
bool isHWIntegerType(mlir::Type type)
Return true if the specified type is a value HW Integer type.
bool isClockOrI1Type(Type ty)
Returns true if the type is i1 or seq.clock
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.