summaryrefslogtreecommitdiff
path: root/src/mem/ruby/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/common')
-rw-r--r--src/mem/ruby/common/Debug.cc55
-rw-r--r--src/mem/ruby/common/Debug.hh11
-rw-r--r--src/mem/ruby/common/Debug.py23
-rw-r--r--src/mem/ruby/common/SConscript2
4 files changed, 45 insertions, 46 deletions
diff --git a/src/mem/ruby/common/Debug.cc b/src/mem/ruby/common/Debug.cc
index cb9fdf082..68ab2448b 100644
--- a/src/mem/ruby/common/Debug.cc
+++ b/src/mem/ruby/common/Debug.cc
@@ -87,53 +87,20 @@ void changeDebugFilter(int filter)
g_debug_ptr->setFilter(filter);
}
-Debug::Debug()
+Debug::Debug(const Params *p)
+ : SimObject(p)
{
- m_verbosityLevel = No_Verb;
- m_starting_cycle = ~0;
clearFilter();
debug_cout_ptr = &cout;
-}
-
-Debug::Debug( const string & name, const vector<string> & argv )
-{
- //
- // must clear the filter before adding filter strings
- //
- clearFilter();
- for (size_t i=0;i<argv.size();i+=2) {
- if (argv[i] == "filter_string") {
- if (setFilterString(argv[i+1].c_str())) {
- fatal("could not set filter string to %s\n", argv[i+1].c_str());
- }
- } else if (argv[i] == "verbosity_string") {
- setVerbosityString( argv[i+1].c_str() );
- } else if (argv[i] == "start_time") {
- m_starting_cycle = atoi( argv[i+1].c_str() );
- } else if (argv[i] == "output_filename") {
- setDebugOutputFile( argv[i+1].c_str() );
- } else if (argv[i] == "protocol_trace") {
- m_protocol_trace = string_to_bool(argv[i+1]);
- } else {
- fatal("invalid argument %s\n");
- }
- }
+ setFilterString(p->filter_string.c_str());
+ setVerbosityString(p->verbosity_string.c_str());
+ setDebugOutputFile(p->output_filename.c_str());
+ m_starting_cycle = p->start_time;
+ m_protocol_trace = p->protocol_trace;
+ g_debug_ptr = this;
}
-Debug::Debug( const char *filterString, const char *verboseString,
- Time filterStartTime, const char *filename )
-{
- m_verbosityLevel = No_Verb;
- clearFilter();
- debug_cout_ptr = &cout;
-
- m_starting_cycle = filterStartTime;
- if (setFilterString(filterString))
- fatal("could not set filter string to %s\n", filterString);
- setVerbosityString( verboseString );
- setDebugOutputFile( filename );
-}
Debug::~Debug()
{
@@ -417,3 +384,9 @@ void ERROR_OUT( const char* fmt, ... ) {
}
*/
+
+Debug *
+RubyDebugParams::create()
+{
+ return new Debug(this);
+}
diff --git a/src/mem/ruby/common/Debug.hh b/src/mem/ruby/common/Debug.hh
index 03e123866..5fb4d412f 100644
--- a/src/mem/ruby/common/Debug.hh
+++ b/src/mem/ruby/common/Debug.hh
@@ -41,6 +41,9 @@
#include "config/ruby_debug.hh"
#include "mem/ruby/common/Global.hh"
+#include "sim/sim_object.hh"
+
+#include "params/RubyDebug.hh"
extern std::ostream * debug_cout_ptr;
@@ -70,13 +73,11 @@ enum DebugComponents
enum PriorityLevel {HighPrio, MedPrio, LowPrio};
enum VerbosityLevel {No_Verb, Low_Verb, Med_Verb, High_Verb};
-class Debug {
+class Debug : public SimObject {
public:
// Constructors
- Debug();
- Debug(const std::string & name, const std::vector<std::string> & argv);
- Debug( const char *filterString, const char *verboseString,
- Time filterStartTime, const char *filename );
+ typedef RubyDebugParams Params;
+ Debug(const Params *p);
// Destructor
~Debug();
diff --git a/src/mem/ruby/common/Debug.py b/src/mem/ruby/common/Debug.py
new file mode 100644
index 000000000..09886d0c6
--- /dev/null
+++ b/src/mem/ruby/common/Debug.py
@@ -0,0 +1,23 @@
+from m5.params import *
+from m5.SimObject import SimObject
+
+class RubyDebug(SimObject):
+ type = 'RubyDebug'
+ cxx_class = 'Debug'
+
+ filter_string = Param.String('none',
+ "a string for filtering debugging output (see Debug.h)")
+ verbosity_string = Param.String('none',
+ "filters debugging messages based on priority (low, med, high)")
+ output_filename = Param.String('none',
+ "sends debugging messages to a file")
+ start_time = Param.Tick(1,
+ "filters debugging messages based on a ruby time")
+ # For debugging purposes, one can enable a trace of all the protocol
+ # state machine changes. Unfortunately, the code to generate the
+ # trace is protocol specific. To enable the code for some of the
+ # standard protocols,
+ # 1. change protocol_trace = true
+ # 2. enable debug in the Ruby Makefile
+ protocol_trace = Param.Bool(False,
+ "enable protocol state machine trace")
diff --git a/src/mem/ruby/common/SConscript b/src/mem/ruby/common/SConscript
index 15df8312e..56f5d7556 100644
--- a/src/mem/ruby/common/SConscript
+++ b/src/mem/ruby/common/SConscript
@@ -33,6 +33,8 @@ Import('*')
if not env['RUBY']:
Return()
+SimObject('Debug.py')
+
Source('Address.cc')
Source('DataBlock.cc')
Source('Debug.cc')