CIRCT  20.0.0git
FIRRTL.h
Go to the documentation of this file.
1 //===- FIRRTL.h - C interface for the FIRRTL dialect --------------*- C -*-===//
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 // This file declares the C-API for FIRRTL dialect.
10 //
11 // A complete example of using these C-APIs is Chisel, see
12 // https://github.com/chipsalliance/chisel/blob/4f392323e9160440961b9f06e383d3f2742d2f3e/panamaconverter/src/PanamaCIRCTConverter.scala
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef CIRCT_C_DIALECT_FIRRTL_H
17 #define CIRCT_C_DIALECT_FIRRTL_H
18 
19 #include "mlir-c/IR.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /// Module instantiation conventions.
26 // NOLINTNEXTLINE(modernize-use-using)
27 typedef enum FIRRTLConvention {
31 
32 /// Port direction.
33 // NOLINTNEXTLINE(modernize-use-using)
34 typedef enum FIRRTLDirection {
38 
39 /// Name preservation.
40 ///
41 /// Names tagged with `FIRRTL_NAME_KIND_INTERESTING_NAME` will be preserved.
42 // NOLINTNEXTLINE(modernize-use-using)
43 typedef enum FIRRTLNameKind {
47 
48 /// Read-Under-Write behaviour.
49 // NOLINTNEXTLINE(modernize-use-using)
50 typedef enum FIRRTLRUW {
55 
56 /// Memory port direction.
57 // NOLINTNEXTLINE(modernize-use-using)
58 typedef enum FIRRTLMemDir {
64 
65 /// Edge control trigger.
66 // NOLINTNEXTLINE(modernize-use-using)
67 typedef enum FIRRTLEventControl {
72 
73 /// Flow of value.
74 // NOLINTNEXTLINE(modernize-use-using)
75 typedef enum FIRRTLValueFlow {
81 
82 /// Describes a field in a bundle type.
83 // NOLINTNEXTLINE(modernize-use-using)
84 typedef struct FIRRTLBundleField {
85  MlirIdentifier name;
86  bool isFlip;
87  MlirType type;
89 
90 /// Describes an element in a class type.
91 // NOLINTNEXTLINE(modernize-use-using)
92 typedef struct FIRRTLClassElement {
93  MlirIdentifier name;
94  MlirType type;
97 
98 //===----------------------------------------------------------------------===//
99 // Dialect API.
100 //===----------------------------------------------------------------------===//
101 
103 
104 //===----------------------------------------------------------------------===//
105 // Type API.
106 //===----------------------------------------------------------------------===//
107 
108 /// Returns `true` if this is a const type whose value is guaranteed to be
109 /// unchanging at circuit execution time.
110 MLIR_CAPI_EXPORTED bool firrtlTypeIsConst(MlirType type);
111 
112 /// Returns a const or non-const version of this type.
113 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetConstType(MlirType type, bool isConst);
114 
115 /// Gets the bit width for this type, returns -1 if unknown.
116 ///
117 /// It recursively computes the bit width of aggregate types. For bundle and
118 /// vectors, recursively get the width of each field element and return the
119 /// total bit width of the aggregate type. This returns -1, if any of the bundle
120 /// fields is a flip type, or ground type with unknown bit width.
121 MLIR_CAPI_EXPORTED int64_t firrtlTypeGetBitWidth(MlirType type,
122  bool ignoreFlip);
123 
124 /// Checks if this type is a unsigned integer type.
125 MLIR_CAPI_EXPORTED bool firrtlTypeIsAUInt(MlirType type);
126 
127 /// Creates a unsigned integer type with the specified width.
128 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetUInt(MlirContext ctx, int32_t width);
129 
130 /// Checks if this type is a signed integer type.
131 MLIR_CAPI_EXPORTED bool firrtlTypeIsASInt(MlirType type);
132 
133 /// Creates a signed integer type with the specified width.
134 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetSInt(MlirContext ctx, int32_t width);
135 
136 /// Checks if this type is a clock type.
137 MLIR_CAPI_EXPORTED bool firrtlTypeIsAClock(MlirType type);
138 
139 /// Creates a clock type.
140 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetClock(MlirContext ctx);
141 
142 /// Checks if this type is a reset type.
143 MLIR_CAPI_EXPORTED bool firrtlTypeIsAReset(MlirType type);
144 
145 /// Creates a reset type.
146 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetReset(MlirContext ctx);
147 
148 /// Checks if this type is an async reset type.
149 MLIR_CAPI_EXPORTED bool firrtlTypeIsAAsyncReset(MlirType type);
150 
151 /// Creates an async reset type.
152 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAsyncReset(MlirContext ctx);
153 
154 /// Checks if this type is an analog type.
155 MLIR_CAPI_EXPORTED bool firrtlTypeIsAAnalog(MlirType type);
156 
157 /// Creates an analog type with the specified width.
158 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAnalog(MlirContext ctx, int32_t width);
159 
160 /// Checks if this type is a vector type.
161 MLIR_CAPI_EXPORTED bool firrtlTypeIsAVector(MlirType type);
162 
163 /// Creates a vector type with the specified element type and count.
164 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetVector(MlirContext ctx,
165  MlirType element, size_t count);
166 
167 /// Returns the element type of a vector type.
168 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetVectorElement(MlirType vec);
169 
170 /// Returns the number of elements in a vector type.
171 MLIR_CAPI_EXPORTED size_t firrtlTypeGetVectorNumElements(MlirType vec);
172 
173 /// Returns true if the specified type is a bundle type.
174 MLIR_CAPI_EXPORTED bool firrtlTypeIsABundle(MlirType type);
175 
176 /// Returns true if the specified type is an open bundle type.
177 ///
178 /// An open bundle type means that it contains non FIRRTL base types.
179 MLIR_CAPI_EXPORTED bool firrtlTypeIsAOpenBundle(MlirType type);
180 
181 /// Creates a bundle type with the specified fields.
182 ///
183 /// If any field has a non-FIRRTL base type, an open bundle type is returned,
184 /// otherwise a normal bundle type is returned.
185 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetBundle(
186  MlirContext ctx, size_t count, const FIRRTLBundleField *fields);
187 
188 /// Returns the number of fields in the bundle type.
189 MLIR_CAPI_EXPORTED size_t firrtlTypeGetBundleNumFields(MlirType bundle);
190 
191 /// Returns the field at the specified index in the bundle type.
192 MLIR_CAPI_EXPORTED bool
193 firrtlTypeGetBundleFieldByIndex(MlirType type, size_t index,
194  FIRRTLBundleField *field);
195 
196 /// Returns the index of the field with the specified name in the bundle type.
197 MLIR_CAPI_EXPORTED unsigned
198 firrtlTypeGetBundleFieldIndex(MlirType type, MlirStringRef fieldName);
199 
200 /// Checks if this type is a ref type.
201 MLIR_CAPI_EXPORTED bool firrtlTypeIsARef(MlirType type);
202 
203 /// Creates a ref type.
204 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetRef(MlirType target, bool forceable);
205 
206 /// Checks if this type is an anyref type.
207 MLIR_CAPI_EXPORTED bool firrtlTypeIsAAnyRef(MlirType type);
208 
209 /// Creates an anyref type.
210 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAnyRef(MlirContext ctx);
211 
212 /// Checks if this type is a property integer type.
213 MLIR_CAPI_EXPORTED bool firrtlTypeIsAInteger(MlirType type);
214 
215 /// Creates a property integer type.
216 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetInteger(MlirContext ctx);
217 
218 /// Checks if this type is a property double type.
219 MLIR_CAPI_EXPORTED bool firrtlTypeIsADouble(MlirType type);
220 
221 /// Creates a property double type.
222 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetDouble(MlirContext ctx);
223 
224 /// Checks if this type is a property string type.
225 MLIR_CAPI_EXPORTED bool firrtlTypeIsAString(MlirType type);
226 
227 /// Creates a property string type.
228 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetString(MlirContext ctx);
229 
230 /// Checks if this type is a property boolean type.
231 MLIR_CAPI_EXPORTED bool firrtlTypeIsABoolean(MlirType type);
232 
233 /// Creates a property boolean type.
234 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetBoolean(MlirContext ctx);
235 
236 /// Checks if this type is a property path type.
237 MLIR_CAPI_EXPORTED bool firrtlTypeIsAPath(MlirType type);
238 
239 /// Creates a property path type.
240 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetPath(MlirContext ctx);
241 
242 /// Checks if this type is a property list type.
243 MLIR_CAPI_EXPORTED bool firrtlTypeIsAList(MlirType type);
244 
245 /// Creates a property list type with the specified element type.
246 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetList(MlirContext ctx,
247  MlirType elementType);
248 
249 /// Checks if this type is a class type.
250 MLIR_CAPI_EXPORTED bool firrtlTypeIsAClass(MlirType type);
251 
252 /// Creates a class type with the specified name and elements.
253 MLIR_CAPI_EXPORTED MlirType
254 firrtlTypeGetClass(MlirContext ctx, MlirAttribute name, size_t numberOfElements,
255  const FIRRTLClassElement *elements);
256 
257 /// Returns this type with all ground types replaced with UInt<1>. This is
258 /// used for `mem` operations.
259 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetMaskType(MlirType type);
260 
261 //===----------------------------------------------------------------------===//
262 // Attribute API.
263 //===----------------------------------------------------------------------===//
264 
265 /// Creates an ConventionAttr with the specified value.
266 MLIR_CAPI_EXPORTED MlirAttribute
267 firrtlAttrGetConvention(MlirContext ctx, FIRRTLConvention convention);
268 
269 /// Creates a DenseBoolArrayAttr with the specified port directions.
270 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetPortDirs(
271  MlirContext ctx, size_t count, const FIRRTLDirection *dirs);
272 
273 /// Creates a ParamDeclAttr with the specified name, type, and value. This is
274 /// used for module or instance parameter definition.
275 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetParamDecl(MlirContext ctx,
276  MlirIdentifier name,
277  MlirType type,
278  MlirAttribute value);
279 
280 /// Creates a NameKindEnumAttr with the specified name preservation semantic.
281 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetNameKind(MlirContext ctx,
282  FIRRTLNameKind nameKind);
283 
284 /// Creates a RUWAttr with the specified Read-Under-Write Behaviour.
285 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetRUW(MlirContext ctx,
286  FIRRTLRUW ruw);
287 
288 /// Creates a MemoryInitAttr with the specified memory initialization
289 /// information.
290 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetMemInit(MlirContext ctx,
291  MlirIdentifier filename,
292  bool isBinary,
293  bool isInline);
294 
295 /// Creates a MemDirAttr with the specified memory port direction.
296 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetMemDir(MlirContext ctx,
297  FIRRTLMemDir dir);
298 
299 /// Creates a EventControlAttr with the specified value.
300 MLIR_CAPI_EXPORTED MlirAttribute
301 firrtlAttrGetEventControl(MlirContext ctx, FIRRTLEventControl eventControl);
302 
303 /// Creates an IntegerAttr from a string representation of integer.
304 ///
305 /// This is a workaround for supporting large integers. See
306 /// https://github.com/llvm/llvm-project/issues/84190#issuecomment-2035552035
307 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetIntegerFromString(
308  MlirType type, unsigned numBits, MlirStringRef str, uint8_t radix);
309 
310 //===----------------------------------------------------------------------===//
311 // Utility API.
312 //===----------------------------------------------------------------------===//
313 
314 /// Computes the flow for a Value, \p value, as determined by the FIRRTL
315 /// specification. This recursively walks backwards from \p value to the
316 /// declaration. The resulting flow is a combination of the declaration flow
317 /// (output ports and instance inputs are sinks, registers and wires are
318 /// duplex, anything else is a source) and the number of intermediary flips.
319 /// An even number of flips will result in the same flow as the declaration.
320 /// An odd number of flips will result in reversed flow being returned. The
321 /// reverse of source is sink. The reverse of sink is source. The reverse of
322 /// duplex is duplex. The \p flow parameter sets the initial flow.
323 /// A user should normally \a not have to change this from its default of \p
324 /// Flow::Source.
325 MLIR_CAPI_EXPORTED FIRRTLValueFlow firrtlValueFoldFlow(MlirValue value,
326  FIRRTLValueFlow flow);
327 
328 /// Deserializes a JSON value into FIRRTL Annotations. Annotations are
329 /// represented as a Target-keyed arrays of attributes. The input JSON value is
330 /// checked, at runtime, to be an array of objects. Returns true if successful,
331 /// false if unsuccessful.
332 MLIR_CAPI_EXPORTED bool
333 firrtlImportAnnotationsFromJSONRaw(MlirContext ctx,
334  MlirStringRef annotationsStr,
335  MlirAttribute *importedAnnotationsArray);
336 
337 #ifdef __cplusplus
338 }
339 #endif
340 
341 #endif // CIRCT_C_DIALECT_FIRRTL_H
MlirType elementType
Definition: CHIRRTL.cpp:29
struct FIRRTLBundleField FIRRTLBundleField
Describes a field in a bundle type.
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetSInt(MlirContext ctx, int32_t width)
Creates a signed integer type with the specified width.
Definition: FIRRTL.cpp:59
MLIR_CAPI_EXPORTED bool firrtlTypeIsAUInt(MlirType type)
Checks if this type is a unsigned integer type.
Definition: FIRRTL.cpp:51
MLIR_CAPI_EXPORTED bool firrtlTypeIsABoolean(MlirType type)
Checks if this type is a property boolean type.
Definition: FIRRTL.cpp:227
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetInteger(MlirContext ctx)
Creates a property integer type.
Definition: FIRRTL.cpp:207
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetPortDirs(MlirContext ctx, size_t count, const FIRRTLDirection *dirs)
Creates a DenseBoolArrayAttr with the specified port directions.
Definition: FIRRTL.cpp:294
MLIR_CAPI_EXPORTED bool firrtlTypeIsConst(MlirType type)
Returns true if this is a const type whose value is guaranteed to be unchanging at circuit execution ...
MLIR_CAPI_EXPORTED bool firrtlTypeIsAInteger(MlirType type)
Checks if this type is a property integer type.
Definition: FIRRTL.cpp:203
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetEventControl(MlirContext ctx, FIRRTLEventControl eventControl)
Creates a EventControlAttr with the specified value.
Definition: FIRRTL.cpp:373
MLIR_CAPI_EXPORTED bool firrtlTypeIsABundle(MlirType type)
Returns true if the specified type is a bundle type.
Definition: FIRRTL.cpp:110
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAnalog(MlirContext ctx, int32_t width)
Creates an analog type with the specified width.
Definition: FIRRTL.cpp:87
struct FIRRTLClassElement FIRRTLClassElement
Describes an element in a class type.
MLIR_CAPI_EXPORTED bool firrtlTypeIsAString(MlirType type)
Checks if this type is a property string type.
Definition: FIRRTL.cpp:219
MLIR_CAPI_EXPORTED bool firrtlTypeIsAList(MlirType type)
Checks if this type is a property list type.
Definition: FIRRTL.cpp:239
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetReset(MlirContext ctx)
Creates a reset type.
Definition: FIRRTL.cpp:71
FIRRTLValueFlow
Flow of value.
Definition: FIRRTL.h:75
@ FIRRTL_VALUE_FLOW_SOURCE
Definition: FIRRTL.h:77
@ FIRRTL_VALUE_FLOW_NONE
Definition: FIRRTL.h:76
@ FIRRTL_VALUE_FLOW_SINK
Definition: FIRRTL.h:78
@ FIRRTL_VALUE_FLOW_DUPLEX
Definition: FIRRTL.h:79
MLIR_CAPI_EXPORTED bool firrtlTypeIsAPath(MlirType type)
Checks if this type is a property path type.
Definition: FIRRTL.cpp:233
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(FIRRTL, firrtl)
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetPath(MlirContext ctx)
Creates a property path type.
Definition: FIRRTL.cpp:235
MLIR_CAPI_EXPORTED bool firrtlTypeIsAAnyRef(MlirType type)
Checks if this type is an anyref type.
Definition: FIRRTL.cpp:195
FIRRTLNameKind
Name preservation.
Definition: FIRRTL.h:43
@ FIRRTL_NAME_KIND_DROPPABLE_NAME
Definition: FIRRTL.h:44
@ FIRRTL_NAME_KIND_INTERESTING_NAME
Definition: FIRRTL.h:45
MLIR_CAPI_EXPORTED bool firrtlTypeIsAAsyncReset(MlirType type)
Checks if this type is an async reset type.
Definition: FIRRTL.cpp:75
MLIR_CAPI_EXPORTED bool firrtlTypeIsAVector(MlirType type)
Checks if this type is a vector type.
Definition: FIRRTL.cpp:91
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetConstType(MlirType type, bool isConst)
Returns a const or non-const version of this type.
Definition: FIRRTL.cpp:42
FIRRTLMemDir
Memory port direction.
Definition: FIRRTL.h:58
@ FIRRTL_MEM_DIR_INFER
Definition: FIRRTL.h:59
@ FIRRTL_MEM_DIR_READ
Definition: FIRRTL.h:60
@ FIRRTL_MEM_DIR_READ_WRITE
Definition: FIRRTL.h:62
@ FIRRTL_MEM_DIR_WRITE
Definition: FIRRTL.h:61
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetConvention(MlirContext ctx, FIRRTLConvention convention)
Creates an ConventionAttr with the specified value.
Definition: FIRRTL.cpp:278
MLIR_CAPI_EXPORTED bool firrtlTypeIsADouble(MlirType type)
Checks if this type is a property double type.
Definition: FIRRTL.cpp:211
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetRef(MlirType target, bool forceable)
Creates a ref type.
Definition: FIRRTL.cpp:188
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetNameKind(MlirContext ctx, FIRRTLNameKind nameKind)
Creates a NameKindEnumAttr with the specified name preservation semantic.
Definition: FIRRTL.cpp:313
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetUInt(MlirContext ctx, int32_t width)
Creates a unsigned integer type with the specified width.
Definition: FIRRTL.cpp:53
MLIR_CAPI_EXPORTED bool firrtlTypeIsAOpenBundle(MlirType type)
Returns true if the specified type is an open bundle type.
Definition: FIRRTL.cpp:114
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetRUW(MlirContext ctx, FIRRTLRUW ruw)
Creates a RUWAttr with the specified Read-Under-Write Behaviour.
Definition: FIRRTL.cpp:328
MLIR_CAPI_EXPORTED size_t firrtlTypeGetVectorNumElements(MlirType vec)
Returns the number of elements in a vector type.
Definition: FIRRTL.cpp:106
MLIR_CAPI_EXPORTED unsigned firrtlTypeGetBundleFieldIndex(MlirType type, MlirStringRef fieldName)
Returns the index of the field with the specified name in the bundle type.
Definition: FIRRTL.cpp:173
MLIR_CAPI_EXPORTED size_t firrtlTypeGetBundleNumFields(MlirType bundle)
Returns the number of fields in the bundle type.
Definition: FIRRTL.cpp:144
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetString(MlirContext ctx)
Creates a property string type.
Definition: FIRRTL.cpp:223
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetMemInit(MlirContext ctx, MlirIdentifier filename, bool isBinary, bool isInline)
Creates a MemoryInitAttr with the specified memory initialization information.
Definition: FIRRTL.cpp:346
MLIR_CAPI_EXPORTED bool firrtlTypeIsAAnalog(MlirType type)
Checks if this type is an analog type.
Definition: FIRRTL.cpp:83
FIRRTLEventControl
Edge control trigger.
Definition: FIRRTL.h:67
@ FIRRTL_EVENT_CONTROL_AT_POS_EDGE
Definition: FIRRTL.h:68
@ FIRRTL_EVENT_CONTROL_AT_NEG_EDGE
Definition: FIRRTL.h:69
@ FIRRTL_EVENT_CONTROL_AT_EDGE
Definition: FIRRTL.h:70
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetMemDir(MlirContext ctx, FIRRTLMemDir dir)
Creates a MemDirAttr with the specified memory port direction.
Definition: FIRRTL.cpp:352
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetParamDecl(MlirContext ctx, MlirIdentifier name, MlirType type, MlirAttribute value)
Creates a ParamDeclAttr with the specified name, type, and value.
Definition: FIRRTL.cpp:307
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetList(MlirContext ctx, MlirType elementType)
Creates a property list type with the specified element type.
Definition: FIRRTL.cpp:241
MLIR_CAPI_EXPORTED bool firrtlTypeIsAReset(MlirType type)
Checks if this type is a reset type.
Definition: FIRRTL.cpp:69
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetVectorElement(MlirType vec)
Returns the element type of a vector type.
Definition: FIRRTL.cpp:102
MLIR_CAPI_EXPORTED int64_t firrtlTypeGetBitWidth(MlirType type, bool ignoreFlip)
Gets the bit width for this type, returns -1 if unknown.
Definition: FIRRTL.cpp:46
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetVector(MlirContext ctx, MlirType element, size_t count)
Creates a vector type with the specified element type and count.
Definition: FIRRTL.cpp:95
MLIR_CAPI_EXPORTED bool firrtlTypeGetBundleFieldByIndex(MlirType type, size_t index, FIRRTLBundleField *field)
Returns the field at the specified index in the bundle type.
Definition: FIRRTL.cpp:154
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetBundle(MlirContext ctx, size_t count, const FIRRTLBundleField *fields)
Creates a bundle type with the specified fields.
Definition: FIRRTL.cpp:118
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAsyncReset(MlirContext ctx)
Creates an async reset type.
Definition: FIRRTL.cpp:79
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetDouble(MlirContext ctx)
Creates a property double type.
Definition: FIRRTL.cpp:215
FIRRTLDirection
Port direction.
Definition: FIRRTL.h:34
@ FIRRTL_DIRECTION_OUT
Definition: FIRRTL.h:36
@ FIRRTL_DIRECTION_IN
Definition: FIRRTL.h:35
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetMaskType(MlirType type)
Returns this type with all ground types replaced with UInt<1>.
Definition: FIRRTL.cpp:268
MLIR_CAPI_EXPORTED bool firrtlImportAnnotationsFromJSONRaw(MlirContext ctx, MlirStringRef annotationsStr, MlirAttribute *importedAnnotationsArray)
Deserializes a JSON value into FIRRTL Annotations.
Definition: FIRRTL.cpp:431
MLIR_CAPI_EXPORTED bool firrtlTypeIsAClass(MlirType type)
Checks if this type is a class type.
Definition: FIRRTL.cpp:248
MLIR_CAPI_EXPORTED FIRRTLValueFlow firrtlValueFoldFlow(MlirValue value, FIRRTLValueFlow flow)
Computes the flow for a Value, value, as determined by the FIRRTL specification.
Definition: FIRRTL.cpp:398
MLIR_CAPI_EXPORTED bool firrtlTypeIsAClock(MlirType type)
Checks if this type is a clock type.
Definition: FIRRTL.cpp:63
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetClock(MlirContext ctx)
Creates a clock type.
Definition: FIRRTL.cpp:65
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetIntegerFromString(MlirType type, unsigned numBits, MlirStringRef str, uint8_t radix)
Creates an IntegerAttr from a string representation of integer.
Definition: FIRRTL.cpp:392
MLIR_CAPI_EXPORTED bool firrtlTypeIsARef(MlirType type)
Checks if this type is a ref type.
Definition: FIRRTL.cpp:186
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAnyRef(MlirContext ctx)
Creates an anyref type.
Definition: FIRRTL.cpp:199
FIRRTLRUW
Read-Under-Write behaviour.
Definition: FIRRTL.h:50
@ FIRRTL_RUW_OLD
Definition: FIRRTL.h:52
@ FIRRTL_RUW_UNDEFINED
Definition: FIRRTL.h:51
@ FIRRTL_RUW_NEW
Definition: FIRRTL.h:53
MLIR_CAPI_EXPORTED bool firrtlTypeIsASInt(MlirType type)
Checks if this type is a signed integer type.
Definition: FIRRTL.cpp:57
FIRRTLConvention
Module instantiation conventions.
Definition: FIRRTL.h:27
@ FIRRTL_CONVENTION_SCALARIZED
Definition: FIRRTL.h:29
@ FIRRTL_CONVENTION_INTERNAL
Definition: FIRRTL.h:28
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetBoolean(MlirContext ctx)
Creates a property boolean type.
Definition: FIRRTL.cpp:229
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetClass(MlirContext ctx, MlirAttribute name, size_t numberOfElements, const FIRRTLClassElement *elements)
Creates a class type with the specified name and elements.
Definition: FIRRTL.cpp:250
bool isConst(Type type)
Returns true if this is a 'const' type whose value is guaranteed to be unchanging at circuit executio...
Describes a field in a bundle type.
Definition: FIRRTL.h:84
MlirType type
Definition: FIRRTL.h:87
MlirIdentifier name
Definition: FIRRTL.h:85
Describes an element in a class type.
Definition: FIRRTL.h:92
MlirIdentifier name
Definition: FIRRTL.h:93
MlirType type
Definition: FIRRTL.h:94
FIRRTLDirection direction
Definition: FIRRTL.h:95