@@ -135,6 +135,33 @@ def Xls_TranslationLinkage : Xls_Attr<"TranslationLinkage"> {
135135 let attrName = "xls.translation_linkage";
136136}
137137
138+ def Xls_FlopKindNone : I32EnumAttrCase<"kNone", 0, "none">;
139+ def Xls_FlopKindFlop : I32EnumAttrCase<"kFlop", 1, "flop">;
140+ def Xls_FlopKindSkid : I32EnumAttrCase<"kSkid", 2, "skid">;
141+ def Xls_FlopKindZeroLatency : I32EnumAttrCase<"kZeroLatency", 3, "zero-latency">;
142+ def Xls_FlopKind : I32EnumAttr<"FlopKind", "XLS flop kind",
143+ [Xls_FlopKindNone, Xls_FlopKindFlop, Xls_FlopKindSkid, Xls_FlopKindZeroLatency]> {
144+ let genSpecializedAttr = 0;
145+ let cppNamespace = "::mlir::xls";
146+ }
147+ def Xls_FlopKindAttr : EnumAttr<Xls_Dialect, Xls_FlopKind, "flop_kind">;
148+
149+ def Xls_FifoConfig : Xls_Attr<"FifoConfig"> {
150+ let summary = "TODO";
151+ let description = [{TODO}];
152+
153+ let parameters = (ins
154+ "int64_t":$fifo_depth,
155+ "bool":$bypass,
156+ "bool":$register_push_outputs,
157+ "bool":$register_pop_outputs
158+ );
159+
160+ let mnemonic = "fifo_config";
161+
162+ let assemblyFormat = "`<` struct(params) `>`";
163+ }
164+
138165class GetShapeSplat<string name> :
139166 StrFunc<"getShapeSplat($" # name # ".getType())">;
140167
@@ -1626,6 +1653,9 @@ def Xls_ChanOp : Xls_Op<"chan", [
16261653 let arguments = (ins
16271654 SymbolNameAttr:$sym_name,
16281655 TypeAttr:$type,
1656+ OptionalAttr<Xls_FifoConfig>: $fifo_config,
1657+ OptionalAttr<Xls_FlopKindAttr>: $input_flop_kind,
1658+ OptionalAttr<Xls_FlopKindAttr>: $output_flop_kind,
16291659 DefaultValuedAttr<BoolAttr, "true">:$send_supported,
16301660 DefaultValuedAttr<BoolAttr, "true">:$recv_supported
16311661 );
@@ -1653,7 +1683,6 @@ def Xls_ChanOp : Xls_Op<"chan", [
16531683 void setArgAttrsAttr(ArrayAttr) { return; }
16541684 void setResAttrsAttr(ArrayAttr) { return; }
16551685 }];
1656-
16571686}
16581687
16591688def Xls_InstantiateEprocOp : Xls_Op<"instantiate_eproc", [DeclareOpInterfaceMethods<SymbolUserOpInterface>]> {
@@ -1763,7 +1792,10 @@ def Xls_SchanOp : Xls_Op<"schan", [Pure, HasParent<"SprocOp">]> {
17631792 }];
17641793 let arguments = (ins
17651794 StrAttr:$name,
1766- TypeAttr:$type
1795+ TypeAttr:$type,
1796+ OptionalAttr<Xls_FifoConfig>: $fifo_config,
1797+ OptionalAttr<Xls_FlopKindAttr>: $input_flop_kind,
1798+ OptionalAttr<Xls_FlopKindAttr>: $output_flop_kind
17671799 );
17681800 let results = (outs
17691801 Xls_SchanType:$out,
@@ -1774,7 +1806,7 @@ def Xls_SchanOp : Xls_Op<"schan", [Pure, HasParent<"SprocOp">]> {
17741806 OpBuilder<(ins "::mlir::StringRef":$name, "::mlir::Type":$element_type), [{
17751807 auto inChanTy = SchanType::get($_builder.getContext(), element_type, /*isInput=*/true);
17761808 auto outChanTy = SchanType::get($_builder.getContext(), element_type, /*isInput=*/false);
1777- build($_builder, $_state, ::mlir::TypeRange{outChanTy, inChanTy}, name, element_type);
1809+ build($_builder, $_state, ::mlir::TypeRange{outChanTy, inChanTy}, name, element_type, /*fifo_config=*/nullptr, /*input_flop_kind=*/nullptr, /*output_flop_kind=*/nullptr );
17781810 }]>
17791811 ];
17801812}
0 commit comments