mirror of https://github.com/llvm/circt.git
[ESI] Add signaling standard to channel type
In the past, ESI has only supported valid-ready signaling, so we didn't need to encode the signaling standard. Since we're about to add FIFO signaling, we need a way to encode the signaling standard. Create an enum and add it as a parameter to the channel type, defaulting to ReadyValid so we don't have to fix a bunch of tests.
This commit is contained in:
parent
db40efbcdc
commit
3338609341
|
@ -6,6 +6,11 @@ mlir_tablegen(ESIPasses.h.inc -gen-pass-decls)
|
||||||
add_public_tablegen_target(MLIRESITransformsIncGen)
|
add_public_tablegen_target(MLIRESITransformsIncGen)
|
||||||
add_circt_doc(ESI ESIPasses -gen-pass-doc)
|
add_circt_doc(ESI ESIPasses -gen-pass-doc)
|
||||||
|
|
||||||
|
set(LLVM_TARGET_DEFINITIONS ESI.td)
|
||||||
|
mlir_tablegen(ESIEnums.h.inc -gen-enum-decls)
|
||||||
|
mlir_tablegen(ESIEnums.cpp.inc -gen-enum-defs)
|
||||||
|
add_public_tablegen_target(MLIRESIEnumsIncGen)
|
||||||
|
|
||||||
set(LLVM_TARGET_DEFINITIONS ESIInterfaces.td)
|
set(LLVM_TARGET_DEFINITIONS ESIInterfaces.td)
|
||||||
mlir_tablegen(ESIInterfaces.h.inc -gen-op-interface-decls)
|
mlir_tablegen(ESIInterfaces.h.inc -gen-op-interface-decls)
|
||||||
mlir_tablegen(ESIInterfaces.cpp.inc -gen-op-interface-defs)
|
mlir_tablegen(ESIInterfaces.cpp.inc -gen-op-interface-defs)
|
||||||
|
|
|
@ -57,4 +57,7 @@ Operation *buildESIWrapper(OpBuilder &b, Operation *mod,
|
||||||
|
|
||||||
#include "circt/Dialect/ESI/ESIDialect.h.inc"
|
#include "circt/Dialect/ESI/ESIDialect.h.inc"
|
||||||
|
|
||||||
|
// Pull in all enum type definitions and utility function declarations.
|
||||||
|
#include "circt/Dialect/ESI/ESIEnums.h.inc"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,8 +14,20 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
include "mlir/IR/AttrTypeBase.td"
|
||||||
|
include "mlir/IR/EnumAttr.td"
|
||||||
|
|
||||||
|
|
||||||
class ESI_Port<string name> : TypeDef<ESI_Dialect, name> {}
|
class ESI_Port<string name> : TypeDef<ESI_Dialect, name> {}
|
||||||
|
|
||||||
|
def ChannelSignalingValidReady : I32EnumAttrCase<"ValidReady", 0>;
|
||||||
|
def ChannelSignaling : I32EnumAttr<
|
||||||
|
"ChannelSignaling",
|
||||||
|
"ESI channel wire signaling standard",
|
||||||
|
[ChannelSignalingValidReady]>{
|
||||||
|
let cppNamespace = "::circt::esi";
|
||||||
|
}
|
||||||
|
|
||||||
def ChannelType : ESI_Port<"Channel"> {
|
def ChannelType : ESI_Port<"Channel"> {
|
||||||
let summary = "An ESI-compatible channel port";
|
let summary = "An ESI-compatible channel port";
|
||||||
let description = [{
|
let description = [{
|
||||||
|
@ -33,9 +45,20 @@ def ChannelType : ESI_Port<"Channel"> {
|
||||||
}];
|
}];
|
||||||
|
|
||||||
let mnemonic = "channel";
|
let mnemonic = "channel";
|
||||||
let parameters = (ins "Type":$inner);
|
let parameters = (ins
|
||||||
|
"Type":$inner,
|
||||||
|
DefaultValuedParameter<
|
||||||
|
"::circt::esi::ChannelSignaling",
|
||||||
|
"::circt::esi::ChannelSignaling::ValidReady">:$signaling);
|
||||||
|
|
||||||
let assemblyFormat = "`<` $inner `>`";
|
let assemblyFormat = "`<` $inner (`,` $signaling^)? `>`";
|
||||||
|
|
||||||
|
let builders = [
|
||||||
|
TypeBuilder<(ins "Type":$type), [{
|
||||||
|
return Base::get(type.getContext(), type,
|
||||||
|
::circt::esi::ChannelSignaling::ValidReady);
|
||||||
|
}]>,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========
|
//=========
|
||||||
|
|
|
@ -61,6 +61,7 @@ add_circt_dialect_library(CIRCTESI
|
||||||
|
|
||||||
DEPENDS
|
DEPENDS
|
||||||
MLIRESITransformsIncGen
|
MLIRESITransformsIncGen
|
||||||
|
MLIRESIEnumsIncGen
|
||||||
${ESI_Deps}
|
${ESI_Deps}
|
||||||
|
|
||||||
LINK_COMPONENTS
|
LINK_COMPONENTS
|
||||||
|
|
|
@ -330,4 +330,7 @@ circt::esi::buildESIWrapper(OpBuilder &b, Operation *pearl,
|
||||||
return shell;
|
return shell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provide implementations for the enums we use.
|
||||||
|
#include "circt/Dialect/ESI/ESIEnums.cpp.inc"
|
||||||
|
|
||||||
#include "circt/Dialect/ESI/ESIDialect.cpp.inc"
|
#include "circt/Dialect/ESI/ESIDialect.cpp.inc"
|
||||||
|
|
|
@ -6,7 +6,7 @@ hw.module @Sender() -> (x: !esi.channel<i1>) {
|
||||||
%ch, %rcvrRdy = esi.wrap.vr %0, %0 : i1
|
%ch, %rcvrRdy = esi.wrap.vr %0, %0 : i1
|
||||||
hw.output %ch : !esi.channel<i1>
|
hw.output %ch : !esi.channel<i1>
|
||||||
}
|
}
|
||||||
hw.module @Reciever(%a: !esi.channel<i1>) {
|
hw.module @Reciever(%a: !esi.channel<i1, ValidReady>) {
|
||||||
%rdy = arith.constant 1 : i1
|
%rdy = arith.constant 1 : i1
|
||||||
// Recieve bits.
|
// Recieve bits.
|
||||||
%data, %valid = esi.unwrap.vr %a, %rdy : i1
|
%data, %valid = esi.unwrap.vr %a, %rdy : i1
|
||||||
|
|
Loading…
Reference in New Issue