diff --git a/DRAMSys/simulator/simulator.pro b/DRAMSys/simulator/simulator.pro index 593718da..3577b06b 100644 --- a/DRAMSys/simulator/simulator.pro +++ b/DRAMSys/simulator/simulator.pro @@ -169,7 +169,8 @@ HEADERS += \ src/controller/core/configuration/ConfigurationLoader.h \ src/error/errormodel.h \ src/simulation/ExampleInitiator.h \ - src/controller/core/powerdown/PowerDownManagerTimeoutBankwise.h + src/controller/core/powerdown/PowerDownManagerTimeoutBankwise.h \ + src/error/controllerECC.h thermalsim = $$(THERMALSIM) isEmpty(thermalsim) { diff --git a/DRAMSys/simulator/src/error/controllerECC.h b/DRAMSys/simulator/src/error/controllerECC.h new file mode 100644 index 00000000..28c93547 --- /dev/null +++ b/DRAMSys/simulator/src/error/controllerECC.h @@ -0,0 +1,40 @@ +#ifndef CONTROLLERECC_H +#define CONTROLLERECC_H + +#include + +using namespace std; +using namespace tlm; + +struct ControllerECC: sc_module +{ + tlm_utils::multi_passthrough_target_socket t_socket; + tlm_utils::multi_passthrough_initiator_socket i_socket; + + SC_CTOR(ControllerECC) + : t_socket("t_socket") + , i_socket("i_socket") + { + t_socket.register_nb_transport_fw (this, &ControllerECC::nb_transport_fw); + i_socket.register_nb_transport_bw (this, &ControllerECC::nb_transport_bw); + } + + // Forward interface + + virtual tlm::tlm_sync_enum nb_transport_fw( int id, tlm::tlm_generic_payload& trans, + tlm::tlm_phase& phase, sc_time& delay ) + { + return i_socket[id]->nb_transport_fw( trans, phase, delay ); + } + + + // Backward interface + + virtual tlm::tlm_sync_enum nb_transport_bw( int id, tlm::tlm_generic_payload& trans, + tlm::tlm_phase& phase, sc_time& delay ) + { + return t_socket[id]->nb_transport_bw( trans, phase, delay ); + } +}; + +#endif // CONTROLLERECC_H diff --git a/DRAMSys/simulator/src/simulation/Simulation.cpp b/DRAMSys/simulator/src/simulation/Simulation.cpp index eae30c9a..c478e0bf 100644 --- a/DRAMSys/simulator/src/simulation/Simulation.cpp +++ b/DRAMSys/simulator/src/simulation/Simulation.cpp @@ -117,6 +117,10 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT // Create and properly initialize TLM recorders. They need to be ready before creating some modules. setupTlmRecorders(traceName, pathToResources, devices); + // Create ECC Controller + ecc = new ControllerECC("ecc"); + + // Create Arbiter arbiter = new Arbiter("arbiter"); arbiter->setTlmRecorders(tlmRecorders); @@ -142,7 +146,9 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT void Simulation::bindSockets() { - tSocket.bind(arbiter->tSocket); + tSocket.bind(ecc->t_socket); + ecc->i_socket(arbiter->tSocket); + //tSocket.bind(arbiter->tSocket); if(Configuration::getInstance().CheckTLM2Protocol) { for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; i++) { diff --git a/DRAMSys/simulator/src/simulation/Simulation.h b/DRAMSys/simulator/src/simulation/Simulation.h index 45890b47..18304cbe 100644 --- a/DRAMSys/simulator/src/simulation/Simulation.h +++ b/DRAMSys/simulator/src/simulation/Simulation.h @@ -49,7 +49,7 @@ #include "../controller/Controller.h" #include "../common/third_party/tinyxml2/tinyxml2.h" #include "../common/tlm2_base_protocol_checker.h" - +#include "../error/controllerECC.h" struct DramSetup { @@ -96,6 +96,8 @@ private: //TLM 2.0 Protocol Checkers std::vector*> controllersTlmCheckers; + // All transactions pass first through the ECC Controller + ControllerECC *ecc; // All transactions pass through the same arbiter Arbiter *arbiter; // Each DRAM unit has a controller