slicc: support for multiple message types on the same buffer
This patch allows SLICC protocols to use more than one message type with a
message buffer. For example, you can declare two in ports as such:
in_port(ResponseQueue_in, ResponseMsg, responseFromDir, rank=3) { ... }
in_port(tgtResponseQueue_in, TgtResponseMsg, responseFromDir, rank=2) { ... }
diff --git a/src/mem/slicc/ast/PeekStatementAST.py b/src/mem/slicc/ast/PeekStatementAST.py
index d267df2..cecb9aa 100644
--- a/src/mem/slicc/ast/PeekStatementAST.py
+++ b/src/mem/slicc/ast/PeekStatementAST.py
@@ -62,7 +62,12 @@
// Declare message
const $mtid* in_msg_ptr M5_VAR_USED;
in_msg_ptr = dynamic_cast<const $mtid *>(($qcode).${{self.method}}());
- assert(in_msg_ptr != NULL); // Check the cast result
+ if (in_msg_ptr == NULL) {
+ // If the cast fails, this is the wrong inport (wrong message type).
+ // Throw an exception, and the caller will decide to either try a
+ // different inport or punt.
+ throw RejectException();
+ }
''')
if self.pairs.has_key("block_on"):