Merge branch 'serialize_refresh' into 'develop'
Implement serialize and deserialize in Refresh Managers See merge request ems/astdm/modeling.dram/dram.sys.5!83
This commit is contained in:
@@ -900,4 +900,20 @@ void Controller::end_of_simulation()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
void Controller::serialize(std::ostream& stream) const
|
||||
{
|
||||
for (auto& refreshManager : refreshManagers)
|
||||
{
|
||||
refreshManager->serialize(stream);
|
||||
}
|
||||
}
|
||||
|
||||
void Controller::deserialize(std::istream& stream)
|
||||
{
|
||||
for (auto& refreshManager : refreshManagers)
|
||||
{
|
||||
refreshManager->deserialize(stream);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace DRAMSys
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "powerdown/PowerDownManagerIF.h"
|
||||
#include "refresh/RefreshManagerIF.h"
|
||||
#include "respqueue/RespQueueIF.h"
|
||||
#include "DRAMSys/common/Deserialize.h"
|
||||
#include "DRAMSys/common/Serialize.h"
|
||||
|
||||
#include "DRAMSys/common/TlmRecorder.h"
|
||||
#include "DRAMSys/simulation/SimConfig.h"
|
||||
@@ -57,13 +59,11 @@
|
||||
#include <tlm>
|
||||
#include <tlm_utils/simple_initiator_socket.h>
|
||||
#include <tlm_utils/simple_target_socket.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace DRAMSys
|
||||
{
|
||||
|
||||
class Controller : public sc_core::sc_module
|
||||
class Controller : public sc_core::sc_module, public Serialize, public Deserialize
|
||||
{
|
||||
public:
|
||||
tlm_utils::simple_target_socket<Controller> tSocket{"tSocket"}; // Arbiter side
|
||||
@@ -80,6 +80,9 @@ public:
|
||||
[[nodiscard]] bool idle() const { return totalNumberOfPayloads == 0; }
|
||||
void registerIdleCallback(std::function<void()> idleCallback);
|
||||
|
||||
void serialize(std::ostream& stream) const override;
|
||||
void deserialize(std::istream& stream) override;
|
||||
|
||||
protected:
|
||||
void end_of_simulation() override;
|
||||
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Matthias Jung
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Matthias Jung
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#include "RefreshManagerAllBank.h"
|
||||
@@ -240,4 +242,14 @@ sc_time RefreshManagerAllBank::getTimeForNextTrigger()
|
||||
return timeForNextTrigger;
|
||||
}
|
||||
|
||||
void RefreshManagerAllBank::serialize(std::ostream& stream) const
|
||||
{
|
||||
stream.write(reinterpret_cast<char const*>(&timeForNextTrigger), sizeof(timeForNextTrigger));
|
||||
}
|
||||
|
||||
void RefreshManagerAllBank::deserialize(std::istream& stream)
|
||||
{
|
||||
stream.read(reinterpret_cast<char *>(&timeForNextTrigger), sizeof(timeForNextTrigger));
|
||||
}
|
||||
|
||||
} // namespace DRAMSys
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#ifndef REFRESHMANAGERALLBANK_H
|
||||
@@ -37,12 +39,10 @@
|
||||
|
||||
#include "DRAMSys/configuration/memspec/MemSpec.h"
|
||||
#include "DRAMSys/controller/McConfig.h"
|
||||
#include "DRAMSys/controller/checker/CheckerIF.h"
|
||||
#include "DRAMSys/controller/refresh/RefreshManagerIF.h"
|
||||
|
||||
#include <systemc>
|
||||
#include <tlm>
|
||||
#include <vector>
|
||||
|
||||
namespace DRAMSys
|
||||
{
|
||||
@@ -64,6 +64,9 @@ public:
|
||||
void update(Command command) override;
|
||||
sc_core::sc_time getTimeForNextTrigger() override;
|
||||
|
||||
void serialize(std::ostream& stream) const override;
|
||||
void deserialize(std::istream& stream) override;
|
||||
|
||||
private:
|
||||
enum class State
|
||||
{
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#include "RefreshManagerDummy.h"
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#ifndef REFRESHMANAGERDUMMY_H
|
||||
@@ -50,6 +52,9 @@ public:
|
||||
void update([[maybe_unused]] Command command) override {}
|
||||
sc_core::sc_time getTimeForNextTrigger() override;
|
||||
|
||||
void serialize([[maybe_unused]] std::ostream& stream) const override {}
|
||||
void deserialize([[maybe_unused]] std::istream& stream) override {}
|
||||
|
||||
private:
|
||||
const sc_core::sc_time scMaxTime = sc_core::sc_max_time();
|
||||
};
|
||||
|
||||
@@ -29,14 +29,17 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#ifndef REFRESHMANAGERIF_H
|
||||
#define REFRESHMANAGERIF_H
|
||||
|
||||
#include "DRAMSys/common/Deserialize.h"
|
||||
#include "DRAMSys/common/Serialize.h"
|
||||
#include "DRAMSys/common/dramExtensions.h"
|
||||
#include "DRAMSys/controller/Command.h"
|
||||
#include "DRAMSys/controller/ManagerIF.h"
|
||||
|
||||
#include <cmath>
|
||||
@@ -45,7 +48,7 @@
|
||||
namespace DRAMSys
|
||||
{
|
||||
|
||||
class RefreshManagerIF : public ManagerIF
|
||||
class RefreshManagerIF : public ManagerIF, public Serialize, public Deserialize
|
||||
{
|
||||
public:
|
||||
virtual sc_core::sc_time getTimeForNextTrigger() = 0;
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#include "RefreshManagerPer2Bank.h"
|
||||
@@ -264,4 +266,14 @@ sc_time RefreshManagerPer2Bank::getTimeForNextTrigger()
|
||||
return timeForNextTrigger;
|
||||
}
|
||||
|
||||
void RefreshManagerPer2Bank::serialize(std::ostream& stream) const
|
||||
{
|
||||
stream.write(reinterpret_cast<char const*>(&timeForNextTrigger), sizeof(timeForNextTrigger));
|
||||
}
|
||||
|
||||
void RefreshManagerPer2Bank::deserialize(std::istream& stream)
|
||||
{
|
||||
stream.read(reinterpret_cast<char *>(&timeForNextTrigger), sizeof(timeForNextTrigger));
|
||||
}
|
||||
|
||||
} // namespace DRAMSys
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#ifndef REFRESHMANAGERPER2BANK_H
|
||||
@@ -37,7 +39,6 @@
|
||||
|
||||
#include "DRAMSys/configuration/memspec/MemSpec.h"
|
||||
#include "DRAMSys/controller/McConfig.h"
|
||||
#include "DRAMSys/controller/checker/CheckerIF.h"
|
||||
#include "DRAMSys/controller/refresh/RefreshManagerIF.h"
|
||||
|
||||
#include <list>
|
||||
@@ -66,6 +67,9 @@ public:
|
||||
void update(Command command) override;
|
||||
sc_core::sc_time getTimeForNextTrigger() override;
|
||||
|
||||
void serialize(std::ostream& stream) const override;
|
||||
void deserialize(std::istream& stream) override;
|
||||
|
||||
private:
|
||||
enum class State
|
||||
{
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#include "RefreshManagerPerBank.h"
|
||||
@@ -213,4 +215,14 @@ sc_time RefreshManagerPerBank::getTimeForNextTrigger()
|
||||
return timeForNextTrigger;
|
||||
}
|
||||
|
||||
void RefreshManagerPerBank::serialize(std::ostream& stream) const
|
||||
{
|
||||
stream.write(reinterpret_cast<char const*>(&timeForNextTrigger), sizeof(timeForNextTrigger));
|
||||
}
|
||||
|
||||
void RefreshManagerPerBank::deserialize(std::istream& stream)
|
||||
{
|
||||
stream.read(reinterpret_cast<char *>(&timeForNextTrigger), sizeof(timeForNextTrigger));
|
||||
}
|
||||
|
||||
} // namespace DRAMSys
|
||||
|
||||
@@ -29,14 +29,15 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#ifndef REFRESHMANAGERPERBANK_H
|
||||
#define REFRESHMANAGERPERBANK_H
|
||||
|
||||
#include "DRAMSys/configuration/memspec/MemSpec.h"
|
||||
#include "DRAMSys/controller/checker/CheckerIF.h"
|
||||
#include "DRAMSys/controller/McConfig.h"
|
||||
#include "DRAMSys/controller/refresh/RefreshManagerIF.h"
|
||||
|
||||
@@ -44,7 +45,6 @@
|
||||
#include <systemc>
|
||||
#include <tlm>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace DRAMSys
|
||||
{
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
void update(Command command) override;
|
||||
sc_core::sc_time getTimeForNextTrigger() override;
|
||||
|
||||
void serialize(std::ostream& stream) const override;
|
||||
void deserialize(std::istream& stream) override;
|
||||
|
||||
private:
|
||||
enum class State
|
||||
{
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#include "RefreshManagerSameBank.h"
|
||||
@@ -337,4 +339,14 @@ sc_time RefreshManagerSameBank::getTimeForNextTrigger()
|
||||
return timeForNextTrigger;
|
||||
}
|
||||
|
||||
void RefreshManagerSameBank::serialize(std::ostream& stream) const
|
||||
{
|
||||
stream.write(reinterpret_cast<char const*>(&timeForNextTrigger), sizeof(timeForNextTrigger));
|
||||
}
|
||||
|
||||
void RefreshManagerSameBank::deserialize(std::istream& stream)
|
||||
{
|
||||
stream.read(reinterpret_cast<char *>(&timeForNextTrigger), sizeof(timeForNextTrigger));
|
||||
}
|
||||
|
||||
} // namespace DRAMSys
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
* Authors:
|
||||
* Lukas Steiner
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#ifndef REFRESHMANAGERSAMEBANK_H
|
||||
@@ -37,7 +39,6 @@
|
||||
|
||||
#include "DRAMSys/configuration/memspec/MemSpec.h"
|
||||
#include "DRAMSys/controller/McConfig.h"
|
||||
#include "DRAMSys/controller/checker/CheckerIF.h"
|
||||
#include "DRAMSys/controller/refresh/RefreshManagerIF.h"
|
||||
|
||||
#include <list>
|
||||
@@ -65,6 +66,9 @@ public:
|
||||
void update(Command command) override;
|
||||
sc_core::sc_time getTimeForNextTrigger() override;
|
||||
|
||||
void serialize(std::ostream& stream) const override;
|
||||
void deserialize(std::istream& stream) override;
|
||||
|
||||
private:
|
||||
enum class State
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user