From 96c999fe88a5f600a1a5ddf8c15eadba3051508b Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Fri, 18 Sep 2015 13:27:47 -0500 Subject: ruby: print addresses in hex Changeset 4872dbdea907 replaced Address by Addr, but did not make changes to print statements. So the addresses which were being printed in hex earlier along with their line address, were now being printed in decimals. This patch adds a function printAddress(Addr) that can be used to print the address in hex along with the lines address. This function has been put to use in some of the places. At other places, change has been made to print just the address in hex. --- src/mem/slicc/symbols/StateMachine.py | 8 ++++---- src/mem/slicc/symbols/Type.py | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/mem/slicc') diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py index 9eaa40d77..a530307ee 100644 --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -1155,7 +1155,7 @@ ${ident}_Controller::doTransition(${ident}_Event event, code(''' ${ident}_State next_state = state; -DPRINTF(RubyGenerated, "%s, Time: %lld, state: %s, event: %s, addr: %s\\n", +DPRINTF(RubyGenerated, "%s, Time: %lld, state: %s, event: %s, addr: %#x\\n", *this, curCycle(), ${ident}_State_to_string(state), ${ident}_Event_to_string(event), addr); @@ -1184,7 +1184,7 @@ if (result == TransitionResult_Valid) { ${ident}_Event_to_string(event), ${ident}_State_to_string(state), ${ident}_State_to_string(next_state), - addr, GET_TRANSITION_COMMENT()); + printAddress(addr), GET_TRANSITION_COMMENT()); CLEAR_TRANSITION_COMMENT(); ''') @@ -1208,7 +1208,7 @@ if (result == TransitionResult_Valid) { ${ident}_Event_to_string(event), ${ident}_State_to_string(state), ${ident}_State_to_string(next_state), - addr, "Resource Stall"); + printAddress(addr), "Resource Stall"); } else if (result == TransitionResult_ProtocolStall) { DPRINTF(RubyGenerated, "stalling\\n"); DPRINTFR(ProtocolTrace, "%15s %3s %10s%20s %6s>%-6s %#x %s\\n", @@ -1216,7 +1216,7 @@ if (result == TransitionResult_Valid) { ${ident}_Event_to_string(event), ${ident}_State_to_string(state), ${ident}_State_to_string(next_state), - addr, "Protocol Stall"); + printAddress(addr), "Protocol Stall"); } return result; diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py index 6234f4f7f..a3223b3ac 100644 --- a/src/mem/slicc/symbols/Type.py +++ b/src/mem/slicc/symbols/Type.py @@ -412,7 +412,11 @@ ${{self.c_ident}}::print(ostream& out) const # For each field code.indent() for dm in self.data_members.values(): - code('out << "${{dm.ident}} = " << m_${{dm.ident}} << " ";''') + if dm.type.c_ident == "Addr": + code(''' +out << "${{dm.ident}} = " << printAddress(m_${{dm.ident}}) << " ";''') + else: + code('out << "${{dm.ident}} = " << m_${{dm.ident}} << " ";''') code.dedent() -- cgit v1.2.3