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 unwrap(type).isa<ArrayType>(); }
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(unwrap(type).cast<ArrayType>().getElementType());
48 }
49 
50 intptr_t hwArrayTypeGetSize(MlirType type) {
51  return unwrap(type).cast<ArrayType>().getNumElements();
52 }
53 
54 bool hwTypeIsAIntType(MlirType type) { return unwrap(type).isa<IntType>(); }
55 
56 MlirType hwParamIntTypeGet(MlirAttribute parameter) {
57  return wrap(IntType::get(unwrap(parameter).cast<TypedAttr>()));
58 }
59 
60 MlirAttribute hwParamIntTypeGetWidthAttr(MlirType type) {
61  return wrap(unwrap(type).cast<IntType>().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(unwrap(type).cast<InOutType>().getElementType());
70 }
71 
72 bool hwTypeIsAInOut(MlirType type) { return unwrap(type).isa<InOutType>(); }
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 unwrap(type).isa<StructType>();
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  unwrap(elements[i].name).cast<StringAttr>(), 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 = unwrap(structType).cast<StructType>();
147  return wrap(st.getFieldType(unwrap(fieldName)));
148 }
149 
150 MlirAttribute hwStructTypeGetFieldIndex(MlirType structType,
151  MlirStringRef fieldName) {
152  StructType st = unwrap(structType).cast<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 = unwrap(structType).cast<StructType>();
160  return st.getElements().size();
161 }
162 
163 HWStructFieldInfo hwStructTypeGetFieldNum(MlirType structType, unsigned idx) {
164  StructType st = unwrap(structType).cast<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 unwrap(type).isa<TypeAliasType>();
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 = unwrap(typeAlias).cast<TypeAliasType>();
190  return wrap(type.getCanonicalType());
191 }
192 
193 MlirType hwTypeAliasTypeGetInnerType(MlirType typeAlias) {
194  TypeAliasType type = unwrap(typeAlias).cast<TypeAliasType>();
195  return wrap(type.getInnerType());
196 }
197 
198 MlirStringRef hwTypeAliasTypeGetName(MlirType typeAlias) {
199  TypeAliasType type = unwrap(typeAlias).cast<TypeAliasType>();
200  return wrap(type.getRef().getLeafReference().getValue());
201 }
202 
203 MlirStringRef hwTypeAliasTypeGetScope(MlirType typeAlias) {
204  TypeAliasType type = unwrap(typeAlias).cast<TypeAliasType>();
205  return wrap(type.getRef().getRootReference().getValue());
206 }
207 
208 //===----------------------------------------------------------------------===//
209 // Attribute API.
210 //===----------------------------------------------------------------------===//
211 
212 bool hwAttrIsAInnerSymAttr(MlirAttribute attr) {
213  return unwrap(attr).isa<InnerSymAttr>();
214 }
215 
216 MlirAttribute hwInnerSymAttrGet(MlirAttribute symName) {
217  return wrap(InnerSymAttr::get(unwrap(symName).cast<StringAttr>()));
218 }
219 
220 MlirAttribute hwInnerSymAttrGetSymName(MlirAttribute innerSymAttr) {
221  return wrap(
222  (Attribute)unwrap(innerSymAttr).cast<InnerSymAttr>().getSymName());
223 }
224 
225 bool hwAttrIsAInnerRefAttr(MlirAttribute attr) {
226  return unwrap(attr).isa<InnerRefAttr>();
227 }
228 
229 MlirAttribute hwInnerRefAttrGet(MlirAttribute moduleName,
230  MlirAttribute innerSym) {
231  auto moduleNameAttr = unwrap(moduleName).cast<StringAttr>();
232  auto innerSymAttr = unwrap(innerSym).cast<StringAttr>();
233  return wrap(InnerRefAttr::get(moduleNameAttr, innerSymAttr));
234 }
235 
236 MlirAttribute hwInnerRefAttrGetName(MlirAttribute innerRefAttr) {
237  return wrap((Attribute)unwrap(innerRefAttr).cast<InnerRefAttr>().getName());
238 }
239 
240 MlirAttribute hwInnerRefAttrGetModule(MlirAttribute innerRefAttr) {
241  return wrap((Attribute)unwrap(innerRefAttr).cast<InnerRefAttr>().getModule());
242 }
243 
244 MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclAttr(MlirAttribute attr) {
245  return unwrap(attr).isa<ParamDeclAttr>();
246 }
247 MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGet(MlirStringRef cName,
248  MlirType cType,
249  MlirAttribute cValue) {
250  auto type = unwrap(cType);
251  auto name = StringAttr::get(type.getContext(), unwrap(cName));
252  return wrap(
253  ParamDeclAttr::get(type.getContext(), name, type, unwrap(cValue)));
254 }
255 MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclAttrGetName(MlirAttribute decl) {
256  return wrap(unwrap(decl).cast<ParamDeclAttr>().getName().getValue());
257 }
258 MLIR_CAPI_EXPORTED MlirType hwParamDeclAttrGetType(MlirAttribute decl) {
259  return wrap(unwrap(decl).cast<ParamDeclAttr>().getType());
260 }
261 MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGetValue(MlirAttribute decl) {
262  return wrap(unwrap(decl).cast<ParamDeclAttr>().getValue());
263 }
264 
265 MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclRefAttr(MlirAttribute attr) {
266  return unwrap(attr).isa<ParamDeclRefAttr>();
267 }
268 
269 MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclRefAttrGet(MlirContext ctx,
270  MlirStringRef cName) {
271  auto name = StringAttr::get(unwrap(ctx), unwrap(cName));
272  return wrap(ParamDeclRefAttr::get(unwrap(ctx), name,
273  IntegerType::get(unwrap(ctx), 32)));
274 }
275 
276 MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclRefAttrGetName(MlirAttribute decl) {
277  return wrap(unwrap(decl).cast<ParamDeclRefAttr>().getName().getValue());
278 }
279 MLIR_CAPI_EXPORTED MlirType hwParamDeclRefAttrGetType(MlirAttribute decl) {
280  return wrap(unwrap(decl).cast<ParamDeclRefAttr>().getType());
281 }
282 
283 MLIR_CAPI_EXPORTED bool hwAttrIsAParamVerbatimAttr(MlirAttribute attr) {
284  return unwrap(attr).isa<ParamVerbatimAttr>();
285 }
286 MLIR_CAPI_EXPORTED MlirAttribute hwParamVerbatimAttrGet(MlirAttribute text) {
287  auto textAttr = unwrap(text).cast<StringAttr>();
288  MLIRContext *ctx = textAttr.getContext();
289  auto type = NoneType::get(ctx);
290  return wrap(ParamVerbatimAttr::get(ctx, textAttr, type));
291 }
292 
293 MLIR_CAPI_EXPORTED bool hwAttrIsAOutputFileAttr(MlirAttribute attr) {
294  return unwrap(attr).isa<OutputFileAttr>();
295 }
296 MLIR_CAPI_EXPORTED MlirAttribute
297 hwOutputFileGetFromFileName(MlirAttribute fileName, bool excludeFromFileList,
298  bool includeReplicatedOp) {
299  auto fileNameStrAttr = unwrap(fileName).cast<StringAttr>();
300  return wrap(OutputFileAttr::getFromFilename(
301  fileNameStrAttr.getContext(), fileNameStrAttr.getValue(),
302  excludeFromFileList, includeReplicatedOp));
303 }
304 
305 MLIR_CAPI_EXPORTED HWInstanceGraph hwInstanceGraphGet(MlirOperation operation) {
306  return wrap(new InstanceGraph{unwrap(operation)});
307 }
308 
309 MLIR_CAPI_EXPORTED void hwInstanceGraphDestroy(HWInstanceGraph instanceGraph) {
310  delete unwrap(instanceGraph);
311 }
312 
313 MLIR_CAPI_EXPORTED HWInstanceGraphNode
314 hwInstanceGraphGetTopLevelNode(HWInstanceGraph instanceGraph) {
315  return wrap(unwrap(instanceGraph)->getTopLevelNode());
316 }
317 
318 MLIR_CAPI_EXPORTED void
319 hwInstanceGraphForEachNode(HWInstanceGraph instanceGraph,
321  void *userData) {
322  InstanceGraph *graph = unwrap(instanceGraph);
323  for (const auto &inst : llvm::post_order(graph)) {
324  callback(wrap(inst), userData);
325  }
326 }
327 
328 MLIR_CAPI_EXPORTED bool hwInstanceGraphNodeEqual(HWInstanceGraphNode lhs,
329  HWInstanceGraphNode rhs) {
330  return unwrap(lhs) == unwrap(rhs);
331 }
332 
333 MLIR_CAPI_EXPORTED MlirModule
334 hwInstanceGraphNodeGetModule(HWInstanceGraphNode node) {
335  return wrap(dyn_cast<ModuleOp>(unwrap(node)->getModule()));
336 }
337 
338 MLIR_CAPI_EXPORTED MlirOperation
339 hwInstanceGraphNodeGetModuleOp(HWInstanceGraphNode node) {
340  return wrap(unwrap(node)->getModule());
341 }
DEFINE_C_API_PTR_METHODS(CirctFirtoolFirtoolOptions, circt::firtool::FirtoolOptions) CirctFirtoolFirtoolOptions circtFirtoolOptionsCreateDefault()
Definition: Firtool.cpp:20
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:247
MlirAttribute hwInnerRefAttrGetModule(MlirAttribute innerRefAttr)
Definition: HW.cpp:240
MLIR_CAPI_EXPORTED MlirType hwParamDeclAttrGetType(MlirAttribute decl)
Definition: HW.cpp:258
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:314
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:339
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:229
MLIR_CAPI_EXPORTED bool hwInstanceGraphNodeEqual(HWInstanceGraphNode lhs, HWInstanceGraphNode rhs)
Definition: HW.cpp:328
MLIR_CAPI_EXPORTED MlirModule hwInstanceGraphNodeGetModule(HWInstanceGraphNode node)
Definition: HW.cpp:334
MLIR_CAPI_EXPORTED HWInstanceGraph hwInstanceGraphGet(MlirOperation operation)
Definition: HW.cpp:305
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:261
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:309
MLIR_CAPI_EXPORTED void hwInstanceGraphForEachNode(HWInstanceGraph instanceGraph, HWInstanceGraphNodeCallback callback, void *userData)
Definition: HW.cpp:319
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:283
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:293
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:297
MlirAttribute hwInnerRefAttrGetName(MlirAttribute innerRefAttr)
Definition: HW.cpp:236
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:265
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:276
MlirStringRef hwTypeAliasTypeGetName(MlirType typeAlias)
Definition: HW.cpp:198
bool hwAttrIsAInnerRefAttr(MlirAttribute attr)
Definition: HW.cpp:225
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclRefAttrGet(MlirContext ctx, MlirStringRef cName)
Definition: HW.cpp:269
MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclAttr(MlirAttribute attr)
Definition: HW.cpp:244
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:255
MLIR_CAPI_EXPORTED MlirAttribute hwParamVerbatimAttrGet(MlirAttribute text)
Definition: HW.cpp:286
MLIR_CAPI_EXPORTED MlirType hwParamDeclRefAttrGetType(MlirAttribute decl)
Definition: HW.cpp:279
@ 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:34
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:102
circt::hw::InOutType InOutType
Definition: SVTypes.h:25
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