diff --git a/DRAMSys/simulator/library.pro b/DRAMSys/simulator/library.pro index 50e6afa0..8a17d847 100644 --- a/DRAMSys/simulator/library.pro +++ b/DRAMSys/simulator/library.pro @@ -28,6 +28,17 @@ $$eval(dramsys_pct) { DEFINES += DRAMSYS_PCT } +# Check if gem5 should be used +gem5 = $$(GEM5) +isEmpty(gem5) { + message(GEM5 environment variable not found) + message(Gem5 Simulation Disabled) +} else { + message(Gem5 Simulation Feature Enabled) + message(Gem5 home is $${gem5}) + DEFINES += DRAMSYS_GEM5 +} + message(SystemC home is $${systemc_home}) systemc_target_arch = $$(SYSTEMC_TARGET_ARCH) diff --git a/DRAMSys/simulator/resources/configs/simulator/ddr3-single-device.xml b/DRAMSys/simulator/resources/configs/simulator/ddr3-single-device.xml index 059d3ee1..35fd3dec 100644 --- a/DRAMSys/simulator/resources/configs/simulator/ddr3-single-device.xml +++ b/DRAMSys/simulator/resources/configs/simulator/ddr3-single-device.xml @@ -11,5 +11,4 @@ - diff --git a/DRAMSys/simulator/resources/configs/simulator/ddr3.xml b/DRAMSys/simulator/resources/configs/simulator/ddr3.xml index 431f052d..9e322605 100644 --- a/DRAMSys/simulator/resources/configs/simulator/ddr3.xml +++ b/DRAMSys/simulator/resources/configs/simulator/ddr3.xml @@ -11,11 +11,9 @@ - diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp index d460c6b2..3598217b 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp @@ -190,11 +190,13 @@ void Configuration::setParameter(std::string name, std::string value) SC_REPORT_FATAL("Configuration", ("Invalid value for parameter " + name + ". This parameter must be at least one.").c_str()); } else NumberOfDevicesOnDIMM = string2int(value); - else if(name == "gem5") - gem5 = string2bool(value); else if(name == "AddressOffset") { +#ifdef DRAMSYS_GEM5 AddressOffset = string2ull(value); +#else + AddressOffset = 0; +#endif cout << "Address Offset: " << AddressOffset << endl; } else if(name == "CheckTLM2Protocol") diff --git a/DRAMSys/simulator/src/simulation/Dram.h b/DRAMSys/simulator/src/simulation/Dram.h index 1e8079be..d641afcb 100644 --- a/DRAMSys/simulator/src/simulation/Dram.h +++ b/DRAMSys/simulator/src/simulation/Dram.h @@ -393,11 +393,8 @@ struct Dram : sc_module } else if (phase == BEGIN_WR) { -#ifndef DRAMSYS_PCT - if(Configuration::getInstance().gem5 == false) - { - assert(payload.get_data_length() == bytesPerBurst); - } +#if !defined (DRAMSYS_PCT) && !defined (DRAMSYS_GEM5) + assert(payload.get_data_length() == bytesPerBurst); #endif if(powerAnalysis == true){DRAMPower->doCommand(MemCommand::WR, bank, cycle);} @@ -421,11 +418,8 @@ struct Dram : sc_module } else if (phase == BEGIN_RD) { -#ifndef DRAMSYS_PCT - if(Configuration::getInstance().gem5 == false) - { - assert(payload.get_data_length() == bytesPerBurst); - } +#if !defined (DRAMSYS_PCT) && !defined (DRAMSYS_GEM5) + assert(payload.get_data_length() == bytesPerBurst); #endif numberOfTransactionsServed++;