From 98c94cfe3ce83634f3bad79ca18263f42e36ca6a Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Fri, 29 Jan 2010 20:29:17 -0800 Subject: ruby: Convert most Ruby objects to M5 SimObjects. The necessary companion conversion of Ruby objects generated by SLICC are converted to M5 SimObjects in the following patch, so this patch alone does not compile. Conversion of Garnet network models is also handled in a separate patch; that code is temporarily disabled from compiling to allow testing of interim code. --- src/mem/ruby/common/Debug.cc | 55 +++++++++++------------------------------- src/mem/ruby/common/Debug.hh | 11 +++++---- src/mem/ruby/common/Debug.py | 23 ++++++++++++++++++ src/mem/ruby/common/SConscript | 2 ++ 4 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 src/mem/ruby/common/Debug.py (limited to 'src/mem/ruby/common') 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 & argv ) -{ - // - // must clear the filter before adding filter strings - // - clearFilter(); - for (size_t i=0;ifilter_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 & 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') -- cgit v1.2.3