CIRCT  19.0.0git
HW.cpp
Go to the documentation of this file.
1 //===- HW.cpp - C interface for the HW 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 
9 #include "circt-c/Dialect/HW.h"
12 #include "circt/Dialect/HW/HWOps.h"
14 #include "circt/Support/LLVM.h"
15 #include "mlir/CAPI/IR.h"
16 #include "mlir/CAPI/Registration.h"
17 #include "mlir/CAPI/Support.h"
18 #include "llvm/ADT/PostOrderIterator.h"
19 
20 using namespace circt;
21 using namespace circt::hw;
22 
25 
26 //===----------------------------------------------------------------------===//
27 // Dialect API.
28 //===----------------------------------------------------------------------===//
29 
31 
32 //===----------------------------------------------------------------------===//
33 // Type API.
34 //===----------------------------------------------------------------------===//
35 
36 int64_t hwGetBitWidth(MlirType type) { return getBitWidth(unwrap(type)); }
37 
38 bool hwTypeIsAValueType(MlirType type) { return isHWValueType(unwrap(type)); }
39 
40 bool hwTypeIsAArrayType(MlirType type) { return isa<ArrayType>(unwrap(type)); }
41 
42 MlirType hwArrayTypeGet(MlirType element, size_t size) {
43  return wrap(ArrayType::get(unwrap(element), size));
44 }
45 
46 MlirType hwArrayTypeGetElementType(MlirType type) {
47  return wrap(cast<ArrayType>(unwrap(type)).getElementType());
48 }
49 
50 intptr_t hwArrayTypeGetSize(MlirType type) {
51  return cast<ArrayType>(unwrap(type)).getNumElements();
52 }
53 
54 bool hwTypeIsAIntType(MlirType type) { return isa<IntType>(unwrap(type)); }
55 
56 MlirType hwParamIntTypeGet(MlirAttribute parameter) {
57  return wrap(IntType::get(cast<TypedAttr>(unwrap(parameter))));
58 }
59 
60 MlirAttribute hwParamIntTypeGetWidthAttr(MlirType type) {
61  return wrap(cast<IntType>(unwrap(type)).getWidth());
62 }
63 
64 MlirType hwInOutTypeGet(MlirType element) {
65  return wrap(InOutType::get(unwrap(element)));
66 }
67 
68 MlirType hwInOutTypeGetElementType(MlirType type) {
69  return wrap(cast<InOutType>(unwrap(type)).getElementType());
70 }
71 
72 bool hwTypeIsAInOut(MlirType type) { return isa<InOutType>(unwrap(type)); }
73 
74 bool hwTypeIsAModuleType(MlirType type) {
75  return isa<ModuleType>(unwrap(type));
76 }
77 
78 MlirType hwModuleTypeGet(MlirContext ctx, intptr_t numPorts,
79  HWModulePort const *ports) {
80  SmallVector<ModulePort> modulePorts;
81  for (intptr_t i = 0; i < numPorts; ++i) {
82  HWModulePort port = ports[i];
83 
85  switch (port.dir) {
88  break;
91  break;
94  break;
95  }
96 
97  StringAttr name = cast<StringAttr>(unwrap(port.name));
98  Type type = unwrap(port.type);
99 
100  modulePorts.push_back(ModulePort{name, type, dir});
101  }
102 
103  return wrap(ModuleType::get(unwrap(ctx), modulePorts));
104 }
105 
106 intptr_t hwModuleTypeGetNumInputs(MlirType type) {
107  return cast<ModuleType>(unwrap(type)).getNumInputs();
108 }
109 
110 MlirType hwModuleTypeGetInputType(MlirType type, intptr_t index) {
111  return wrap(cast<ModuleType>(unwrap(type)).getInputType(index));
112 }
113 
114 MlirStringRef hwModuleTypeGetInputName(MlirType type, intptr_t index) {
115  return wrap(cast<ModuleType>(unwrap(type)).getInputName(index));
116 }
117 
118 intptr_t hwModuleTypeGetNumOutputs(MlirType type) {
119  return cast<ModuleType>(unwrap(type)).getNumOutputs();
120 }
121 
122 MlirType hwModuleTypeGetOutputType(MlirType type, intptr_t index) {
123  return wrap(cast<ModuleType>(unwrap(type)).getOutputType(index));
124 }
125 
126 MlirStringRef hwModuleTypeGetOutputName(MlirType type, intptr_t index) {
127  return wrap(cast<ModuleType>(unwrap(type)).getOutputName(index));
128 }
129 
130 bool hwTypeIsAStructType(MlirType type) {
131  return isa<StructType>(unwrap(type));
132 }
133 
134 MlirType hwStructTypeGet(MlirContext ctx, intptr_t numElements,
135  HWStructFieldInfo const *elements) {
136  SmallVector<StructType::FieldInfo> fieldInfos;
137  fieldInfos.reserve(numElements);
138  for (intptr_t i = 0; i < numElements; ++i) {
139  fieldInfos.push_back(StructType::FieldInfo{
140  cast<StringAttr>(unwrap(elements[i].name)), unwrap(elements[i].type)});
141  }
142  return wrap(StructType::get(unwrap(ctx), fieldInfos));
143 }
144 
145 MlirType hwStructTypeGetField(MlirType structType, MlirStringRef fieldName) {
146  StructType st = cast<StructType>(unwrap(structType));
147  return wrap(st.getFieldType(unwrap(fieldName)));
148 }
149 
150 MlirAttribute hwStructTypeGetFieldIndex(MlirType structType,
151  MlirStringRef fieldName) {
152  StructType st = cast<StructType>(unwrap(structType));
153  if (auto idx = st.getFieldIndex(unwrap(fieldName)))
154  return wrap(IntegerAttr::get(IntegerType::get(st.getContext(), 32), *idx));
155  return wrap(UnitAttr::get(st.getContext()));
156 }
157 
158 intptr_t hwStructTypeGetNumFields(MlirType structType) {
159  StructType st = cast<StructType>(unwrap(structType));
160  return st.getElements().size();
161 }
162 
163 HWStructFieldInfo hwStructTypeGetFieldNum(MlirType structType, unsigned idx) {
164  StructType st = cast<StructType>(unwrap(structType));
165  auto cppField = st.getElements()[idx];
166  HWStructFieldInfo ret;
167  ret.name = wrap(cppField.name);
168  ret.type = wrap(cppField.type);
169  return ret;
170 }
171 
172 bool hwTypeIsATypeAliasType(MlirType type) {
173  return isa<TypeAliasType>(unwrap(type));
174 }
175 
176 MlirType hwTypeAliasTypeGet(MlirStringRef cScope, MlirStringRef cName,
177  MlirType cInnerType) {
178  StringRef scope = unwrap(cScope);
179  StringRef name = unwrap(cName);
180  Type innerType = unwrap(cInnerType);
181  FlatSymbolRefAttr nameRef =
182  FlatSymbolRefAttr::get(innerType.getContext(), name);
183  SymbolRefAttr ref =
184  SymbolRefAttr::get(innerType.getContext(), scope, {nameRef});
185  return wrap(TypeAliasType::get(ref, innerType));
186 }
187 
188 MlirType hwTypeAliasTypeGetCanonicalType(MlirType typeAlias) {
189  TypeAliasType type = cast<TypeAliasType>(unwrap(typeAlias));
190  return wrap(type.getCanonicalType());
191 }
192 
193 MlirType hwTypeAliasTypeGetInnerType(MlirType typeAlias) {
194  TypeAliasType type = cast<TypeAliasType>(unwrap(typeAlias));
195  return wrap(type.getInnerType());
196 }
197 
198 MlirStringRef hwTypeAliasTypeGetName(MlirType typeAlias) {
199  TypeAliasType type = cast<TypeAliasType>(unwrap(typeAlias));
200  return wrap(type.getRef().getLeafReference().getValue());
201 }
202 
203 MlirStringRef hwTypeAliasTypeGetScope(MlirType typeAlias) {
204  TypeAliasType type = cast<TypeAliasType>(unwrap(typeAlias));
205  return wrap(type.getRef().getRootReference().getValue());
206 }
207 
208 //===----------------------------------------------------------------------===//
209 // Attribute API.
210 //===----------------------------------------------------------------------===//
211 
212 bool hwAttrIsAInnerSymAttr(MlirAttribute attr) {
213  return isa<InnerSymAttr>(unwrap(attr));
214 }
215 
216 MlirAttribute hwInnerSymAttrGet(MlirAttribute symName) {
217  return wrap(InnerSymAttr::get(cast<StringAttr>(unwrap(symName))));
218 }
219 
220 MlirAttribute hwInnerSymAttrGetSymName(MlirAttribute innerSymAttr) {
221  return wrap((Attribute)cast<InnerSymAttr>(unwrap(innerSymAttr)).getSymName());
222 }
223 
224 bool hwAttrIsAInnerRefAttr(MlirAttribute attr) {
225  return isa<InnerRefAttr>(unwrap(attr));
226 }
227 
228 MlirAttribute hwInnerRefAttrGet(MlirAttribute moduleName,
229  MlirAttribute innerSym) {
230  auto moduleNameAttr = cast<StringAttr>(unwrap(moduleName));
231  auto innerSymAttr = cast<StringAttr>(unwrap(innerSym));
232  return wrap(InnerRefAttr::get(moduleNameAttr, innerSymAttr));
233 }
234 
235 MlirAttribute hwInnerRefAttrGetName(MlirAttribute innerRefAttr) {
236  return wrap((Attribute)cast<InnerRefAttr>(unwrap(innerRefAttr)).getName());
237 }
238 
239 MlirAttribute hwInnerRefAttrGetModule(MlirAttribute innerRefAttr) {
240  return wrap((Attribute)cast<InnerRefAttr>(unwrap(innerRefAttr)).getModule());
241 }
242 
243 MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclAttr(MlirAttribute attr) {
244  return isa<ParamDeclAttr>(unwrap(attr));
245 }
246 MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGet(MlirStringRef cName,
247  MlirType cType,
248  MlirAttribute cValue) {
249  auto type = unwrap(cType);
250  auto name = StringAttr::get(type.getContext(), unwrap(cName));
251  return wrap(
252  ParamDeclAttr::get(type.getContext(), name, type, unwrap(cValue)));
253 }
254 MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclAttrGetName(MlirAttribute decl) {
255  return wrap(cast<ParamDeclAttr>(unwrap(decl)).getName().getValue());
256 }
257 MLIR_CAPI_EXPORTED MlirType hwParamDeclAttrGetType(MlirAttribute decl) {
258  return wrap(cast<ParamDeclAttr>(unwrap(decl)).getType());
259 }
260 MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGetValue(MlirAttribute decl) {
261  return wrap(cast<ParamDeclAttr>(unwrap(decl)).getValue());
262 }
263 
264 MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclRefAttr(MlirAttribute attr) {
265  return isa<ParamDeclRefAttr>(unwrap(attr));
266 }
267 
268 MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclRefAttrGet(MlirContext ctx,
269  MlirStringRef cName) {
270  auto name = StringAttr::get(unwrap(ctx), unwrap(cName));
271  return wrap(ParamDeclRefAttr::get(unwrap(ctx), name,
272  IntegerType::get(unwrap(ctx), 32)));
273 }
274 
275 MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclRefAttrGetName(MlirAttribute decl) {
276  return wrap(cast<ParamDeclRefAttr>(unwrap(decl)).getName().getValue());
277 }
278 MLIR_CAPI_EXPORTED MlirType hwParamDeclRefAttrGetType(MlirAttribute decl) {
279  return wrap(cast<ParamDeclRefAttr>(unwrap(decl)).getType());
280 }
281 
282 MLIR_CAPI_EXPORTED bool hwAttrIsAParamVerbatimAttr(MlirAttribute attr) {
283  return isa<ParamVerbatimAttr>(unwrap(attr));
284 }
285 MLIR_CAPI_EXPORTED MlirAttribute hwParamVerbatimAttrGet(MlirAttribute text) {
286  auto textAttr = cast<StringAttr>(unwrap(text));
287  MLIRContext *ctx = textAttr.getContext();
288  auto type = NoneType::get(ctx);
289  return wrap(ParamVerbatimAttr::get(ctx, textAttr, type));
290 }
291 
292 MLIR_CAPI_EXPORTED bool hwAttrIsAOutputFileAttr(MlirAttribute attr) {
293  return isa<OutputFileAttr>(unwrap(attr));
294 }
295 MLIR_CAPI_EXPORTED MlirAttribute
296 hwOutputFileGetFromFileName(MlirAttribute fileName, bool excludeFromFileList,
297  bool includeReplicatedOp) {
298  auto fileNameStrAttr = cast<StringAttr>(unwrap(fileName));
299  return wrap(OutputFileAttr::getFromFilename(
300  fileNameStrAttr.getContext(), fileNameStrAttr.getValue(),
301  excludeFromFileList, includeReplicatedOp));
302 }
303 
304 MLIR_CAPI_EXPORTED HWInstanceGraph hwInstanceGraphGet(MlirOperation operation) {
305  return wrap(new InstanceGraph{unwrap(operation)});
306 }
307 
308 MLIR_CAPI_EXPORTED void hwInstanceGraphDestroy(HWInstanceGraph instanceGraph) {
309  delete unwrap(instanceGraph);
310 }
311 
312 MLIR_CAPI_EXPORTED HWInstanceGraphNode
313 hwInstanceGraphGetTopLevelNode(HWInstanceGraph instanceGraph) {
314  return wrap(unwrap(instanceGraph)->getTopLevelNode());
315 }
316 
317 MLIR_CAPI_EXPORTED void
318 hwInstanceGraphForEachNode(HWInstanceGraph instanceGraph,
320  void *userData) {
321  InstanceGraph *graph = unwrap(instanceGraph);
322  for (const auto &inst : llvm::post_order(graph)) {
323  callback(wrap(inst), userData);
324  }
325 }
326 
327 MLIR_CAPI_EXPORTED bool hwInstanceGraphNodeEqual(HWInstanceGraphNode lhs,
328  HWInstanceGraphNode rhs) {
329  return unwrap(lhs) == unwrap(rhs);
330 }
331 
332 MLIR_CAPI_EXPORTED MlirModule
333 hwInstanceGraphNodeGetModule(HWInstanceGraphNode node) {
334  return wrap(dyn_cast<ModuleOp>(unwrap(node)->getModule().getOperation()));
335 }
336 
337 MLIR_CAPI_EXPORTED MlirOperation
338 hwInstanceGraphNodeGetModuleOp(HWInstanceGraphNode node) {
339  return wrap(unwrap(node)->getModule());
340 }
DEFINE_C_API_PTR_METHODS(CirctFirtoolFirtoolOptions, circt::firtool::FirtoolOptions) CirctFirtoolFirtoolOptions circtFirtoolOptionsCreateDefault()
Definition: Firtool.cpp:18
return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements))
MlirType uint64_t numElements
Definition: CHIRRTL.cpp:30
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGet(MlirStringRef cName, MlirType cType, MlirAttribute cValue)
Definition: HW.cpp:246
MlirAttribute hwInnerRefAttrGetModule(MlirAttribute innerRefAttr)
Definition: HW.cpp:239
MLIR_CAPI_EXPORTED MlirType hwParamDeclAttrGetType(MlirAttribute decl)
Definition: HW.cpp:257
MlirType hwInOutTypeGet(MlirType element)
Creates an HW inout type in the context associated with element.
Definition: HW.cpp:64
MlirType hwArrayTypeGet(MlirType element, size_t size)
Creates a fixed-size HW array type in the context associated with element.
Definition: HW.cpp:42
intptr_t hwArrayTypeGetSize(MlirType type)
returns the size of an array type
Definition: HW.cpp:50
MlirType hwStructTypeGet(MlirContext ctx, intptr_t numElements, HWStructFieldInfo const *elements)
Creates an HW struct type in the context associated with the elements.
Definition: HW.cpp:134
MlirType hwArrayTypeGetElementType(MlirType type)
returns the element type of an array type
Definition: HW.cpp:46
MLIR_CAPI_EXPORTED HWInstanceGraphNode hwInstanceGraphGetTopLevelNode(HWInstanceGraph instanceGraph)
Definition: HW.cpp:313
intptr_t hwModuleTypeGetNumInputs(MlirType type)
Get an HW module type's number of inputs.
Definition: HW.cpp:106
MLIR_CAPI_EXPORTED MlirOperation hwInstanceGraphNodeGetModuleOp(HWInstanceGraphNode node)
Definition: HW.cpp:338
intptr_t hwStructTypeGetNumFields(MlirType structType)
Definition: HW.cpp:158
bool hwTypeIsAArrayType(MlirType type)
If the type is an HW array.
Definition: HW.cpp:40
bool hwTypeIsATypeAliasType(MlirType type)
If the type is an HW type alias.
Definition: HW.cpp:172
MlirType hwTypeAliasTypeGetInnerType(MlirType typeAlias)
Definition: HW.cpp:193
MlirType hwTypeAliasTypeGetCanonicalType(MlirType typeAlias)
Definition: HW.cpp:188
MlirType hwStructTypeGetField(MlirType structType, MlirStringRef fieldName)
Definition: HW.cpp:145
MlirAttribute hwInnerRefAttrGet(MlirAttribute moduleName, MlirAttribute innerSym)
Definition: HW.cpp:228
MLIR_CAPI_EXPORTED bool hwInstanceGraphNodeEqual(HWInstanceGraphNode lhs, HWInstanceGraphNode rhs)
Definition: HW.cpp:327
MLIR_CAPI_EXPORTED MlirModule hwInstanceGraphNodeGetModule(HWInstanceGraphNode node)
Definition: HW.cpp:333
MLIR_CAPI_EXPORTED HWInstanceGraph hwInstanceGraphGet(MlirOperation operation)
Definition: HW.cpp:304
bool hwTypeIsAIntType(MlirType type)
If the type is an HW int.
Definition: HW.cpp:54
MlirType hwModuleTypeGetInputType(MlirType type, intptr_t index)
Get an HW module type's input type at a specific index.
Definition: HW.cpp:110
bool hwTypeIsAInOut(MlirType type)
If the type is an HW inout.
Definition: HW.cpp:72
MlirStringRef hwModuleTypeGetInputName(MlirType type, intptr_t index)
Get an HW module type's input name at a specific index.
Definition: HW.cpp:114
MlirType hwModuleTypeGet(MlirContext ctx, intptr_t numPorts, HWModulePort const *ports)
Creates an HW module type.
Definition: HW.cpp:78
MlirAttribute hwStructTypeGetFieldIndex(MlirType structType, MlirStringRef fieldName)
Definition: HW.cpp:150
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGetValue(MlirAttribute decl)
Definition: HW.cpp:260
MlirAttribute hwInnerSymAttrGetSymName(MlirAttribute innerSymAttr)
Definition: HW.cpp:220
MlirAttribute hwInnerSymAttrGet(MlirAttribute symName)
Definition: HW.cpp:216
MLIR_CAPI_EXPORTED void hwInstanceGraphDestroy(HWInstanceGraph instanceGraph)
Definition: HW.cpp:308
MLIR_CAPI_EXPORTED void hwInstanceGraphForEachNode(HWInstanceGraph instanceGraph, HWInstanceGraphNodeCallback callback, void *userData)
Definition: HW.cpp:318
MlirStringRef hwTypeAliasTypeGetScope(MlirType typeAlias)
Definition: HW.cpp:203
MlirType hwInOutTypeGetElementType(MlirType type)
Returns the element type of an inout type.
Definition: HW.cpp:68
MlirType hwTypeAliasTypeGet(MlirStringRef cScope, MlirStringRef cName, MlirType cInnerType)
Definition: HW.cpp:176
bool hwTypeIsAValueType(MlirType type)
Return true if the specified type can be used as an HW value type, that is the set of types that can ...
Definition: HW.cpp:38
bool hwAttrIsAInnerSymAttr(MlirAttribute attr)
Definition: HW.cpp:212
MLIR_CAPI_EXPORTED bool hwAttrIsAParamVerbatimAttr(MlirAttribute attr)
Definition: HW.cpp:282
bool hwTypeIsAStructType(MlirType type)
If the type is an HW struct.
Definition: HW.cpp:130
MLIR_CAPI_EXPORTED bool hwAttrIsAOutputFileAttr(MlirAttribute attr)
Definition: HW.cpp:292
MlirType hwParamIntTypeGet(MlirAttribute parameter)
Definition: HW.cpp:56
MlirStringRef hwModuleTypeGetOutputName(MlirType type, intptr_t index)
Get an HW module type's output name at a specific index.
Definition: HW.cpp:126
MLIR_CAPI_EXPORTED MlirAttribute hwOutputFileGetFromFileName(MlirAttribute fileName, bool excludeFromFileList, bool includeReplicatedOp)
Definition: HW.cpp:296
MlirAttribute hwInnerRefAttrGetName(MlirAttribute innerRefAttr)
Definition: HW.cpp:235
HWStructFieldInfo hwStructTypeGetFieldNum(MlirType structType, unsigned idx)
Definition: HW.cpp:163
bool hwTypeIsAModuleType(MlirType type)
If the type is an HW module type.
Definition: HW.cpp:74
MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclRefAttr(MlirAttribute attr)
Definition: HW.cpp:264
int64_t hwGetBitWidth(MlirType type)
Return the hardware bit width of a type.
Definition: HW.cpp:36
MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclRefAttrGetName(MlirAttribute decl)
Definition: HW.cpp:275
MlirStringRef hwTypeAliasTypeGetName(MlirType typeAlias)
Definition: HW.cpp:198
bool hwAttrIsAInnerRefAttr(MlirAttribute attr)
Definition: HW.cpp:224
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclRefAttrGet(MlirContext ctx, MlirStringRef cName)
Definition: HW.cpp:268
MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclAttr(MlirAttribute attr)
Definition: HW.cpp:243
MlirType hwModuleTypeGetOutputType(MlirType type, intptr_t index)
Get an HW module type's output type at a specific index.
Definition: HW.cpp:122
MlirAttribute hwParamIntTypeGetWidthAttr(MlirType type)
Definition: HW.cpp:60
intptr_t hwModuleTypeGetNumOutputs(MlirType type)
Get an HW module type's number of outputs.
Definition: HW.cpp:118
MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclAttrGetName(MlirAttribute decl)
Definition: HW.cpp:254
MLIR_CAPI_EXPORTED MlirAttribute hwParamVerbatimAttrGet(MlirAttribute text)
Definition: HW.cpp:285
MLIR_CAPI_EXPORTED MlirType hwParamDeclRefAttrGetType(MlirAttribute decl)
Definition: HW.cpp:278
@ Input
Definition: HW.h:35
@ Output
Definition: HW.h:35
@ InOut
Definition: HW.h:35
void(* HWInstanceGraphNodeCallback)(HWInstanceGraphNode, void *)
Definition: HW.h:205
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
Definition: OM.cpp:96
HW-specific instance graph with a virtual entry node linking to all publicly visible modules.
This is a Node in the InstanceGraph.
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
Definition: CalyxOps.cpp:54
uint64_t getWidth(Type t)
Definition: ESIPasses.cpp:32
mlir::Type innerType(mlir::Type type)
Definition: ESITypes.cpp:184
StringAttr getName(ArrayAttr names, size_t idx)
Return the name at the specified index of the ArrayAttr or null if it cannot be determined.
bool isHWValueType(mlir::Type type)
Return true if the specified type can be used as an HW value type, that is the set of types that can ...
int64_t getBitWidth(mlir::Type type)
Return the hardware bit width of a type.
Definition: HWTypes.cpp:109
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: hw.py:1
HWModulePortDirection dir
Definition: HW.h:41
MlirAttribute name
Definition: HW.h:39
MlirType type
Definition: HW.h:40
MlirIdentifier name
Definition: HW.h:30
MlirType type
Definition: HW.h:31