summaryrefslogtreecommitdiff
path: root/src/mem/slicc/ast/PeekStatementAST.py
diff options
context:
space:
mode:
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"):