From 2f30950143cc70bc42a3c8a4111d7cf8198ec881 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 11 May 2009 10:38:43 -0700 Subject: ruby: Import ruby and slicc from GEMS We eventually plan to replace the m5 cache hierarchy with the GEMS hierarchy, but for now we will make both live alongside eachother. --- src/mem/ruby/init.cc | 307 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 src/mem/ruby/init.cc (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc new file mode 100644 index 000000000..213d6b176 --- /dev/null +++ b/src/mem/ruby/init.cc @@ -0,0 +1,307 @@ + +/* + * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * init.C + * + * Description: See init.h + * + * $Id$ + * + */ + +#include "Global.hh" +#include "EventQueue.hh" +#include "System.hh" +#include "Debug.hh" +#include "Profiler.hh" +#include "Tester.hh" +#include "OpalInterface.hh" +#include "init.hh" +#include "interface.hh" + +#ifdef CONTIGUOUS_ADDRESSES +#include "ContiguousAddressTranslator.hh" + +/* Declared in interface.C */ +extern ContiguousAddressTranslator * g_p_ca_translator; + +#endif // #ifdef CONTIGUOUS_ADDRESSES + +using namespace std; +#include +#include +#include + +// Maurice +// extern "C" { +// #include "simics/api.hh" +// }; + +#include "FakeSimicsDataTypes.hh" + +#include "confio.hh" +#include "initvar.hh" + +// A generated file containing the default parameters in string form +// The defaults are stored in the variable global_default_param +#include "default_param.hh" + +attr_value_t ruby_session_get( void *id, void *obj, + attr_value_t *idx ) { + attr_value_t ret; + + // all session attributes default to return invalid + ret.kind = Sim_Val_Invalid; + return ret; +} + +set_error_t ruby_session_set( void *id, void *obj, + attr_value_t *val, attr_value_t *idx ) { + const char *command = (const char *) id; + // Add new ruby commands to this function + +#if 0 // Eventually add these commands back in + if (!strcmp(command, "dump-stats" ) ) { + char* filename = (char*) val->u.string; + if(strcmp(filename, "")){ + ruby_dump_stats(filename); + } else { + ruby_dump_stats(NULL); + } + return Sim_Set_Ok; + } else if (!strcmp(command, "dump-short-stats" ) ) { + char* filename = (char*) val->u.string; + if(strcmp(filename, "")){ + ruby_dump_short_stats(filename); + } else { + ruby_dump_short_stats(NULL); + } + return Sim_Set_Ok; + } else if (!strcmp(command, "periodic-stats-file" ) ) { + char* filename = (char*) val->u.string; + ruby_set_periodic_stats_file(filename); + return Sim_Set_Ok; + } else if (!strcmp(command, "periodic-stats-interval" ) ) { + int interval = val->u.integer; + ruby_set_periodic_stats_interval(interval); + return Sim_Set_Ok; + } else if (!strcmp(command, "clear-stats" ) ) { + ruby_clear_stats(); + return Sim_Set_Ok; + } else if (!strcmp(command, "debug-verb" ) ) { + char* new_verbosity = (char*) val->u.string; + ruby_change_debug_verbosity(new_verbosity); + return Sim_Set_Ok; + } else if (!strcmp(command, "debug-filter" ) ) { + char* new_debug_filter = (char*) val->u.string; + ruby_change_debug_filter(new_debug_filter); + return Sim_Set_Ok; + } else if (!strcmp(command, "debug-output-file" ) ) { + char* new_filename = (char*) val->u.string; + ruby_set_debug_output_file(new_filename); + return Sim_Set_Ok; + } else if (!strcmp(command, "debug-start-time" ) ) { + char* new_start_time = (char*) val->u.string; + ruby_set_debug_start_time(new_start_time); + return Sim_Set_Ok; + } else if (!strcmp(command, "load-caches" ) ) { + char* filename = (char*) val->u.string; + ruby_load_caches(filename); + return Sim_Set_Ok; + } else if (!strcmp(command, "save-caches" ) ) { + char* filename = (char*) val->u.string; + ruby_save_caches(filename); + return Sim_Set_Ok; + } else if (!strcmp(command, "dump-cache" ) ) { + int cpuNumber = val->u.integer; + ruby_dump_cache(cpuNumber); + return Sim_Set_Ok; + } else if (!strcmp(command, "dump-cache-data" ) ) { + int cpuNumber = val->u.list.vector[0].u.integer; + char *filename = (char*) val->u.list.vector[1].u.string; + ruby_dump_cache_data( cpuNumber, filename ); + return Sim_Set_Ok; + } else if (!strcmp(command, "tracer-output-file" ) ) { + char* new_filename = (char*) val->u.string; + ruby_set_tracer_output_file(new_filename); + return Sim_Set_Ok; + } else if (!strcmp(command, "xact-visualizer-file" ) ) { + char* new_filename = (char*) val->u.string; + ruby_xact_visualizer_file(new_filename); + return Sim_Set_Ok; + } + fprintf( stderr, "error: unrecognized command: %s\n", command ); +#endif + return Sim_Set_Illegal_Value; +} + +static initvar_t *ruby_initvar_obj = NULL; + +//*************************************************************************** +static void init_generate_values( void ) +{ + /* update generated values, based on input configuration */ +} + +//*************************************************************************** +void init_variables( void ) +{ + // allocate the "variable initialization" package + ruby_initvar_obj = new initvar_t( "ruby", "../../../ruby/", + global_default_param, + &init_simulator, + &init_generate_values, + &ruby_session_get, + &ruby_session_set ); +} + +void init_simulator() +{ + // Set things to NULL to make sure we don't de-reference them + // without a seg. fault. + g_system_ptr = NULL; + g_debug_ptr = NULL; + g_eventQueue_ptr = NULL; + + cout << "Ruby Timing Mode" << endl; +#ifndef MULTIFACET_NO_OPT_WARN + cerr << "Warning: optimizations not enabled." << endl; +#endif + + if (g_SIMICS) { + // LUKE - if we don't set the default SMT threads in condor scripts, + // set it now + if(g_NUM_SMT_THREADS == 0){ + g_NUM_SMT_THREADS = 1; + } + if(g_NUM_PROCESSORS == 0){ + //only set to default if value not set in condor scripts + // Account for SMT systems also + g_NUM_PROCESSORS = SIMICS_number_processors()/g_NUM_SMT_THREADS; + } + } + + RubyConfig::init(); + + g_debug_ptr = new Debug( DEBUG_FILTER_STRING, + DEBUG_VERBOSITY_STRING, + DEBUG_START_TIME, + DEBUG_OUTPUT_FILENAME ); + + cout << "Creating event queue..." << endl; + g_eventQueue_ptr = new EventQueue; + cout << "Creating event queue done" << endl; + + cout << "Creating system..." << endl; + cout << " Processors: " << RubyConfig::numberOfProcessors() << endl; + + g_system_ptr = new System; + cout << "Creating system done" << endl; + + // if opal is loaded, its static interface object (inst) will be non-null, + // and the opal object needs to be notified that ruby is now loaded. + // "1" indicates a load and should be replaced with an enumerated type. + if (OpalInterface::inst != NULL) { + OpalInterface::inst->notify( 1 ); + } + +#ifdef CONTIGUOUS_ADDRESSES + if(g_SIMICS) { + cout << "Establishing Contiguous Address Space Mappings..." << flush; + g_p_ca_translator = new ContiguousAddressTranslator(); + assert(g_p_ca_translator!=NULL); + if(g_p_ca_translator->AddressesAreContiguous()) { + cout << "Physical Memory Addresses are already contiguous." << endl; + delete g_p_ca_translator; + g_p_ca_translator = NULL; + } else { + cout << "Done." << endl; + } + } else { + g_p_ca_translator = NULL; + } +#endif // #ifdef CONTIGUOUS_ADDRESSES + + cout << "Ruby initialization complete" << endl; +} + +void init_opal_interface( mf_ruby_api_t *api ) +{ + OpalInterface::installInterface( api ); +} + +int init_use_snoop() +{ + if (g_SIMICS) { + // The "snoop interface" defined by simics allows ruby to see store + // data values (from simics). If DATA_BLOCK is defined, we are tracking + // data, so we need to install the snoop interface. + return ((DATA_BLOCK == true) || (XACT_MEMORY)); + } else { + return (0); + } +} + +void destroy_simulator() +{ + cout << "Deleting system..." << endl; + delete g_system_ptr; + cout << "Deleting system done" << endl; + + cout << "Deleting event queue..." << endl; + delete g_eventQueue_ptr; + cout << "Deleting event queue done" << endl; + + delete g_debug_ptr; +} + +/*-------------------------------------------------------------------------+ + | DG: These are the external load and unload hooks that will be called by | + | M5 in phase 1 integration, and possibly afterwards, too. | + +-------------------------------------------------------------------------*/ + +extern "C" +int OnLoadRuby() { + init_variables(); + return 0; +} + +extern "C" +int OnInitRuby() { + init_simulator(); + return 0; +} + +extern "C" +int OnUnloadRuby() { + destroy_simulator(); + return 0; +} + -- cgit v1.2.3 From b05da09cd69329b3fef33eefd8cbf835f7d6e2f8 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 11 May 2009 10:38:44 -0700 Subject: ruby: strip out some unused defines --- src/mem/ruby/init.cc | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index 213d6b176..5efc8f691 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -191,9 +191,6 @@ void init_simulator() g_eventQueue_ptr = NULL; cout << "Ruby Timing Mode" << endl; -#ifndef MULTIFACET_NO_OPT_WARN - cerr << "Warning: optimizations not enabled." << endl; -#endif if (g_SIMICS) { // LUKE - if we don't set the default SMT threads in condor scripts, -- cgit v1.2.3 From ab5e4a22b3893fb0ccdfbf466d46983caeb5948e Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Date: Mon, 11 May 2009 10:38:44 -0700 Subject: ruby: Removed System name clash by renaming ruby's System to RubySystem --- src/mem/ruby/init.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index 5efc8f691..e230bb591 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -219,7 +219,7 @@ void init_simulator() cout << "Creating system..." << endl; cout << " Processors: " << RubyConfig::numberOfProcessors() << endl; - g_system_ptr = new System; + g_system_ptr = new RubySystem; cout << "Creating system done" << endl; // if opal is loaded, its static interface object (inst) will be non-null, -- cgit v1.2.3 From 6e8373fad6f5faac0648c814f8c7ddc21023dc6c Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Mon, 11 May 2009 10:38:45 -0700 Subject: ruby: Renamed Ruby's EventQueue to RubyEventQueue --HG-- rename : src/mem/ruby/eventqueue/EventQueue.cc => src/mem/ruby/eventqueue/RubyEventQueue.cc rename : src/mem/ruby/eventqueue/EventQueue.hh => src/mem/ruby/eventqueue/RubyEventQueue.hh rename : src/mem/ruby/eventqueue/EventQueueNode.cc => src/mem/ruby/eventqueue/RubyEventQueueNode.cc rename : src/mem/ruby/eventqueue/EventQueueNode.hh => src/mem/ruby/eventqueue/RubyEventQueueNode.hh --- src/mem/ruby/init.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index e230bb591..534b1c286 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -37,7 +37,7 @@ */ #include "Global.hh" -#include "EventQueue.hh" +#include "RubyEventQueue.hh" #include "System.hh" #include "Debug.hh" #include "Profiler.hh" @@ -213,7 +213,7 @@ void init_simulator() DEBUG_OUTPUT_FILENAME ); cout << "Creating event queue..." << endl; - g_eventQueue_ptr = new EventQueue; + g_eventQueue_ptr = new RubyEventQueue; cout << "Creating event queue done" << endl; cout << "Creating system..." << endl; -- cgit v1.2.3 From d8c592a05d884560b3cbbe04d9e1ed9cf6575eaa Mon Sep 17 00:00:00 2001 From: Dan Gibson Date: Mon, 11 May 2009 10:38:45 -0700 Subject: ruby: remove unnecessary code. 1) Removing files from the ruby build left some unresovled symbols. Those have been fixed. 2) Most of the dependencies on Simics data types and the simics interface files have been removed. 3) Almost all mention of opal is gone. 4) Huge chunks of LogTM are now gone. 5) Handling 1-4 left ~hundreds of unresolved references, which were fixed, yielding a snowball effect (and the massive size of this delta). --- src/mem/ruby/init.cc | 244 +++++++++------------------------------------------ 1 file changed, 43 insertions(+), 201 deletions(-) (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index 534b1c286..a2e874df8 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -42,30 +42,13 @@ #include "Debug.hh" #include "Profiler.hh" #include "Tester.hh" -#include "OpalInterface.hh" #include "init.hh" -#include "interface.hh" - -#ifdef CONTIGUOUS_ADDRESSES -#include "ContiguousAddressTranslator.hh" - -/* Declared in interface.C */ -extern ContiguousAddressTranslator * g_p_ca_translator; - -#endif // #ifdef CONTIGUOUS_ADDRESSES using namespace std; #include #include #include -// Maurice -// extern "C" { -// #include "simics/api.hh" -// }; - -#include "FakeSimicsDataTypes.hh" - #include "confio.hh" #include "initvar.hh" @@ -73,210 +56,65 @@ using namespace std; // The defaults are stored in the variable global_default_param #include "default_param.hh" -attr_value_t ruby_session_get( void *id, void *obj, - attr_value_t *idx ) { - attr_value_t ret; - - // all session attributes default to return invalid - ret.kind = Sim_Val_Invalid; - return ret; -} - -set_error_t ruby_session_set( void *id, void *obj, - attr_value_t *val, attr_value_t *idx ) { - const char *command = (const char *) id; - // Add new ruby commands to this function - -#if 0 // Eventually add these commands back in - if (!strcmp(command, "dump-stats" ) ) { - char* filename = (char*) val->u.string; - if(strcmp(filename, "")){ - ruby_dump_stats(filename); - } else { - ruby_dump_stats(NULL); - } - return Sim_Set_Ok; - } else if (!strcmp(command, "dump-short-stats" ) ) { - char* filename = (char*) val->u.string; - if(strcmp(filename, "")){ - ruby_dump_short_stats(filename); - } else { - ruby_dump_short_stats(NULL); - } - return Sim_Set_Ok; - } else if (!strcmp(command, "periodic-stats-file" ) ) { - char* filename = (char*) val->u.string; - ruby_set_periodic_stats_file(filename); - return Sim_Set_Ok; - } else if (!strcmp(command, "periodic-stats-interval" ) ) { - int interval = val->u.integer; - ruby_set_periodic_stats_interval(interval); - return Sim_Set_Ok; - } else if (!strcmp(command, "clear-stats" ) ) { - ruby_clear_stats(); - return Sim_Set_Ok; - } else if (!strcmp(command, "debug-verb" ) ) { - char* new_verbosity = (char*) val->u.string; - ruby_change_debug_verbosity(new_verbosity); - return Sim_Set_Ok; - } else if (!strcmp(command, "debug-filter" ) ) { - char* new_debug_filter = (char*) val->u.string; - ruby_change_debug_filter(new_debug_filter); - return Sim_Set_Ok; - } else if (!strcmp(command, "debug-output-file" ) ) { - char* new_filename = (char*) val->u.string; - ruby_set_debug_output_file(new_filename); - return Sim_Set_Ok; - } else if (!strcmp(command, "debug-start-time" ) ) { - char* new_start_time = (char*) val->u.string; - ruby_set_debug_start_time(new_start_time); - return Sim_Set_Ok; - } else if (!strcmp(command, "load-caches" ) ) { - char* filename = (char*) val->u.string; - ruby_load_caches(filename); - return Sim_Set_Ok; - } else if (!strcmp(command, "save-caches" ) ) { - char* filename = (char*) val->u.string; - ruby_save_caches(filename); - return Sim_Set_Ok; - } else if (!strcmp(command, "dump-cache" ) ) { - int cpuNumber = val->u.integer; - ruby_dump_cache(cpuNumber); - return Sim_Set_Ok; - } else if (!strcmp(command, "dump-cache-data" ) ) { - int cpuNumber = val->u.list.vector[0].u.integer; - char *filename = (char*) val->u.list.vector[1].u.string; - ruby_dump_cache_data( cpuNumber, filename ); - return Sim_Set_Ok; - } else if (!strcmp(command, "tracer-output-file" ) ) { - char* new_filename = (char*) val->u.string; - ruby_set_tracer_output_file(new_filename); - return Sim_Set_Ok; - } else if (!strcmp(command, "xact-visualizer-file" ) ) { - char* new_filename = (char*) val->u.string; - ruby_xact_visualizer_file(new_filename); - return Sim_Set_Ok; - } - fprintf( stderr, "error: unrecognized command: %s\n", command ); -#endif - return Sim_Set_Illegal_Value; -} - -static initvar_t *ruby_initvar_obj = NULL; +static initvar_t *ruby_initvar_obj = NULL; //*************************************************************************** static void init_generate_values( void ) { - /* update generated values, based on input configuration */ + /* update generated values, based on input configuration */ } //*************************************************************************** void init_variables( void ) { - // allocate the "variable initialization" package - ruby_initvar_obj = new initvar_t( "ruby", "../../../ruby/", - global_default_param, - &init_simulator, - &init_generate_values, - &ruby_session_get, - &ruby_session_set ); + // allocate the "variable initialization" package + ruby_initvar_obj = new initvar_t( "ruby", "../../../ruby/", + global_default_param, + &init_simulator, + &init_generate_values ); } void init_simulator() { - // Set things to NULL to make sure we don't de-reference them - // without a seg. fault. - g_system_ptr = NULL; - g_debug_ptr = NULL; - g_eventQueue_ptr = NULL; + // Set things to NULL to make sure we don't de-reference them + // without a seg. fault. + g_system_ptr = NULL; + g_debug_ptr = NULL; + g_eventQueue_ptr = NULL; - cout << "Ruby Timing Mode" << endl; + cout << "Ruby Timing Mode" << endl; - if (g_SIMICS) { - // LUKE - if we don't set the default SMT threads in condor scripts, - // set it now - if(g_NUM_SMT_THREADS == 0){ - g_NUM_SMT_THREADS = 1; - } - if(g_NUM_PROCESSORS == 0){ - //only set to default if value not set in condor scripts - // Account for SMT systems also - g_NUM_PROCESSORS = SIMICS_number_processors()/g_NUM_SMT_THREADS; - } - } + RubyConfig::init(); - RubyConfig::init(); + g_debug_ptr = new Debug( DEBUG_FILTER_STRING, + DEBUG_VERBOSITY_STRING, + DEBUG_START_TIME, + DEBUG_OUTPUT_FILENAME ); - g_debug_ptr = new Debug( DEBUG_FILTER_STRING, - DEBUG_VERBOSITY_STRING, - DEBUG_START_TIME, - DEBUG_OUTPUT_FILENAME ); + cout << "Creating event queue..." << endl; + g_eventQueue_ptr = new RubyEventQueue; + cout << "Creating event queue done" << endl; - cout << "Creating event queue..." << endl; - g_eventQueue_ptr = new RubyEventQueue; - cout << "Creating event queue done" << endl; + cout << "Creating system..." << endl; + cout << " Processors: " << RubyConfig::numberOfProcessors() << endl; - cout << "Creating system..." << endl; - cout << " Processors: " << RubyConfig::numberOfProcessors() << endl; + g_system_ptr = new RubySystem; + cout << "Creating system done" << endl; - g_system_ptr = new RubySystem; - cout << "Creating system done" << endl; - - // if opal is loaded, its static interface object (inst) will be non-null, - // and the opal object needs to be notified that ruby is now loaded. - // "1" indicates a load and should be replaced with an enumerated type. - if (OpalInterface::inst != NULL) { - OpalInterface::inst->notify( 1 ); - } - -#ifdef CONTIGUOUS_ADDRESSES - if(g_SIMICS) { - cout << "Establishing Contiguous Address Space Mappings..." << flush; - g_p_ca_translator = new ContiguousAddressTranslator(); - assert(g_p_ca_translator!=NULL); - if(g_p_ca_translator->AddressesAreContiguous()) { - cout << "Physical Memory Addresses are already contiguous." << endl; - delete g_p_ca_translator; - g_p_ca_translator = NULL; - } else { - cout << "Done." << endl; - } - } else { - g_p_ca_translator = NULL; - } -#endif // #ifdef CONTIGUOUS_ADDRESSES - - cout << "Ruby initialization complete" << endl; -} - -void init_opal_interface( mf_ruby_api_t *api ) -{ - OpalInterface::installInterface( api ); -} - -int init_use_snoop() -{ - if (g_SIMICS) { - // The "snoop interface" defined by simics allows ruby to see store - // data values (from simics). If DATA_BLOCK is defined, we are tracking - // data, so we need to install the snoop interface. - return ((DATA_BLOCK == true) || (XACT_MEMORY)); - } else { - return (0); - } + cout << "Ruby initialization complete" << endl; } void destroy_simulator() { - cout << "Deleting system..." << endl; - delete g_system_ptr; - cout << "Deleting system done" << endl; + cout << "Deleting system..." << endl; + delete g_system_ptr; + cout << "Deleting system done" << endl; - cout << "Deleting event queue..." << endl; - delete g_eventQueue_ptr; - cout << "Deleting event queue done" << endl; + cout << "Deleting event queue..." << endl; + delete g_eventQueue_ptr; + cout << "Deleting event queue done" << endl; - delete g_debug_ptr; + delete g_debug_ptr; } /*-------------------------------------------------------------------------+ @@ -286,19 +124,23 @@ void destroy_simulator() extern "C" int OnLoadRuby() { - init_variables(); - return 0; + init_variables(); + return 0; } extern "C" int OnInitRuby() { - init_simulator(); - return 0; + init_simulator(); + return 0; } extern "C" int OnUnloadRuby() { - destroy_simulator(); - return 0; + destroy_simulator(); + return 0; } +/* I have to put it somewhere for now */ +void tester_main(int argc, char **argv) { + std::cout << __FILE__ << "(" << __LINE__ << "): Not implemented." << std::endl; +} -- cgit v1.2.3 From 24da30e317cdbf4b628141d69b2d17dac5ae3822 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 11 May 2009 10:38:45 -0700 Subject: ruby: Make ruby #includes use full paths to the files they're including. This basically means changing all #include statements and changing autogenerated code so that it generates the correct paths. Because slicc generates #includes, I had to hard code the include paths to mem/protocol. --- src/mem/ruby/init.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index a2e874df8..22a048b5b 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -36,25 +36,25 @@ * */ -#include "Global.hh" -#include "RubyEventQueue.hh" -#include "System.hh" -#include "Debug.hh" -#include "Profiler.hh" -#include "Tester.hh" -#include "init.hh" +#include "mem/ruby/common/Global.hh" +#include "mem/ruby/eventqueue/RubyEventQueue.hh" +#include "mem/ruby/system/System.hh" +#include "mem/ruby/common/Debug.hh" +#include "mem/ruby/profiler/Profiler.hh" +#include "mem/ruby/tester/Tester.hh" +#include "mem/ruby/init.hh" using namespace std; #include #include #include -#include "confio.hh" -#include "initvar.hh" +#include "mem/gems_common/ioutil/confio.hh" +#include "mem/gems_common/ioutil/initvar.hh" // A generated file containing the default parameters in string form // The defaults are stored in the variable global_default_param -#include "default_param.hh" +#include "mem/protocol/default_param.hh" static initvar_t *ruby_initvar_obj = NULL; -- cgit v1.2.3 From 7311fd7182bfe65206c5655d058a72dd717cbe42 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 11 May 2009 10:38:46 -0700 Subject: ruby: Migrate all of ruby and slicc to SCons. Add the PROTOCOL sticky option sets the coherence protocol that slicc will parse and therefore ruby will use. This whole process was made difficult by the fact that the set of files that are output by slicc are not easily known ahead of time. The easiest thing wound up being to write a parser for slicc that would tell me. Incidentally this means we now have a slicc grammar written in python. --- src/mem/ruby/init.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index 22a048b5b..ae81dfc57 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -54,7 +54,7 @@ using namespace std; // A generated file containing the default parameters in string form // The defaults are stored in the variable global_default_param -#include "mem/protocol/default_param.hh" +#include "mem/ruby/default_param.hh" static initvar_t *ruby_initvar_obj = NULL; -- cgit v1.2.3 From 9f34659c52e0ea9095e86d82ac87a9c3d4d0f25a Mon Sep 17 00:00:00 2001 From: Polina Dudnik Date: Mon, 11 May 2009 10:38:46 -0700 Subject: ruby: reordered Debug and RubyConfig::init to fix segfault due to uninitialized output file pointer. --- src/mem/ruby/init.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index ae81dfc57..6e29b1a41 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -84,12 +84,12 @@ void init_simulator() cout << "Ruby Timing Mode" << endl; - RubyConfig::init(); g_debug_ptr = new Debug( DEBUG_FILTER_STRING, DEBUG_VERBOSITY_STRING, DEBUG_START_TIME, DEBUG_OUTPUT_FILENAME ); + RubyConfig::init(); cout << "Creating event queue..." << endl; g_eventQueue_ptr = new RubyEventQueue; -- cgit v1.2.3 From 93f2f69657d0a2420a2c86b71505e6d27e6e2a38 Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Date: Mon, 11 May 2009 10:38:46 -0700 Subject: ruby: Working M5 interface and updated Ruby interface. This changeset also includes a lot of work from Derek Hower RubyMemory is now both a driver for Ruby and a port for M5. Changed makeRequest/hitCallback interface. Brought packets (superficially) into the sequencer. Modified tester infrastructure to be packet based. and Ruby can be used together through the example ruby_se.py script. SPARC parallel applications work, and the timing *seems* right from combined M5/Ruby debug traces. To run, % build/ALPHA_SE/m5.debug configs/example/ruby_se.py -c tests/test-progs/hello/bin/alpha/linux/hello -n 4 -t --- src/mem/ruby/init.cc | 63 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 9 deletions(-) (limited to 'src/mem/ruby/init.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index 6e29b1a41..bf7fcf397 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -40,6 +40,7 @@ #include "mem/ruby/eventqueue/RubyEventQueue.hh" #include "mem/ruby/system/System.hh" #include "mem/ruby/common/Debug.hh" +#include "mem/ruby/common/Driver.hh" #include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/tester/Tester.hh" #include "mem/ruby/init.hh" @@ -65,14 +66,27 @@ static void init_generate_values( void ) } //*************************************************************************** + void init_variables( void ) { - // allocate the "variable initialization" package - ruby_initvar_obj = new initvar_t( "ruby", "../../../ruby/", - global_default_param, - &init_simulator, - &init_generate_values ); + // allocate the "variable initialization" package + ruby_initvar_obj = new initvar_t( "ruby", "../../../ruby/", + global_default_param, + &init_simulator, + &init_generate_values); +} + + + /* +void init_variables(const char* config_str ) +{ + // allocate the "variable initialization" package + ruby_initvar_obj = new initvar_t( "ruby", "../../../ruby/", + config_str, + &init_simulator, + &init_generate_values ); } + */ void init_simulator() { @@ -104,6 +118,36 @@ void init_simulator() cout << "Ruby initialization complete" << endl; } +void init_simulator(Driver* _driver) +{ + // Set things to NULL to make sure we don't de-reference them + // without a seg. fault. + g_system_ptr = NULL; + g_debug_ptr = NULL; + g_eventQueue_ptr = NULL; + + cout << "Ruby Timing Mode" << endl; + + + g_debug_ptr = new Debug( DEBUG_FILTER_STRING, + DEBUG_VERBOSITY_STRING, + DEBUG_START_TIME, + DEBUG_OUTPUT_FILENAME ); + RubyConfig::init(); + + cout << "Creating event queue..." << endl; + g_eventQueue_ptr = new RubyEventQueue; + cout << "Creating event queue done" << endl; + + cout << "Creating system..." << endl; + cout << " Processors: " << RubyConfig::numberOfProcessors() << endl; + + g_system_ptr = new RubySystem(_driver); + cout << "Creating system done" << endl; + + cout << "Ruby initialization complete" << endl; +} + void destroy_simulator() { cout << "Deleting system..." << endl; @@ -122,7 +166,8 @@ void destroy_simulator() | M5 in phase 1 integration, and possibly afterwards, too. | +-------------------------------------------------------------------------*/ -extern "C" +//dsm: superfluous +/*extern "C" int OnLoadRuby() { init_variables(); return 0; @@ -136,9 +181,9 @@ int OnInitRuby() { extern "C" int OnUnloadRuby() { - destroy_simulator(); - return 0; -} + destroy_simulator(); + return 0; +}*/ /* I have to put it somewhere for now */ void tester_main(int argc, char **argv) { -- cgit v1.2.3