From 69d31fcda599d82e9bcf5970bdecbc181388e5ef Mon Sep 17 00:00:00 2001 From: Dongdong Li Date: Thu, 22 Aug 2013 20:28:46 -0800 Subject: Refactoring: 1. Decouple the constructor of interconnect interface 2. Some type changed to unsigned from int Fixed Bug: wrong variable in InterconnectInterface::Busy() Review: 83001 [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16877] --- src/gpgpu-sim/icnt_wrapper.cc | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src/gpgpu-sim/icnt_wrapper.cc') diff --git a/src/gpgpu-sim/icnt_wrapper.cc b/src/gpgpu-sim/icnt_wrapper.cc index c005dd9..ee58ece 100644 --- a/src/gpgpu-sim/icnt_wrapper.cc +++ b/src/gpgpu-sim/icnt_wrapper.cc @@ -30,16 +30,17 @@ #include "../intersim2/globals.hpp" #include "../intersim2/interconnect_interface.hpp" -icnt_init_p icnt_init; -icnt_has_buffer_p icnt_has_buffer; -icnt_push_p icnt_push; -icnt_pop_p icnt_pop; -icnt_transfer_p icnt_transfer; -icnt_busy_p icnt_busy; -icnt_display_stats_p icnt_display_stats; +icnt_create_p icnt_create; +icnt_init_p icnt_init; +icnt_has_buffer_p icnt_has_buffer; +icnt_push_p icnt_push; +icnt_pop_p icnt_pop; +icnt_transfer_p icnt_transfer; +icnt_busy_p icnt_busy; +icnt_display_stats_p icnt_display_stats; icnt_display_overall_stats_p icnt_display_overall_stats; -icnt_display_state_p icnt_display_state; -icnt_get_flit_size_p icnt_get_flit_size; +icnt_display_state_p icnt_display_state; +icnt_get_flit_size_p icnt_get_flit_size; int g_network_mode; char* g_network_config_filename; @@ -48,6 +49,12 @@ char* g_network_config_filename; // Wrapper to intersim2 to accompany old icnt_wrapper // TODO: use delegate/boost/c++11 instead + +static void intersim2_create(unsigned int n_shader, unsigned int n_mem) +{ + g_icnt_interface->CreateInterconnect(n_shader, n_mem); +} + static void intersim2_init() { g_icnt_interface->Init(); @@ -104,12 +111,13 @@ void icnt_reg_options( class OptionParser * opp ) option_parser_register(opp, "-inter_config_file", OPT_CSTR, &g_network_config_filename, "Interconnection network config file", "mesh"); } -void icnt_wrapper_init( unsigned int n_shader, unsigned int n_mem ) +void icnt_wrapper_init() { switch (g_network_mode) { case INTERSIM: //FIXME: delete the object: may add icnt_done wrapper - g_icnt_interface = new InterconnectInterface(g_network_config_filename, n_shader, n_mem ); + g_icnt_interface = InterconnectInterface::New(g_network_config_filename); + icnt_create = intersim2_create; icnt_init = intersim2_init; icnt_has_buffer = intersim2_has_buffer; icnt_push = intersim2_push; -- cgit v1.3