summaryrefslogtreecommitdiff
path: root/src/mem/slicc/ast/PeekStatementAST.py
diff options
context:
space:
mode:
authorDavid Hashe <david.hashe@amd.com>2015-07-20 09:15:18 -0500
committerDavid Hashe <david.hashe@amd.com>2015-07-20 09:15:18 -0500
commit6a288d9de3422024b9e99caa8b3717d98e467314 (patch)
treecf47855e262bccc800de1da1325c4be3f3e1dd9a /src/mem/slicc/ast/PeekStatementAST.py
parentb609b032aaa02348884bd66396b39a3ad1a056cc (diff)
downloadgem5-6a288d9de3422024b9e99caa8b3717d98e467314.tar.xz
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) { ... }
Diffstat (limited to 'src/mem/slicc/ast/PeekStatementAST.py')
-rw-r--r--src/mem/slicc/ast/PeekStatementAST.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mem/slicc/ast/PeekStatementAST.py b/src/mem/slicc/ast/PeekStatementAST.py
index d267df26e..cecb9aa9f 100644
--- a/src/mem/slicc/ast/PeekStatementAST.py
+++ b/src/mem/slicc/ast/PeekStatementAST.py
@@ -62,7 +62,12 @@ class PeekStatementAST(StatementAST):
// 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"):