Make DRAMPower required again
DRAMPower was only optional because the linker had problems when integrating with gem5 as there still exists a very old version in the source tree. With the new namespaces, there is no longer a need for making DRAMPower optional.
This commit is contained in:
@@ -150,14 +150,7 @@ endif()
|
|||||||
find_package(SystemCLanguage REQUIRED)
|
find_package(SystemCLanguage REQUIRED)
|
||||||
find_package(SQLite3 REQUIRED)
|
find_package(SQLite3 REQUIRED)
|
||||||
find_package(DRAMUtils REQUIRED)
|
find_package(DRAMUtils REQUIRED)
|
||||||
|
find_package(DRAMPower REQUIRED)
|
||||||
find_package(DRAMPower)
|
|
||||||
|
|
||||||
if (DRAMPower_FOUND)
|
|
||||||
message(STATUS "Building with DRAMPower")
|
|
||||||
else()
|
|
||||||
message(STATUS "Building without DRAMPower")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
### Source Directory ###
|
### Source Directory ###
|
||||||
|
|||||||
@@ -82,11 +82,6 @@ $ cmake -S . -B build
|
|||||||
$ cmake --build build
|
$ cmake --build build
|
||||||
```
|
```
|
||||||
|
|
||||||
To include **DRAMPower** in your build enable the CMake option `DRAMSYS_WITH_DRAMPOWER`:
|
|
||||||
```console
|
|
||||||
$ cmake -B build -D DRAMSYS_WITH_DRAMPOWER=Y
|
|
||||||
```
|
|
||||||
|
|
||||||
If you plan to integrate DRAMSys into your own SystemC TLM-2.0 project you can build only the DRAMSys library by disabling the CMake option `DRAMSYS_BUILD_CLI`.
|
If you plan to integrate DRAMSys into your own SystemC TLM-2.0 project you can build only the DRAMSys library by disabling the CMake option `DRAMSYS_BUILD_CLI`.
|
||||||
|
|
||||||
To include the Trace Analyzer in the build process, enable the CMake option `DRAMSYS_BUILD_TRACE_ANALYZER`.
|
To include the Trace Analyzer in the build process, enable the CMake option `DRAMSYS_BUILD_TRACE_ANALYZER`.
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
#include "MemSpecDDR5.h"
|
#include "MemSpecDDR5.h"
|
||||||
|
|
||||||
#include <DRAMSys/common/utils.h>
|
#include "DRAMSys/common/utils.h"
|
||||||
|
|
||||||
|
#include <DRAMPower/standards/ddr5/DDR5.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -278,11 +280,9 @@ bool MemSpecDDR5::requiresMaskedWrite(const tlm::tlm_generic_payload& payload) c
|
|||||||
return !allBytesEnabled(payload);
|
return !allBytesEnabled(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> MemSpecDDR5::toDramPowerObject() const
|
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> MemSpecDDR5::toDramPowerObject() const
|
||||||
{
|
{
|
||||||
return std::make_unique<DRAMPower::DDR5>(std::move(DRAMPower::MemSpecDDR5(memSpec)));
|
return std::make_unique<DRAMPower::DDR5>(DRAMPower::MemSpecDDR5(memSpec));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -116,10 +116,7 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] bool requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] bool requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const override;
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
[[nodiscard]] std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> toDramPowerObject() const override;
|
[[nodiscard]] std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> toDramPowerObject() const override;
|
||||||
#endif
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -37,7 +37,9 @@
|
|||||||
|
|
||||||
#include "MemSpecLPDDR5.h"
|
#include "MemSpecLPDDR5.h"
|
||||||
|
|
||||||
#include <DRAMSys/common/utils.h>
|
#include "DRAMSys/common/utils.h"
|
||||||
|
|
||||||
|
#include <DRAMPower/standards/lpddr5/LPDDR5.h>
|
||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
using namespace tlm;
|
using namespace tlm;
|
||||||
@@ -255,11 +257,9 @@ bool MemSpecLPDDR5::requiresMaskedWrite(const tlm::tlm_generic_payload& payload)
|
|||||||
return !allBytesEnabled(payload);
|
return !allBytesEnabled(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> MemSpecLPDDR5::toDramPowerObject() const
|
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> MemSpecLPDDR5::toDramPowerObject() const
|
||||||
{
|
{
|
||||||
return std::make_unique<DRAMPower::LPDDR5>(std::move(DRAMPower::MemSpecLPDDR5(memSpec)));
|
return std::make_unique<DRAMPower::LPDDR5>(DRAMPower::MemSpecLPDDR5(memSpec));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -134,10 +134,8 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] bool requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] bool requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const override;
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
[[nodiscard]] std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>>
|
[[nodiscard]] std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>>
|
||||||
toDramPowerObject() const override;
|
toDramPowerObject() const override;
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned per2BankOffset;
|
unsigned per2BankOffset;
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ target_compile_features(libdramsys PUBLIC cxx_std_17)
|
|||||||
target_compile_definitions(libdramsys
|
target_compile_definitions(libdramsys
|
||||||
PUBLIC
|
PUBLIC
|
||||||
DRAMSYS_RESOURCE_DIR="${DRAMSYS_RESOURCE_DIR}"
|
DRAMSYS_RESOURCE_DIR="${DRAMSYS_RESOURCE_DIR}"
|
||||||
$<$<BOOL:${DRAMPower_FOUND}>:DRAMPOWER>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(libdramsys
|
target_link_libraries(libdramsys
|
||||||
@@ -109,7 +108,7 @@ target_link_libraries(libdramsys
|
|||||||
SystemC::systemc
|
SystemC::systemc
|
||||||
DRAMSys::config
|
DRAMSys::config
|
||||||
DRAMUtils::DRAMUtils
|
DRAMUtils::DRAMUtils
|
||||||
$<$<TARGET_EXISTS:DRAMPower::DRAMPower>:DRAMPower::DRAMPower>
|
DRAMPower::DRAMPower
|
||||||
PRIVATE
|
PRIVATE
|
||||||
SQLite::SQLite3
|
SQLite::SQLite3
|
||||||
|
|
||||||
|
|||||||
@@ -43,16 +43,14 @@
|
|||||||
#include "DRAMSys/common/utils.h"
|
#include "DRAMSys/common/utils.h"
|
||||||
#include "DRAMSys/controller/Command.h"
|
#include "DRAMSys/controller/Command.h"
|
||||||
|
|
||||||
|
#include <DRAMPower/command/CmdType.h>
|
||||||
|
#include <DRAMPower/dram/dram_base.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <systemc>
|
#include <systemc>
|
||||||
#include <tlm>
|
#include <tlm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
#include <DRAMPower/dram/dram_base.h>
|
|
||||||
#include <DRAMPower/command/CmdType.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
@@ -64,8 +62,7 @@ public:
|
|||||||
MemSpec& operator=(MemSpec&&) = delete;
|
MemSpec& operator=(MemSpec&&) = delete;
|
||||||
virtual ~MemSpec() = default;
|
virtual ~MemSpec() = default;
|
||||||
|
|
||||||
static constexpr enum sc_core::sc_time_unit TCK_UNIT
|
static constexpr enum sc_core::sc_time_unit TCK_UNIT = sc_core::SC_SEC;
|
||||||
= sc_core::SC_SEC;
|
|
||||||
|
|
||||||
const uint64_t numberOfChannels;
|
const uint64_t numberOfChannels;
|
||||||
const uint64_t ranksPerChannel;
|
const uint64_t ranksPerChannel;
|
||||||
@@ -115,20 +112,19 @@ public:
|
|||||||
[[nodiscard]] double getCommandLengthInCycles(Command command) const;
|
[[nodiscard]] double getCommandLengthInCycles(Command command) const;
|
||||||
[[nodiscard]] uint64_t getSimMemSizeInBytes() const;
|
[[nodiscard]] uint64_t getSimMemSizeInBytes() const;
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates the DRAMPower object if the standard is supported by DRAMPower.
|
* @brief Creates the DRAMPower object if the standard is supported by DRAMPower.
|
||||||
* If the standard is not supported, a fatal error is reported and the simulation is aborted.
|
* If the standard is not supported, a fatal error is reported and the simulation is aborted.
|
||||||
* @return unique_ptr to the DRAMPower object.
|
* @return unique_ptr to the DRAMPower object.
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> toDramPowerObject() const
|
[[nodiscard]] virtual std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>>
|
||||||
|
toDramPowerObject() const
|
||||||
{
|
{
|
||||||
SC_REPORT_FATAL("MemSpec", "DRAMPower does not support this memory standard");
|
SC_REPORT_FATAL("MemSpec", "DRAMPower does not support this memory standard");
|
||||||
sc_core::sc_abort();
|
sc_core::sc_abort();
|
||||||
// This line is never reached, but it is needed to avoid a compiler warning
|
// This line is never reached, but it is needed to avoid a compiler warning
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
[[nodiscard]] static bool allBytesEnabled(const tlm::tlm_generic_payload& trans)
|
[[nodiscard]] static bool allBytesEnabled(const tlm::tlm_generic_payload& trans)
|
||||||
@@ -147,7 +143,7 @@ protected:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename MemSpecType>
|
template <typename MemSpecType>
|
||||||
MemSpec(const MemSpecType& memSpec,
|
MemSpec(const MemSpecType& memSpec,
|
||||||
uint64_t numberOfChannels,
|
uint64_t numberOfChannels,
|
||||||
uint64_t ranksPerChannel,
|
uint64_t ranksPerChannel,
|
||||||
@@ -169,8 +165,8 @@ protected:
|
|||||||
columnsPerRow(memSpec.memarchitecturespec.nbrOfColumns),
|
columnsPerRow(memSpec.memarchitecturespec.nbrOfColumns),
|
||||||
defaultBurstLength(memSpec.memarchitecturespec.burstLength),
|
defaultBurstLength(memSpec.memarchitecturespec.burstLength),
|
||||||
maxBurstLength(memSpec.memarchitecturespec.maxBurstLength.has_value()
|
maxBurstLength(memSpec.memarchitecturespec.maxBurstLength.has_value()
|
||||||
? memSpec.memarchitecturespec.maxBurstLength.value()
|
? memSpec.memarchitecturespec.maxBurstLength.value()
|
||||||
: defaultBurstLength),
|
: defaultBurstLength),
|
||||||
dataRate(memSpec.memarchitecturespec.dataRate),
|
dataRate(memSpec.memarchitecturespec.dataRate),
|
||||||
bitWidth(memSpec.memarchitecturespec.width),
|
bitWidth(memSpec.memarchitecturespec.width),
|
||||||
dataBusWidth(bitWidth * devicesPerRank),
|
dataBusWidth(bitWidth * devicesPerRank),
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
#include "DRAMSys/common/utils.h"
|
#include "DRAMSys/common/utils.h"
|
||||||
|
|
||||||
|
#include <DRAMPower/standards/ddr4/DDR4.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
@@ -189,11 +191,9 @@ bool MemSpecDDR4::requiresMaskedWrite(const tlm::tlm_generic_payload& payload) c
|
|||||||
return !allBytesEnabled(payload);
|
return !allBytesEnabled(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> MemSpecDDR4::toDramPowerObject() const
|
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> MemSpecDDR4::toDramPowerObject() const
|
||||||
{
|
{
|
||||||
return std::make_unique<DRAMPower::DDR4>(std::move(DRAMPower::MemSpecDDR4(memSpec)));
|
return std::make_unique<DRAMPower::DDR4>(DRAMPower::MemSpecDDR4(memSpec));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -42,11 +42,6 @@
|
|||||||
|
|
||||||
#include <DRAMUtils/memspec/standards/MemSpecDDR4.h>
|
#include <DRAMUtils/memspec/standards/MemSpecDDR4.h>
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
#include "DRAMPower/standards/ddr4/DDR4.h"
|
|
||||||
#include "DRAMPower/memspec/MemSpecDDR4.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <systemc>
|
#include <systemc>
|
||||||
|
|
||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
@@ -102,9 +97,7 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] bool requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] bool requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const override;
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
[[nodiscard]] std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> toDramPowerObject() const override;
|
[[nodiscard]] std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> toDramPowerObject() const override;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
#include "DRAMSys/common/utils.h"
|
#include "DRAMSys/common/utils.h"
|
||||||
|
|
||||||
|
#include <DRAMPower/standards/lpddr4/LPDDR4.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
@@ -188,12 +190,10 @@ MemSpecLPDDR4::getIntervalOnDataStrobe(Command command,
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> MemSpecLPDDR4::toDramPowerObject() const
|
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> MemSpecLPDDR4::toDramPowerObject() const
|
||||||
{
|
{
|
||||||
return std::make_unique<DRAMPower::LPDDR4>(std::move(DRAMPower::MemSpecLPDDR4(memSpec)));
|
return std::make_unique<DRAMPower::LPDDR4>(DRAMPower::MemSpecLPDDR4(memSpec));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool MemSpecLPDDR4::requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const
|
bool MemSpecLPDDR4::requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,11 +42,6 @@
|
|||||||
|
|
||||||
#include <DRAMUtils/memspec/standards/MemSpecLPDDR4.h>
|
#include <DRAMUtils/memspec/standards/MemSpecLPDDR4.h>
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
#include "DRAMPower/standards/lpddr4/LPDDR4.h"
|
|
||||||
#include "DRAMPower/memspec/MemSpecLPDDR4.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <systemc>
|
#include <systemc>
|
||||||
|
|
||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
@@ -106,10 +101,7 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] bool requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] bool requiresMaskedWrite(const tlm::tlm_generic_payload& payload) const override;
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
[[nodiscard]] std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> toDramPowerObject() const override;
|
[[nodiscard]] std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> toDramPowerObject() const override;
|
||||||
#endif
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -43,10 +43,6 @@
|
|||||||
|
|
||||||
using namespace tlm;
|
using namespace tlm;
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
using namespace DRAMPower;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -185,41 +181,39 @@ tlm_phase Command::toPhase() const
|
|||||||
return phaseOfCommand[type];
|
return phaseOfCommand[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
DRAMPower::CmdType phaseToDRAMPowerCommand(tlm_phase phase)
|
||||||
CmdType phaseToDRAMPowerCommand(tlm_phase phase)
|
|
||||||
{
|
{
|
||||||
// TODO missing DSMEN, DSMEX
|
// TODO missing DSMEN, DSMEX
|
||||||
assert(phase >= BEGIN_NOP && phase <= END_SREF);
|
assert(phase >= BEGIN_NOP && phase <= END_SREF);
|
||||||
static std::array<CmdType, Command::Type::END_ENUM> phaseOfCommand = {
|
static std::array<DRAMPower::CmdType, Command::Type::END_ENUM> phaseOfCommand = {
|
||||||
CmdType::NOP, // 0
|
DRAMPower::CmdType::NOP, // 0
|
||||||
CmdType::RD, // 1
|
DRAMPower::CmdType::RD, // 1
|
||||||
CmdType::WR, // 2
|
DRAMPower::CmdType::WR, // 2
|
||||||
CmdType::NOP, // 3
|
DRAMPower::CmdType::NOP, // 3
|
||||||
CmdType::RDA, // 4
|
DRAMPower::CmdType::RDA, // 4
|
||||||
CmdType::WRA, // 5
|
DRAMPower::CmdType::WRA, // 5
|
||||||
CmdType::NOP, // 6
|
DRAMPower::CmdType::NOP, // 6
|
||||||
CmdType::ACT, // 7
|
DRAMPower::CmdType::ACT, // 7
|
||||||
CmdType::PRE, // 8, PREPB
|
DRAMPower::CmdType::PRE, // 8, PREPB
|
||||||
CmdType::REFB, // 9, REFPB
|
DRAMPower::CmdType::REFB, // 9, REFPB
|
||||||
CmdType::NOP, // 10, RFMPB
|
DRAMPower::CmdType::NOP, // 10, RFMPB
|
||||||
CmdType::REFP2B, // 11, REFP2B
|
DRAMPower::CmdType::REFP2B, // 11, REFP2B
|
||||||
CmdType::NOP, // 12, RFMP2B
|
DRAMPower::CmdType::NOP, // 12, RFMP2B
|
||||||
CmdType::PRESB, // 13, PRESB
|
DRAMPower::CmdType::PRESB, // 13, PRESB
|
||||||
CmdType::REFSB, // 14, REFSB
|
DRAMPower::CmdType::REFSB, // 14, REFSB
|
||||||
CmdType::NOP, // 15, RFMSB
|
DRAMPower::CmdType::NOP, // 15, RFMSB
|
||||||
CmdType::PREA, // 16, PREAB
|
DRAMPower::CmdType::PREA, // 16, PREAB
|
||||||
CmdType::REFA, // 17, REFAB
|
DRAMPower::CmdType::REFA, // 17, REFAB
|
||||||
CmdType::NOP, // 18, RFMAB
|
DRAMPower::CmdType::NOP, // 18, RFMAB
|
||||||
CmdType::PDEA, // 19
|
DRAMPower::CmdType::PDEA, // 19
|
||||||
CmdType::PDEP, // 20
|
DRAMPower::CmdType::PDEP, // 20
|
||||||
CmdType::SREFEN, // 21
|
DRAMPower::CmdType::SREFEN, // 21
|
||||||
CmdType::PDXA, // 22
|
DRAMPower::CmdType::PDXA, // 22
|
||||||
CmdType::PDXP, // 23
|
DRAMPower::CmdType::PDXP, // 23
|
||||||
CmdType::SREFEX // 24
|
DRAMPower::CmdType::SREFEX // 24
|
||||||
};
|
};
|
||||||
return phaseOfCommand[phase - BEGIN_NOP];
|
return phaseOfCommand[phase - BEGIN_NOP];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool Command::isBankCommand() const
|
bool Command::isBankCommand() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,9 +38,7 @@
|
|||||||
#ifndef COMMAND_H
|
#ifndef COMMAND_H
|
||||||
#define COMMAND_H
|
#define COMMAND_H
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
#include <DRAMPower/command/CmdType.h>
|
#include <DRAMPower/command/CmdType.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <systemc>
|
#include <systemc>
|
||||||
@@ -86,9 +84,7 @@ DECLARE_EXTENDED_PHASE(END_PDNA); // 27
|
|||||||
DECLARE_EXTENDED_PHASE(END_PDNP); // 28
|
DECLARE_EXTENDED_PHASE(END_PDNP); // 28
|
||||||
DECLARE_EXTENDED_PHASE(END_SREF); // 29
|
DECLARE_EXTENDED_PHASE(END_SREF); // 29
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
DRAMPower::CmdType phaseToDRAMPowerCommand(tlm::tlm_phase phase);
|
DRAMPower::CmdType phaseToDRAMPowerCommand(tlm::tlm_phase phase);
|
||||||
#endif
|
|
||||||
|
|
||||||
bool phaseHasDataStrobe(tlm::tlm_phase phase);
|
bool phaseHasDataStrobe(tlm::tlm_phase phase);
|
||||||
bool isPowerDownEntryPhase(tlm::tlm_phase phase);
|
bool isPowerDownEntryPhase(tlm::tlm_phase phase);
|
||||||
|
|||||||
@@ -55,17 +55,11 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
#include <DRAMPower/command/Command.h>
|
||||||
#include "DRAMPower/command/Command.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
using namespace tlm;
|
using namespace tlm;
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
using namespace DRAMPower;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -110,7 +104,6 @@ Dram::Dram(const sc_module_name& name,
|
|||||||
tSocket.register_b_transport(this, &Dram::b_transport);
|
tSocket.register_b_transport(this, &Dram::b_transport);
|
||||||
tSocket.register_transport_dbg(this, &Dram::transport_dbg);
|
tSocket.register_transport_dbg(this, &Dram::transport_dbg);
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
if (simConfig.powerAnalysis)
|
if (simConfig.powerAnalysis)
|
||||||
{
|
{
|
||||||
DRAMPower = memSpec.toDramPowerObject();
|
DRAMPower = memSpec.toDramPowerObject();
|
||||||
@@ -125,7 +118,6 @@ Dram::Dram(const sc_module_name& name,
|
|||||||
|
|
||||||
if (simConfig.powerAnalysis && simConfig.enableWindowing)
|
if (simConfig.powerAnalysis && simConfig.enableWindowing)
|
||||||
SC_THREAD(powerWindow);
|
SC_THREAD(powerWindow);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dram::~Dram()
|
Dram::~Dram()
|
||||||
@@ -136,7 +128,6 @@ Dram::~Dram()
|
|||||||
|
|
||||||
void Dram::reportPower()
|
void Dram::reportPower()
|
||||||
{
|
{
|
||||||
#ifdef DRAMPOWER
|
|
||||||
if (!DRAMPower)
|
if (!DRAMPower)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -158,14 +149,12 @@ void Dram::reportPower()
|
|||||||
tlmRecorder->recordPower(sc_time_stamp().to_seconds(),
|
tlmRecorder->recordPower(sc_time_stamp().to_seconds(),
|
||||||
energy / time);
|
energy / time);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload& trans, tlm_phase& phase, sc_time& delay)
|
tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload& trans, tlm_phase& phase, sc_time& delay)
|
||||||
{
|
{
|
||||||
assert(phase >= BEGIN_RD && phase <= END_SREF);
|
assert(phase >= BEGIN_RD && phase <= END_SREF);
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
if (DRAMPower)
|
if (DRAMPower)
|
||||||
{
|
{
|
||||||
std::size_t rank = static_cast<std::size_t>(ControllerExtension::getRank(trans)); // relaitve to the channel
|
std::size_t rank = static_cast<std::size_t>(ControllerExtension::getRank(trans)); // relaitve to the channel
|
||||||
@@ -190,7 +179,6 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload& trans, tlm_phase& phase
|
|||||||
DRAMPower::Command command(cycle, phaseToDRAMPowerCommand(phase), target, data, datasize);
|
DRAMPower::Command command(cycle, phaseToDRAMPowerCommand(phase), target, data, datasize);
|
||||||
DRAMPower->doCoreInterfaceCommand(command);
|
DRAMPower->doCoreInterfaceCommand(command);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (storeMode == Config::StoreModeType::Store)
|
if (storeMode == Config::StoreModeType::Store)
|
||||||
{
|
{
|
||||||
@@ -311,10 +299,6 @@ void Dram::deserialize(std::istream& stream)
|
|||||||
stream.read(reinterpret_cast<char*>(memory), channelSize);
|
stream.read(reinterpret_cast<char*>(memory), channelSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
// This Thread is only triggered when Power Simulation is enabled.
|
|
||||||
// It estimates the current average power which will be stored in the trace database for
|
|
||||||
// visualization purposes.
|
|
||||||
void Dram::powerWindow()
|
void Dram::powerWindow()
|
||||||
{
|
{
|
||||||
int64_t clkCycles = 0;
|
int64_t clkCycles = 0;
|
||||||
@@ -354,6 +338,5 @@ void Dram::powerWindow()
|
|||||||
std::string("\t[W]"));
|
std::string("\t[W]"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -48,10 +48,8 @@
|
|||||||
#include "DRAMSys/configuration/memspec/MemSpec.h"
|
#include "DRAMSys/configuration/memspec/MemSpec.h"
|
||||||
#include "DRAMSys/simulation/SimConfig.h"
|
#include "DRAMSys/simulation/SimConfig.h"
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
#include <DRAMPower/command/CmdType.h>
|
||||||
#include "DRAMPower/command/CmdType.h"
|
#include <DRAMPower/dram/dram_base.h>
|
||||||
#include "DRAMPower/dram/dram_base.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <systemc>
|
#include <systemc>
|
||||||
#include <tlm>
|
#include <tlm>
|
||||||
@@ -74,13 +72,12 @@ protected:
|
|||||||
TlmRecorder* const tlmRecorder;
|
TlmRecorder* const tlmRecorder;
|
||||||
sc_core::sc_time powerWindowSize;
|
sc_core::sc_time powerWindowSize;
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
|
||||||
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> DRAMPower;
|
std::unique_ptr<DRAMPower::dram_base<DRAMPower::CmdType>> DRAMPower;
|
||||||
|
|
||||||
// This Thread is only triggered when Power Simulation is enabled.
|
// This Thread is only triggered when Power Simulation is enabled.
|
||||||
// It estimates the current average power which will be stored in the trace database for
|
// It estimates the current average power which will be stored in the trace database for
|
||||||
// visualization purposes.
|
// visualization purposes.
|
||||||
void powerWindow();
|
void powerWindow();
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload& trans,
|
virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload& trans,
|
||||||
tlm::tlm_phase& phase,
|
tlm::tlm_phase& phase,
|
||||||
|
|||||||
@@ -62,12 +62,6 @@ SimConfig::SimConfig(const Config::SimConfig& simConfig) :
|
|||||||
|
|
||||||
if (windowSize == 0)
|
if (windowSize == 0)
|
||||||
SC_REPORT_FATAL("SimConfig", "Minimum window size is 1");
|
SC_REPORT_FATAL("SimConfig", "Minimum window size is 1");
|
||||||
|
|
||||||
#ifndef DRAMPOWER
|
|
||||||
if (powerAnalysis)
|
|
||||||
SC_REPORT_FATAL("SimConfig",
|
|
||||||
"Power analysis is only supported with included DRAMPower library!");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
Reference in New Issue
Block a user