Refactored string comparisons out of the main loop.

This commit is contained in:
Iron Prando da Silva
2022-03-01 11:57:23 +01:00
parent bf1641e80a
commit b2581bbce3
16 changed files with 257 additions and 76 deletions

View File

@@ -112,7 +112,8 @@ add_executable(TraceAnalyzer
simulationdialog.cpp
businessObjects/dependencymodels.cpp
businessObjects/dramTimeDependencies/common/common.cpp
businessObjects/dramTimeDependencies/common/QStringComparator.cpp
businessObjects/dramTimeDependencies/common/StringMapper.cpp
businessObjects/dramTimeDependencies/deviceDependencies/poolcontroller.cpp
businessObjects/dramTimeDependencies/deviceDependencies/poolcontrollermap.cpp
businessObjects/dramTimeDependencies/deviceDependencies/dramtimedependenciesIF.cpp

View File

@@ -1,10 +1,10 @@
#include "common.h"
#include "QStringComparator.h"
bool QStringsComparator::operator()(const QString& s1, const QString& s2) {
bool QStringsComparator::operator()(const QString& s1, const QString& s2) const {
return s1.compare(s2) < 0;
}
bool QStringsComparator::compareQStrings(const QString& s1, const QString& s2) {
return s1.compare(s2) < 0;
}
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include <QString>
struct QStringsComparator {
bool operator()(const QString& s1, const QString& s2) const;
static bool compareQStrings(const QString& s1, const QString& s2);
};

View File

@@ -0,0 +1,109 @@
#include "StringMapper.h"
StringMapper::StringMapper(const QString& name) {
mIDEnum = getIDEnum(name);
mIDStr = name;
mIsPool = mAuxIsPool(mIDEnum);
}
QString StringMapper::getIDStr(StringMapper::Identifier id) {
static const std::map<StringMapper::Identifier, QString> enumToStr {
{StringMapper::Identifier::CMD_BUS, "CMD_BUS"},
{StringMapper::Identifier::NAW, "NAW"},
{StringMapper::Identifier::FAW, "FAW"},
{StringMapper::Identifier::_32AW, "32AW"},
{StringMapper::Identifier::FAW_LOGICAL, "FAW_LOGICAL"},
{StringMapper::Identifier::FAW_PHYSICAL, "FAW_PHYSICAL"},
{StringMapper::Identifier::REFAB, "REFAB"},
{StringMapper::Identifier::PREAB, "PREAB"},
{StringMapper::Identifier::PDEP, "PDEP"},
{StringMapper::Identifier::PDXP, "PDXP"},
{StringMapper::Identifier::SREFEN, "SREFEN"},
{StringMapper::Identifier::SREFEX, "SREFEX"},
{StringMapper::Identifier::PDEA, "PDEA"},
{StringMapper::Identifier::PDXA, "PDXA"},
{StringMapper::Identifier::SRPDEN, "SRPDEN"},
{StringMapper::Identifier::SRPDEX, "SRPDEX"},
{StringMapper::Identifier::ACT, "ACT"},
{StringMapper::Identifier::RD, "RD"},
{StringMapper::Identifier::WR, "WR"},
{StringMapper::Identifier::PREPB, "PREPB"},
{StringMapper::Identifier::RDA, "RDA"},
{StringMapper::Identifier::WRA, "WRA"},
{StringMapper::Identifier::REFPB, "REFPB"},
};
auto it = enumToStr.find(id);
if (it != enumToStr.end()) return it->second;
else throw std::invalid_argument("The provided StringMapper::StringMapper::Identifier is not valid.");
}
StringMapper::Identifier StringMapper::getIDEnum(const QString& id) {
static const std::map<QString, StringMapper::Identifier, QStringsComparator> strToEnum {
{"CMD_BUS", StringMapper::Identifier::CMD_BUS},
{"NAW", StringMapper::Identifier::NAW},
{"FAW", StringMapper::Identifier::FAW},
{"32AW", StringMapper::Identifier::_32AW},
{"FAW_LOGICAL", StringMapper::Identifier::FAW_LOGICAL},
{"FAW_PHYSICAL", StringMapper::Identifier::FAW_PHYSICAL},
{"REFAB", StringMapper::Identifier::REFAB},
{"PREAB", StringMapper::Identifier::PREAB},
{"PDEP", StringMapper::Identifier::PDEP},
{"PDXP", StringMapper::Identifier::PDXP},
{"SREFEN", StringMapper::Identifier::SREFEN},
{"SREFEX", StringMapper::Identifier::SREFEX},
{"PDEA", StringMapper::Identifier::PDEA},
{"PDXA", StringMapper::Identifier::PDXA},
{"SRPDEN", StringMapper::Identifier::SRPDEN},
{"SRPDEX", StringMapper::Identifier::SRPDEX},
{"ACT", StringMapper::Identifier::ACT},
{"RD", StringMapper::Identifier::RD},
{"WR", StringMapper::Identifier::WR},
{"PREPB", StringMapper::Identifier::PREPB},
{"RDA", StringMapper::Identifier::RDA},
{"WRA", StringMapper::Identifier::WRA},
{"REFPB", StringMapper::Identifier::REFPB},
};
auto it = strToEnum.find(id);
if (it != strToEnum.end()) return it->second;
else throw std::invalid_argument("The provided StringMapper::Identifier '" + id.toStdString() + "' is not valid.");
}
bool StringMapper::mAuxIsPool(StringMapper::Identifier id) {
return id == StringMapper::Identifier::CMD_BUS
|| id == StringMapper::Identifier::NAW
|| id == StringMapper::Identifier::FAW
|| id == StringMapper::Identifier::_32AW
|| id == StringMapper::Identifier::FAW_LOGICAL
|| id == StringMapper::Identifier::FAW_PHYSICAL;
}
bool StringMapper::operator==(const StringMapper& str2) const {
return mIDEnum == str2.mIDEnum;
}
bool StringMapper::operator!=(const StringMapper& str2) const {
return mIDEnum != str2.mIDEnum;
}
bool StringMapper::operator<(const StringMapper& str2) const {
return mIDEnum < str2.mIDEnum;
}
bool StringMapper::compare(const StringMapper& str1, const StringMapper& str2) {
return str1.getIDEnum() < str2.getIDEnum();
}
bool StringMapper::operator==(const StringMapper::Identifier& id) const {
return mIDEnum == id;
}
bool StringMapper::operator!=(const StringMapper::Identifier& id) const {
return mIDEnum != id;
}

View File

@@ -0,0 +1,66 @@
#pragma once
#include <map>
#include "QStringComparator.h"
class StringMapper {
public:
enum Identifier {
None,
CMD_BUS,
NAW,
FAW,
_32AW,
FAW_LOGICAL,
FAW_PHYSICAL,
REFAB,
PREAB,
PDEP,
PDXP,
SREFEN,
SREFEX,
PDEA,
PDXA,
SRPDEN,
SRPDEX,
ACT,
RD,
WR,
PREPB,
RDA,
WRA,
REFPB
};
public:
StringMapper() = default;
StringMapper(const QString& id);
StringMapper(const char* str) : StringMapper(std::forward<QString>(str)) {}
~StringMapper() = default;
Identifier getIDEnum() const { return mIDEnum; }
const QString getIDStr() const { return mIDStr; }
bool isPool() const { return mIsPool; }
static QString getIDStr(Identifier);
static Identifier getIDEnum(const QString&);
bool operator==(const StringMapper&) const;
bool operator!=(const StringMapper&) const;
bool operator<(const StringMapper&) const;
bool operator==(const Identifier&) const;
bool operator!=(const Identifier&) const;
static bool compare(const StringMapper&, const StringMapper&);
protected:
Identifier mIDEnum = None;
QString mIDStr = "";
bool mIsPool = false;
protected:
static bool mAuxIsPool(Identifier);
};

View File

@@ -56,12 +56,7 @@ struct PhaseTimeDependencies {
size_t maxTime;
};
struct QStringsComparator {
bool operator()(const QString& s1, const QString& s2);
static bool compareQStrings(const QString& s1, const QString& s2);
};
typedef std::map<QString, PhaseTimeDependencies, QStringsComparator> DependencyMap;
typedef std::map<StringMapper, PhaseTimeDependencies> DependencyMap;
struct DBDependencyEntry {
size_t delayedPhaseID;

View File

@@ -2,6 +2,7 @@
#pragma once
#include <QString>
#include "StringMapper.h"
class TimeDependency {
public:
@@ -9,12 +10,12 @@ public:
TimeDependency(size_t timeValue, QString phaseDep, DependencyType depType,
QString timeDepName, bool considerIntraRank = false)
: timeValue{timeValue}, phaseDep{phaseDep}, depType{depType},
timeDepName{timeDepName}, considerIntraRank{considerIntraRank} {}
timeDepName{timeDepName} {}
size_t timeValue;
QString phaseDep;
StringMapper phaseDep;
DependencyType depType;
QString timeDepName;
bool considerIntraRank = false; // Used only for InterRank skip check in PhaseDependenciesTracker::mCalculateDependencies
bool isPool() { return phaseDep.isPool(); }
};

View File

@@ -14,7 +14,7 @@ class DBPhaseEntryIF {
virtual bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryIF> otherPhase) const { return false; }
size_t id;
QString phaseName;
StringMapper phaseName;
size_t phaseBegin;
size_t phaseEnd;
size_t transact;

View File

@@ -3,7 +3,7 @@
DDR3DBPhaseEntry::DDR3DBPhaseEntry(const QSqlQuery& query) {
id = query.value(0).toLongLong();
phaseName = query.value(1).toString();
phaseName = StringMapper(query.value(1).toString());
phaseBegin = query.value(2).toLongLong();
phaseEnd = query.value(3).toLongLong();
transact = query.value(4).toLongLong();
@@ -16,7 +16,7 @@ bool DDR3DBPhaseEntry::potentialDependency(const TimeDependency& dep, const std:
auto other = std::dynamic_pointer_cast<DDR3DBPhaseEntry>(otherPhase);
if (!other) return false;
bool isCmdPool = dep.phaseDep == "CMD_BUS_POOL";
bool isCmdPool = dep.phaseDep == StringMapper::Identifier::CMD_BUS;
bool const skipOnIntraBankAndDifferentBanks = {
dep.depType == DependencyType::IntraBank

View File

@@ -47,19 +47,19 @@ DependencyMap
DRAMTimeDependenciesIF::getDependencies(std::vector<QString>& dependencyFilter) const {
DependencyMap dependenciesMap;
std::vector<StringMapper> dependencyFilterStrMapper(dependencyFilter.begin(), dependencyFilter.end());
std::sort(
dependencyFilter.begin(),
dependencyFilter.end(),
QStringsComparator::compareQStrings
dependencyFilterStrMapper.begin(),
dependencyFilterStrMapper.end()
);
dependenciesMap = mSpecializedGetDependencies();
mFilterDependencyMap(dependenciesMap, dependencyFilter);
mFilterDependencyMap(dependenciesMap, dependencyFilterStrMapper);
auto it = dependenciesMap.begin();
while (it != dependenciesMap.end()) {
mFilterDependencyList(it->second.dependencies, dependencyFilter);
mFilterDependencyList(it->second.dependencies, dependencyFilterStrMapper);
it->second.maxTime = mFindVectorMaximum(it->second.dependencies);
++it;
@@ -73,7 +73,7 @@ PoolControllerMap DRAMTimeDependenciesIF::getPools() const {
return PoolControllerMap(mPools);
}
void DRAMTimeDependenciesIF::mFilterDependencyList(std::vector<TimeDependency>& dependencyList, const std::vector<QString>& dependencyFilter) const {
void DRAMTimeDependenciesIF::mFilterDependencyList(std::vector<TimeDependency>& dependencyList, const std::vector<StringMapper>& dependencyFilter) const {
std::vector<TimeDependency> newDepList(dependencyList.size());
// TODO - probably there is a smarter way to filter these values,
@@ -88,12 +88,12 @@ void DRAMTimeDependenciesIF::mFilterDependencyList(std::vector<TimeDependency>&
dependencyFilter.begin(),
dependencyFilter.end(),
dep.phaseDep,
[](const QString& cmd, const QString& depName){
return depName.indexOf("_POOL", 3) != -1 || QStringsComparator::compareQStrings(cmd, depName);
[](const StringMapper& cmd, const StringMapper& depName){
return depName.isPool() || cmd < depName;
}
);
if (dep.phaseDep.indexOf("_POOL", 3) != -1 || it != dependencyFilter.end() && *it == dep.phaseDep)
if (dep.phaseDep.isPool() || it != dependencyFilter.end() && *it == dep.phaseDep)
return true;
return false;
@@ -114,7 +114,7 @@ void DRAMTimeDependenciesIF::mFilterDependencyList(std::vector<TimeDependency>&
}
void DRAMTimeDependenciesIF::mFilterDependencyMap(DependencyMap& dependencyMap, const std::vector<QString>& dependencyFilter) const {
void DRAMTimeDependenciesIF::mFilterDependencyMap(DependencyMap& dependencyMap, const std::vector<StringMapper>& dependencyFilter) const {
if (!dependencyMap.empty()) {
auto itFilter = dependencyFilter.begin();
@@ -132,8 +132,8 @@ void DRAMTimeDependenciesIF::mFilterDependencyMap(DependencyMap& dependencyMap,
itFilter,
itFilterLast,
itDependencyMap,
[](const QString& cmd, const std::pair<QString, PhaseTimeDependencies>& vpair) {
return cmd.compare(vpair.first) == 0;
[](const StringMapper& cmd, const std::pair<StringMapper, PhaseTimeDependencies>& vpair) {
return cmd == vpair.first;
}
);
@@ -141,11 +141,12 @@ void DRAMTimeDependenciesIF::mFilterDependencyMap(DependencyMap& dependencyMap,
dependencyMap.erase(pair.second, dependencyMap.end());
break;
} else if (pair.first->compare(pair.second->first) < 0) {
} else if (*(pair.first) < pair.second->first < 0) {
++(pair.first);
} else if (pair.first->compare(pair.second->first) == 0) {
} else if (*(pair.first) == pair.second->first == 0) {
++(pair.second);
} else {
pair.second = dependencyMap.erase(pair.second);

View File

@@ -2,7 +2,7 @@
#include "poolcontroller.h"
#include <algorithm>
PoolController::PoolController(const uint poolSize, const std::vector<QString>& dependencies)
PoolController::PoolController(const uint poolSize, const std::vector<StringMapper>& dependencies)
: mDependencies(mAuxSortInput(dependencies))
{
mPoolSize = poolSize;
@@ -31,17 +31,17 @@ void PoolController::merge(std::vector<DBDependencyEntry>& depEntries) {
}
}
bool PoolController::isDependency(const QString& phaseName) {
bool PoolController::isDependency(const StringMapper& phaseName) {
return std::binary_search(
mDependencies.begin(),
mDependencies.end(),
phaseName,
QStringsComparator::compareQStrings
phaseName,
StringMapper::compare
);
}
std::vector<QString> PoolController::mAuxSortInput(std::vector<QString> vec) {
std::sort(vec.begin(), vec.end(), QStringsComparator::compareQStrings);
std::vector<StringMapper> PoolController::mAuxSortInput(std::vector<StringMapper> vec) {
std::sort(vec.begin(), vec.end());
return vec;
}

View File

@@ -5,7 +5,7 @@
class PoolController {
public:
PoolController(const uint poolSize, const std::vector<QString>& dependencies);
PoolController(const uint poolSize, const std::vector<StringMapper>& dependencies);
~PoolController() = default;
void clear();
@@ -13,14 +13,14 @@ public:
void increment();
void merge(std::vector<DBDependencyEntry>& depEntries);
bool isDependency(const QString& phaseName);
bool isDependency(const StringMapper& phaseName);
protected:
const std::vector<QString> mDependencies;
const std::vector<StringMapper> mDependencies;
std::vector<DBDependencyEntry> mPool;
uint mCount = 0;
uint mPoolSize = 0;
protected:
static std::vector<QString> mAuxSortInput(std::vector<QString> vec);
static std::vector<StringMapper> mAuxSortInput(std::vector<StringMapper> vec);
};

View File

@@ -35,7 +35,7 @@
#include "poolcontrollermap.h"
PoolControllerMap::PoolControllerMap(const std::map<QString, PoolController, QStringsComparator>& pools) {
PoolControllerMap::PoolControllerMap(const std::map<StringMapper, PoolController>& pools) {
mPools = pools;
}
@@ -46,7 +46,7 @@ void PoolControllerMap::clear() {
}
void PoolControllerMap::push(const QString& poolName, DBDependencyEntry dep) {
void PoolControllerMap::push(const StringMapper& poolName, DBDependencyEntry dep) {
auto pool = mPools.find(poolName);
if (pool != mPools.end()) {
pool->second.push(dep);
@@ -56,7 +56,7 @@ void PoolControllerMap::push(const QString& poolName, DBDependencyEntry dep) {
}
}
void PoolControllerMap::increment(const QString& poolName) {
void PoolControllerMap::increment(const StringMapper& poolName) {
auto pool = mPools.find(poolName);
if (pool != mPools.end()) {
pool->second.increment();
@@ -72,7 +72,7 @@ void PoolControllerMap::merge(std::vector<DBDependencyEntry>& depEntries) {
}
}
bool PoolControllerMap::isDependency(const QString& poolName, const QString& phaseName) {
bool PoolControllerMap::isDependency(const StringMapper& poolName, const StringMapper& phaseName) {
auto pool = mPools.find(poolName);
if (pool != mPools.end()) {
return pool->second.isDependency(phaseName);

View File

@@ -39,17 +39,17 @@
class PoolControllerMap {
public:
PoolControllerMap(const std::map<QString, PoolController, QStringsComparator>& pools);
PoolControllerMap(const std::map<StringMapper, PoolController>& pools);
~PoolControllerMap() = default;
void clear();
void push(const QString& poolName, DBDependencyEntry);
void increment(const QString& poolName);
void push(const StringMapper& poolName, DBDependencyEntry);
void increment(const StringMapper& poolName);
void merge(std::vector<DBDependencyEntry>& depEntries);
bool isDependency(const QString& poolName, const QString& phaseName);
bool isDependency(const StringMapper& poolName, const StringMapper& phaseName);
protected:
std::map<QString, PoolController, QStringsComparator> mPools;
std::map<StringMapper, PoolController> mPools;
};

View File

@@ -143,8 +143,8 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFC, "REFAB", DependencyType::IntraRank, "tRFC"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tFAW, "NAW_POOL", DependencyType::IntraRank, "tFAW"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
{tFAW, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
@@ -165,7 +165,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -187,7 +187,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -208,7 +208,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -229,7 +229,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -243,7 +243,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tAL + tRTP, "RD", DependencyType::IntraBank, "tAL + tRTP"},
{tWRPRE, "WR", DependencyType::IntraBank, "tWRPRE"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -259,7 +259,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tWRPRE, "WR", DependencyType::IntraRank, "tWRPRE"},
{tWRPRE, "WRA", DependencyType::IntraRank, "tWRPRE"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -277,7 +277,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFC, "REFAB", DependencyType::IntraRank, "tRFC"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -294,7 +294,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tWRAPDEN, "WRA", DependencyType::IntraRank, "tWRAPDEN"},
{tPRPDEN, "PREPB", DependencyType::IntraRank, "tPRPDEN"},
{tCKE, "PDXA", DependencyType::IntraRank, "tCKE"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -305,7 +305,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEA", DependencyType::IntraRank, "tPD"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -323,7 +323,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tCKE, "PDXP", DependencyType::IntraRank, "tCKE"},
{tREFPDEN, "REFAB", DependencyType::IntraRank, "tREFPDEN"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -334,7 +334,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEP", DependencyType::IntraRank, "tPD"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -352,7 +352,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFC, "REFAB", DependencyType::IntraRank, "tRFC"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
@@ -363,7 +363,7 @@ DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
forward_as_tuple(
initializer_list<TimeDependency>{
{tCKESR, "SREFEN", DependencyType::IntraRank, "tCKESR"},
{tCK, "CMD_BUS_POOL", DependencyType::InterRank, "CMD_BUS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);

View File

@@ -209,33 +209,32 @@ PhaseDependenciesTracker::mCalculateDependencies(const std::shared_ptr<Configura
// For each possible dependency for the current phase,
// checks if otherPhase would match as a dependency
for (const auto& dep : deps.dependencies) {
int poolSubstrPos = dep.phaseDep.indexOf("_POOL", 3);
if (poolSubstrPos == -1 && dep.phaseDep != otherPhase->phaseName) continue;
bool isPoolDep = dep.phaseDep.isPool();
if (!isPoolDep && dep.phaseDep != otherPhase->phaseName) continue;
if (!phase->potentialDependency(dep, otherPhase)) {
continue;
}
if (poolSubstrPos != -1) {
if (isPoolDep) {
// Captures activate window dependencies
QString poolName = dep.phaseDep.left(poolSubstrPos);
if (poolController.isDependency(poolName, otherPhase->phaseName)) {
if (poolController.isDependency(dep.phaseDep, otherPhase->phaseName)) {
if (timeDiff == dep.timeValue) {
// Captures only the first (exactly matching time) phase in
// the pool window as a dependency
poolController.push(poolName, DBDependencyEntry{
poolController.push(dep.phaseDep, DBDependencyEntry{
phase->id,
phase->phaseName,
phase->phaseName.getIDStr(),
PhaseDependency::dependencyTypeName(dep.depType),
dep.timeDepName,
otherPhase->id,
otherPhase->phaseName
otherPhase->phaseName.getIDStr()
});
}
if (timeDiff < dep.timeValue) {
poolController.increment(poolName);
poolController.increment(dep.phaseDep);
}
@@ -247,11 +246,11 @@ PhaseDependenciesTracker::mCalculateDependencies(const std::shared_ptr<Configura
if (timeDiff == dep.timeValue) {
entries.emplace_back(DBDependencyEntry{
phase->id,
phase->phaseName,
phase->phaseName.getIDStr(),
PhaseDependency::dependencyTypeName(dep.depType),
dep.timeDepName,
otherPhase->id,
otherPhase->phaseName
otherPhase->phaseName.getIDStr()
});
}