Files
DRAMSys/extensions/apps/traceAnalyzer/businessObjects/dramTimeDependencies/deviceDependencies/specialized/DDR3TimeDependencies.cpp

373 lines
16 KiB
C++

/*
* Copyright (c) 2022, Technische Universität Kaiserslautern
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors:
* Iron Prando da Silva
*/
#include "DDR3TimeDependencies.h"
using namespace std;
DDR3TimeDependencies::DDR3TimeDependencies(const QJsonObject& memspec, const uint tCK) : DRAMTimeDependenciesBase(memspec, tCK) {
mInitializeValues();
}
void DDR3TimeDependencies::mInitializeValues() {
burstLength = mMemspecJson["memarchitecturespec"].toObject()["burstLength"].toInt();
dataRate = mMemspecJson["memarchitecturespec"].toObject()["dataRate"].toInt();
tRP = tCK * mMemspecJson["memtimingspec"].toObject()["RP"].toInt();
tRAS = tCK * mMemspecJson["memtimingspec"].toObject()["RAS"].toInt();
tRC = tCK * mMemspecJson["memtimingspec"].toObject()["RC"].toInt();
tRTP = tCK * mMemspecJson["memtimingspec"].toObject()["RTP"].toInt();
tRRD = tCK * mMemspecJson["memtimingspec"].toObject()["RRD"].toInt();
tCCD = tCK * mMemspecJson["memtimingspec"].toObject()["CCD"].toInt();
tRCD = tCK * mMemspecJson["memtimingspec"].toObject()["RCD"].toInt();
tFAW = tCK * mMemspecJson["memtimingspec"].toObject()["FAW"].toInt();
tRL = tCK * mMemspecJson["memtimingspec"].toObject()["RL"].toInt();
tWL = tCK * mMemspecJson["memtimingspec"].toObject()["WL"].toInt();
tWR = tCK * mMemspecJson["memtimingspec"].toObject()["WR"].toInt();
tWTR = tCK * mMemspecJson["memtimingspec"].toObject()["WTR"].toInt();
tCKESR = tCK * mMemspecJson["memtimingspec"].toObject()["CKESR"].toInt();
tCKE = tCK * mMemspecJson["memtimingspec"].toObject()["CKE"].toInt();
tXP = tCK * mMemspecJson["memtimingspec"].toObject()["XP"].toInt();
tXPDLL = tCK * mMemspecJson["memtimingspec"].toObject()["XPDLL"].toInt();
tXS = tCK * mMemspecJson["memtimingspec"].toObject()["XS"].toInt();
tXSDLL = tCK * mMemspecJson["memtimingspec"].toObject()["XSDLL"].toInt();
tAL = tCK * mMemspecJson["memtimingspec"].toObject()["AL"].toInt();
tRFC = tCK * mMemspecJson["memtimingspec"].toObject()["RFC"].toInt();
tREFI = tCK * mMemspecJson["memtimingspec"].toObject()["REFI"].toInt();
tRTRS = tCK * mMemspecJson["memtimingspec"].toObject()["RTRS"].toInt();
tACTPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["ACTPDEN"].toInt();
tPRPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["PRPDEN"].toInt();
tREFPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["REFPDEN"].toInt();
tCKE = tCK * mMemspecJson["memtimingspec"].toObject()["CKE"].toInt();
tPD = tCKE;
tBURST = (uint) ((burstLength / (float) dataRate) * tCK);
tRDWR = tRL + tBURST + 2 * tCK - tWL;
tRDWR_R = tRL + tBURST + tRTRS - tWL;
tWRRD = tWL + tBURST + tWTR;
tWRRD_R = tWL + tBURST + tRTRS - tRL;
tWRPRE = tWL + tBURST + tWR;
tRDPDEN = tRL + tBURST + tCK;
tWRPDEN = tWL + tBURST + tWR;
tWRAPDEN = tWL + tBURST + tWR + tCK;
mPools.insert({
"CMD_BUS", {
1, {
{"ACT", tCK},
{"RD", tCK},
{"WR", tCK},
{"PREPB", tCK},
{"RDA", tCK},
{"WRA", tCK},
{"REFAB", tCK},
{"PREAB", tCK},
{"PDEP", tCK},
{"PDXP", tCK},
{"SREFEN", tCK},
{"SREFEX", tCK},
{"PDEA", tCK},
{"PDXA", tCK},
}
}
});
mPools.insert({"NAW", {4, {{"ACT", tFAW}}}});
}
const vector<QString> DDR3TimeDependencies::getPossiblePhases() {
return {"ACT",
"RD",
"RDA",
"WR",
"WRA",
"PREPB",
"PREAB",
"REFAB",
"PDEA",
"PDXA",
"PDEP",
"PDXP",
"SREFEN",
"SREFEX"
};
}
DependencyMap DDR3TimeDependencies::mSpecializedGetDependencies() const {
DependencyMap dmap;
dmap.emplace(
piecewise_construct,
forward_as_tuple("ACT"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC, "ACT", DependencyType::IntraBank, "tRC"},
{tAL + tRTP + tRP, "RDA", DependencyType::IntraBank, "tAL + tRTP + tRP"},
{tWRPRE + tRP, "WRA", DependencyType::IntraBank, "tWRPRE + tRP"},
{tRP, "PREPB", DependencyType::IntraBank, "tRP"},
{tRRD, "ACT", DependencyType::IntraRank, "tRRD"},
{tRP, "PREAB", DependencyType::IntraRank, "tRP"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFC, "REFAB", DependencyType::IntraRank, "tRFC"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
{tFAW, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RD"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tCCD, "RD", DependencyType::IntraRank, "tCCD"},
{tCCD, "RDA", DependencyType::IntraRank, "tCCD"},
{tWRRD, "WR", DependencyType::IntraRank, "tWRRD"},
{tWRRD, "WRA", DependencyType::IntraRank, "tWRRD"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tBURST + tRTRS, "RD", DependencyType::InterRank, "tBURST + tRTRS"},
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RDA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tWRPRE - tRTP, "WR", DependencyType::IntraBank, "tWRPRE - tRTP"},
{tCCD, "RD", DependencyType::IntraRank, "tCCD"},
{tCCD, "RDA", DependencyType::IntraRank, "tCCD"},
{tWRRD, "WR", DependencyType::IntraRank, "tWRRD"},
{tWRRD, "WRA", DependencyType::IntraRank, "tWRRD"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tBURST + tRTRS, "RD", DependencyType::InterRank, "tBURST + tRTRS"},
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WR"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tRDWR, "RD", DependencyType::IntraRank, "tRDWR"},
{tRDWR, "RDA", DependencyType::IntraRank, "tRDWR"},
{tCCD, "WR", DependencyType::IntraRank, "tCCD"},
{tCCD, "WRA", DependencyType::IntraRank, "tCCD"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tRDWR_R, "RD", DependencyType::InterRank, "tRDWR_R"},
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WRA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tRDWR, "RD", DependencyType::IntraRank, "tRDWR"},
{tRDWR, "RDA", DependencyType::IntraRank, "tRDWR"},
{tCCD, "WR", DependencyType::IntraRank, "tCCD"},
{tCCD, "WRA", DependencyType::IntraRank, "tCCD"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tRDWR_R, "RD", DependencyType::InterRank, "tRDWR_R"},
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREPB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS, "ACT", DependencyType::IntraBank, "tRAS"},
{tAL + tRTP, "RD", DependencyType::IntraBank, "tAL + tRTP"},
{tWRPRE, "WR", DependencyType::IntraBank, "tWRPRE"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS, "ACT", DependencyType::IntraRank, "tRAS"},
{tAL + tRTP, "RD", DependencyType::IntraRank, "tAL + tRTP"},
{tAL + tRTP, "RDA", DependencyType::IntraRank, "tAL + tRTP"},
{tWRPRE, "WR", DependencyType::IntraRank, "tWRPRE"},
{tWRPRE, "WRA", DependencyType::IntraRank, "tWRPRE"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC, "ACT", DependencyType::IntraRank, "tRC"},
{tAL + tRTP + tRP, "RDA", DependencyType::IntraRank, "tAL + tRTP + tRP"},
{tWRPRE + tRP, "WRA", DependencyType::IntraRank, "tWRPRE + tRP"},
{tRP, "PREPB", DependencyType::IntraRank, "tRP"},
{tRP, "PREAB", DependencyType::IntraRank, "tRP"},
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFC, "REFAB", DependencyType::IntraRank, "tRFC"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDEA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tACTPDEN, "ACT", DependencyType::IntraRank, "tACTPDEN"},
{tRDPDEN, "RD", DependencyType::IntraRank, "tRDPDEN"},
{tRDPDEN, "RDA", DependencyType::IntraRank, "tRDPDEN"},
{tWRPDEN, "WR", DependencyType::IntraRank, "tWRPDEN"},
{tWRAPDEN, "WRA", DependencyType::IntraRank, "tWRAPDEN"},
{tPRPDEN, "PREPB", DependencyType::IntraRank, "tPRPDEN"},
{tCKE, "PDXA", DependencyType::IntraRank, "tCKE"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEA", DependencyType::IntraRank, "tPD"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDEP"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRDPDEN, "RD", DependencyType::IntraRank, "tRDPDEN"},
{tRDPDEN, "RDA", DependencyType::IntraRank, "tRDPDEN"},
{tWRAPDEN, "WRA", DependencyType::IntraRank, "tWRAPDEN"},
{tPRPDEN, "PREPB", DependencyType::IntraRank, "tPRPDEN"},
{tPRPDEN, "PREAB", DependencyType::IntraRank, "tPRPDEN"},
{tCKE, "PDXP", DependencyType::IntraRank, "tCKE"},
{tREFPDEN, "REFAB", DependencyType::IntraRank, "tREFPDEN"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXP"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEP", DependencyType::IntraRank, "tPD"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SREFEN"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC, "ACT", DependencyType::IntraRank, "tRC"},
{max({tRDPDEN, tAL + tRTP + tRP}), "RDA", DependencyType::IntraRank, "max(tRDPDEN, tAL + tRTP + tRP)"},
{max({tWRAPDEN, tWRPRE + tRP}), "WRA", DependencyType::IntraRank, "max(tWRAPDEN, tWRPRE + tRP)"},
{tRP, "PREPB", DependencyType::IntraRank, "tRP"},
{tRP, "PREAB", DependencyType::IntraRank, "tRP"},
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFC, "REFAB", DependencyType::IntraRank, "tRFC"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SREFEX"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tCKESR, "SREFEN", DependencyType::IntraRank, "tCKESR"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CMD_BUS"},
}
)
);
return dmap;
}