summaryrefslogtreecommitdiff
path: root/src/cpu/rubytest/RubyTester.hh
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-03-29 20:39:02 -0400
committerNathan Binkert <nate@binkert.org>2010-03-29 20:39:02 -0400
commit60ae1d2b10002bb73b420fce91c4b74397c55457 (patch)
treef986a920f3d8702f93f8aefa8a64007495144ae6 /src/cpu/rubytest/RubyTester.hh
parent1c98bc5a567599f9fdc7d9940dbfe907091cb3b4 (diff)
downloadgem5-60ae1d2b10002bb73b420fce91c4b74397c55457.tar.xz
style: cleanup the Ruby Tester
Diffstat (limited to 'src/cpu/rubytest/RubyTester.hh')
-rw-r--r--src/cpu/rubytest/RubyTester.hh190
1 files changed, 86 insertions, 104 deletions
diff --git a/src/cpu/rubytest/RubyTester.hh b/src/cpu/rubytest/RubyTester.hh
index f1ed7e34e..f4cf4a04d 100644
--- a/src/cpu/rubytest/RubyTester.hh
+++ b/src/cpu/rubytest/RubyTester.hh
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2009 Advanced Micro Devices, Inc.
@@ -28,135 +27,118 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef RUBY_TESTER_H
-#define RUBY_TESTER_H
+#ifndef __CPU_RUBYTEST_RUBYTESTER_HH__
+#define __CPU_RUBYTEST_RUBYTESTER_HH__
-#include "mem/ruby/common/Global.hh"
-#include "mem/mem_object.hh"
#include "cpu/rubytest/CheckTable.hh"
-#include "mem/ruby/system/RubyPort.hh"
-#include "mem/ruby/common/SubBlock.hh"
-#include "mem/ruby/common/DataBlock.hh"
+#include "mem/mem_object.hh"
#include "mem/packet.hh"
+#include "mem/ruby/common/DataBlock.hh"
+#include "mem/ruby/common/Global.hh"
+#include "mem/ruby/common/SubBlock.hh"
+#include "mem/ruby/system/RubyPort.hh"
#include "params/RubyTester.hh"
-class RubyTester : public MemObject
+class RubyTester : public MemObject
{
+ public:
+ class CpuPort : public SimpleTimingPort
+ {
+ private:
+ RubyTester *tester;
+
+ public:
+ CpuPort(const std::string &_name, RubyTester *_tester, int _idx)
+ : SimpleTimingPort(_name, _tester), tester(_tester), idx(_idx)
+ {}
- public:
+ int idx;
- class CpuPort : public SimpleTimingPort
- {
- RubyTester *tester;
+ protected:
+ virtual bool recvTiming(PacketPtr pkt);
+ virtual Tick recvAtomic(PacketPtr pkt);
+ };
- public:
-
- CpuPort(const std::string &_name,
- RubyTester *_tester,
- int _idx)
- : SimpleTimingPort(_name, _tester), tester(_tester), idx(_idx)
- {}
+ struct SenderState : public Packet::SenderState
+ {
+ SubBlock* subBlock;
+ Packet::SenderState *saved;
- int idx;
-
- protected:
-
- virtual bool recvTiming(PacketPtr pkt);
+ SenderState(Address addr, int size,
+ Packet::SenderState *sender_state = NULL)
+ : saved(sender_state)
+ {
+ subBlock = new SubBlock(addr, size);
+ }
- virtual Tick recvAtomic(PacketPtr pkt);
-
- };
+ ~SenderState()
+ {
+ delete subBlock;
+ }
+ };
- struct SenderState : public Packet::SenderState
- {
- SubBlock* subBlock;
- Packet::SenderState *saved;
-
- SenderState(Address addr,
- int size,
- Packet::SenderState *sender_state = NULL)
- : saved(sender_state)
- {subBlock = new SubBlock(addr, size);}
+ typedef RubyTesterParams Params;
+ RubyTester(const Params *p);
+ ~RubyTester();
- ~SenderState() {delete subBlock;}
- };
+ virtual Port *getPort(const std::string &if_name, int idx = -1);
- typedef RubyTesterParams Params;
- // Constructors
- RubyTester(const Params *p);
+ Port* getCpuPort(int idx);
- // Destructor
- ~RubyTester();
-
- // Public Methods
-
- virtual Port *getPort(const std::string &if_name, int idx = -1);
+ virtual void init();
- Port* getCpuPort(int idx);
+ void wakeup();
- void virtual init();
+ void incrementCheckCompletions() { m_checks_completed++; }
- void wakeup();
+ void printStats(ostream& out) const {}
+ void clearStats() {}
+ void printConfig(ostream& out) const {}
- void incrementCheckCompletions() { m_checks_completed++; }
+ void print(ostream& out) const;
- void printStats(ostream& out) const {}
- void clearStats() {}
- void printConfig(ostream& out) const {}
+ protected:
+ class CheckStartEvent : public Event
+ {
+ private:
+ RubyTester *tester;
- void print(ostream& out) const;
+ public:
+ CheckStartEvent(RubyTester *_tester)
+ : Event(CPU_Tick_Pri), tester(_tester)
+ {}
+ void process() { tester->wakeup(); }
+ virtual const char *description() const { return "RubyTester tick"; }
+ };
+
+ CheckStartEvent checkStartEvent;
- protected:
- class CheckStartEvent : public Event
- {
private:
- RubyTester *tester;
-
- public:
- CheckStartEvent(RubyTester *_tester) : Event(CPU_Tick_Pri), tester(_tester) {}
- void process() { tester->wakeup(); }
- virtual const char *description() const { return "RubyTester tick"; }
- };
-
- CheckStartEvent checkStartEvent;
-
-
- private:
- // Private Methods
-
- void hitCallback(NodeID proc, SubBlock* data);
-
- void checkForDeadlock();
-
- // Private copy constructor and assignment operator
- RubyTester(const RubyTester& obj);
- RubyTester& operator=(const RubyTester& obj);
-
- // Data Members (m_ prefix)
-
- CheckTable* m_checkTable_ptr;
- Vector<Time> m_last_progress_vector;
-
- uint64 m_checks_completed;
- std::vector<CpuPort*> ports;
- uint64 m_checks_to_complete;
- int m_deadlock_threshold;
- int m_num_cpu_sequencers;
- int m_wakeup_frequency;
-};
+ void hitCallback(NodeID proc, SubBlock* data);
+
+ void checkForDeadlock();
-// Output operator declaration
-ostream& operator<<(ostream& out, const RubyTester& obj);
+ // Private copy constructor and assignment operator
+ RubyTester(const RubyTester& obj);
+ RubyTester& operator=(const RubyTester& obj);
-// ******************* Definitions *******************
+ CheckTable* m_checkTable_ptr;
+ Vector<Time> m_last_progress_vector;
+
+ uint64 m_checks_completed;
+ std::vector<CpuPort*> ports;
+ uint64 m_checks_to_complete;
+ int m_deadlock_threshold;
+ int m_num_cpu_sequencers;
+ int m_wakeup_frequency;
+};
-// Output operator definition
-extern inline
-ostream& operator<<(ostream& out, const RubyTester& obj)
+inline ostream&
+operator<<(ostream& out, const RubyTester& obj)
{
- obj.print(out);
- out << flush;
- return out;
+ obj.print(out);
+ out << flush;
+ return out;
}
-#endif //RUBY_TESTER_H
+#endif // __CPU_RUBYTEST_RUBYTESTER_HH__