diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2013-01-14 10:04:21 -0600 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2013-01-14 10:04:21 -0600 |
commit | cf232de4615f0fe9435d6e92a1d6319c972a8c88 (patch) | |
tree | 539c365baf0b078b2fdbf820feeb89c1afee8726 /src/mem/slicc | |
parent | cbbc4c7f6b4cb718cc3907b955f7ae527d2d0274 (diff) | |
download | gem5-cf232de4615f0fe9435d6e92a1d6319c972a8c88.tar.xz |
Ruby: use ClockedObject in Consumer class
Many Ruby structures inherit from the Consumer, which is used for scheduling
events. The Consumer used to relay on an Event Manager for scheduling events
and on g_system_ptr for time. With this patch, the Consumer will now use a
ClockedObject to schedule events and to query for current time. This resulted
in several structures being converted from SimObjects to ClockedObjects. Also,
the MessageBuffer class now requires a pointer to a ClockedObject so as to
query for time.
Diffstat (limited to 'src/mem/slicc')
-rw-r--r-- | src/mem/slicc/ast/AST.py | 2 | ||||
-rw-r--r-- | src/mem/slicc/symbols/StateMachine.py | 17 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/mem/slicc/ast/AST.py b/src/mem/slicc/ast/AST.py index 9e3844445..6eaa452cc 100644 --- a/src/mem/slicc/ast/AST.py +++ b/src/mem/slicc/ast/AST.py @@ -55,6 +55,6 @@ class AST(PairContainer): code = self.slicc.codeFormatter() code(''' panic("Runtime Error at ${{self.location}}, Ruby Time: %d, %s.\\n", - g_system_ptr->getTime(), $message); + curCycle(), $message); ''') return code diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py index 6c85480ab..c676574cc 100644 --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -527,6 +527,8 @@ $c_ident::init() { MachineType machine_type; int base; + machine_type = string_to_MachineType("${{var.machine.ident}}"); + base = MachineType_base_number(machine_type); m_machineID.type = MachineType_${ident}; m_machineID.num = m_version; @@ -592,8 +594,6 @@ $c_ident::init() assert var.machine is not None code(''' -machine_type = string_to_MachineType("${{var.machine.ident}}"); -base = MachineType_base_number(machine_type); $vid = m_net_ptr->get${network}NetQueue(m_version + base, $ordered, $vnet, "$vnet_type"); ''') @@ -638,15 +638,14 @@ $vid->setDescription("[Version " + to_string(m_version) + ", ${ident}, name=${{v for prefetcher in self.prefetchers: code('${{prefetcher.code}}.setController(this);') - # Set the queue consumers code() for port in self.in_ports: + # Set the queue consumers code('${{port.code}}.setConsumer(this);') - - # Set the queue descriptions - code() - for port in self.in_ports: + # Set the queue descriptions code('${{port.code}}.setDescription("[Version " + to_string(m_version) + ", $ident, $port]");') + # Set the clock object + code('${{port.code}}.setClockObj(this);') # Initialize the transition profiling code() @@ -1139,7 +1138,7 @@ ${ident}_Controller::doTransition(${ident}_Event event, ${ident}_State next_state = state; DPRINTF(RubyGenerated, "%s, Time: %lld, state: %s, event: %s, addr: %s\\n", - *this, g_system_ptr->getTime(), ${ident}_State_to_string(state), + *this, curCycle(), ${ident}_State_to_string(state), ${ident}_Event_to_string(event), addr); TransitionResult result = @@ -1312,7 +1311,7 @@ if (!checkResourceAvailable(%s_RequestType_%s, addr)) { default: fatal("Invalid transition\\n" "%s time: %d addr: %s event: %s state: %s\\n", - name(), g_system_ptr->getTime(), addr, event, state); + name(), curCycle(), addr, event, state); } return TransitionResult_Valid; } |