CIRCT  19.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 #ifndef CIRCT_C_DIALECT_FIRRTL_H
10 #define CIRCT_C_DIALECT_FIRRTL_H
11 
12 #include "mlir-c/IR.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 // NOLINTNEXTLINE(modernize-use-using)
19 typedef enum FIRRTLConvention {
23 
24 // NOLINTNEXTLINE(modernize-use-using)
25 typedef enum FIRRTLDirection {
29 
30 // NOLINTNEXTLINE(modernize-use-using)
31 typedef enum FIRRTLNameKind {
35 
36 // NOLINTNEXTLINE(modernize-use-using)
37 typedef enum FIRRTLRUW {
42 
43 // NOLINTNEXTLINE(modernize-use-using)
44 typedef enum FIRRTLMemDir {
50 
51 // NOLINTNEXTLINE(modernize-use-using)
52 typedef enum FIRRTLEventControl {
57 
58 // NOLINTNEXTLINE(modernize-use-using)
59 typedef enum FIRRTLValueFlow {
65 
66 // NOLINTNEXTLINE(modernize-use-using)
67 typedef struct FIRRTLBundleField {
68  MlirIdentifier name;
69  bool isFlip;
70  MlirType type;
72 
73 // NOLINTNEXTLINE(modernize-use-using)
74 typedef struct FIRRTLClassElement {
75  MlirIdentifier name;
76  MlirType type;
79 
80 //===----------------------------------------------------------------------===//
81 // Dialect API.
82 //===----------------------------------------------------------------------===//
83 
85 
86 //===----------------------------------------------------------------------===//
87 // Type API.
88 //===----------------------------------------------------------------------===//
89 
90 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetUInt(MlirContext ctx, int32_t width);
91 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetSInt(MlirContext ctx, int32_t width);
92 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetClock(MlirContext ctx);
93 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetReset(MlirContext ctx);
94 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAsyncReset(MlirContext ctx);
95 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAnalog(MlirContext ctx, int32_t width);
96 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetVector(MlirContext ctx,
97  MlirType element, size_t count);
98 MLIR_CAPI_EXPORTED bool firrtlTypeIsAOpenBundle(MlirType type);
99 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetBundle(
100  MlirContext ctx, size_t count, const FIRRTLBundleField *fields);
101 MLIR_CAPI_EXPORTED unsigned
102 firrtlTypeGetBundleFieldIndex(MlirType type, MlirStringRef fieldName);
103 
104 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetRef(MlirType target, bool forceable);
105 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAnyRef(MlirContext ctx);
106 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetInteger(MlirContext ctx);
107 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetDouble(MlirContext ctx);
108 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetString(MlirContext ctx);
109 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetBoolean(MlirContext ctx);
110 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetPath(MlirContext ctx);
111 MLIR_CAPI_EXPORTED MlirType firrtlTypeGetList(MlirContext ctx,
112  MlirType elementType);
113 MLIR_CAPI_EXPORTED MlirType
114 firrtlTypeGetClass(MlirContext ctx, MlirAttribute name, size_t numberOfElements,
115  const FIRRTLClassElement *elements);
116 
117 //===----------------------------------------------------------------------===//
118 // Attribute API.
119 //===----------------------------------------------------------------------===//
120 
121 MLIR_CAPI_EXPORTED MlirAttribute
122 firrtlAttrGetConvention(MlirContext ctx, FIRRTLConvention convention);
123 
124 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetPortDirs(
125  MlirContext ctx, size_t count, const FIRRTLDirection *dirs);
126 
127 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetParamDecl(MlirContext ctx,
128  MlirIdentifier name,
129  MlirType type,
130  MlirAttribute value);
131 
132 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetNameKind(MlirContext ctx,
133  FIRRTLNameKind nameKind);
134 
135 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetRUW(MlirContext ctx,
136  FIRRTLRUW ruw);
137 
138 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetMemInit(MlirContext ctx,
139  MlirIdentifier filename,
140  bool isBinary,
141  bool isInline);
142 
143 MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetMemDir(MlirContext ctx,
144  FIRRTLMemDir dir);
145 
146 MLIR_CAPI_EXPORTED MlirAttribute
147 firrtlAttrGetEventControl(MlirContext ctx, FIRRTLEventControl eventControl);
148 
149 //===----------------------------------------------------------------------===//
150 // Utility API.
151 //===----------------------------------------------------------------------===//
152 
153 MLIR_CAPI_EXPORTED FIRRTLValueFlow firrtlValueFoldFlow(MlirValue value,
154  FIRRTLValueFlow flow);
155 
156 MLIR_CAPI_EXPORTED bool
157 firrtlImportAnnotationsFromJSONRaw(MlirContext ctx,
158  MlirStringRef annotationsStr,
159  MlirAttribute *importedAnnotationsArray);
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif // CIRCT_C_DIALECT_FIRRTL_H
MlirType elementType
Definition: CHIRRTL.cpp:29
int32_t width
Definition: FIRRTL.cpp:36
struct FIRRTLBundleField FIRRTLBundleField
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetSInt(MlirContext ctx, int32_t width)
Definition: FIRRTL.cpp:40
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetInteger(MlirContext ctx)
Definition: FIRRTL.cpp:121
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetPortDirs(MlirContext ctx, size_t count, const FIRRTLDirection *dirs)
Definition: FIRRTL.cpp:186
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetEventControl(MlirContext ctx, FIRRTLEventControl eventControl)
Definition: FIRRTL.cpp:265
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAnalog(MlirContext ctx, int32_t width)
Definition: FIRRTL.cpp:56
struct FIRRTLClassElement FIRRTLClassElement
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetReset(MlirContext ctx)
Definition: FIRRTL.cpp:48
FIRRTLValueFlow
Definition: FIRRTL.h:59
@ FIRRTL_VALUE_FLOW_SOURCE
Definition: FIRRTL.h:61
@ FIRRTL_VALUE_FLOW_NONE
Definition: FIRRTL.h:60
@ FIRRTL_VALUE_FLOW_SINK
Definition: FIRRTL.h:62
@ FIRRTL_VALUE_FLOW_DUPLEX
Definition: FIRRTL.h:63
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(FIRRTL, firrtl)
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetPath(MlirContext ctx)
Definition: FIRRTL.cpp:137
FIRRTLNameKind
Definition: FIRRTL.h:31
@ FIRRTL_NAME_KIND_DROPPABLE_NAME
Definition: FIRRTL.h:32
@ FIRRTL_NAME_KIND_INTERESTING_NAME
Definition: FIRRTL.h:33
FIRRTLMemDir
Definition: FIRRTL.h:44
@ FIRRTL_MEM_DIR_INFER
Definition: FIRRTL.h:45
@ FIRRTL_MEM_DIR_READ
Definition: FIRRTL.h:46
@ FIRRTL_MEM_DIR_READ_WRITE
Definition: FIRRTL.h:48
@ FIRRTL_MEM_DIR_WRITE
Definition: FIRRTL.h:47
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetConvention(MlirContext ctx, FIRRTLConvention convention)
Definition: FIRRTL.cpp:170
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetRef(MlirType target, bool forceable)
Definition: FIRRTL.cpp:110
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetNameKind(MlirContext ctx, FIRRTLNameKind nameKind)
Definition: FIRRTL.cpp:205
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetUInt(MlirContext ctx, int32_t width)
MLIR_CAPI_EXPORTED bool firrtlTypeIsAOpenBundle(MlirType type)
Definition: FIRRTL.cpp:67
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetRUW(MlirContext ctx, FIRRTLRUW ruw)
Definition: FIRRTL.cpp:220
MLIR_CAPI_EXPORTED unsigned firrtlTypeGetBundleFieldIndex(MlirType type, MlirStringRef fieldName)
Definition: FIRRTL.cpp:97
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetString(MlirContext ctx)
Definition: FIRRTL.cpp:129
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetMemInit(MlirContext ctx, MlirIdentifier filename, bool isBinary, bool isInline)
Definition: FIRRTL.cpp:238
FIRRTLEventControl
Definition: FIRRTL.h:52
@ FIRRTL_EVENT_CONTROL_AT_POS_EDGE
Definition: FIRRTL.h:53
@ FIRRTL_EVENT_CONTROL_AT_NEG_EDGE
Definition: FIRRTL.h:54
@ FIRRTL_EVENT_CONTROL_AT_EDGE
Definition: FIRRTL.h:55
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetMemDir(MlirContext ctx, FIRRTLMemDir dir)
Definition: FIRRTL.cpp:244
MLIR_CAPI_EXPORTED MlirAttribute firrtlAttrGetParamDecl(MlirContext ctx, MlirIdentifier name, MlirType type, MlirAttribute value)
Definition: FIRRTL.cpp:199
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetList(MlirContext ctx, MlirType elementType)
Definition: FIRRTL.cpp:141
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetVector(MlirContext ctx, MlirType element, size_t count)
Definition: FIRRTL.cpp:60
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetBundle(MlirContext ctx, size_t count, const FIRRTLBundleField *fields)
Definition: FIRRTL.cpp:71
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAsyncReset(MlirContext ctx)
Definition: FIRRTL.cpp:52
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetDouble(MlirContext ctx)
Definition: FIRRTL.cpp:125
FIRRTLDirection
Definition: FIRRTL.h:25
@ FIRRTL_DIRECTION_OUT
Definition: FIRRTL.h:27
@ FIRRTL_DIRECTION_IN
Definition: FIRRTL.h:26
MLIR_CAPI_EXPORTED bool firrtlImportAnnotationsFromJSONRaw(MlirContext ctx, MlirStringRef annotationsStr, MlirAttribute *importedAnnotationsArray)
Definition: FIRRTL.cpp:316
MLIR_CAPI_EXPORTED FIRRTLValueFlow firrtlValueFoldFlow(MlirValue value, FIRRTLValueFlow flow)
Definition: FIRRTL.cpp:284
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetClock(MlirContext ctx)
Definition: FIRRTL.cpp:44
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetAnyRef(MlirContext ctx)
Definition: FIRRTL.cpp:117
FIRRTLRUW
Definition: FIRRTL.h:37
@ FIRRTL_RUW_OLD
Definition: FIRRTL.h:39
@ FIRRTL_RUW_UNDEFINED
Definition: FIRRTL.h:38
@ FIRRTL_RUW_NEW
Definition: FIRRTL.h:40
FIRRTLConvention
Definition: FIRRTL.h:19
@ FIRRTL_CONVENTION_SCALARIZED
Definition: FIRRTL.h:21
@ FIRRTL_CONVENTION_INTERNAL
Definition: FIRRTL.h:20
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetBoolean(MlirContext ctx)
Definition: FIRRTL.cpp:133
MLIR_CAPI_EXPORTED MlirType firrtlTypeGetClass(MlirContext ctx, MlirAttribute name, size_t numberOfElements, const FIRRTLClassElement *elements)
Definition: FIRRTL.cpp:148
MlirType type
Definition: FIRRTL.h:70
MlirIdentifier name
Definition: FIRRTL.h:68
MlirIdentifier name
Definition: FIRRTL.h:75
MlirType type
Definition: FIRRTL.h:76
FIRRTLDirection direction
Definition: FIRRTL.h:77