[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:
John Demme 2023-02-11 00:56:42 +00:00
parent db40efbcdc
commit 3338609341
6 changed files with 38 additions and 3 deletions

View File

@ -6,6 +6,11 @@ mlir_tablegen(ESIPasses.h.inc -gen-pass-decls)
add_public_tablegen_target(MLIRESITransformsIncGen)
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)
mlir_tablegen(ESIInterfaces.h.inc -gen-op-interface-decls)
mlir_tablegen(ESIInterfaces.cpp.inc -gen-op-interface-defs)

View File

@ -57,4 +57,7 @@ Operation *buildESIWrapper(OpBuilder &b, Operation *mod,
#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

View File

@ -14,8 +14,20 @@
//
//===----------------------------------------------------------------------===//
include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/EnumAttr.td"
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"> {
let summary = "An ESI-compatible channel port";
let description = [{
@ -33,9 +45,20 @@ def ChannelType : ESI_Port<"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);
}]>,
];
}
//=========

View File

@ -61,6 +61,7 @@ add_circt_dialect_library(CIRCTESI
DEPENDS
MLIRESITransformsIncGen
MLIRESIEnumsIncGen
${ESI_Deps}
LINK_COMPONENTS

View File

@ -330,4 +330,7 @@ circt::esi::buildESIWrapper(OpBuilder &b, Operation *pearl,
return shell;
}
// Provide implementations for the enums we use.
#include "circt/Dialect/ESI/ESIEnums.cpp.inc"
#include "circt/Dialect/ESI/ESIDialect.cpp.inc"

View File

@ -6,7 +6,7 @@ hw.module @Sender() -> (x: !esi.channel<i1>) {
%ch, %rcvrRdy = esi.wrap.vr %0, %0 : 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
// Recieve bits.
%data, %valid = esi.unwrap.vr %a, %rdy : i1