From 21f08335b2cf3771a3f9ad5b045be74563aa23a7 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 11 May 2022 15:56:04 +0200 Subject: [PATCH] Revert debug example, fix segfault in TlmRecorder. --- DRAMSys/library/resources/simulations/ddr5-example.json | 8 +------- DRAMSys/library/src/simulation/DRAMSysRecordable.cpp | 5 ++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/DRAMSys/library/resources/simulations/ddr5-example.json b/DRAMSys/library/resources/simulations/ddr5-example.json index 695b783a..e85d1b92 100644 --- a/DRAMSys/library/resources/simulations/ddr5-example.json +++ b/DRAMSys/library/resources/simulations/ddr5-example.json @@ -9,13 +9,7 @@ "tracesetup": [ { "clkMhz": 2000, - "name": "gen0", - "type": "generator", - "numRequests": 20, - "rwRatio": 1, - "addressDistribution": "random", - "dataLength": 64, - "seed": 1 + "name": "ddr3_example.stl" } ] } diff --git a/DRAMSys/library/src/simulation/DRAMSysRecordable.cpp b/DRAMSys/library/src/simulation/DRAMSysRecordable.cpp index aae02150..324f6e2c 100644 --- a/DRAMSys/library/src/simulation/DRAMSysRecordable.cpp +++ b/DRAMSys/library/src/simulation/DRAMSysRecordable.cpp @@ -92,8 +92,11 @@ void DRAMSysRecordable::end_of_simulation() void DRAMSysRecordable::setupTlmRecorders(const std::string& traceName, const DRAMSysConfiguration::Configuration& configLib) { - //tlmRecorders.reserve(config.memSpec->numberOfChannels); // Create TLM Recorders, one per channel. + // Reserve is required because the recorders use double buffers that are accessed with pointers. + // Without a reserve, the vector reallocates storage before inserting a second + // element and the pointers are not valid anymore. + tlmRecorders.reserve(config.memSpec->numberOfChannels); for (std::size_t i = 0; i < config.memSpec->numberOfChannels; i++) { std::string dbName = traceName + std::string("_ch") + std::to_string(i) + ".tdb";