summaryrefslogtreecommitdiff
path: root/src/mem/slicc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/slicc')
-rw-r--r--src/mem/slicc/ast/FuncCallExprAST.py32
-rw-r--r--src/mem/slicc/symbols/StateMachine.py22
2 files changed, 37 insertions, 17 deletions
diff --git a/src/mem/slicc/ast/FuncCallExprAST.py b/src/mem/slicc/ast/FuncCallExprAST.py
index abf7eec7b..830b10c21 100644
--- a/src/mem/slicc/ast/FuncCallExprAST.py
+++ b/src/mem/slicc/ast/FuncCallExprAST.py
@@ -40,11 +40,33 @@ class FuncCallExprAST(ExprAST):
def generate(self, code):
machine = self.state_machine
- # DEBUG_EXPR is strange since it takes parameters of multiple types
- if self.proc_name == "DEBUG_EXPR":
- # FIXME - check for number of parameters
- code('DEBUG_SLICC(MedPrio, "$0: ", $1)',
- self.exprs[0].location, self.exprs[0].inline())
+ if self.proc_name == "DPRINTF":
+ # Code for inserting the location of the DPRINTF()
+ # statement in the .sm file in the statement it self.
+ # 'self.exprs[0].location' represents the location.
+ # 'format' represents the second argument of the
+ # original DPRINTF() call. It is left unmodified.
+ # str_list is used for concatenating the argument
+ # list following the format specifier. A DPRINTF()
+ # call may or may not contain any arguments following
+ # the format specifier. These two cases need to be
+ # handled differently. Hence the check whether or not
+ # the str_list is empty.
+
+ format = "%s" % (self.exprs[1].inline())
+ format_length = len(format)
+ str_list = []
+
+ for i in range(2, len(self.exprs)):
+ str_list.append("%s" % self.exprs[i].inline())
+
+ if len(str_list) == 0:
+ code('DPRINTF(RubySlicc, "$0: $1")',
+ self.exprs[0].location, format[2:format_length-2])
+ else:
+ code('DPRINTF(RubySlicc, "$0: $1", $2)',
+ self.exprs[0].location, format[2:format_length-2],
+ ', '.join(str_list))
return self.symtab.find("void", Type)
diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py
index c1926fbab..a7ac556e1 100644
--- a/src/mem/slicc/symbols/StateMachine.py
+++ b/src/mem/slicc/symbols/StateMachine.py
@@ -743,7 +743,7 @@ void $c_ident::clearStats() {
void
$c_ident::${{action.ident}}(const Address& addr)
{
- DEBUG_MSG(GENERATED_COMP, HighPrio, "executing");
+ DPRINTF(RubyGenerated, "executing\\n");
${{action["c_code"]}}
}
@@ -814,7 +814,6 @@ ${ident}_Controller::wakeup()
break; // If we got this far, we have nothing left todo
}
// g_eventQueue_ptr->scheduleEvent(this, 1);
- // DEBUG_NEWLINE(GENERATED_COMP, MedPrio);
}
''')
@@ -849,19 +848,19 @@ ${ident}_Controller::doTransition(${ident}_Event event,
{
${ident}_State next_state = state;
- DEBUG_NEWLINE(GENERATED_COMP, MedPrio);
- DEBUG_MSG(GENERATED_COMP, MedPrio, *this);
- DEBUG_EXPR(GENERATED_COMP, MedPrio, g_eventQueue_ptr->getTime());
- DEBUG_EXPR(GENERATED_COMP, MedPrio,state);
- DEBUG_EXPR(GENERATED_COMP, MedPrio,event);
- DEBUG_EXPR(GENERATED_COMP, MedPrio,addr);
+ DPRINTF(RubyGenerated, "%s, Time: %lld, state: %s, event: %s, addr: %s\\n",
+ *this,
+ g_eventQueue_ptr->getTime(),
+ ${ident}_State_to_string(state),
+ ${ident}_Event_to_string(event),
+ addr);
TransitionResult result =
doTransitionWorker(event, state, next_state, addr);
if (result == TransitionResult_Valid) {
- DEBUG_EXPR(GENERATED_COMP, MedPrio, next_state);
- DEBUG_NEWLINE(GENERATED_COMP, MedPrio);
+ DPRINTF(RubyGenerated, "next_state: %s\\n",
+ ${ident}_State_to_string(next_state));
m_profiler.countTransition(state, event);
if (Debug::getProtocolTrace()) {
g_system_ptr->getProfiler()->profileTransition("${ident}",
@@ -884,8 +883,7 @@ ${ident}_Controller::doTransition(${ident}_Event event,
"Resource Stall");
}
} else if (result == TransitionResult_ProtocolStall) {
- DEBUG_MSG(GENERATED_COMP, HighPrio, "stalling");
- DEBUG_NEWLINE(GENERATED_COMP, MedPrio);
+ DPRINTF(RubyGenerated, "stalling\\n");
if (Debug::getProtocolTrace()) {
g_system_ptr->getProfiler()->profileTransition("${ident}",
m_version, addr,