Added extension mechanism and ported DDR5, LPDDR5, HBM3, TraceAnalyzer

This commit is contained in:
Thomas Psota
2023-02-09 14:22:34 +01:00
parent f4bc3867fc
commit f434026ccd
204 changed files with 1685 additions and 246 deletions

View File

@@ -0,0 +1,13 @@
---
BasedOnStyle: LLVM
AccessModifierOffset: '-4'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakTemplateDeclarations: 'true'
BreakBeforeBraces: Allman
ColumnLimit: '120'
IndentWidth: '4'
PointerAlignment: Right
...

View File

@@ -0,0 +1,8 @@
[Dolphin]
Timestamp=2022,2,16,16,1,1.259
Version=4
ViewMode=1
VisibleRoles=Details_text,Details_type,Details_size,Details_modificationtime,CustomizedDetails
[Settings]
HiddenFilesShown=true

View File

@@ -0,0 +1,178 @@
# Copyright (c) 2020, 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:
# Matthias Jung
# Lukas Steiner
# Derek Christ
# Iron Prando da Silva
cmake_minimum_required(VERSION 3.12)
# Project Name:
project(TraceAnalyzer)
# Add Python3 Dependency:
find_package(Python3 COMPONENTS Development)
# Add QWT Dependency:
find_library(QWT_LIBRARY NAMES "qwt-qt5" "qwt" PATHS
"$ENV{QWT_HOME}/lib"
"/opt/homebrew/opt/qwt-qt5/lib"
)
find_path(QWT_INCLUDE_DIRS NAMES "qwt_plot.h" PATHS
"/usr/include/qwt-qt5"
"/usr/include/qwt"
"$ENV{QWT_HOME}/include"
"/opt/homebrew/opt/qwt-qt5/include"
"/opt/homebrew/opt/qwt-qt5/lib/qwt.framework/Headers"
)
# Add QT Library:
if (APPLE)
set(Qt5_DIR "/opt/homebrew/opt/qt@5/lib/cmake/Qt5")
endif(APPLE)
find_package(Qt5 COMPONENTS Core Gui Widgets Sql REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Configure:
set(CMAKE_CXX_STANDARD 17)
set(DCMAKE_SH="CMAKE_SH-NOTFOUND")
add_executable(TraceAnalyzer
main.cpp
businessObjects/transaction.cpp
businessObjects/timespan.cpp
data/tracedb.cpp
presentation/tracenavigator.cpp
presentation/util/colorgenerator.cpp
presentation/util/colorobject.cpp
presentation/tracedrawing.cpp
presentation/traceplotitem.cpp
gototimedialog.cpp
presentation/traceplot.cpp
tracefiletab.cpp
presentation/tracescroller.cpp
traceanalyzer.cpp
presentation/transactiontreewidget.cpp
presentation/util/clkgrid.cpp
queryeditor.cpp
presentation/selectedtransactiontreewidget.cpp
businessObjects/phases/phasefactory.cpp
presentation/debugmessagetreewidget.cpp
presentation/tracePlotMouseLabel.cpp
evaluationtool.cpp
selectmetrics.cpp
presentation/util/testlight.cpp
presentation/util/togglecollapsedaction.cpp
businessObjects/pythoncaller.cpp
presentation/tracemetrictreewidget.cpp
businessObjects/phases/phase.cpp
businessObjects/phases/phasedependency.cpp
businessObjects/phases/dependencyinfos.cpp
presentation/tracedrawingproperties.cpp
presentation/util/customlabelscaledraw.cpp
businessObjects/configmodels.cpp
businessObjects/commentmodel.cpp
businessObjects/traceplotlinemodel.cpp
simulationdialog.cpp
businessObjects/dependencymodels.cpp
businessObjects/dramTimeDependencies/common/QStringComparator.cpp
businessObjects/dramTimeDependencies/common/StringMapper.cpp
businessObjects/dramTimeDependencies/deviceDependencies/poolcontroller.cpp
businessObjects/dramTimeDependencies/deviceDependencies/poolcontrollermap.cpp
businessObjects/dramTimeDependencies/deviceDependencies/dramtimedependenciesbase.cpp
businessObjects/dramTimeDependencies/configurations/configurationBase.cpp
businessObjects/dramTimeDependencies/dbEntries/specialized/DDR3dbphaseentry.cpp
# businessObjects/dramTimeDependencies/deviceDependencies/specialized/DDR3TimeDependencies.cpp
businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoDDR3.cpp
businessObjects/dramTimeDependencies/configurations/specialized/DDR3Configuration.cpp
businessObjects/dramTimeDependencies/dbEntries/specialized/DDR4dbphaseentry.cpp
businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoDDR4.cpp
businessObjects/dramTimeDependencies/configurations/specialized/DDR4Configuration.cpp
businessObjects/dramTimeDependencies/dbEntries/specialized/HBM2dbphaseentry.cpp
businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoHBM2.cpp
businessObjects/dramTimeDependencies/configurations/specialized/HBM2Configuration.cpp
businessObjects/dramTimeDependencies/dbEntries/specialized/LPDDR4dbphaseentry.cpp
businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoLPDDR4.cpp
businessObjects/dramTimeDependencies/configurations/specialized/LPDDR4Configuration.cpp
businessObjects/dramTimeDependencies/dbEntries/specialized/DDR5dbphaseentry.cpp
businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoDDR5.cpp
businessObjects/dramTimeDependencies/configurations/specialized/DDR5Configuration.cpp
businessObjects/dramTimeDependencies/dbEntries/specialized/LPDDR5dbphaseentry.cpp
businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoLPDDR5.cpp
businessObjects/dramTimeDependencies/configurations/specialized/LPDDR5Configuration.cpp
businessObjects/dramTimeDependencies/configurations/configurationfactory.cpp
businessObjects/dramTimeDependencies/phasedependenciestracker.cpp
selectmetrics.ui
preferences.ui
evaluationtool.ui
gototimedialog.ui
tracefiletab.ui
queryeditor.ui
traceanalyzer.ui
simulationdialog.ui
scripts/memUtil.py
scripts/metrics.py
scripts/tests.py
scripts/plots.py
scripts/vcdExport.py
scripts/sonification.pl
scripts/dataExtractForNN.pl
resources.qrc
)
target_include_directories(TraceAnalyzer
PRIVATE ${QWT_INCLUDE_DIRS}
PRIVATE ${Python3_INCLUDE_DIRS}
)
# Build:
target_link_libraries(TraceAnalyzer
PRIVATE ${Python3_LIBRARIES}
PRIVATE ${QWT_LIBRARY}
PRIVATE Qt5::Widgets
PRIVATE Qt5::Sql
PRIVATE DRAMSysConfiguration
)

View File

@@ -0,0 +1,2 @@
dram.vp.scheduler
=================

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#ifndef METRIC_H
#define METRIC_H
#include <QString>
class CalculatedMetric
{
public:
CalculatedMetric(QString name, double value): name(name), value(value) {}
QString getName()
{
return name;
}
double getValue()
{
return value;
}
private:
QString name;
double value;
};
#endif // METRIC_H

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 2019, 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:
* Lukas Steiner
*/
#ifndef COMMANDLENGTHS_H
#define COMMANDLENGTHS_H
struct CommandLengths
{
double NOP = 1;
double RD = 1;
double WR = 1;
double RDA = 1;
double WRA = 1;
double ACT = 1;
double PREPB = 1;
double REFPB = 1;
double RFMPB = 1;
double REFP2B = 1;
double RFMP2B = 1;
double PRESB = 1;
double REFSB = 1;
double RFMSB = 1;
double PREAB = 1;
double REFAB = 1;
double RFMAB = 1;
double PDEA = 1;
double PDXA = 1;
double PDEP = 1;
double PDXP = 1;
double SREFEN = 1;
double SREFEX = 1;
CommandLengths(double NOP, double RD, double WR,
double RDA, double WRA, double ACT,
double PREPB, double REFPB, double RFMPB,
double REFP2B, double RFMP2B,
double PRESB, double REFSB, double RFMSB,
double PREAB, double REFAB, double RFMAB,
double PDEA, double PDXA, double PDEP, double PDXP,
double SREFEN, double SREFEX) :
NOP(NOP), RD(RD), WR(WR),
RDA(RDA), WRA(WRA), ACT(ACT),
PREPB(PREPB), REFPB(REFPB), RFMPB(RFMPB),
REFP2B(REFP2B), RFMP2B(RFMP2B),
PRESB(PRESB), REFSB(REFSB), RFMSB(RFMSB),
PREAB(PREAB), REFAB(REFAB), RFMAB(RFMAB),
PDEA(PDEA), PDXA(PDXA), PDEP(PDEP), PDXP(PDXP),
SREFEN(SREFEN), SREFEX(SREFEX) {}
CommandLengths() = default;
};
#endif // COMMANDLENGTHS_H

View File

@@ -0,0 +1,305 @@
/*
* Copyright (c) 2021, 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:
* Derek Christ
*/
#include "commentmodel.h"
#include <QMenu>
#include <QItemSelectionModel>
#include <QKeyEvent>
CommentModel::CommentModel(QObject *parent) : QAbstractTableModel(parent),
gotoAction(new QAction("Goto comment", this)),
editAction(new QAction("Edit comment", this)),
deleteAction(new QAction("Delete comment", this)),
selectAllAction(new QAction("Select all comments", this)),
deselectAllAction(new QAction("Deselect all comments", this)),
internalSelectionModel(new QItemSelectionModel(this, this))
{
setUpActions();
}
void CommentModel::setUpActions()
{
QObject::connect(gotoAction, &QAction::triggered, this, [=](){
const QModelIndexList indexes = internalSelectionModel->selectedRows();
for (const QModelIndex &currentIndex : indexes)
{
emit gotoCommentTriggered(currentIndex);
}
});
QObject::connect(editAction, &QAction::triggered, this, [=](){
const QModelIndexList indexes = internalSelectionModel->selectedRows();
for (const QModelIndex &currentIndex : indexes)
emit editTriggered(index(currentIndex.row(), static_cast<int>(Column::Comment)));
});
QObject::connect(deleteAction, &QAction::triggered, this, [=](){
const QModelIndexList indexes = internalSelectionModel->selectedRows();
for (const QModelIndex &currentIndex : indexes)
removeComment(currentIndex);
});
QObject::connect(selectAllAction, &QAction::triggered, this, [=](){
QModelIndex topLeft = index(0, 0);
QModelIndex bottomRight = index(rowCount() - 1, columnCount() - 1);
internalSelectionModel->select(QItemSelection(topLeft, bottomRight),
QItemSelectionModel::Select | QItemSelectionModel::Rows);
});
QObject::connect(deselectAllAction, &QAction::triggered,
internalSelectionModel, &QItemSelectionModel::clearSelection);
}
int CommentModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return comments.size();
}
int CommentModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return static_cast<int>(Column::COLUMNCOUNT);
}
QVariant CommentModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
// Qt::UserRole is used to get the raw time without pretty formatting.
if (role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::UserRole)
return QVariant();
const Comment &comment = comments.at(index.row());
if (role == Qt::UserRole && static_cast<Column>(index.column()) == Column::Time)
return QVariant(comment.time);
switch (static_cast<Column>(index.column())) {
case Column::Time:
return QVariant(prettyFormatTime(comment.time));
case Column::Comment:
return QVariant(comment.text);
default:
break;
}
return QVariant();
}
bool CommentModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (!index.isValid())
return false;
if (role != Qt::EditRole)
return false;
if (static_cast<Column>(index.column()) != Column::Comment)
return false;
QString newText = value.toString();
Comment &comment = comments.at(index.row());
comment.text = newText;
emit dataChanged(index, index);
return true;
}
QVariant CommentModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation == Qt::Horizontal)
{
switch (static_cast<Column>(section)) {
case Column::Time:
return "Time";
case Column::Comment:
return "Comment";
default:
break;
}
}
return QVariant();
}
Qt::ItemFlags CommentModel::flags(const QModelIndex &index) const
{
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
if (index.isValid() && index.column() == static_cast<int>(Column::Comment))
flags |= Qt::ItemIsEditable;
return flags;
}
void CommentModel::openContextMenu()
{
if (!internalSelectionModel->hasSelection())
return;
QMenu *menu = new QMenu();
menu->addActions({gotoAction, editAction, deleteAction});
menu->addSeparator();
menu->addActions({selectAllAction, deselectAllAction});
QObject::connect(menu, &QMenu::aboutToHide, [=]() {
menu->deleteLater();
});
menu->popup(QCursor::pos());
}
QItemSelectionModel *CommentModel::selectionModel() const
{
return internalSelectionModel;
}
void CommentModel::addComment(traceTime time)
{
auto commentIt = std::find_if(comments.rbegin(), comments.rend(), [time](const Comment &comment){
return comment.time <= time;
});
int insertIndex = std::distance(comments.begin(), commentIt.base());
beginInsertRows(QModelIndex(), insertIndex, insertIndex);
comments.insert(comments.begin() + insertIndex, {time, "Enter comment text..."});
endInsertRows();
internalSelectionModel->setCurrentIndex(index(insertIndex, 0),
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
emit editTriggered(index(insertIndex, 1));
}
void CommentModel::addComment(traceTime time, QString text)
{
auto commentIt = std::find_if(comments.rbegin(), comments.rend(), [time](const Comment &comment){
return comment.time <= time;
});
int insertIndex = std::distance(comments.begin(), commentIt.base());
beginInsertRows(QModelIndex(), insertIndex, insertIndex);
comments.insert(comments.begin() + insertIndex, {time, text});
endInsertRows();
}
void CommentModel::removeComment(traceTime time)
{
auto commentIt = std::find_if(comments.begin(), comments.end(), [time](const Comment &comment){
return comment.time == time;
});
if (commentIt == comments.end())
return;
int removeIndex = std::distance(comments.begin(), commentIt);
beginRemoveRows(QModelIndex(), removeIndex, removeIndex);
comments.erase(commentIt);
endRemoveRows();
}
void CommentModel::removeComment(const QModelIndex &index)
{
beginRemoveRows(QModelIndex(), index.row(), index.row());
comments.erase(comments.begin() + index.row());
endRemoveRows();
}
const std::vector<CommentModel::Comment> &CommentModel::getComments() const
{
return comments;
}
traceTime CommentModel::getTimeFromIndex(const QModelIndex &index) const
{
Q_ASSERT(comments.size() > index.row());
return comments[index.row()].time;
}
QModelIndex CommentModel::hoveredComment(Timespan timespan) const
{
auto commentIt = std::find_if(comments.begin(), comments.end(), [timespan](const Comment &comment){
return timespan.Begin() < comment.time && comment.time < timespan.End();
});
if (commentIt == comments.end())
return QModelIndex();
int commentIndex = std::distance(comments.begin(), commentIt);
return index(commentIndex, 0);
}
bool CommentModel::eventFilter(QObject *object, QEvent *event)
{
Q_UNUSED(object)
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Delete)
{
const QModelIndexList indexes = internalSelectionModel->selectedRows();
for (const QModelIndex &currentIndex : indexes)
{
removeComment(currentIndex);
}
}
}
return false;
}
void CommentModel::rowDoubleClicked(const QModelIndex &index)
{
if (!index.isValid())
return;
if (static_cast<Column>(index.column()) == Column::Time)
Q_EMIT gotoCommentTriggered(index);
}

View File

@@ -0,0 +1,119 @@
/*
* Copyright (c) 2021, 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:
* Derek Christ
*/
#ifndef COMMENTMODEL_H
#define COMMENTMODEL_H
#include "tracetime.h"
#include "timespan.h"
#include <QAbstractTableModel>
#include <utility>
class QAction;
class QItemSelectionModel;
class CommentModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit CommentModel(QObject *parent = nullptr);
struct Comment {
traceTime time;
QString text;
};
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
enum class Column {
Time = 0,
Comment,
COLUMNCOUNT
};
void openContextMenu();
QItemSelectionModel *selectionModel() const;
void addComment(traceTime time);
void addComment(traceTime time, QString text);
void removeComment(traceTime time);
void removeComment(const QModelIndex &index);
const std::vector<Comment> &getComments() const;
traceTime getTimeFromIndex(const QModelIndex &index) const;
QModelIndex hoveredComment(Timespan timespan) const;
public Q_SLOTS:
void rowDoubleClicked(const QModelIndex &index);
protected:
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
/**
* The eventFilter is used to delete comments using the delete key.
*/
bool eventFilter(QObject *object, QEvent *event) override;
Q_SIGNALS:
void editTriggered(const QModelIndex &index);
void gotoCommentTriggered(const QModelIndex &index);
private:
void setUpActions();
std::vector<Comment> comments;
QAction *gotoAction;
QAction *editAction;
QAction *deleteAction;
QAction *selectAllAction;
QAction *deselectAllAction;
QItemSelectionModel *internalSelectionModel;
};
#endif // COMMENTMODEL_H

View File

@@ -0,0 +1,292 @@
/*
* Copyright (c) 2021, 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:
* Derek Christ
*/
#include "configmodels.h"
#include <QJsonObject>
#include <QJsonDocument>
McConfigModel::McConfigModel(const TraceDB &traceFile, QObject *parent) : QAbstractTableModel(parent)
{
QSqlDatabase db = traceFile.getDatabase();
QString query = "SELECT MCconfig FROM GeneralInfo";
QSqlQuery sqlQuery = db.exec(query);
// The whole configuration is stored in a single cell.
sqlQuery.next();
QString mcConfigJson = sqlQuery.value(0).toString();
addAdditionalInfos(traceFile.getGeneralInfo());
parseJson(mcConfigJson);
}
void McConfigModel::parseJson(const QString &jsonString)
{
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toUtf8());
QJsonObject mcConfigJson = jsonDocument.object()["mcconfig"].toObject();
for (auto key : mcConfigJson.keys())
{
QJsonValue currentValue = mcConfigJson.value(key);
if (currentValue.isDouble())
{
entries.push_back({key, QString::number(currentValue.toDouble())});
}
else if (currentValue.isString())
{
entries.push_back({key, currentValue.toString()});
}
else if (currentValue.isBool())
{
entries.push_back({key, currentValue.toBool() ? "True" : "False"});
}
}
}
void McConfigModel::addAdditionalInfos(const GeneralInfo &generalInfo)
{
auto addEntry = [this](const QString &key, const QString &value) { entries.push_back({key, value}); };
addEntry("Number of Transactions", QString::number(generalInfo.numberOfTransactions));
addEntry("Clock period", QString::number(generalInfo.clkPeriod) + " " + generalInfo.unitOfTime.toLower());
addEntry("Length of trace", prettyFormatTime(generalInfo.span.End()));
addEntry("Window size", QString::number(generalInfo.windowSize));
}
int McConfigModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return entries.size();
}
int McConfigModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return 2;
}
QVariant McConfigModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (role != Qt::DisplayRole)
return QVariant();
auto entry = entries.at(index.row());
if (index.column() == 0)
return entry.first;
else if (index.column() == 1)
return entry.second;
return QVariant();
}
QVariant McConfigModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation == Qt::Horizontal)
{
switch (section) {
case 0:
return "Field";
case 1:
return "Value";
default:
break;
}
}
return QVariant();
}
MemSpecModel::MemSpecModel(const TraceDB &traceFile, QObject *parent) : QAbstractItemModel(parent)
{
QSqlDatabase db = traceFile.getDatabase();
QString query = "SELECT Memspec FROM GeneralInfo";
QSqlQuery sqlQuery = db.exec(query);
// The whole configuration is stored in a single cell.
sqlQuery.next();
QString memSpecJson = sqlQuery.value(0).toString();
parseJson(memSpecJson);
}
int MemSpecModel::Node::getRow() const
{
if (!parent)
return 0;
const auto &siblings = parent->children;
const auto siblingsIt = std::find_if(siblings.begin(), siblings.end(), [this](const std::unique_ptr<Node> &node){
return node.get() == this;
});
Q_ASSERT(siblingsIt != siblings.end());
return std::distance(siblings.begin(), siblingsIt);
}
void MemSpecModel::parseJson(const QString &jsonString)
{
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toUtf8());
QJsonObject memSpecJson = jsonDocument.object()["memspec"].toObject();
std::function<void(const QJsonObject &, std::unique_ptr<Node> &)> addNodes;
addNodes = [&addNodes](const QJsonObject &obj, std::unique_ptr<Node> &parentNode)
{
for (auto key : obj.keys())
{
QJsonValue currentValue = obj.value(key);
QString value;
if (currentValue.isDouble())
{
value = QString::number(currentValue.toDouble());
}
else if (currentValue.isString())
{
value = currentValue.toString();
}
else if (currentValue.isBool())
{
value = currentValue.toBool() ? "True" : "False";
}
std::unique_ptr<Node> node = std::unique_ptr<Node>(new Node({key, value}, parentNode.get()));
addNodes(obj[key].toObject(), node);
parentNode->children.push_back(std::move(node));
}
};
addNodes(memSpecJson, rootNode);
}
int MemSpecModel::rowCount(const QModelIndex &parent) const
{
if (parent.column() > 0)
return 0;
const Node *parentNode;
if (!parent.isValid())
parentNode = rootNode.get();
else
parentNode = static_cast<const Node *>(parent.internalPointer());
return parentNode->childCount();
}
int MemSpecModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return 2;
}
QVariant MemSpecModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (role != Qt::DisplayRole && role != Qt::ToolTipRole)
return QVariant();
auto *node = static_cast<const Node *>(index.internalPointer());
if (index.column() == 0)
return QVariant(node->data.first);
else
return QVariant(node->data.second);
}
QVariant MemSpecModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation == Qt::Horizontal)
{
switch (section) {
case 0:
return "Field";
case 1:
return "Value";
default:
break;
}
}
return QVariant();
}
QModelIndex MemSpecModel::index(int row, int column, const QModelIndex &parent) const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
const Node *parentNode;
if (!parent.isValid())
parentNode = rootNode.get();
else
parentNode = static_cast<const Node *>(parent.internalPointer());
const Node *node = parentNode->children[row].get();
return createIndex(row, column, const_cast<Node *>(node));
}
QModelIndex MemSpecModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
const Node *childNode = static_cast<const Node *>(index.internalPointer());
const Node *parentNode = childNode->parent;
if (!parentNode || parentNode == rootNode.get())
return QModelIndex();
return createIndex(parentNode->getRow(), 0, const_cast<Node *>(parentNode));
}

View File

@@ -0,0 +1,128 @@
/*
* Copyright (c) 2021, 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:
* Derek Christ
*/
#ifndef CONFIGMODELS_H
#define CONFIGMODELS_H
#include "../data/tracedb.h"
#include "phases/dependencyinfos.h"
#include <QAbstractTableModel>
#include <vector>
#include <utility>
class McConfigModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit McConfigModel(const TraceDB &traceFile, QObject *parent = nullptr);
protected:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
private:
/**
* Parses the json file and adds json entries to the entries vector.
* In case of failure, nothing is added and therefore the model
* will stay empty.
*/
void parseJson(const QString &jsonString);
/**
* Add additional infos about the tracefile which were
* previously displayed in the fileDescription widget.
*/
void addAdditionalInfos(const GeneralInfo &generalInfo);
std::vector<std::pair<QString, QString>> entries;
};
class MemSpecModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit MemSpecModel(const TraceDB &traceFile, QObject *parent = nullptr);
protected:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
QModelIndex parent(const QModelIndex &index) const override;
private:
/**
* Parses the json file and adds json entries to the entries vector.
* In case of failure, nothing is added and therefore the model
* will stay empty.
*/
void parseJson(const QString &jsonString);
struct Node
{
using NodeData = std::pair<QString, QString>;
/**
* Constructor only used for the root node that does not contain any data.
*/
Node() = default;
Node(NodeData data, const Node *parent) : data(data), parent(parent) {}
/**
* Gets the row relative to its parent.
*/
int getRow() const;
int childCount() const { return children.size(); }
NodeData data;
const Node *parent = nullptr;
std::vector<std::unique_ptr<Node>> children;
};
std::unique_ptr<Node> rootNode = std::unique_ptr<Node>(new Node);
};
#endif // CONFIGMODELS_H

View File

@@ -0,0 +1,175 @@
/*
* 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 "dependencymodels.h"
DependencyInfosModel::DependencyInfosModel(TraceDB &traceFile, QObject *parent) : QAbstractItemModel(parent)
{
mDepInfosDepType = traceFile.getDependencyInfos(DependencyInfos::Type::DependencyType);
mDepInfosTimeDep = traceFile.getDependencyInfos(DependencyInfos::Type::TimeDependency);
mDepInfosDelPhase = traceFile.getDependencyInfos(DependencyInfos::Type::DelayedPhase);
mDepInfosDepPhase = traceFile.getDependencyInfos(DependencyInfos::Type::DependencyPhase);
if (traceFile.checkDependencyTableExists())
{
parseInfos();
}
}
int DependencyInfosModel::Node::getRow() const
{
if (!parent)
return 0;
const auto &siblings = parent->children;
const auto siblingsIt = std::find_if(siblings.begin(), siblings.end(),
[this](const std::unique_ptr<Node> &node) { return node.get() == this; });
Q_ASSERT(siblingsIt != siblings.end());
return std::distance(siblings.begin(), siblingsIt);
}
void DependencyInfosModel::parseInfos()
{
std::vector<std::pair<QString, DependencyInfos &>> infos = {{"Dependency Granularity", mDepInfosDepType},
{"Time Dependencies", mDepInfosTimeDep},
{"Delayed Phases", mDepInfosDelPhase},
{"Dependency Phases", mDepInfosDepPhase}};
for (auto pair : infos)
{
std::unique_ptr<Node> node = std::unique_ptr<Node>(new Node({pair.first, ""}, rootNode.get()));
for (auto v : pair.second.getInfos())
{
QString value = QString::number(v.value) + " %";
node->children.push_back(std::move(std::unique_ptr<Node>(new Node({v.id, value}, node.get()))));
}
rootNode->children.push_back(std::move(node));
}
}
int DependencyInfosModel::rowCount(const QModelIndex &parent) const
{
if (parent.column() > 0)
return 0;
const Node *parentNode;
if (!parent.isValid())
parentNode = rootNode.get();
else
parentNode = static_cast<const Node *>(parent.internalPointer());
return parentNode->childCount();
}
int DependencyInfosModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return 2;
}
QVariant DependencyInfosModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (role != Qt::DisplayRole && role != Qt::ToolTipRole)
return QVariant();
auto *node = static_cast<const Node *>(index.internalPointer());
if (index.column() == 0)
return QVariant(node->data.first);
else
return QVariant(node->data.second);
}
QVariant DependencyInfosModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation == Qt::Horizontal)
{
switch (section)
{
case 0:
return "Field";
case 1:
return "Percentage";
default:
break;
}
}
return QVariant();
}
QModelIndex DependencyInfosModel::index(int row, int column, const QModelIndex &parent) const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
const Node *parentNode;
if (!parent.isValid())
parentNode = rootNode.get();
else
parentNode = static_cast<const Node *>(parent.internalPointer());
const Node *node = parentNode->children[row].get();
return createIndex(row, column, const_cast<Node *>(node));
}
QModelIndex DependencyInfosModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
const Node *childNode = static_cast<const Node *>(index.internalPointer());
const Node *parentNode = childNode->parent;
if (!parentNode)
return QModelIndex();
return createIndex(parentNode->getRow(), 0, const_cast<Node *>(parentNode));
}

View File

@@ -0,0 +1,99 @@
/*
* 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
*/
#pragma once
#include "../data/tracedb.h"
#include "phases/dependencyinfos.h"
#include <QAbstractTableModel>
#include <QListWidget>
#include <vector>
#include <utility>
class DependencyInfosModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit DependencyInfosModel(TraceDB &traceFile, QObject *parent = nullptr);
~DependencyInfosModel()
{
}
protected:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
QModelIndex parent(const QModelIndex &index) const override;
private:
DependencyInfos mDepInfosDepType;
DependencyInfos mDepInfosTimeDep;
DependencyInfos mDepInfosDelPhase;
DependencyInfos mDepInfosDepPhase;
void parseInfos();
struct Node
{
using NodeData = std::pair<QString, QString>;
Node()
{
}
Node(NodeData data, const Node *parent) : data(data), parent(parent)
{
}
/**
* Gets the row relative to its parent.
*/
int getRow() const;
int childCount() const
{
return children.size();
}
NodeData data;
const Node *parent = nullptr;
std::vector<std::unique_ptr<Node>> children;
};
std::unique_ptr<Node> rootNode = std::unique_ptr<Node>(new Node);
};

View File

@@ -0,0 +1,53 @@
## Relevant classes
```
PhaseDependenciesTracker
├── ConfigurationFactory
│   └── ConfigurationBase
│   ├── DBPhaseEntryBase
│   └── DRAMTimeDependenciesBase
│   ├── DependencyMap
│   │   └── PhaseTimeDependencies
│   └── PoolControllerMap
└── DBDependencyEntry
```
#### PhaseDependenciesTracker
Responsible for the whole execution. Instantiates a configuration class through the ConfigurationFactory, loads the selected phases into memory, calculates the time dependencies between phases and saves into the database file.
#### ConfigurationFactory
Creates a configuration object given its name.
#### ConfigurationBase
Interface and common functionality of configuration classes. These include creating DBPhaseEntryBase objects from the database for the given device and delegate methods.
#### DBPhaseEntryBase
Interfaces to device specific phase entries. Specificities include object data, construction and dependency logic.
#### DRAMTimeDependenciesBase
Interfaces to device's time dependencies descriptor class.
#### DependencyMap
A STL map using auxiliar objects. Maps phases to their PhaseTimeDependencies.
#### PhaseTimeDependencies
An auxiliar class with initializer list constructor. Contains a vector of TimeDependency objects and its maximum time value.
#### PoolControllerMap
Maps pool names to PoolController objects. Pools keep track of all potential dependencies of a given phase.
#### DBDependencyEntry
Contains the data to be written to the database.
## Suggested steps for creating a device:
1. Create a time dependencies class inheriting from the DRAMTimeDependenciesBase object.
2. Create the phase entry object inheriting from DBPhaseEntryBase. The object must determine the relevant data to be used and how phases may be correlated.
3. Create a configuration class for your object inheriting from ConfigurationBase. This will contain the dependencies maps and instantiate the specialized DBPhaseEntryBase object.
4. Add the newly created device to the functions of the ConfigurationFactory class. The device name is taken from the database.
#### Example
For instance, we have the necessary objects for calculating DDR3 device dependencies implemented in the following files:
1. deviceDependencies/specialized/TimeDependenciesInfoDDR3.(h/cpp)
2. dbEntries/specialized/DDR3dbphaseentry.(h/cpp)
3. configurations/specialized/DDR3Configuration.(h/cpp)

View File

@@ -0,0 +1,44 @@
/*
* 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 "QStringComparator.h"
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,43 @@
/*
* 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
*/
#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,159 @@
/*
* 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 "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::RAS_BUS, "RAS_BUS"},
{StringMapper::Identifier::CAS_BUS, "CAS_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"},
{StringMapper::Identifier::REFP2B, "REFP2B"},
{StringMapper::Identifier::PRESB, "PRESB"},
{StringMapper::Identifier::RFMAB, "RFMAB"},
{StringMapper::Identifier::REFSB, "REFSB"},
{StringMapper::Identifier::RFMSB, "RFMSB"},
};
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},
{"RAS_BUS", StringMapper::Identifier::RAS_BUS},
{"CAS_BUS", StringMapper::Identifier::CAS_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},
{"REFP2B", StringMapper::Identifier::REFP2B},
{"PRESB", StringMapper::Identifier::PRESB},
{"RFMAB", StringMapper::Identifier::RFMAB},
{"REFSB", StringMapper::Identifier::REFSB},
{"RFMSB", StringMapper::Identifier::RFMSB},
};
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::RAS_BUS
|| id == StringMapper::Identifier::CAS_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,107 @@
/*
* 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
*/
#pragma once
#include <map>
#include "QStringComparator.h"
class StringMapper {
public:
enum Identifier {
None,
CMD_BUS,
RAS_BUS,
CAS_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,
REFP2B,
PRESB,
RFMAB,
REFSB,
RFMSB
};
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

@@ -0,0 +1,67 @@
/*
* 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
*/
#pragma once
#include <algorithm>
#include <vector>
#include <map>
#include <QString>
#include <QJsonDocument>
#include <QJsonValue>
#include <QJsonArray>
#include <QJsonObject>
#include "businessObjects/phases/phasedependency.h"
#include "timedependency.h"
struct PhaseTimeDependencies {
explicit PhaseTimeDependencies(std::initializer_list<TimeDependency> d) : dependencies(d) {}
std::vector<TimeDependency> dependencies;
size_t maxTime;
};
typedef std::map<StringMapper, PhaseTimeDependencies> DependencyMap;
struct DBDependencyEntry {
size_t delayedPhaseID;
QString delayedPhaseName;
QString dependencyType;
QString timeDependency;
size_t dependencyPhaseID;
QString dependencyPhaseName;
};

View File

@@ -0,0 +1,69 @@
/*
* 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
*/
#pragma once
#include <QString>
#include <memory>
#include "StringMapper.h"
class DBPhaseEntryBase;
#define PASSFUNCTIONDECL (const std::shared_ptr<DBPhaseEntryBase> thisPhase, const std::shared_ptr<DBPhaseEntryBase> otherPhase)
struct PassFunction {
using Fn = std::function<bool PASSFUNCTIONDECL>;
PassFunction(Fn passFunction) : mPassFn{std::move(passFunction)} {}
bool execute PASSFUNCTIONDECL { return mPassFn(thisPhase, otherPhase); }
Fn mPassFn;
};
class TimeDependency {
public:
TimeDependency() = default;
TimeDependency(size_t timeValue, QString phaseDep, DependencyType depType,
QString timeDepName, std::shared_ptr<PassFunction> pass=nullptr)
: timeValue{timeValue}, phaseDep{phaseDep}, depType{depType},
timeDepName{timeDepName}, passFunction{pass} {}
size_t timeValue;
StringMapper phaseDep;
DependencyType depType;
QString timeDepName;
std::shared_ptr<PassFunction> passFunction;
bool isPool() { return phaseDep.isPool(); }
};

View File

@@ -0,0 +1,87 @@
/*
* 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 "configurationBase.h"
const uint ConfigurationBase::getClk() const {
if (!mDeviceDeps)
throw std::invalid_argument("Invalid DRAMTimeDependenciesBase object in 'ConfigurationBase::getClk'.");
return mDeviceDeps->getClk();
}
DependencyMap ConfigurationBase::getDependencies(std::vector<QString>& commands) const {
if (!mDeviceDeps)
throw std::invalid_argument("Invalid DRAMTimeDependenciesBase object in 'ConfigurationBase::getDependencies'.");
return mDeviceDeps->getDependencies(commands);
}
PoolControllerMap ConfigurationBase::getPools() const {
if (!mDeviceDeps)
throw std::invalid_argument("Invalid DRAMTimeDependenciesBase object in 'ConfigurationBase::getAWPools'.");
return mDeviceDeps->getPools();
}
const QString ConfigurationBase::getDeviceName(const TraceDB& tdb) {
return mGetMemspec(tdb)["memoryType"].toString();
}
const uint ConfigurationBase::mGetClk(const TraceDB& tdb) {
QSqlDatabase db = tdb.getDatabase();
QString query = "SELECT clk FROM GeneralInfo";
QSqlQuery sqlQuery = db.exec(query);
sqlQuery.next();
uint clock = sqlQuery.value(0).toLongLong();
sqlQuery.finish();
return clock;
}
const QJsonObject ConfigurationBase::mGetMemspec(const TraceDB& tdb) {
QSqlDatabase db = tdb.getDatabase();
QString query = "SELECT Memspec FROM GeneralInfo";
QSqlQuery sqlQuery = db.exec(query);
sqlQuery.next();
QString memSpecJson = sqlQuery.value(0).toString();
sqlQuery.finish();
QJsonDocument jsonDocument = QJsonDocument::fromJson(memSpecJson.toUtf8());
return jsonDocument.object()["memspec"].toObject();
}

View File

@@ -0,0 +1,66 @@
/*
* 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
*/
#pragma once
#include <QSqlQuery>
#include "businessObjects/dramTimeDependencies/deviceDependencies/dramtimedependenciesbase.h"
#include "businessObjects/dramTimeDependencies/dbEntries/dbphaseentryBase.h"
class ConfigurationBase {
public:
ConfigurationBase() {};
virtual ~ConfigurationBase() = default;
virtual QString getQueryStr(const std::vector<QString>& commands) const = 0;
virtual std::shared_ptr<DBPhaseEntryBase> makePhaseEntry(const QSqlQuery&) const = 0;
// Delegated methods
const uint getClk() const;
DependencyMap getDependencies(std::vector<QString>& commands) const;
PoolControllerMap getPools() const;
static const QString getDeviceName(const TraceDB& tdb);
protected:
std::shared_ptr<DRAMTimeDependenciesBase> mDeviceDeps = nullptr;
static const uint mGetClk(const TraceDB& tdb);
static const QJsonObject mGetMemspec(const TraceDB& tdb);
QSqlQuery mExecuteQuery(const QString& queryStr);
};

View File

@@ -0,0 +1,122 @@
/*
* 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 "configurationfactory.h"
std::shared_ptr<ConfigurationBase> ConfigurationFactory::make(const TraceDB& tdb) {
const QString deviceName = ConfigurationBase::getDeviceName(tdb);
if (deviceName == "DDR3") {
return std::make_shared<DDR3Configuration>(tdb);
} else if (deviceName == "DDR4") {
return std::make_shared<DDR4Configuration>(tdb);
} else if (deviceName == "HBM2") {
return std::make_shared<HBM2Configuration>(tdb);
} else if (deviceName == "LPDDR4") {
return std::make_shared<LPDDR4Configuration>(tdb);
} else if (deviceName == "DDR5") {
return std::make_shared<DDR5Configuration>(tdb);
} else if (deviceName == "LPDDR5") {
return std::make_shared<LPDDR5Configuration>(tdb);
} else {
// TODO maybe throw?
throw std::invalid_argument("Could not find the device type '" + deviceName.toStdString() + '\'');
}
}
const std::vector<QString> ConfigurationFactory::possiblePhases(const TraceDB& tdb) {
const QString deviceName = ConfigurationBase::getDeviceName(tdb);
if (deviceName == "DDR3") {
// return DDR3TimeDependencies::getPossiblePhases();
return TimeDependenciesInfoDDR3::getPossiblePhases();
} else if (deviceName == "DDR4") {
return TimeDependenciesInfoDDR4::getPossiblePhases();
} else if (deviceName == "HBM2") {
return TimeDependenciesInfoHBM2::getPossiblePhases();
} else if (deviceName == "LPDDR4") {
return TimeDependenciesInfoLPDDR4::getPossiblePhases();
} else if (deviceName == "DDR5") {
return TimeDependenciesInfoDDR5::getPossiblePhases();
} else if (deviceName == "LPDDR5") {
return TimeDependenciesInfoLPDDR5::getPossiblePhases();
} else {
// TODO maybe throw?
// throw std::invalid_argument("Could not find the device type '" + deviceName.toStdString() + '\'');
return {""};
}
}
bool ConfigurationFactory::deviceSupported(const TraceDB& tdb) {
uint clk; // Not used
const QString deviceName = ConfigurationBase::getDeviceName(tdb);
if (deviceName == "DDR3") {
return true;
} else if (deviceName == "DDR4") {
return true;
} else if (deviceName == "HBM2") {
return true;
} else if (deviceName == "LPDDR4") {
return true;
} else if (deviceName == "DDR5") {
return true;
} else if (deviceName == "LPDDR5") {
return true;
} else {
return false;
}
}

View File

@@ -0,0 +1,62 @@
/*
* 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
*/
#pragma once
#include <memory>
#include "configurationBase.h"
#include "specialized/DDR3Configuration.h"
#include "specialized/DDR4Configuration.h"
#include "specialized/HBM2Configuration.h"
#include "specialized/LPDDR4Configuration.h"
#include "specialized/DDR5Configuration.h"
#include "specialized/LPDDR5Configuration.h"
#include "data/tracedb.h"
class ConfigurationFactory {
public:
static std::shared_ptr<ConfigurationBase> make(const TraceDB& tdb);
static const std::vector<QString> possiblePhases(const TraceDB& tdb);
static bool deviceSupported(const TraceDB& tdb);
private:
ConfigurationFactory() = delete;
~ConfigurationFactory() = delete;
};

View File

@@ -0,0 +1,61 @@
/*
* 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 "DDR3Configuration.h"
DDR3Configuration::DDR3Configuration(const TraceDB& tdb) {
// mDeviceDeps = std::make_shared<DDR3TimeDependencies>(std::forward<const QJsonObject>(mGetMemspec(tdb)), mGetClk(tdb));
mDeviceDeps = std::make_shared<TimeDependenciesInfoDDR3>(std::forward<const QJsonObject>(mGetMemspec(tdb)), mGetClk(tdb));
}
QString DDR3Configuration::getQueryStr(const std::vector<QString>& commands) const
{
QString queryStr = "SELECT Phases.ID, Phases.PhaseName, Phases.PhaseBegin, Phases.PhaseEnd, Phases.Transact, Phases.Bank, Phases.Rank "
" FROM Phases "
" WHERE PhaseName IN (";
for (const auto& cmd : commands) {
queryStr = queryStr + '\"' + cmd + "\",";
}
queryStr.back() = ')';
queryStr += " ORDER BY PhaseBegin; ";
return queryStr;
}
std::shared_ptr<DBPhaseEntryBase> DDR3Configuration::makePhaseEntry(const QSqlQuery& query) const {
return std::make_shared<DDR3DBPhaseEntry>(query);
}

View File

@@ -0,0 +1,50 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/configurations/configurationBase.h"
// #include "businessObjects/dramTimeDependencies/deviceDependencies/specialized/DDR3TimeDependencies.h"
#include "businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoDDR3.h"
#include "businessObjects/dramTimeDependencies/dbEntries/specialized/DDR3dbphaseentry.h"
class DDR3Configuration : public ConfigurationBase {
public:
DDR3Configuration(const TraceDB& tdb);
QString getQueryStr(const std::vector<QString>& commands) const override;
std::shared_ptr<DBPhaseEntryBase> makePhaseEntry(const QSqlQuery&) const override;
};

View File

@@ -0,0 +1,60 @@
/*
* 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 "DDR4Configuration.h"
DDR4Configuration::DDR4Configuration(const TraceDB& tdb)
{
mDeviceDeps = std::make_shared<TimeDependenciesInfoDDR4>(std::forward<const QJsonObject>(mGetMemspec(tdb)), mGetClk(tdb));
}
QString DDR4Configuration::getQueryStr(const std::vector<QString>& commands) const
{
QString queryStr = "SELECT Phases.ID, Phases.PhaseName, Phases.PhaseBegin, Phases.PhaseEnd, Phases.Transact, Phases.Bank, Phases.Bankgroup, Phases.Rank "
" FROM Phases "
" WHERE PhaseName IN (";
for (const auto& cmd : commands) {
queryStr = queryStr + '\"' + cmd + "\",";
}
queryStr.back() = ')';
queryStr += " ORDER BY PhaseBegin; ";
return queryStr;
}
std::shared_ptr<DBPhaseEntryBase> DDR4Configuration::makePhaseEntry(const QSqlQuery& query) const {
return std::make_shared<DDR4DBPhaseEntry>(query);
}

View File

@@ -0,0 +1,49 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/configurations/configurationBase.h"
#include "businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoDDR4.h"
#include "businessObjects/dramTimeDependencies/dbEntries/specialized/DDR4dbphaseentry.h"
class DDR4Configuration : public ConfigurationBase {
public:
DDR4Configuration(const TraceDB& tdb);
QString getQueryStr(const std::vector<QString>& commands) const override;
std::shared_ptr<DBPhaseEntryBase> makePhaseEntry(const QSqlQuery&) const override;
};

View File

@@ -0,0 +1,67 @@
/*
* 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 "DDR5Configuration.h"
#include <memory>
DDR5Configuration::DDR5Configuration(const TraceDB& tdb) {
mDeviceDeps = std::make_shared<TimeDependenciesInfoDDR5>(std::forward<const QJsonObject>(mGetMemspec(tdb)), mGetClk(tdb));
}
QString DDR5Configuration::getQueryStr(const std::vector<QString>& commands) const
{
QString queryStr = "SELECT Phases.ID, Phases.PhaseName, Phases.PhaseBegin, Phases.PhaseEnd, Phases.Transact, Phases.Bank, Phases.Bankgroup, Phases.Rank, Phases.BurstLength "
" FROM Phases "
" WHERE PhaseName IN (";
for (const auto& cmd : commands) {
queryStr = queryStr + '\"' + cmd + "\",";
}
queryStr.back() = ')';
queryStr += " ORDER BY PhaseBegin; ";
return queryStr;
}
std::shared_ptr<DBPhaseEntryBase> DDR5Configuration::makePhaseEntry(const QSqlQuery& query) const {
auto phase = std::make_shared<DDR5DBPhaseEntry>(query);
auto device = std::dynamic_pointer_cast<TimeDependenciesInfoDDR5>(mDeviceDeps);
device->rankIDToRankIDs(phase->tRank, phase->tLogicalRank, phase->tPhysicalRank, phase->tDIMMRank);
device->bankIDToBankInGroup(phase->tLogicalRank, phase->tBank, phase->tBankInGroup);
return phase;
}

View File

@@ -0,0 +1,49 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/configurations/configurationBase.h"
#include "businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoDDR5.h"
#include "businessObjects/dramTimeDependencies/dbEntries/specialized/DDR5dbphaseentry.h"
class DDR5Configuration : public ConfigurationBase {
public:
DDR5Configuration(const TraceDB& tdb);
QString getQueryStr(const std::vector<QString>& commands) const override;
std::shared_ptr<DBPhaseEntryBase> makePhaseEntry(const QSqlQuery&) const override;
};

View File

@@ -0,0 +1,60 @@
/*
* 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 "HBM2Configuration.h"
HBM2Configuration::HBM2Configuration(const TraceDB& tdb) {
mDeviceDeps = std::make_shared<TimeDependenciesInfoHBM2>(std::forward<const QJsonObject>(mGetMemspec(tdb)), mGetClk(tdb));
}
QString HBM2Configuration::getQueryStr(const std::vector<QString>& commands) const
{
QString queryStr = "SELECT Phases.ID, Phases.PhaseName, Phases.PhaseBegin, Phases.PhaseEnd, Phases.Transact, Phases.Bank, Phases.Bankgroup, Phases.Rank "
" FROM Phases "
" WHERE PhaseName IN (";
for (const auto& cmd : commands) {
queryStr = queryStr + '\"' + cmd + "\",";
}
queryStr.back() = ')';
queryStr += " ORDER BY PhaseBegin; ";
return queryStr;
}
std::shared_ptr<DBPhaseEntryBase> HBM2Configuration::makePhaseEntry(const QSqlQuery& query) const {
return std::make_shared<HBM2DBPhaseEntry>(query);
}

View File

@@ -0,0 +1,49 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/configurations/configurationBase.h"
#include "businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoHBM2.h"
#include "businessObjects/dramTimeDependencies/dbEntries/specialized/HBM2dbphaseentry.h"
class HBM2Configuration : public ConfigurationBase {
public:
HBM2Configuration(const TraceDB& tdb);
QString getQueryStr(const std::vector<QString>& commands) const override;
std::shared_ptr<DBPhaseEntryBase> makePhaseEntry(const QSqlQuery&) const override;
};

View File

@@ -0,0 +1,61 @@
/*
* 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 "LPDDR4Configuration.h"
LPDDR4Configuration::LPDDR4Configuration(const TraceDB& tdb) {
// mDeviceDeps = std::make_shared<LPDDR4TimeDependencies>(std::forward<const QJsonObject>(mGetMemspec(tdb)), mGetClk(tdb));
mDeviceDeps = std::make_shared<TimeDependenciesInfoLPDDR4>(std::forward<const QJsonObject>(mGetMemspec(tdb)), mGetClk(tdb));
}
QString LPDDR4Configuration::getQueryStr(const std::vector<QString>& commands) const
{
QString queryStr = "SELECT Phases.ID, Phases.PhaseName, Phases.PhaseBegin, Phases.PhaseEnd, Phases.Transact, Phases.Bank, Phases.Rank "
" FROM Phases "
" WHERE PhaseName IN (";
for (const auto& cmd : commands) {
queryStr = queryStr + '\"' + cmd + "\",";
}
queryStr.back() = ')';
queryStr += " ORDER BY PhaseBegin; ";
return queryStr;
}
std::shared_ptr<DBPhaseEntryBase> LPDDR4Configuration::makePhaseEntry(const QSqlQuery& query) const {
return std::make_shared<LPDDR4DBPhaseEntry>(query);
}

View File

@@ -0,0 +1,49 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/configurations/configurationBase.h"
#include "businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoLPDDR4.h"
#include "businessObjects/dramTimeDependencies/dbEntries/specialized/LPDDR4dbphaseentry.h"
class LPDDR4Configuration : public ConfigurationBase {
public:
LPDDR4Configuration(const TraceDB& tdb);
QString getQueryStr(const std::vector<QString>& commands) const override;
std::shared_ptr<DBPhaseEntryBase> makePhaseEntry(const QSqlQuery&) const override;
};

View File

@@ -0,0 +1,66 @@
/*
* 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 "LPDDR5Configuration.h"
#include <memory>
LPDDR5Configuration::LPDDR5Configuration(const TraceDB& tdb) {
mDeviceDeps = std::make_shared<TimeDependenciesInfoLPDDR5>(std::forward<const QJsonObject>(mGetMemspec(tdb)), mGetClk(tdb));
}
QString LPDDR5Configuration::getQueryStr(const std::vector<QString>& commands) const
{
QString queryStr = "SELECT Phases.ID, Phases.PhaseName, Phases.PhaseBegin, Phases.PhaseEnd, Phases.Transact, Phases.Bank, Phases.Bankgroup, Phases.Rank, Phases.BurstLength "
" FROM Phases "
" WHERE PhaseName IN (";
for (const auto& cmd : commands) {
queryStr = queryStr + '\"' + cmd + "\",";
}
queryStr.back() = ')';
queryStr += " ORDER BY PhaseBegin; ";
return queryStr;
}
std::shared_ptr<DBPhaseEntryBase> LPDDR5Configuration::makePhaseEntry(const QSqlQuery& query) const {
auto phase = std::make_shared<LPDDR5DBPhaseEntry>(query);
auto device = std::dynamic_pointer_cast<TimeDependenciesInfoLPDDR5>(mDeviceDeps);
phase->bankOffsetREFP2B = device->getPer2BankOffset();
return phase;
}

View File

@@ -0,0 +1,49 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/configurations/configurationBase.h"
#include "businessObjects/dramTimeDependencies/deviceDependencies/specialized/TimeDependenciesInfoLPDDR5.h"
#include "businessObjects/dramTimeDependencies/dbEntries/specialized/LPDDR5dbphaseentry.h"
class LPDDR5Configuration : public ConfigurationBase {
public:
LPDDR5Configuration(const TraceDB& tdb);
QString getQueryStr(const std::vector<QString>& commands) const override;
std::shared_ptr<DBPhaseEntryBase> makePhaseEntry(const QSqlQuery&) const override;
};

View File

@@ -0,0 +1,56 @@
/*
* 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
*/
#pragma once
#include <QSqlQuery>
#include "businessObjects/phases/phasedependency.h"
#include "businessObjects/dramTimeDependencies/common/common.h"
class DBPhaseEntryBase : public std::enable_shared_from_this<DBPhaseEntryBase>{
public:
DBPhaseEntryBase() = default;
virtual ~DBPhaseEntryBase() = default;
virtual bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) { return false; }
size_t id;
StringMapper phaseName;
size_t phaseBegin;
size_t phaseEnd;
size_t transact;
size_t tBank;
};

View File

@@ -0,0 +1,69 @@
/*
* 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 "DDR3dbphaseentry.h"
DDR3DBPhaseEntry::DDR3DBPhaseEntry(const QSqlQuery& query) {
id = query.value(0).toLongLong();
phaseName = StringMapper(query.value(1).toString());
phaseBegin = query.value(2).toLongLong();
phaseEnd = query.value(3).toLongLong();
transact = query.value(4).toLongLong();
tBank = query.value(5).toLongLong();
tRank = query.value(6).toLongLong();
}
bool DDR3DBPhaseEntry::potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) {
auto other = std::dynamic_pointer_cast<DDR3DBPhaseEntry>(otherPhase);
if (!other) return false;
bool isCmdPool = dep.phaseDep == StringMapper::Identifier::CMD_BUS;
bool const skipOnIntraBankAndDifferentBanks = {
dep.depType == DependencyType::IntraBank
&& tBank != other->tBank
};
bool const skipOnIntraRankAndDifferentRanks = {
dep.depType == DependencyType::IntraRank
&& tRank != other->tRank
};
bool const skipOnInterRankAndSameRank = {
dep.depType == DependencyType::InterRank
&& tRank == other->tRank
&& !isCmdPool
};
return !(skipOnIntraBankAndDifferentBanks || skipOnIntraRankAndDifferentRanks || skipOnInterRankAndSameRank);
}

View File

@@ -0,0 +1,47 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/dbEntries/dbphaseentryBase.h"
class DDR3DBPhaseEntry : public DBPhaseEntryBase {
public:
DDR3DBPhaseEntry(const QSqlQuery&);
size_t tRank;
bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) override;
};

View File

@@ -0,0 +1,79 @@
/*
* 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 "DDR4dbphaseentry.h"
DDR4DBPhaseEntry::DDR4DBPhaseEntry(const QSqlQuery& query) {
id = query.value(0).toLongLong();
phaseName = StringMapper(query.value(1).toString());
phaseBegin = query.value(2).toLongLong();
phaseEnd = query.value(3).toLongLong();
transact = query.value(4).toLongLong();
tBank = query.value(5).toLongLong();
tBankgroup = query.value(6).toLongLong();
tRank = query.value(7).toLongLong();
}
bool DDR4DBPhaseEntry::potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) {
auto other = std::dynamic_pointer_cast<DDR4DBPhaseEntry>(otherPhase);
if (!other) return false;
bool isCmdPool = dep.phaseDep == StringMapper::Identifier::CMD_BUS;
bool const skipOnIntraBankAndDifferentBanks = {
dep.depType == DependencyType::IntraBank
&& tBank != other->tBank
};
bool const skipOnIntraBankgroupAndDifferentBankgroup = {
dep.depType == DependencyType::IntraBankGroup
&& tBankgroup != other->tBankgroup
};
bool const skipOnIntraRankAndDifferentRanks = {
dep.depType == DependencyType::IntraRank
&& tRank != other->tRank
};
bool const skipOnInterRankAndSameRank = {
dep.depType == DependencyType::InterRank
&& tRank == other->tRank
&& !isCmdPool
};
return !(
skipOnIntraBankAndDifferentBanks
|| skipOnIntraBankgroupAndDifferentBankgroup
|| skipOnIntraRankAndDifferentRanks
|| skipOnInterRankAndSameRank
);
}

View File

@@ -0,0 +1,48 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/dbEntries/dbphaseentryBase.h"
class DDR4DBPhaseEntry : public DBPhaseEntryBase {
public:
DDR4DBPhaseEntry(const QSqlQuery&);
size_t tBankgroup;
size_t tRank;
bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) override;
};

View File

@@ -0,0 +1,98 @@
/*
* 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 "DDR5dbphaseentry.h"
DDR5DBPhaseEntry::DDR5DBPhaseEntry(const QSqlQuery& query) {
id = query.value(0).toLongLong();
phaseName = StringMapper(query.value(1).toString());
phaseBegin = query.value(2).toLongLong();
phaseEnd = query.value(3).toLongLong();
transact = query.value(4).toLongLong();
tBank = query.value(5).toLongLong();
tBankgroup = query.value(6).toLongLong();
tRank = query.value(7).toLongLong();
tBurstLength = query.value(8).toLongLong();
}
bool DDR5DBPhaseEntry::potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) {
auto other = std::dynamic_pointer_cast<DDR5DBPhaseEntry>(otherPhase);
if (!other) return false;
if (dep.passFunction && !dep.passFunction->execute(shared_from_this(), other)) return false;
bool isCmdPool = dep.phaseDep == StringMapper::Identifier::CMD_BUS;
bool const skipOnIntraBankAndDifferentBanks = {
dep.depType == DependencyType::IntraBank
&& tBank != other->tBank
};
bool const skipOnIntraBankgroupAndDifferentBankgroup = {
dep.depType == DependencyType::IntraBankGroup
&& tBankgroup != other->tBankgroup
};
bool const skipOnIntraBankInGroupAndDifferentBankInGroup = {
dep.depType == DependencyType::IntraBankInGroup
&& tBankInGroup != other->tBankInGroup
};
bool const skipOnIntraLogRankAndDifferentRanks = {
dep.depType == DependencyType::IntraLogicalRank
&& tLogicalRank != other->tLogicalRank
};
bool const skipOnIntraPhysRankAndDifferentRanks = {
dep.depType == DependencyType::IntraPhysicalRank
&& tPhysicalRank != other->tPhysicalRank
};
bool const skipOnIntraDIMMRankAndDifferentRanks = {
dep.depType == DependencyType::IntraDIMMRank
&& tDIMMRank != other->tDIMMRank
};
bool const skipOnInterDIMMRankAndSameRank = {
dep.depType == DependencyType::InterDIMMRank
&& tDIMMRank == other->tDIMMRank
&& !isCmdPool
};
return !(
skipOnIntraBankAndDifferentBanks
|| skipOnIntraBankgroupAndDifferentBankgroup
|| skipOnIntraBankInGroupAndDifferentBankInGroup
|| skipOnIntraLogRankAndDifferentRanks
|| skipOnIntraPhysRankAndDifferentRanks
|| skipOnIntraDIMMRankAndDifferentRanks
|| skipOnInterDIMMRankAndSameRank
);
}

View File

@@ -0,0 +1,54 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/dbEntries/dbphaseentryBase.h"
class DDR5DBPhaseEntry : public DBPhaseEntryBase {
public:
DDR5DBPhaseEntry(const QSqlQuery&);
size_t tBankgroup;
size_t tBankInGroup;
size_t tRank;
size_t tBurstLength;
size_t tLogicalRank;
size_t tPhysicalRank;
size_t tDIMMRank;
bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) override;
};

View File

@@ -0,0 +1,79 @@
/*
* 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 "HBM2dbphaseentry.h"
HBM2DBPhaseEntry::HBM2DBPhaseEntry(const QSqlQuery& query) {
id = query.value(0).toLongLong();
phaseName = StringMapper(query.value(1).toString());
phaseBegin = query.value(2).toLongLong();
phaseEnd = query.value(3).toLongLong();
transact = query.value(4).toLongLong();
tBank = query.value(5).toLongLong();
tBankgroup = query.value(6).toLongLong();
tRank = query.value(7).toLongLong();
}
bool HBM2DBPhaseEntry::potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) {
auto other = std::dynamic_pointer_cast<HBM2DBPhaseEntry>(otherPhase);
if (!other) return false;
bool isCmdPool = dep.phaseDep == StringMapper::Identifier::CMD_BUS;
bool const skipOnIntraBankAndDifferentBanks = {
dep.depType == DependencyType::IntraBank
&& tBank != other->tBank
};
bool const skipOnIntraBankgroupAndDifferentBankgroup = {
dep.depType == DependencyType::IntraBankGroup
&& tBankgroup != other->tBankgroup
};
bool const skipOnIntraRankAndDifferentRanks = {
dep.depType == DependencyType::IntraRank
&& tRank != other->tRank
};
bool const skipOnInterRankAndSameRank = {
dep.depType == DependencyType::InterRank
&& tRank == other->tRank
&& !isCmdPool
};
return !(
skipOnIntraBankAndDifferentBanks
|| skipOnIntraBankgroupAndDifferentBankgroup
|| skipOnIntraRankAndDifferentRanks
|| skipOnInterRankAndSameRank
);
}

View File

@@ -0,0 +1,48 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/dbEntries/dbphaseentryBase.h"
class HBM2DBPhaseEntry : public DBPhaseEntryBase {
public:
HBM2DBPhaseEntry(const QSqlQuery&);
size_t tBankgroup;
size_t tRank;
bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) override;
};

View File

@@ -0,0 +1,69 @@
/*
* 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 "LPDDR4dbphaseentry.h"
LPDDR4DBPhaseEntry::LPDDR4DBPhaseEntry(const QSqlQuery& query) {
id = query.value(0).toLongLong();
phaseName = StringMapper(query.value(1).toString());
phaseBegin = query.value(2).toLongLong();
phaseEnd = query.value(3).toLongLong();
transact = query.value(4).toLongLong();
tBank = query.value(5).toLongLong();
tRank = query.value(6).toLongLong();
}
bool LPDDR4DBPhaseEntry::potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) {
auto other = std::dynamic_pointer_cast<LPDDR4DBPhaseEntry>(otherPhase);
if (!other) return false;
bool isCmdPool = dep.phaseDep == StringMapper::Identifier::CMD_BUS;
bool const skipOnIntraBankAndDifferentBanks = {
dep.depType == DependencyType::IntraBank
&& tBank != other->tBank
};
bool const skipOnIntraRankAndDifferentRanks = {
dep.depType == DependencyType::IntraRank
&& tRank != other->tRank
};
bool const skipOnInterRankAndSameRank = {
dep.depType == DependencyType::InterRank
&& tRank == other->tRank
&& !isCmdPool
};
return !(skipOnIntraBankAndDifferentBanks || skipOnIntraRankAndDifferentRanks || skipOnInterRankAndSameRank);
}

View File

@@ -0,0 +1,48 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/dbEntries/dbphaseentryBase.h"
class LPDDR4DBPhaseEntry : public DBPhaseEntryBase {
public:
LPDDR4DBPhaseEntry(const QSqlQuery&);
size_t tRank;
bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) override;
};

View File

@@ -0,0 +1,100 @@
/*
* 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 "LPDDR5dbphaseentry.h"
LPDDR5DBPhaseEntry::LPDDR5DBPhaseEntry(const QSqlQuery& query) {
id = query.value(0).toLongLong();
phaseName = StringMapper(query.value(1).toString());
phaseBegin = query.value(2).toLongLong();
phaseEnd = query.value(3).toLongLong();
transact = query.value(4).toLongLong();
tBank = query.value(5).toLongLong();
tBankgroup = query.value(6).toLongLong();
tRank = query.value(7).toLongLong();
tBurstLength = query.value(8).toLongLong();
}
bool LPDDR5DBPhaseEntry::potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) {
auto other = std::dynamic_pointer_cast<LPDDR5DBPhaseEntry>(otherPhase);
if (!other) return false;
if (dep.passFunction && !dep.passFunction->execute(shared_from_this(), other)) return false;
bool isCmdPool = dep.phaseDep == StringMapper::Identifier::CMD_BUS;
bool thisIsREFP2B = phaseName == StringMapper::Identifier::REFP2B;
bool otherIsREFP2B = dep.phaseDep == StringMapper::Identifier::REFP2B;
bool const skipOnIntraBankAndNoBankDep = {
dep.depType == DependencyType::IntraBank
&&
(
( // If phase is not REFP2B or both are REFP2B, intra bank dependency must occur in the same bank
(!thisIsREFP2B || (thisIsREFP2B && otherIsREFP2B))
&& tBank != other->tBank
)
||
( // If phase is REFP2B, "intra bank" dependency must occur in the same bank or in the offset bank
(thisIsREFP2B && !otherIsREFP2B)
&&
(
tBank != other->tBank
&& tBank != (other->tBank - bankOffsetREFP2B)
)
)
)
};
bool const skipOnIntraBankgroupAndDifferentBankgroup = {
dep.depType == DependencyType::IntraBankGroup
&& tBankgroup != other->tBankgroup
};
bool const skipOnIntraRankAndDifferentRanks = {
dep.depType == DependencyType::IntraRank
&& tRank != other->tRank
};
bool const skipOnInterRankAndSameRank = {
dep.depType == DependencyType::InterRank
&& tRank == other->tRank
&& !isCmdPool
};
return !(
skipOnIntraBankAndNoBankDep
|| skipOnIntraBankgroupAndDifferentBankgroup
|| skipOnIntraRankAndDifferentRanks
|| skipOnInterRankAndSameRank
);
}

View File

@@ -0,0 +1,50 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/dbEntries/dbphaseentryBase.h"
class LPDDR5DBPhaseEntry : public DBPhaseEntryBase {
public:
LPDDR5DBPhaseEntry(const QSqlQuery&);
size_t tBankgroup;
size_t tRank;
size_t tBurstLength;
size_t bankOffsetREFP2B;
bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryBase> otherPhase) override;
};

View File

@@ -0,0 +1,174 @@
/*
* 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 "dramtimedependenciesbase.h"
#include <QJsonDocument>
DRAMTimeDependenciesBase::DRAMTimeDependenciesBase(const QJsonObject& memspec, const uint inTCK) {
mMemspecJson = memspec;
tCK = inTCK;
}
DependencyMap
DRAMTimeDependenciesBase::getDependencies(std::vector<QString>& dependencyFilter) const {
DependencyMap dependenciesMap;
std::vector<StringMapper> dependencyFilterStrMapper(dependencyFilter.begin(), dependencyFilter.end());
std::sort(
dependencyFilterStrMapper.begin(),
dependencyFilterStrMapper.end()
);
dependenciesMap = mSpecializedGetDependencies();
mFilterDependencyMap(dependenciesMap, dependencyFilterStrMapper);
auto it = dependenciesMap.begin();
while (it != dependenciesMap.end()) {
mFilterDependencyList(it->second.dependencies, dependencyFilterStrMapper);
it->second.maxTime = mFindVectorMaximum(it->second.dependencies);
++it;
}
return dependenciesMap;
}
PoolControllerMap DRAMTimeDependenciesBase::getPools() const {
return PoolControllerMap(mPools);
}
void DRAMTimeDependenciesBase::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,
// although the lists are not to be greater than 20-50 elements
std::copy_if(
dependencyList.begin(),
dependencyList.end(),
newDepList.begin(),
[ dependencyFilter ](const TimeDependency& dep) {
auto it = std::lower_bound(
dependencyFilter.begin(),
dependencyFilter.end(),
dep.phaseDep,
[](const StringMapper& cmd, const StringMapper& depName){
return depName.isPool() || cmd < depName;
}
);
if (dep.phaseDep.isPool() || it != dependencyFilter.end() && *it == dep.phaseDep)
return true;
return false;
}
);
newDepList.shrink_to_fit();
dependencyList = newDepList;
std::sort(
dependencyList.begin(),
dependencyList.end(),
[](const TimeDependency& v1, const TimeDependency& v2) {
return v1.timeValue < v2.timeValue;
}
);
}
void DRAMTimeDependenciesBase::mFilterDependencyMap(DependencyMap& dependencyMap, const std::vector<StringMapper>& dependencyFilter) const {
if (!dependencyMap.empty()) {
auto itFilter = dependencyFilter.begin();
auto itFilterLast = std::lower_bound(
dependencyFilter.begin(),
dependencyFilter.end(),
dependencyMap.rbegin()->first
);
auto itDependencyMap = dependencyMap.begin();
while (true) {
auto pair = std::mismatch(
itFilter,
itFilterLast,
itDependencyMap,
[](const StringMapper& cmd, const std::pair<StringMapper, PhaseTimeDependencies>& vpair) {
return cmd == vpair.first;
}
);
if (pair.first == dependencyFilter.end() || pair.second == dependencyMap.end()) {
dependencyMap.erase(pair.second, dependencyMap.end());
break;
} else if (*(pair.first) < pair.second->first) {
++(pair.first);
} else if (*(pair.first) == pair.second->first) {
++(pair.second);
} else {
pair.second = dependencyMap.erase(pair.second);
}
itFilter = pair.first;
itDependencyMap = pair.second;
}
}
}
uint DRAMTimeDependenciesBase::mFindVectorMaximum(const std::vector<TimeDependency>& dependencyList) const {
auto maxElement = std::max_element(
dependencyList.begin(),
dependencyList.end(),
[](const TimeDependency& dep1, const TimeDependency& dep2) {
return dep1.timeValue < dep2.timeValue;
}
);
if (maxElement == dependencyList.end()) return 0;
return maxElement->timeValue;
}

View File

@@ -0,0 +1,71 @@
/*
* 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
*/
#pragma once
#include "data/tracedb.h"
#include "businessObjects/dramTimeDependencies/common/common.h"
#include "poolcontrollermap.h"
class DRAMTimeDependenciesBase {
public:
DRAMTimeDependenciesBase(const QJsonObject& memspec, const uint tCK);
virtual ~DRAMTimeDependenciesBase() = default;
DependencyMap getDependencies(std::vector<QString>& dependencyFilter) const;
const uint getClk() const { return tCK; }
PoolControllerMap getPools() const;
protected:
void mFilterDependencyList(std::vector<TimeDependency>& dependencyList, const std::vector<StringMapper>& dependencyFilter) const;
void mFilterDependencyMap(DependencyMap& dependencyMap, const std::vector<StringMapper>& dependencyFilter) const;
uint mFindVectorMaximum(const std::vector<TimeDependency>& dependencyList) const;
protected:
QJsonObject mMemspecJson;
// To be implemented by the specializing class
protected:
virtual void mInitializeValues() {} ;
virtual DependencyMap mSpecializedGetDependencies() const { DependencyMap map; return map; } ;
uint tCK = 0;
std::map<StringMapper, PoolController> mPools;
};

View File

@@ -0,0 +1,97 @@
/*
* 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 "poolcontroller.h"
#include <algorithm>
PoolController::PoolController(const uint poolSize, const std::vector<PoolEntry>& dependencies)
: mDependencies(mAuxSortInput(dependencies))
{
mPoolSize = poolSize;
}
void PoolController::clear() {
mPool.clear();
mCount = 0;
}
void PoolController::push(DBDependencyEntry dep) {
mPool.push_back(dep);
mCount++;
}
void PoolController::increment() {
mCount++;
}
void PoolController::merge(std::vector<DBDependencyEntry>& depEntries) {
if(mCount >= mPoolSize) {
depEntries.insert( depEntries.end(), mPool.begin(), mPool.end() );
}
}
uint PoolController::getBusyTime(const StringMapper& phaseName) {
PoolEntry v{phaseName, 0};
auto entryIt = std::lower_bound(
mDependencies.begin(),
mDependencies.end(),
v,
[](const PoolEntry& e1, const PoolEntry& e2) {
return e1.first < e2.first;
}
);
if (entryIt->first == phaseName) {
return entryIt->second;
} else {
return 0;
}
}
std::vector<PoolEntry> PoolController::mAuxSortInput(std::vector<PoolEntry> vec) {
std::sort(
vec.begin(),
vec.end(),
[](const PoolEntry& e1, const PoolEntry& e2) {
return e1.first < e2.first;
}
);
return vec;
}

View File

@@ -0,0 +1,63 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/common/common.h"
typedef std::pair<StringMapper, uint> PoolEntry;
class PoolController {
public:
PoolController(const uint poolSize, const std::vector<PoolEntry>& dependencies);
~PoolController() = default;
void clear();
void push(DBDependencyEntry);
void increment();
void merge(std::vector<DBDependencyEntry>& depEntries);
size_t count() { return mCount; }
uint getBusyTime(const StringMapper& phaseName);
protected:
const std::vector<PoolEntry> mDependencies;
std::vector<DBDependencyEntry> mPool;
uint mCount = 0;
uint mPoolSize = 0;
protected:
static std::vector<PoolEntry> mAuxSortInput(std::vector<PoolEntry> vec);
};

View File

@@ -0,0 +1,97 @@
/*
* 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 "poolcontrollermap.h"
PoolControllerMap::PoolControllerMap(const std::map<StringMapper, PoolController>& pools) {
mPools = pools;
}
void PoolControllerMap::clear() {
for (auto& p : mPools) {
p.second.clear();
}
}
void PoolControllerMap::push(const StringMapper& poolName, DBDependencyEntry dep) {
auto pool = mPools.find(poolName);
if (pool != mPools.end()) {
pool->second.push(dep);
} else {
// TODO throw?
}
}
void PoolControllerMap::increment(const StringMapper& poolName) {
auto pool = mPools.find(poolName);
if (pool != mPools.end()) {
pool->second.increment();
} else {
// TODO throw?
}
}
void PoolControllerMap::merge(std::vector<DBDependencyEntry>& depEntries) {
for (auto& p : mPools) {
p.second.merge(depEntries);
}
}
uint PoolControllerMap::getBusyTime(const StringMapper& poolName, const StringMapper& phaseName) {
auto pool = mPools.find(poolName);
if (pool != mPools.end()) {
return pool->second.getBusyTime(phaseName);
} else {
// TODO throw?
return 0;
}
}
size_t PoolControllerMap::count(const StringMapper& poolName) {
auto pool = mPools.find(poolName);
if (pool != mPools.end()) {
return pool->second.count();
} else {
// TODO throw?
return 0;
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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
*/
#pragma once
#include "poolcontroller.h"
class PoolControllerMap {
public:
PoolControllerMap(const std::map<StringMapper, PoolController>& pools);
~PoolControllerMap() = default;
void clear();
void push(const StringMapper& poolName, DBDependencyEntry);
void increment(const StringMapper& poolName);
void merge(std::vector<DBDependencyEntry>& depEntries);
size_t count(const StringMapper& poolName);
uint getBusyTime(const StringMapper& poolName, const StringMapper& phaseName);
protected:
std::map<StringMapper, PoolController> mPools;
};

View File

@@ -0,0 +1,372 @@
/*
* 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;
}

View File

@@ -0,0 +1,92 @@
/*
* 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
*/
#pragma once
#include "businessObjects/dramTimeDependencies/deviceDependencies/dramtimedependenciesbase.h"
class DDR3TimeDependencies final : public DRAMTimeDependenciesBase {
public:
DDR3TimeDependencies(const QJsonObject& memspec, const uint tCK);
static const std::vector<QString> getPossiblePhases();
protected:
void mInitializeValues() override;
DependencyMap mSpecializedGetDependencies() const override;
protected:
uint burstLength;
uint dataRate;
uint tRP;
uint tRAS;
uint tRC;
uint tRTP;
uint tRRD;
uint tCCD;
uint tRCD;
uint tFAW;
uint tRL;
uint tWL;
uint tWR;
uint tWTR;
uint tCKESR;
uint tCKE;
uint tXP;
uint tXPDLL;
uint tXS;
uint tXSDLL;
uint tAL;
uint tRFC;
uint tREFI;
uint tRTRS;
uint tACTPDEN;
uint tPRPDEN;
uint tREFPDEN;
uint tPD;
uint tBURST;
uint tRDWR;
uint tRDWR_R;
uint tWRRD;
uint tWRRD_R;
uint tWRPRE;
uint tRDPDEN;
uint tWRPDEN;
uint tWRAPDEN;
};

View File

@@ -0,0 +1,387 @@
/*
* 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 "TimeDependenciesInfoDDR3.h"
using namespace std;
TimeDependenciesInfoDDR3::TimeDependenciesInfoDDR3(const QJsonObject& memspec, const uint tCK) : DRAMTimeDependenciesBase(memspec, tCK) {
mInitializeValues();
}
void TimeDependenciesInfoDDR3::mInitializeValues() {
burstLength = mMemspecJson["memarchitecturespec"].toObject()["burstLength"].toInt();
dataRate = mMemspecJson["memarchitecturespec"].toObject()["dataRate"].toInt();
tCCD = tCK * mMemspecJson["memtimingspec"].toObject()["CCD"].toInt();
tRCD = tCK * mMemspecJson["memtimingspec"].toObject()["RCD"].toInt();
tRP = tCK * mMemspecJson["memtimingspec"].toObject()["RP"].toInt();
tRAS = tCK * mMemspecJson["memtimingspec"].toObject()["RAS"].toInt();
tCL = tCK * mMemspecJson["memtimingspec"].toObject()["CL"].toInt();
tCWL = tCK * mMemspecJson["memtimingspec"].toObject()["CWL"].toInt();
tAL = tCK * mMemspecJson["memtimingspec"].toObject()["AL"].toInt();
tRL = tCK * mMemspecJson["memtimingspec"].toObject()["RL"].toInt();
tWL = tCK * mMemspecJson["memtimingspec"].toObject()["WL"].toInt();
tRTP = tCK * mMemspecJson["memtimingspec"].toObject()["RTP"].toInt();
tWTR = tCK * mMemspecJson["memtimingspec"].toObject()["WTR"].toInt();
tRRD = tCK * mMemspecJson["memtimingspec"].toObject()["RRD"].toInt();
tWR = tCK * mMemspecJson["memtimingspec"].toObject()["WR"].toInt();
tFAW = tCK * mMemspecJson["memtimingspec"].toObject()["FAW"].toInt();
tRFC = tCK * mMemspecJson["memtimingspec"].toObject()["RFC"].toInt();
tRC = tCK * mMemspecJson["memtimingspec"].toObject()["RC"].toInt();
tXP = tCK * mMemspecJson["memtimingspec"].toObject()["XP"].toInt();
tXS = tCK * mMemspecJson["memtimingspec"].toObject()["XS"].toInt();
tXSDLL = tCK * mMemspecJson["memtimingspec"].toObject()["XSDLL"].toInt();
tCKE = tCK * mMemspecJson["memtimingspec"].toObject()["CKE"].toInt();
tCKESR = tCK * mMemspecJson["memtimingspec"].toObject()["CKESR"].toInt();
tREFPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["REFPDEN"].toInt();
tACTPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["ACTPDEN"].toInt();
tPRPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["PRPDEN"].toInt();
tRTRS = tCK * mMemspecJson["memtimingspec"].toObject()["RTRS"].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 - tAL;
tWRPRE = tWL + tBURST + tWR;
tWRRD_R = tWL + tBURST + tRTRS - tRL;
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 std::vector<QString> TimeDependenciesInfoDDR3::getPossiblePhases() {
return {
"ACT",
"RD",
"WR",
"PREPB",
"RDA",
"WRA",
"REFAB",
"PREAB",
"PDEP",
"PDXP",
"SREFEN",
"SREFEX",
"PDEA",
"PDXA",
};
}
DependencyMap TimeDependenciesInfoDDR3::mSpecializedGetDependencies() const {
DependencyMap dmap;
dmap.emplace(
piecewise_construct,
forward_as_tuple("ACT"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC, "ACT", DependencyType::IntraBank, "tRC"},
{tRRD, "ACT", DependencyType::IntraRank, "tRRD"},
{tAL + tRTP + tRP, "RDA", DependencyType::IntraBank, "tAL + tRTP + tRP"},
{tWRPRE + tRP, "WRA", DependencyType::IntraBank, "tWRPRE + tRP"},
{tRP, "PREPB", DependencyType::IntraBank, "tRP"},
{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, "CommandBus"},
{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::IntraBank, "tCCD"},
{tCCD, "RD", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "RD", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD, "RDA", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{tWRRD, "WR", DependencyType::IntraBank, "tWRRD"},
{tWRRD, "WR", DependencyType::IntraRank, "tWRRD"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD, "WRA", DependencyType::IntraRank, "tWRRD"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WR"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tRDWR, "RD", DependencyType::IntraBank, "tRDWR"},
{tRDWR, "RD", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RD", DependencyType::InterRank, "tRDWR_R"},
{tRDWR, "RDA", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tCCD, "WR", DependencyType::IntraBank, "tCCD"},
{tCCD, "WR", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD, "WRA", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RDA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tCCD, "RD", DependencyType::IntraBank, "tCCD"},
{tCCD, "RD", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "RD", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD, "RDA", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{max({tWRRD, tWRPRE - tRTP - tAL}), "WR", DependencyType::IntraBank, "max(tWRRD, tWRPRE - tRTP - tAL)"},
{tWRRD, "WR", DependencyType::IntraRank, "tWRRD"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD, "WRA", DependencyType::IntraRank, "tWRRD"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WRA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tRDWR, "RD", DependencyType::IntraBank, "tRDWR"},
{tRDWR, "RD", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RD", DependencyType::InterRank, "tRDWR_R"},
{tRDWR, "RDA", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tCCD, "WR", DependencyType::IntraBank, "tCCD"},
{tCCD, "WR", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD, "WRA", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXP"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEP", DependencyType::IntraRank, "tPD"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SREFEX"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tCKESR, "SREFEN", DependencyType::IntraRank, "tCKESR"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEA", DependencyType::IntraRank, "tPD"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
return dmap;
}

View File

@@ -0,0 +1,91 @@
/*
* 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
*/
#pragma once
#include "../dramtimedependenciesbase.h"
class TimeDependenciesInfoDDR3 final : public DRAMTimeDependenciesBase {
public:
TimeDependenciesInfoDDR3(const QJsonObject& memspec, const uint clk);
static const std::vector<QString> getPossiblePhases();
protected:
void mInitializeValues() override;
DependencyMap mSpecializedGetDependencies() const override;
protected:
uint burstLength;
uint dataRate;
uint tCCD;
uint tRCD;
uint tRP;
uint tRAS;
uint tCL;
uint tCWL;
uint tAL;
uint tRL;
uint tWL;
uint tRTP;
uint tWTR;
uint tRRD;
uint tWR;
uint tFAW;
uint tRFC;
uint tRC;
uint tXP;
uint tXS;
uint tXSDLL;
uint tCKE;
uint tCKESR;
uint tPD;
uint tREFPDEN;
uint tACTPDEN;
uint tPRPDEN;
uint tRTRS;
uint tBURST;
uint tRDWR;
uint tRDWR_R;
uint tWRRD;
uint tWRPRE;
uint tWRRD_R;
uint tRDPDEN;
uint tWRPDEN;
uint tWRAPDEN;
};

View File

@@ -0,0 +1,420 @@
/*
* 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 "TimeDependenciesInfoDDR4.h"
using namespace std;
TimeDependenciesInfoDDR4::TimeDependenciesInfoDDR4(const QJsonObject& memspec, const uint tCK) : DRAMTimeDependenciesBase(memspec, tCK) {
mInitializeValues();
}
void TimeDependenciesInfoDDR4::mInitializeValues() {
burstLength = mMemspecJson["memarchitecturespec"].toObject()["burstLength"].toInt();
dataRate = mMemspecJson["memarchitecturespec"].toObject()["dataRate"].toInt();
tRCD = tCK * mMemspecJson["memtimingspec"].toObject()["RCD"].toInt();
tRP = tCK * mMemspecJson["memtimingspec"].toObject()["RP"].toInt();
tRAS = tCK * mMemspecJson["memtimingspec"].toObject()["RAS"].toInt();
tRC = tCK * mMemspecJson["memtimingspec"].toObject()["RC"].toInt();
tCL = tCK * mMemspecJson["memtimingspec"].toObject()["CL"].toInt();
tCWL = tCK * mMemspecJson["memtimingspec"].toObject()["CWL"].toInt();
tAL = tCK * mMemspecJson["memtimingspec"].toObject()["AL"].toInt();
tRL = tCK * mMemspecJson["memtimingspec"].toObject()["RL"].toInt();
tRPRE = tCK * mMemspecJson["memtimingspec"].toObject()["RPRE"].toInt();
tWPRE = tCK * mMemspecJson["memtimingspec"].toObject()["WPRE"].toInt();
tWL = tCK * mMemspecJson["memtimingspec"].toObject()["WL"].toInt();
tCCD_S = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_S"].toInt();
tCCD_L = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_L"].toInt();
tRRD_S = tCK * mMemspecJson["memtimingspec"].toObject()["RRD_S"].toInt();
tRRD_L = tCK * mMemspecJson["memtimingspec"].toObject()["RRD_L"].toInt();
tFAW = tCK * mMemspecJson["memtimingspec"].toObject()["FAW"].toInt();
tWTR_S = tCK * mMemspecJson["memtimingspec"].toObject()["WTR_S"].toInt();
tWTR_L = tCK * mMemspecJson["memtimingspec"].toObject()["WTR_L"].toInt();
tRTP = tCK * mMemspecJson["memtimingspec"].toObject()["RTP"].toInt();
tWR = tCK * mMemspecJson["memtimingspec"].toObject()["WR"].toInt();
tXS = tCK * mMemspecJson["memtimingspec"].toObject()["XS"].toInt();
tXSDLL = tCK * mMemspecJson["memtimingspec"].toObject()["XSDLL"].toInt();
tXP = tCK * mMemspecJson["memtimingspec"].toObject()["XP"].toInt();
tCKE = tCK * mMemspecJson["memtimingspec"].toObject()["CKE"].toInt();
tCKESR = tCK * mMemspecJson["memtimingspec"].toObject()["CKESR"].toInt();
tACTPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["ACTPDEN"].toInt();
tPRPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["PRPDEN"].toInt();
tREFPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["REFPDEN"].toInt();
tRTRS = tCK * mMemspecJson["memtimingspec"].toObject()["RTRS"].toInt();
tPD = tCKE;
tRFC = tCK * (
(mMemspecJson["memtimingspec"].toObject()["REFM"].toInt() == 4) ?
(mMemspecJson["memtimingspec"].toObject()["RFC4"].toInt(1)) :
(
(mMemspecJson["memtimingspec"].toObject()["REFM"].toInt() == 2) ?
(mMemspecJson["memtimingspec"].toObject()["RFC2"].toInt(1)) :
(mMemspecJson["memtimingspec"].toObject()["RFC"].toInt(1))
)
);
tBURST = (uint) (burstLength / (float) dataRate) * tCK;
tRDWR = tRL + tBURST + tCK - tWL + tWPRE;
tRDWR_R = tRL + tBURST + tRTRS - tWL + tWPRE;
tWRRD_S = tWL + tBURST + tWTR_S - tAL;
tWRRD_L = tWL + tBURST + tWTR_L - tAL;
tWRRD_R = tWL + tBURST + tRTRS - tRL + tRPRE;
tRDAACT = tAL + tRTP + tRP;
tWRPRE = tWL + tBURST + tWR;
tWRAACT = tWRPRE + tRP;
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 std::vector<QString> TimeDependenciesInfoDDR4::getPossiblePhases() {
return {
"ACT",
"RD",
"WR",
"PREPB",
"RDA",
"WRA",
"REFAB",
"PREAB",
"PDEP",
"PDXP",
"SREFEN",
"SREFEX",
"PDEA",
"PDXA",
};
}
DependencyMap TimeDependenciesInfoDDR4::mSpecializedGetDependencies() const {
DependencyMap dmap;
dmap.emplace(
piecewise_construct,
forward_as_tuple("ACT"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC, "ACT", DependencyType::IntraBank, "tRC"},
{tRRD_L, "ACT", DependencyType::IntraBankGroup, "tRRD_L"},
{tRRD_S, "ACT", DependencyType::IntraRank, "tRRD_S"},
{tRDAACT, "RDA", DependencyType::IntraBank, "tRDAACT"},
{tWRAACT, "WRA", DependencyType::IntraBank, "tWRAACT"},
{tRP, "PREPB", DependencyType::IntraBank, "tRP"},
{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, "CommandBus"},
{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_L, "RD", DependencyType::IntraBank, "tCCD_L"}, //
{tCCD_L, "RD", DependencyType::IntraBankGroup, "tCCD_L"},
{tCCD_S, "RD", DependencyType::IntraRank, "tCCD_S"},
{tBURST + tRTRS, "RD", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD_L, "RDA", DependencyType::IntraBankGroup, "tCCD_L"},
{tCCD_S, "RDA", DependencyType::IntraRank, "tCCD_S"},
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{tWRRD_L, "WR", DependencyType::IntraBank, "tWRRD_L"}, //
{tWRRD_L, "WR", DependencyType::IntraBankGroup, "tWRRD_L"},
{tWRRD_S, "WR", DependencyType::IntraRank, "tWRRD_S"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD_L, "WRA", DependencyType::IntraBankGroup, "tWRRD_L"},
{tWRRD_S, "WRA", DependencyType::IntraRank, "tWRRD_S"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WR"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tRDWR, "RD", DependencyType::IntraBank, "tRDWR"}, //
{tRDWR, "RD", DependencyType::IntraBankGroup, "tRDWR"}, //
{tRDWR, "RD", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RD", DependencyType::InterRank, "tRDWR_R"},
{tRDWR, "RDA", DependencyType::IntraBankGroup, "tRDWR"}, //
{tRDWR, "RDA", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tCCD_L, "WR", DependencyType::IntraBank, "tCCD_L"}, //
{tCCD_L, "WR", DependencyType::IntraBankGroup, "tCCD_L"},
{tCCD_S, "WR", DependencyType::IntraRank, "tCCD_S"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD_L, "WRA", DependencyType::IntraBankGroup, "tCCD_L"},
{tCCD_S, "WRA", DependencyType::IntraRank, "tCCD_S"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RDA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tCCD_L, "RD", DependencyType::IntraBank, "tCCD_L"},
{tCCD_L, "RD", DependencyType::IntraBankGroup, "tCCD_L"},
{tCCD_S, "RD", DependencyType::IntraRank, "tCCD_S"},
{tBURST + tRTRS, "RD", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD_L, "RDA", DependencyType::IntraBankGroup, "tCCD_L"},
{tCCD_S, "RDA", DependencyType::IntraRank, "tCCD_S"},
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{max({tWRRD_L, tWRPRE - tRTP - tAL}), "WR", DependencyType::IntraBank, "max(tWRRD_L, tWRPRE - tRTP - tAL)"},
{tWRRD_L, "WR", DependencyType::IntraBankGroup, "tWRRD_L"},
{tWRRD_S, "WR", DependencyType::IntraRank, "tWRRD_S"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD_L, "WRA", DependencyType::IntraBankGroup, "tWRRD_L"},
{tWRRD_S, "WRA", DependencyType::IntraRank, "tWRRD_S"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WRA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD - tAL, "ACT", DependencyType::IntraBank, "tRCD - tAL"},
{tRDWR, "RD", DependencyType::IntraBank, "tRDWR"},
{tRDWR, "RD", DependencyType::IntraBankGroup, "tRDWR"},
{tRDWR, "RD", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RD", DependencyType::InterRank, "tRDWR_R"},
{tRDWR, "RDA", DependencyType::IntraBankGroup, "tRDWR"},
{tRDWR, "RDA", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tCCD_L, "WR", DependencyType::IntraBank, "tCCD_L"},
{tCCD_L, "WR", DependencyType::IntraBankGroup, "tCCD_L"},
{tCCD_S, "WR", DependencyType::IntraRank, "tCCD_S"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD_L, "WRA", DependencyType::IntraBankGroup, "tCCD_L"},
{tCCD_S, "WRA", DependencyType::IntraRank, "tCCD_S"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXSDLL, "SREFEX", DependencyType::IntraRank, "tXSDLL"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC, "ACT", DependencyType::IntraRank, "tRC"},
{tRDAACT, "RDA", DependencyType::IntraRank, "tRDAACT"},
{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, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXP"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEP", DependencyType::IntraRank, "tPD"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SREFEX"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tCKESR, "SREFEN", DependencyType::IntraRank, "tCKESR"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEA", DependencyType::IntraRank, "tPD"},
{tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
return dmap;
}

View File

@@ -0,0 +1,99 @@
/*
* 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
*/
#pragma once
#include "../dramtimedependenciesbase.h"
class TimeDependenciesInfoDDR4 final : public DRAMTimeDependenciesBase {
public:
TimeDependenciesInfoDDR4(const QJsonObject& memspec, const uint clk);
static const std::vector<QString> getPossiblePhases();
protected:
void mInitializeValues() override;
DependencyMap mSpecializedGetDependencies() const override;
protected:
uint burstLength;
uint dataRate;
uint tRCD;
uint tRP;
uint tRAS;
uint tRC;
uint tCL;
uint tCWL;
uint tAL;
uint tRL;
uint tRPRE;
uint tWPRE;
uint tWL;
uint tCCD_S;
uint tCCD_L;
uint tRRD_S;
uint tRRD_L;
uint tFAW;
uint tWTR_S;
uint tWTR_L;
uint tRTP;
uint tWR;
uint tRFC;
uint tXS;
uint tXSDLL;
uint tXP;
uint tCKE;
uint tCKESR;
uint tPD;
uint tACTPDEN;
uint tPRPDEN;
uint tREFPDEN;
uint tRTRS;
uint tBURST;
uint tRDWR;
uint tRDWR_R;
uint tWRRD_S;
uint tWRRD_L;
uint tWRRD_R;
uint tRDAACT;
uint tWRPRE;
uint tWRAACT;
uint tRDPDEN;
uint tWRPDEN;
uint tWRAPDEN;
};

View File

@@ -0,0 +1,666 @@
/*
* 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 "TimeDependenciesInfoDDR5.h"
#include <cmath>
using namespace std;
TimeDependenciesInfoDDR5::TimeDependenciesInfoDDR5(const QJsonObject& memspec, const uint tCK) : DRAMTimeDependenciesBase(memspec, tCK) {
mInitializeValues();
}
void TimeDependenciesInfoDDR5::rankIDToRankIDs(size_t rankID, size_t& dimmRID, size_t& physRID, size_t& logRID) const {
logRID = rankID;
physRID = logRID / mNumLogicalRanksPerPhysicalRank;
dimmRID = physRID / mNumPhysicalRanksPerDIMMRank;
}
void TimeDependenciesInfoDDR5::bankIDToBankInGroup(size_t logicalRankID, size_t bankID, size_t& bankInGroup) const {
bankInGroup = logicalRankID * mNumBanksPerGroup + bankID % mNumBanksPerGroup;
}
void TimeDependenciesInfoDDR5::mInitializeValues() {
mNumOfRanks = mMemspecJson["memarchitecturespec"].toObject()["nbrOfRanks"].toInt();
mNumOfDIMMRanks = mMemspecJson["memarchitecturespec"].toObject()["nbrOfDIMMRanks"].toInt();
mNumPhysicalRanksPerDIMMRank = mMemspecJson["memarchitecturespec"].toObject()["nbrOfPhysicalRanks"].toInt();
mNumLogicalRanksPerPhysicalRank = mMemspecJson["memarchitecturespec"].toObject()["nbrOfLogicalRanks"].toInt();
mNumBanksPerGroup = mMemspecJson["memarchitecturespec"].toObject()["nbrOfBanks"].toInt(1);
mNumBanksPerGroup /= mMemspecJson["memarchitecturespec"].toObject()["nbrOfBankGroups"].toInt(1);
burstLength = mMemspecJson["memarchitecturespec"].toObject()["burstLength"].toInt();
dataRate = mMemspecJson["memarchitecturespec"].toObject()["dataRate"].toInt();
refMode = mMemspecJson["memarchitecturespec"].toObject()["refMode"].toInt();
cmdMode = mMemspecJson["memarchitecturespec"].toObject()["cmdMode"].toInt();
bitWidth = mMemspecJson["memarchitecturespec"].toObject()["width"].toInt();
tRCD = tCK * mMemspecJson["memtimingspec"].toObject()["RCD"].toInt();
tPPD = tCK * mMemspecJson["memtimingspec"].toObject()["PPD"].toInt();
tRP = tCK * mMemspecJson["memtimingspec"].toObject()["RP"].toInt();
tRAS = tCK * mMemspecJson["memtimingspec"].toObject()["RAS"].toInt();
tRL = tCK * mMemspecJson["memtimingspec"].toObject()["RL"].toInt();
RBL = tCK * mMemspecJson["memtimingspec"].toObject()["BL"].toInt();
tRTP = tCK * mMemspecJson["memtimingspec"].toObject()["RTP"].toInt();
tRPRE = tCK * mMemspecJson["memtimingspec"].toObject()["RPRE"].toInt();
tRPST = tCK * mMemspecJson["memtimingspec"].toObject()["RPST"].toInt();
tRDDQS = tCK * mMemspecJson["memtimingspec"].toObject()["RDDQS"].toInt();
tWL = tCK * mMemspecJson["memtimingspec"].toObject()["WL"].toInt();
WBL = tCK * mMemspecJson["memtimingspec"].toObject()["BL"].toInt();
tWPRE = tCK * mMemspecJson["memtimingspec"].toObject()["WPRE"].toInt();
tWPST = tCK * mMemspecJson["memtimingspec"].toObject()["WPST"].toInt();
tWR = tCK * mMemspecJson["memtimingspec"].toObject()["WR"].toInt();
tCCD_L_slr = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_L_slr"].toInt();
tCCD_L_WR_slr = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_L_WR_slr"].toInt();
tCCD_L_WR2_slr = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_L_WR2_slr"].toInt();
tCCD_S_slr = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_S_slr"].toInt();
tCCD_S_WR_slr = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_S_WR_slr"].toInt();
tCCD_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_dlr"].toInt();
tCCD_WR_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_WR_dlr"].toInt();
tCCD_WR_dpr = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_WR_dpr"].toInt();
tRRD_S_slr = tCK * mMemspecJson["memtimingspec"].toObject()["RRD_S_slr"].toInt();
tRRD_L_slr = tCK * mMemspecJson["memtimingspec"].toObject()["RRD_L_slr"].toInt();
tRRD_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["RRD_dlr"].toInt();
tFAW_slr = tCK * mMemspecJson["memtimingspec"].toObject()["FAW_slr"].toInt();
tFAW_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["FAW_dlr"].toInt();
tWTR_L = tCK * mMemspecJson["memtimingspec"].toObject()["WTR_L"].toInt();
tWTR_S = tCK * mMemspecJson["memtimingspec"].toObject()["WTR_S"].toInt();
tRFC_slr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC_slr"].toInt();
tRFC_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC_dlr"].toInt();
tRFC_dpr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC_dpr"].toInt();
tRFCsb_slr = tCK * mMemspecJson["memtimingspec"].toObject()["RFCsb_slr"].toInt();
tRFCsb_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["RFCsb_dlr"].toInt();
tREFI = tCK * mMemspecJson["memtimingspec"].toObject()["REFI"].toInt();
tREFSBRD_slr = tCK * mMemspecJson["memtimingspec"].toObject()["REFSBRD_slr"].toInt();
tREFSBRD_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["REFSBRD_dlr"].toInt();
tRTRS = tCK * mMemspecJson["memtimingspec"].toObject()["RTRS"].toInt();
UNKNOWN = tCK * mMemspecJson["memtimingspec"].toObject()["NKNOWN"].toInt();
tCPDED = tCK * mMemspecJson["memtimingspec"].toObject()["CPDED"].toInt();
tPD = tCK * mMemspecJson["memtimingspec"].toObject()["PD"].toInt();
tXP = tCK * mMemspecJson["memtimingspec"].toObject()["XP"].toInt();
tACTPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["ACTPDEN"].toInt();
tPRPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["PRPDEN"].toInt();
tREFPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["REFPDEN"].toInt();
tRC = tRAS + tRP;
if (refMode == 1) {
tRFC_slr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC1_slr"].toInt();
tRFC_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC1_dlr"].toInt();
tRFC_dpr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC1_dpr"].toInt();
tREFI = tCK * mMemspecJson["memtimingspec"].toObject()["REFI1"].toInt();
} else {
tRFC_slr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC2_slr"].toInt();
tRFC_dlr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC2_dlr"].toInt();
tRFC_dpr = tCK * mMemspecJson["memtimingspec"].toObject()["RFC2_dpr"].toInt();
tREFI = tCK * mMemspecJson["memtimingspec"].toObject()["REFI2"].toInt();
}
if (cmdMode == 2) {
shortCmdOffset = 1 * tCK;
longCmdOffset = 3 * tCK;
} else {
shortCmdOffset = 0 * tCK;
longCmdOffset = 1 * tCK;
}
cmdLengthDiff = tCK * mMemspecJson["memarchitecturespec"].toObject()["cmdMode"].toInt();
tBURST16 = 8 * tCK;
tBURST32 = 16 * tCK;
tRD_BURST = (uint) (RBL / (float) dataRate) * tCK;
tWR_BURST = (uint) (WBL / (float) dataRate) * tCK;
tWTRA = tWR - tRTP;
tWRRDA = tWL + tBURST16 + tWTRA;
tWRPRE = tWL + tBURST16 + tWR;
tRDAACT = tRTP + tRP;
tWRAACT = tWRPRE + tRP;
tCCD_L_RTW_slr = tRL - tWL + tBURST16 + 2 * tCK - tRDDQS + tRPST + tWPRE;
tCCD_S_RTW_slr = tRL - tWL + tBURST16 + 2 * tCK - tRDDQS + tRPST + tWPRE;
tCCD_RTW_dlr = tRL - tWL + tBURST16 + 2 * tCK - tRDDQS + tRPST + tWPRE;
tRDRD_dpr = tRD_BURST + tRTRS;
tRDRD_ddr = tRD_BURST + tRTRS;
tRDWR_dpr = tRL - tWL + tRD_BURST + tRTRS - tRDDQS + tRPST + tWPRE;
tRDWR_ddr = tRL - tWL + tRD_BURST + tRTRS - tRDDQS + tRPST + tWPRE;
tCCD_L_WTR_slr = tWL + tBURST16 + tWTR_L;
tCCD_S_WTR_slr = tWL + tBURST16 + tWTR_S;
tCCD_WTR_dlr = tWL + tBURST16 + tWTR_S;
tWRWR_dpr = max(tCCD_WR_dpr, tBURST16 + tRTRS);
tWRWR_ddr = tBURST16 + tRTRS;
tWRRD_dpr = tWL - tRL + tBURST16 + tRTRS + tRDDQS + tWPST + tRPRE;
tWRRD_ddr = tWL - tRL + tBURST16 + tRTRS + tRDDQS + tWPST + tRPRE;
tRDPDEN = tRL + tBURST16 + cmdLengthDiff;
tWRPDEN = tWL + tBURST16 + tWR + cmdLengthDiff;
tWRAPDEN = tWL + tBURST16 + tWR + cmdLengthDiff;
mPools.insert({
"CMD_BUS", {
1, {
{"ACT", 2 * tCK},
{"RD", 2 * tCK},
{"WR", 2 * tCK},
{"RDA", 2 * tCK},
{"WRA", 2 * tCK},
{"PREPB", tCK},
{"PREAB", tCK},
{"REFAB", tCK},
{"PRESB", tCK},
{"RFMAB", tCK},
{"REFSB", tCK},
{"RFMSB", tCK},
}
}
});
mPools.insert({
"FAW_LOGICAL", {
4, {
{"ACT", tFAW_slr - longCmdOffset},
{"REFSB", tFAW_slr - shortCmdOffset},
{"RFMSB", tFAW_slr - shortCmdOffset},
}
}
});
mPools.insert({
"FAW_PHYSICAL", {
4, {
{"ACT", tFAW_dlr - longCmdOffset},
{"REFSB", tFAW_dlr - shortCmdOffset},
{"RFMSB", tFAW_dlr - shortCmdOffset},
}
}
});
}
const std::vector<QString> TimeDependenciesInfoDDR5::getPossiblePhases() {
return {
"ACT",
"RD",
"WR",
"PRESB",
"PREPB",
"RDA",
"WRA",
"RFMAB",
"REFSB",
"RFMSB",
"REFAB",
"PREAB",
"PDEP",
"PDXP",
"SREFEN",
"SREFEX",
"PDEA",
"PDXA",
};
}
DependencyMap TimeDependenciesInfoDDR5::mSpecializedGetDependencies() const {
DependencyMap dmap;
auto passBurstLength16 = std::make_shared<PassFunction>(
[] PASSFUNCTIONDECL {
auto other = std::dynamic_pointer_cast<DDR5DBPhaseEntry>(otherPhase);
if (!other) return false;
return other->tBurstLength == 16;
}
);
auto passBurstLength32 = std::make_shared<PassFunction>(
[] PASSFUNCTIONDECL {
auto other = std::dynamic_pointer_cast<DDR5DBPhaseEntry>(otherPhase);
if (!other) return false;
return other->tBurstLength == 32;
}
);
const auto localBitWidth = bitWidth;
auto passThisBL16AndBW4 = std::make_shared<PassFunction>(
[localBitWidth] PASSFUNCTIONDECL {
auto thisP = std::dynamic_pointer_cast<DDR5DBPhaseEntry>(thisPhase);
if (!thisP) return false;
return thisP->tBurstLength == 16 && localBitWidth == 4;
}
);
auto passOtherBL32ThisBL16BW4 = std::make_shared<PassFunction>(
[passBurstLength32, passThisBL16AndBW4] PASSFUNCTIONDECL {
return passBurstLength32->execute(thisPhase, otherPhase) && passThisBL16AndBW4->execute(thisPhase, otherPhase);
}
);
auto passOtherBL32ThisNotBL16BW4 = std::make_shared<PassFunction>(
[passBurstLength32, passThisBL16AndBW4] PASSFUNCTIONDECL {
return passBurstLength32->execute(thisPhase, otherPhase) && !passThisBL16AndBW4->execute(thisPhase, otherPhase);
}
);
auto passOtherBL16ThisBL16BW4 = std::make_shared<PassFunction>(
[passBurstLength16, passThisBL16AndBW4] PASSFUNCTIONDECL {
return passBurstLength16->execute(thisPhase, otherPhase) && passThisBL16AndBW4->execute(thisPhase, otherPhase);
}
);
auto passOtherBL16ThisNotBL16BW4 = std::make_shared<PassFunction>(
[passBurstLength16, passThisBL16AndBW4] PASSFUNCTIONDECL {
return passBurstLength16->execute(thisPhase, otherPhase) && !passThisBL16AndBW4->execute(thisPhase, otherPhase);
}
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("ACT"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC, "ACT", DependencyType::IntraBank, "tRC"},
{tRRD_L_slr, "ACT", DependencyType::IntraBankGroup, "tRRD_L_slr"},
{tRRD_S_slr, "ACT", DependencyType::IntraLogicalRank, "tRRD_S_slr"},
{tRRD_dlr, "ACT", DependencyType::IntraPhysicalRank, "tRRD_dlr"},
{tRDAACT, "RDA", DependencyType::IntraBank, "tRDAACT"},
{tWRAACT, "WRA", DependencyType::IntraBank, "tWRAACT", passBurstLength16},
{tWRAACT + tBURST16, "WRA", DependencyType::IntraBank, "tWRAACT + tBURST16", passBurstLength32},
{tRP - cmdLengthDiff, "PREPB", DependencyType::IntraBank, "tRP - tCK"},
{tRP - cmdLengthDiff, "PRESB", DependencyType::IntraBankInGroup, "tRP - tCK"},
{tRP - cmdLengthDiff, "PREAB", DependencyType::IntraLogicalRank, "tRP - tCK"},
{tRFC_slr - cmdLengthDiff, "REFAB", DependencyType::IntraLogicalRank, "tRFC_slr - tCK"},
{tRFC_slr - cmdLengthDiff, "RFMAB", DependencyType::IntraLogicalRank, "tRFC_slr - tCK"},
{tRFCsb_slr - cmdLengthDiff, "REFSB", DependencyType::IntraBankInGroup, "tRFCsb_slr - tCK"},
{tREFSBRD_slr - cmdLengthDiff, "REFSB", DependencyType::IntraLogicalRank, "tREFSBRD_slr - tCK"},
{tREFSBRD_dlr - cmdLengthDiff, "REFSB", DependencyType::IntraPhysicalRank, "tREFSBRD_dlr - tCK"},
{tRFCsb_slr - cmdLengthDiff, "RFMSB", DependencyType::IntraBankInGroup, "tRFCsb_slr - tCK"},
{tREFSBRD_slr - cmdLengthDiff, "RFMSB", DependencyType::IntraLogicalRank, "tREFSBRD_slr - tCK"},
{tREFSBRD_dlr - cmdLengthDiff, "RFMSB", DependencyType::IntraPhysicalRank, "tREFSBRD_dlr - tCK"},
{2 * tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
{tFAW_slr - longCmdOffset, "FAW_LOGICAL", DependencyType::IntraLogicalRank, "tFAW_slr"},
{tFAW_dlr - longCmdOffset, "FAW_PHYSICAL", DependencyType::IntraPhysicalRank, "tFAW_dlr"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RD"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD, "ACT", DependencyType::IntraBank, "tRCD"},
{tCCD_L_slr, "RD", DependencyType::IntraBankGroup, "tCCD_L_slr"},
{tCCD_S_slr, "RD", DependencyType::IntraLogicalRank, "tCCD_S_slr"},
{tCCD_dlr, "RD", DependencyType::IntraPhysicalRank, "tCCD_dlr", passBurstLength16},
{tBURST32, "RD", DependencyType::IntraPhysicalRank, "tBURST32", passBurstLength32},
{tRDRD_dpr, "RD", DependencyType::IntraDIMMRank, "tRDRD_dpr", passBurstLength16},
{tRDRD_dpr + tBURST16, "RD", DependencyType::IntraDIMMRank, "tRDRD_dpr + tBURST16", passBurstLength32},
{tRDRD_ddr, "RD", DependencyType::InterDIMMRank, "tRDRD_ddr", passBurstLength16},
{tRDRD_ddr + tBURST16, "RD", DependencyType::InterDIMMRank, "tRDRD_ddr + tBURST16", passBurstLength32},
{tCCD_L_slr, "RDA", DependencyType::IntraBankGroup, "tCCD_L_slr"},
{tCCD_S_slr, "RDA", DependencyType::IntraLogicalRank, "tCCD_S_slr"},
{tCCD_dlr, "RDA", DependencyType::IntraPhysicalRank, "tCCD_dlr", passBurstLength16},
{tBURST32, "RDA", DependencyType::IntraPhysicalRank, "tBURST32", passBurstLength32},
{tRDRD_dpr, "RDA", DependencyType::IntraDIMMRank, "tRDRD_dpr", passBurstLength16},
{tRDRD_dpr + tBURST16, "RDA", DependencyType::IntraDIMMRank, "tRDRD_dpr + tBURST16", passBurstLength32},
{tRDRD_ddr, "RDA", DependencyType::InterDIMMRank, "tRDRD_ddr", passBurstLength16},
{tRDRD_ddr + tBURST16, "RDA", DependencyType::InterDIMMRank, "tRDRD_ddr + tBURST16", passBurstLength32},
{tCCD_L_WTR_slr, "WR", DependencyType::IntraBankGroup, "tCCD_L_WTR_slr", passBurstLength16},
{tCCD_L_WTR_slr + tBURST16, "WR", DependencyType::IntraBankGroup, "tCCD_L_WTR_slr + tBURST16", passBurstLength32},
{tCCD_S_WTR_slr, "WR", DependencyType::IntraLogicalRank, "tCCD_S_WTR_slr", passBurstLength16},
{tCCD_S_WTR_slr + tBURST16, "WR", DependencyType::IntraLogicalRank, "tCCD_S_WTR_slr + tBURST16", passBurstLength32},
{tCCD_WTR_dlr, "WR", DependencyType::IntraPhysicalRank, "tCCD_WTR_dlr", passBurstLength16},
{tCCD_WTR_dlr + tBURST16, "WR", DependencyType::IntraPhysicalRank, "tCCD_WTR_dlr + tBURST16", passBurstLength32},
{tWRRD_dpr, "WR", DependencyType::IntraDIMMRank, "tWRRD_dpr", passBurstLength16},
{tWRRD_dpr + tBURST16, "WR", DependencyType::IntraDIMMRank, "tWRRD_dpr + tBURST16", passBurstLength32},
{tWRRD_ddr, "WR", DependencyType::InterDIMMRank, "tWRRD_ddr", passBurstLength16},
{tWRRD_ddr + tBURST16, "WR", DependencyType::InterDIMMRank, "tWRRD_ddr + tBURST16", passBurstLength32},
{tCCD_L_WTR_slr, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WTR_slr", passBurstLength16},
{tCCD_L_WTR_slr + tBURST16, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WTR_slr + tBURST16", passBurstLength32},
{tCCD_S_WTR_slr, "WRA", DependencyType::IntraLogicalRank, "tCCD_S_WTR_slr", passBurstLength16},
{tCCD_S_WTR_slr + tBURST16, "WRA", DependencyType::IntraLogicalRank, "tCCD_S_WTR_slr + tBURST16", passBurstLength32},
{tCCD_WTR_dlr, "WRA", DependencyType::IntraPhysicalRank, "tCCD_WTR_dlr", passBurstLength16},
{tCCD_WTR_dlr + tBURST16, "WRA", DependencyType::IntraPhysicalRank, "tCCD_WTR_dlr + tBURST16", passBurstLength32},
{tWRRD_dpr, "WRA", DependencyType::IntraDIMMRank, "tWRRD_dpr", passBurstLength16},
{tWRRD_dpr + tBURST16, "WRA", DependencyType::IntraDIMMRank, "tWRRD_dpr + tBURST16", passBurstLength32},
{tWRRD_ddr, "WRA", DependencyType::InterDIMMRank, "tWRRD_ddr", passBurstLength16},
{tWRRD_ddr + tBURST16, "WRA", DependencyType::InterDIMMRank, "tWRRD_ddr + tBURST16", passBurstLength32},
{2 * tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WR"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD, "ACT", DependencyType::IntraBank, "tRCD"},
{tCCD_L_RTW_slr, "RD", DependencyType::IntraBankGroup, "tCCD_L_RTW_slr", passBurstLength16},
{tCCD_L_RTW_slr + tBURST16, "RD", DependencyType::IntraBankGroup, "tCCD_L_RTW_slr + tBURST16", passBurstLength32},
{tCCD_S_RTW_slr, "RD", DependencyType::IntraLogicalRank, "tCCD_S_RTW_slr", passBurstLength16},
{tCCD_S_RTW_slr + tBURST16, "RD", DependencyType::IntraLogicalRank, "tCCD_S_RTW_slr + tBURST16", passBurstLength32},
{tCCD_RTW_dlr, "RD", DependencyType::IntraPhysicalRank, "tCCD_RTW_dlr", passBurstLength16},
{tCCD_RTW_dlr + tBURST16, "RD", DependencyType::IntraPhysicalRank, "tCCD_RTW_dlr + tBURST16", passBurstLength32},
{tRDWR_dpr, "RD", DependencyType::IntraDIMMRank, "tRDWR_dpr", passBurstLength16},
{tRDWR_dpr + tBURST16, "RD", DependencyType::IntraDIMMRank, "tRDWR_dpr + tBURST16", passBurstLength32},
{tRDWR_ddr, "RD", DependencyType::InterDIMMRank, "tRDWR_ddr", passBurstLength16},
{tRDWR_ddr + tBURST16, "RD", DependencyType::InterDIMMRank, "tRDWR_ddr + tBURST16", passBurstLength32},
{tCCD_L_RTW_slr, "RDA", DependencyType::IntraBankGroup, "tCCD_L_RTW_slr", passBurstLength16},
{tCCD_L_RTW_slr + tBURST16, "RDA", DependencyType::IntraBankGroup, "tCCD_L_RTW_slr + tBURST16", passBurstLength32},
{tCCD_S_RTW_slr, "RDA", DependencyType::IntraLogicalRank, "tCCD_S_RTW_slr", passBurstLength16},
{tCCD_S_RTW_slr + tBURST16, "RDA", DependencyType::IntraLogicalRank, "tCCD_S_RTW_slr + tBURST16", passBurstLength32},
{tCCD_RTW_dlr, "RDA", DependencyType::IntraPhysicalRank, "tCCD_RTW_dlr", passBurstLength16},
{tCCD_RTW_dlr + tBURST16, "RDA", DependencyType::IntraPhysicalRank, "tCCD_RTW_dlr + tBURST16", passBurstLength32},
{tRDWR_dpr, "RDA", DependencyType::IntraDIMMRank, "tRDWR_dpr", passBurstLength16},
{tRDWR_dpr + tBURST16, "RDA", DependencyType::IntraDIMMRank, "tRDWR_dpr + tBURST16", passBurstLength32},
{tRDWR_ddr, "RDA", DependencyType::InterDIMMRank, "tRDWR_ddr", passBurstLength16},
{tRDWR_ddr + tBURST16, "RDA", DependencyType::InterDIMMRank, "tRDWR_ddr + tBURST16", passBurstLength32},
{tCCD_L_WR_slr, "WR", DependencyType::IntraBankGroup, "tCCD_L_WR_slr", passOtherBL16ThisBL16BW4},
{tCCD_L_WR_slr + tBURST16, "WR", DependencyType::IntraBankGroup, "tCCD_L_WR_slr + tBURST16", passOtherBL32ThisBL16BW4},
{tCCD_L_WR2_slr, "WR", DependencyType::IntraBankGroup, "tCCD_L_WR2_slr", passOtherBL16ThisNotBL16BW4},
{tCCD_L_WR2_slr + tBURST16, "WR", DependencyType::IntraBankGroup, "tCCD_L_WR2_slr + tBURST16", passOtherBL32ThisNotBL16BW4},
{tCCD_S_WR_slr, "WR", DependencyType::IntraLogicalRank, "tCCD_S_WR_slr"},
{tCCD_WR_dlr, "WR", DependencyType::IntraPhysicalRank, "tCCD_WR_dlr", passBurstLength16},
{tBURST32, "WR", DependencyType::IntraPhysicalRank, "tBURST32", passBurstLength32},
{tWRWR_dpr, "WR", DependencyType::IntraDIMMRank, "tWRWR_dpr", passBurstLength16},
{tWRWR_dpr + tBURST16, "WR", DependencyType::IntraDIMMRank, "tWRWR_dpr + tBURST16", passBurstLength32},
{tWRWR_ddr, "WR", DependencyType::InterDIMMRank, "tWRWR_ddr", passBurstLength16},
{tWRWR_ddr + tBURST16, "WR", DependencyType::InterDIMMRank, "tWRWR_ddr + tBURST16", passBurstLength32},
{tCCD_L_WR_slr, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WR_slr", passOtherBL16ThisBL16BW4},
{tCCD_L_WR_slr + tBURST16, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WR_slr + tBURST16", passOtherBL32ThisBL16BW4},
{tCCD_L_WR2_slr, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WR2_slr", passOtherBL16ThisNotBL16BW4},
{tCCD_L_WR2_slr + tBURST16, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WR2_slr + tBURST16", passOtherBL32ThisNotBL16BW4},
{tCCD_S_WR_slr, "WRA", DependencyType::IntraLogicalRank, "tCCD_S_WR_slr"},
{tCCD_WR_dlr, "WRA", DependencyType::IntraPhysicalRank, "tCCD_WR_dlr", passBurstLength16},
{tBURST32, "WRA", DependencyType::IntraPhysicalRank, "tBURST32", passBurstLength32},
{tWRWR_dpr, "WRA", DependencyType::IntraDIMMRank, "tWRWR_dpr", passBurstLength16},
{tWRWR_dpr + tBURST16, "WRA", DependencyType::IntraDIMMRank, "tWRWR_dpr + tBURST16", passBurstLength32},
{tWRWR_ddr, "WRA", DependencyType::InterDIMMRank, "tWRWR_ddr", passBurstLength16},
{tWRWR_ddr + tBURST16, "WRA", DependencyType::InterDIMMRank, "tWRWR_ddr + tBURST16", passBurstLength32},
{2 * tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREPB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + cmdLengthDiff, "ACT", DependencyType::IntraBank, "tRAS + tCK"},
{tRTP + cmdLengthDiff, "RD", DependencyType::IntraBank, "tRTP + tCK"},
{tWRPRE + cmdLengthDiff, "WR", DependencyType::IntraBank, "tWRPRE + tCK", passBurstLength16},
{tWRPRE + cmdLengthDiff + tBURST16, "WR", DependencyType::IntraBank, "tWRPRE + tCK + tBURST16", passBurstLength32},
{tPPD, "PREPB", DependencyType::IntraPhysicalRank, "tPPD"},
{tPPD, "PREAB", DependencyType::IntraPhysicalRank, "tPPD"},
{tPPD, "PRESB", DependencyType::IntraPhysicalRank, "tPPD"},
{tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RDA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD, "ACT", DependencyType::IntraBank, "tRCD"},
{tCCD_L_slr, "RD", DependencyType::IntraBankGroup, "tCCD_L_slr"},
{tCCD_S_slr, "RD", DependencyType::IntraLogicalRank, "tCCD_S_slr"},
{tCCD_dlr, "RD", DependencyType::IntraPhysicalRank, "tCCD_dlr", passBurstLength16},
{tBURST32, "RD", DependencyType::IntraPhysicalRank, "tBURST32", passBurstLength32},
{tRDRD_dpr, "RD", DependencyType::IntraDIMMRank, "tRDRD_dpr", passBurstLength16},
{tRDRD_dpr + tBURST16, "RD", DependencyType::IntraDIMMRank, "tRDRD_dpr + tBURST16", passBurstLength32},
{tRDRD_ddr, "RD", DependencyType::InterDIMMRank, "tRDRD_ddr", passBurstLength16},
{tRDRD_ddr + tBURST16, "RD", DependencyType::InterDIMMRank, "tRDRD_ddr + tBURST16", passBurstLength32},
{tCCD_L_slr, "RDA", DependencyType::IntraBankGroup, "tCCD_L_slr"},
{tCCD_S_slr, "RDA", DependencyType::IntraLogicalRank, "tCCD_S_slr"},
{tCCD_dlr, "RDA", DependencyType::IntraPhysicalRank, "tCCD_dlr", passBurstLength16},
{tBURST32, "RDA", DependencyType::IntraPhysicalRank, "tBURST32", passBurstLength32},
{tRDRD_dpr, "RDA", DependencyType::IntraDIMMRank, "tRDRD_dpr", passBurstLength16},
{tRDRD_dpr + tBURST16, "RDA", DependencyType::IntraDIMMRank, "tRDRD_dpr + tBURST16", passBurstLength32},
{tRDRD_ddr, "RDA", DependencyType::InterDIMMRank, "tRDRD_ddr", passBurstLength16},
{tRDRD_ddr + tBURST16, "RDA", DependencyType::InterDIMMRank, "tRDRD_ddr + tBURST16", passBurstLength32},
{tWRRDA, "WR", DependencyType::IntraBank, "tWRRDA", passBurstLength16},
{tWRRDA + tBURST16, "WR", DependencyType::IntraBank, "tWRRDA + tBURST16", passBurstLength32},
{tCCD_L_WTR_slr, "WR", DependencyType::IntraBankGroup, "tCCD_L_WTR_slr", passBurstLength16},
{tCCD_L_WTR_slr + tBURST16, "WR", DependencyType::IntraBankGroup, "tCCD_L_WTR_slr + tBURST16", passBurstLength32},
{tCCD_S_WTR_slr, "WR", DependencyType::IntraLogicalRank, "tCCD_S_WTR_slr", passBurstLength16},
{tCCD_S_WTR_slr + tBURST16, "WR", DependencyType::IntraLogicalRank, "tCCD_S_WTR_slr + tBURST16", passBurstLength32},
{tCCD_WTR_dlr, "WR", DependencyType::IntraPhysicalRank, "tCCD_WTR_dlr", passBurstLength16},
{tCCD_WTR_dlr + tBURST16, "WR", DependencyType::IntraPhysicalRank, "tCCD_WTR_dlr + tBURST16", passBurstLength32},
{tWRRD_dpr, "WR", DependencyType::IntraDIMMRank, "tWRRD_dpr", passBurstLength16},
{tWRRD_dpr + tBURST16, "WR", DependencyType::IntraDIMMRank, "tWRRD_dpr + tBURST16", passBurstLength32},
{tWRRD_ddr, "WR", DependencyType::InterDIMMRank, "tWRRD_ddr", passBurstLength16},
{tWRRD_ddr + tBURST16, "WR", DependencyType::InterDIMMRank, "tWRRD_ddr + tBURST16", passBurstLength32},
{tCCD_L_WTR_slr, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WTR_slr", passBurstLength16},
{tCCD_L_WTR_slr + tBURST16, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WTR_slr + tBURST16", passBurstLength32},
{tCCD_S_WTR_slr, "WRA", DependencyType::IntraLogicalRank, "tCCD_S_WTR_slr", passBurstLength16},
{tCCD_S_WTR_slr + tBURST16, "WRA", DependencyType::IntraLogicalRank, "tCCD_S_WTR_slr + tBURST16", passBurstLength32},
{tCCD_WTR_dlr, "WRA", DependencyType::IntraPhysicalRank, "tCCD_WTR_dlr", passBurstLength16},
{tCCD_WTR_dlr + tBURST16, "WRA", DependencyType::IntraPhysicalRank, "tCCD_WTR_dlr + tBURST16", passBurstLength32},
{tWRRD_dpr, "WRA", DependencyType::IntraDIMMRank, "tWRRD_dpr", passBurstLength16},
{tWRRD_dpr + tBURST16, "WRA", DependencyType::IntraDIMMRank, "tWRRD_dpr + tBURST16", passBurstLength32},
{tWRRD_ddr, "WRA", DependencyType::InterDIMMRank, "tWRRD_ddr", passBurstLength16},
{tWRRD_ddr + tBURST16, "WRA", DependencyType::InterDIMMRank, "tWRRD_ddr + tBURST16", passBurstLength32},
{2 * tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WRA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD, "ACT", DependencyType::IntraBank, "tRCD"},
{tCCD_L_RTW_slr, "RD", DependencyType::IntraBankGroup, "tCCD_L_RTW_slr", passBurstLength16},
{tCCD_L_RTW_slr + tBURST16, "RD", DependencyType::IntraBankGroup, "tCCD_L_RTW_slr + tBURST16", passBurstLength32},
{tCCD_S_RTW_slr, "RD", DependencyType::IntraLogicalRank, "tCCD_S_RTW_slr", passBurstLength16},
{tCCD_S_RTW_slr + tBURST16, "RD", DependencyType::IntraLogicalRank, "tCCD_S_RTW_slr + tBURST16", passBurstLength32},
{tCCD_RTW_dlr, "RD", DependencyType::IntraPhysicalRank, "tCCD_RTW_dlr", passBurstLength16},
{tCCD_RTW_dlr + tBURST16, "RD", DependencyType::IntraPhysicalRank, "tCCD_RTW_dlr + tBURST16", passBurstLength32},
{tRDWR_dpr, "RD", DependencyType::IntraDIMMRank, "tRDWR_dpr", passBurstLength16},
{tRDWR_dpr + tBURST16, "RD", DependencyType::IntraDIMMRank, "tRDWR_dpr + tBURST16", passBurstLength32},
{tRDWR_ddr, "RD", DependencyType::InterDIMMRank, "tRDWR_ddr", passBurstLength16},
{tRDWR_ddr + tBURST16, "RD", DependencyType::InterDIMMRank, "tRDWR_ddr + tBURST16", passBurstLength32},
{tCCD_L_RTW_slr, "RDA", DependencyType::IntraBankGroup, "tCCD_L_RTW_slr", passBurstLength16},
{tCCD_L_RTW_slr + tBURST16, "RDA", DependencyType::IntraBankGroup, "tCCD_L_RTW_slr + tBURST16", passBurstLength32},
{tCCD_S_RTW_slr, "RDA", DependencyType::IntraLogicalRank, "tCCD_S_RTW_slr", passBurstLength16},
{tCCD_S_RTW_slr + tBURST16, "RDA", DependencyType::IntraLogicalRank, "tCCD_S_RTW_slr + tBURST16", passBurstLength32},
{tCCD_RTW_dlr, "RDA", DependencyType::IntraPhysicalRank, "tCCD_RTW_dlr", passBurstLength16},
{tCCD_RTW_dlr + tBURST16, "RDA", DependencyType::IntraPhysicalRank, "tCCD_RTW_dlr + tBURST16", passBurstLength32},
{tRDWR_dpr, "RDA", DependencyType::IntraDIMMRank, "tRDWR_dpr", passBurstLength16},
{tRDWR_dpr + tBURST16, "RDA", DependencyType::IntraDIMMRank, "tRDWR_dpr + tBURST16", passBurstLength32},
{tRDWR_ddr, "RDA", DependencyType::InterDIMMRank, "tRDWR_ddr", passBurstLength16},
{tRDWR_ddr + tBURST16, "RDA", DependencyType::InterDIMMRank, "tRDWR_ddr + tBURST16", passBurstLength32},
{tCCD_L_WR_slr, "WR", DependencyType::IntraBankGroup, "tCCD_L_WR_slr"},
{tCCD_S_WR_slr, "WR", DependencyType::IntraLogicalRank, "tCCD_S_WR_slr"},
{tCCD_WR_dlr, "WR", DependencyType::IntraPhysicalRank, "tCCD_WR_dlr", passBurstLength16},
{tBURST32, "WR", DependencyType::IntraPhysicalRank, "tBURST32", passBurstLength32},
{tWRWR_dpr, "WR", DependencyType::IntraDIMMRank, "tWRWR_dpr", passBurstLength16},
{tWRWR_dpr + tBURST16, "WR", DependencyType::IntraDIMMRank, "tWRWR_dpr + tBURST16", passBurstLength32},
{tWRWR_ddr, "WR", DependencyType::InterDIMMRank, "tWRWR_ddr", passBurstLength16},
{tWRWR_ddr + tBURST16, "WR", DependencyType::InterDIMMRank, "tWRWR_ddr + tBURST16", passBurstLength32},
{tCCD_L_WR_slr, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WR_slr", passBurstLength16},
{tCCD_L_WR_slr + tBURST16, "WRA", DependencyType::IntraBankGroup, "tCCD_L_WR_slr + tBURST16", passBurstLength32},
{tCCD_S_WR_slr, "WRA", DependencyType::IntraLogicalRank, "tCCD_S_WR_slr"},
{tCCD_WR_dlr, "WRA", DependencyType::IntraPhysicalRank, "tCCD_WR_dlr", passBurstLength16},
{tBURST32, "WRA", DependencyType::IntraPhysicalRank, "tBURST32", passBurstLength32},
{tWRWR_dpr, "WRA", DependencyType::IntraDIMMRank, "tWRWR_dpr", passBurstLength16},
{tWRWR_dpr + tBURST16, "WRA", DependencyType::IntraDIMMRank, "tWRWR_dpr + tBURST16", passBurstLength32},
{tWRWR_ddr, "WRA", DependencyType::InterDIMMRank, "tWRWR_ddr", passBurstLength16},
{tWRWR_ddr + tBURST16, "WRA", DependencyType::InterDIMMRank, "tWRWR_ddr + tBURST16", passBurstLength32},
{2 * tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC + cmdLengthDiff, "ACT", DependencyType::IntraLogicalRank, "tRC + tCK"},
{tRDAACT + cmdLengthDiff, "RDA", DependencyType::IntraPhysicalRank, "tRDAACT + tCK"},
{tWRPRE + tRP + cmdLengthDiff, "WRA", DependencyType::IntraLogicalRank, "tWRPRE + tRP + tCK", passBurstLength16},
{tWRPRE + tRP + cmdLengthDiff + tBURST16, "WRA", DependencyType::IntraLogicalRank, "tWRPRE + tRP + tCK + tBURST16", passBurstLength32},
{tRP, "PREPB", DependencyType::IntraLogicalRank, "tRP"},
{tRP, "PREAB", DependencyType::IntraLogicalRank, "tRP"},
{tRFC_slr, "REFAB", DependencyType::IntraLogicalRank, "tRFC_slr"},
{tRFC_dlr, "REFAB", DependencyType::IntraPhysicalRank, "tRFC_dlr"},
{tRFC_dpr, "REFAB", DependencyType::IntraDIMMRank, "tRFC_dpr"},
{tRFC_slr, "RFMAB", DependencyType::IntraLogicalRank, "tRFC_slr"},
{tRFC_dlr, "RFMAB", DependencyType::IntraPhysicalRank, "tRFC_dlr"},
{tRFC_dpr, "RFMAB", DependencyType::IntraDIMMRank, "tRFC_dpr"},
{tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RFMAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC + cmdLengthDiff, "ACT", DependencyType::IntraLogicalRank, "tRC + tCK"},
{tRDAACT + cmdLengthDiff, "RDA", DependencyType::IntraPhysicalRank, "tRDAACT + tCK"},
{tWRPRE + tRP + cmdLengthDiff, "WRA", DependencyType::IntraLogicalRank, "tWRPRE + tRP + tCK", passBurstLength16},
{tWRPRE + tRP + cmdLengthDiff + tBURST16, "WRA", DependencyType::IntraLogicalRank, "tWRPRE + tRP + tCK + tBURST16", passBurstLength32},
{tRP, "PREPB", DependencyType::IntraLogicalRank, "tRP"},
{tRP, "PREAB", DependencyType::IntraLogicalRank, "tRP"},
{tRFC_slr, "REFAB", DependencyType::IntraLogicalRank, "tRFC_slr"},
{tRFC_dlr, "REFAB", DependencyType::IntraPhysicalRank, "tRFC_dlr"},
{tRFC_dpr, "REFAB", DependencyType::IntraDIMMRank, "tRFC_dpr"},
{tRFC_slr, "RFMAB", DependencyType::IntraLogicalRank, "tRFC_slr"},
{tRFC_dlr, "RFMAB", DependencyType::IntraPhysicalRank, "tRFC_dlr"},
{tRFC_dpr, "RFMAB", DependencyType::IntraDIMMRank, "tRFC_dpr"},
{tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFSB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC + cmdLengthDiff, "ACT", DependencyType::IntraBankInGroup, "tRC + tCK"},
{tRRD_L_slr + cmdLengthDiff, "ACT", DependencyType::IntraLogicalRank, "tRRD_L_slr + tCK"},
{tRDAACT + cmdLengthDiff, "RDA", DependencyType::IntraBankInGroup, "tRDAACT + tCK"},
{tWRAACT + tRP + cmdLengthDiff, "WRA", DependencyType::IntraBankInGroup, "tWRAACT + tRP + tCK", passBurstLength16},
{tWRAACT + tRP + cmdLengthDiff + tBURST16, "WRA", DependencyType::IntraBankInGroup, "tWRAACT + tRP + tCK + tBURST16", passBurstLength32},
{tRP, "PREPB", DependencyType::IntraBankInGroup, "tRP"},
{tRP, "PRESB", DependencyType::IntraBankInGroup, "tRP"},
{tRFC_slr, "REFAB", DependencyType::IntraLogicalRank, "tRFC_slr"},
{tRFC_dlr, "REFAB", DependencyType::IntraPhysicalRank, "tRFC_dlr"},
{tRFC_dpr, "REFAB", DependencyType::IntraDIMMRank, "tRFC_dpr"},
{tRFC_slr, "RFMAB", DependencyType::IntraLogicalRank, "tRFC_slr"},
{tRFC_dlr, "RFMAB", DependencyType::IntraPhysicalRank, "tRFC_dlr"},
{tRFC_dpr, "RFMAB", DependencyType::IntraDIMMRank, "tRFC_dpr"},
{tRFCsb_slr, "REFSB", DependencyType::IntraLogicalRank, "tRFCsb_slr"},
{tRFCsb_dlr, "REFSB", DependencyType::IntraPhysicalRank, "tRFCsb_dlr"},
{tRFCsb_slr, "RFMSB", DependencyType::IntraLogicalRank, "tRFCsb_slr"},
{tRFCsb_dlr, "RFMSB", DependencyType::IntraPhysicalRank, "tRFCsb_dlr"},
{tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
{tFAW_slr - shortCmdOffset, "FAW_LOGICAL", DependencyType::IntraLogicalRank, "tFAW_slr"},
{tFAW_dlr - shortCmdOffset, "FAW_PHYSICAL", DependencyType::IntraPhysicalRank, "tFAW_dlr"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RFMSB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC + cmdLengthDiff, "ACT", DependencyType::IntraBankGroup, "tRC + tCK"},
{tRRD_L_slr + cmdLengthDiff, "ACT", DependencyType::IntraLogicalRank, "tRRD_L_slr + tCK"},
{tRDAACT + cmdLengthDiff, "RDA", DependencyType::IntraBankGroup, "tRDAACT + tCK"},
{tWRAACT + tRP + cmdLengthDiff, "WRA", DependencyType::IntraBankGroup, "tWRAACT + tRP + tCK", passBurstLength16},
{tWRAACT + tRP + cmdLengthDiff + tBURST16, "WRA", DependencyType::IntraBankGroup, "tWRAACT + tRP + tCK + tBURST16", passBurstLength32},
{tRP, "PREPB", DependencyType::IntraBankGroup, "tRP"},
{tRP, "PRESB", DependencyType::IntraBankGroup, "tRP"},
{tRFC_slr, "REFAB", DependencyType::IntraLogicalRank, "tRFC_slr"},
{tRFC_dlr, "REFAB", DependencyType::IntraPhysicalRank, "tRFC_dlr"},
{tRFC_dpr, "REFAB", DependencyType::IntraDIMMRank, "tRFC_dpr"},
{tRFC_slr, "RFMAB", DependencyType::IntraLogicalRank, "tRFC_slr"},
{tRFC_dlr, "RFMAB", DependencyType::IntraPhysicalRank, "tRFC_dlr"},
{tRFC_dpr, "RFMAB", DependencyType::IntraDIMMRank, "tRFC_dpr"},
{tRFCsb_slr, "REFSB", DependencyType::IntraLogicalRank, "tRFCsb_slr"},
{tRFCsb_dlr, "REFSB", DependencyType::IntraPhysicalRank, "tRFCsb_dlr"},
{tRFCsb_slr, "RFMSB", DependencyType::IntraLogicalRank, "tRFCsb_slr"},
{tRFCsb_dlr, "RFMSB", DependencyType::IntraPhysicalRank, "tRFCsb_dlr"},
{tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
{tFAW_slr - shortCmdOffset, "FAW_LOGICAL", DependencyType::IntraLogicalRank, "tFAW_slr"},
{tFAW_dlr - shortCmdOffset, "FAW_PHYSICAL", DependencyType::IntraPhysicalRank, "tFAW_dlr"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + cmdLengthDiff, "ACT", DependencyType::IntraLogicalRank, "tRAS + tCK"},
{tRTP + cmdLengthDiff, "RD", DependencyType::IntraLogicalRank, "tRTP + tCK"},
{tRTP + cmdLengthDiff, "RDA", DependencyType::IntraLogicalRank, "tRTP + tCK"},
{tWRPRE + cmdLengthDiff, "WR", DependencyType::IntraLogicalRank, "tWRPRE + tCK", passBurstLength16},
{tWRPRE + cmdLengthDiff + tBURST16, "WR", DependencyType::IntraLogicalRank, "tWRPRE + tCK + tBURST16", passBurstLength32},
{tWRPRE + cmdLengthDiff, "WRA", DependencyType::IntraLogicalRank, "tWRPRE + tCK", passBurstLength16},
{tWRPRE + cmdLengthDiff + tBURST16, "WRA", DependencyType::IntraLogicalRank, "tWRPRE + tCK + tBURST16", passBurstLength32},
{tPPD, "PREPB", DependencyType::IntraPhysicalRank, "tPPD"},
{tPPD, "PREAB", DependencyType::IntraPhysicalRank, "tPPD"},
{tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PRESB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + cmdLengthDiff, "ACT", DependencyType::IntraBankInGroup, "tRAS + tCK"},
{tRTP + cmdLengthDiff, "RD", DependencyType::IntraBankInGroup, "tRTP + tCK"},
{tRTP + cmdLengthDiff, "RDA", DependencyType::IntraBankInGroup, "tRTP + tCK"},
{tWRPRE + cmdLengthDiff, "WR", DependencyType::IntraBankInGroup, "tWRPRE + tCK", passBurstLength16},
{tWRPRE + cmdLengthDiff + tBURST16, "WR", DependencyType::IntraBankInGroup, "tWRPRE + tCK + tBURST16", passBurstLength32},
{tWRPRE + cmdLengthDiff, "WRA", DependencyType::IntraBankInGroup, "tWRPRE + tCK", passBurstLength16},
{tWRPRE + cmdLengthDiff + tBURST16, "WRA", DependencyType::IntraBankInGroup, "tWRPRE + tCK + tBURST16", passBurstLength32},
{tPPD, "PREPB", DependencyType::IntraPhysicalRank, "tPPD"},
{tPPD, "PREAB", DependencyType::IntraPhysicalRank, "tPPD"},
{tCK, "CMD_BUS", DependencyType::InterDIMMRank, "CommandBus"},
}
)
);
return dmap;
}

View File

@@ -0,0 +1,147 @@
/*
* 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
*/
#pragma once
#include "../dramtimedependenciesbase.h"
#include "businessObjects/dramTimeDependencies/dbEntries/specialized/DDR5dbphaseentry.h"
class TimeDependenciesInfoDDR5 final : public DRAMTimeDependenciesBase {
public:
TimeDependenciesInfoDDR5(const QJsonObject& memspec, const uint clk);
static const std::vector<QString> getPossiblePhases();
void rankIDToRankIDs(size_t rankID, size_t& dimmRID, size_t& physRID, size_t& logRID) const;
void bankIDToBankInGroup(size_t logicalRankID, size_t bankID, size_t& bankInGroup) const;
protected:
void mInitializeValues() override;
DependencyMap mSpecializedGetDependencies() const override;
protected:
uint mNumOfRanks;
uint mNumOfDIMMRanks;
uint mNumLogicalRanksPerPhysicalRank;
uint mNumPhysicalRanksPerDIMMRank;
uint mNumBanksPerGroup;
uint burstLength;
uint dataRate;
uint refMode;
uint tRCD;
uint tPPD;
uint tRP;
uint tRAS;
uint tRC;
uint tRL;
uint RBL;
uint tRTP;
uint tRPRE;
uint tRPST;
uint tRDDQS;
uint tWL;
uint WBL;
uint tWPRE;
uint tWPST;
uint tWR;
uint tCCD_L_slr;
uint tCCD_L_WR_slr;
uint tCCD_L_WR2_slr;
uint tCCD_S_slr;
uint tCCD_S_WR_slr;
uint tCCD_dlr;
uint tCCD_WR_dlr;
uint tCCD_WR_dpr;
uint tRRD_S_slr;
uint tRRD_L_slr;
uint tRRD_dlr;
uint tFAW_slr;
uint tFAW_dlr;
uint tWTR_L;
uint tWTR_S;
uint tRFC_slr;
uint tRFC_dlr;
uint tRFC_dpr;
uint tRFCsb_slr;
uint tRFCsb_dlr;
uint tREFI;
uint tREFSBRD_slr;
uint tREFSBRD_dlr;
uint tRTRS;
uint UNKNOWN;
uint tCPDED;
uint tPD;
uint tXP;
uint tACTPDEN;
uint tPRPDEN;
uint tREFPDEN;
uint tRD_BURST;
uint tWR_BURST;
uint tWTRA;
uint tWRRDA;
uint tWRPRE;
uint tRDAACT;
uint tWRAACT;
uint tCCD_L_RTW_slr;
uint tCCD_S_RTW_slr;
uint tCCD_RTW_dlr;
uint tRDRD_dpr;
uint tRDRD_ddr;
uint tRDWR_dpr;
uint tRDWR_ddr;
uint tCCD_L_WTR_slr;
uint tCCD_S_WTR_slr;
uint tCCD_WTR_dlr;
uint tWRWR_dpr;
uint tWRWR_ddr;
uint tWRRD_dpr;
uint tWRRD_ddr;
uint tRDPDEN;
uint tWRPDEN;
uint tWRAPDEN;
uint cmdMode;
uint bitWidth;
uint cmdLengthDiff;
uint shortCmdOffset;
uint longCmdOffset;
uint tBURST16;
uint tBURST32;
};

View File

@@ -0,0 +1,431 @@
/*
* 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 "TimeDependenciesInfoHBM2.h"
using namespace std;
TimeDependenciesInfoHBM2::TimeDependenciesInfoHBM2(const QJsonObject& memspec, const uint tCK) : DRAMTimeDependenciesBase(memspec, tCK) {
mInitializeValues();
}
void TimeDependenciesInfoHBM2::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();
tRCDRD = tCK * mMemspecJson["memtimingspec"].toObject()["RCDRD"].toInt();
tRCDWR = tCK * mMemspecJson["memtimingspec"].toObject()["RCDWR"].toInt();
tRTP = tCK * mMemspecJson["memtimingspec"].toObject()["RTP"].toInt();
tRRDS = tCK * mMemspecJson["memtimingspec"].toObject()["RRDS"].toInt();
tRRDL = tCK * mMemspecJson["memtimingspec"].toObject()["RRDL"].toInt();
tRL = tCK * mMemspecJson["memtimingspec"].toObject()["RL"].toInt();
tPL = tCK * mMemspecJson["memtimingspec"].toObject()["PL"].toInt();
tCCDS = tCK * mMemspecJson["memtimingspec"].toObject()["CCDS"].toInt();
tCCDL = tCK * mMemspecJson["memtimingspec"].toObject()["CCDL"].toInt();
tRTW = tCK * mMemspecJson["memtimingspec"].toObject()["RTW"].toInt();
tWL = tCK * mMemspecJson["memtimingspec"].toObject()["WL"].toInt();
tWR = tCK * mMemspecJson["memtimingspec"].toObject()["WR"].toInt();
tWTRS = tCK * mMemspecJson["memtimingspec"].toObject()["WTRS"].toInt();
tWTRL = tCK * mMemspecJson["memtimingspec"].toObject()["WTRL"].toInt();
tCKE = tCK * mMemspecJson["memtimingspec"].toObject()["CKE"].toInt();
tXP = tCK * mMemspecJson["memtimingspec"].toObject()["XP"].toInt();
tRFC = tCK * mMemspecJson["memtimingspec"].toObject()["RFC"].toInt();
tRFCSB = tCK * mMemspecJson["memtimingspec"].toObject()["RFCSB"].toInt();
tRREFD = tCK * mMemspecJson["memtimingspec"].toObject()["RREFD"].toInt();
tXS = tCK * mMemspecJson["memtimingspec"].toObject()["XS"].toInt();
tFAW = tCK * mMemspecJson["memtimingspec"].toObject()["FAW"].toInt();
tPD = tCKE;
tCKESR = tCKE + tCK;
tBURST = (uint) (burstLength / (float) dataRate) * tCK;
tRDPDE = tRL + tPL + tBURST + tCK;
tRDSRE = tRDPDE;
tWRPRE = tWL + tBURST + tWR;
tWRPDE = tWL + tPL + tBURST + tCK + tWR;
tWRAPDE = tWL + tPL + tBURST + tCK + tWR;
tWRRDS = tWL + tBURST + tWTRS;
tWRRDL = tWL + tBURST + tWTRL;
mPools.insert({
"RAS_BUS", {
1, {
{"ACT", 2*tCK},
{"PREPB", tCK},
{"PREAB", tCK},
{"REFPB", tCK},
{"REFAB", tCK},
{"PDEA", tCK},
{"PDXA", tCK},
{"PDEP", tCK},
{"PDXP", tCK},
{"SREFEN", tCK},
{"SREFEX", tCK},
}
}
});
mPools.insert({
"CAS_BUS", {
1, {
{"RD", tCK},
{"RDA", tCK},
{"WR", tCK},
{"WRA", tCK},
{"PDEA", tCK},
{"PDXA", tCK},
{"PDEP", tCK},
{"PDXP", tCK},
{"SREFEN", tCK},
{"SREFEX", tCK},
}
}
});
mPools.insert({
"NAW", {
4, {
{"ACT", tFAW},
{"REFPB", tFAW},
}
}
});
}
const std::vector<QString> TimeDependenciesInfoHBM2::getPossiblePhases() {
return {
"ACT",
"RD",
"WR",
"PREPB",
"RDA",
"WRA",
"REFPB",
"REFAB",
"PREAB",
"PDEP",
"PDXP",
"SREFEN",
"SREFEX",
"PDEA",
"PDXA",
};
}
DependencyMap TimeDependenciesInfoHBM2::mSpecializedGetDependencies() const {
DependencyMap dmap;
dmap.emplace(
piecewise_construct,
forward_as_tuple("ACT"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC, "ACT", DependencyType::IntraBank, "tRC"},
{tRRDL, "ACT", DependencyType::IntraBankGroup, "tRRDL"},
{tRRDS, "ACT", DependencyType::IntraRank, "tRRDS"},
{tRTP + tRP - tCK, "RDA", DependencyType::IntraBank, "tRTP + tRP - tCK"},
{tWRPRE + tRP - tCK, "WRA", DependencyType::IntraBank, "tWRPRE + tRP - tCK"},
{tRP - tCK, "PREPB", DependencyType::IntraBank, "tRP - tCK"},
{tRP - tCK, "PREAB", DependencyType::IntraRank, "tRP - tCK"},
{tXP - tCK, "PDXA", DependencyType::IntraRank, "tXP - tCK"},
{tXP - tCK, "PDXP", DependencyType::IntraRank, "tXP - tCK"},
{tRFC - tCK, "REFAB", DependencyType::IntraRank, "tRFC - tCK"},
{tRFCSB - tCK, "REFPB", DependencyType::IntraBank, "tRFCSB - tCK"},
{tRREFD - tCK, "REFPB", DependencyType::IntraBankGroup, "tRREFD - tCK"},
{tRREFD - tCK, "REFPB", DependencyType::IntraRank, "tRREFD - tCK"},
{tXS - tCK, "SREFEX", DependencyType::IntraRank, "tXS - tCK"},
{2 * tCK, "RAS_BUS", DependencyType::InterRank, "2 * tCK"},
{tFAW, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RD"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCDRD + tCK, "ACT", DependencyType::IntraBank, "tRCDRD + tCK"},
{tCCDL, "RD", DependencyType::IntraBank, "tCCDL"},
{tCCDL, "RD", DependencyType::IntraBankGroup, "tCCDL"},
{tCCDS, "RD", DependencyType::IntraRank, "tCCDS"},
{tCCDL, "RDA", DependencyType::IntraBankGroup, "tCCDL"},
{tCCDS, "RDA", DependencyType::IntraRank, "tCCDS"},
{tWRRDL, "WR", DependencyType::IntraBank, "tWRRDL"},
{tWRRDL, "WR", DependencyType::IntraBankGroup, "tWRRDL"},
{tWRRDS, "WR", DependencyType::IntraRank, "tWRRDS"},
{tWRRDL, "WRA", DependencyType::IntraBankGroup, "tWRRDL"},
{tWRRDS, "WRA", DependencyType::IntraRank, "tWRRDS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WR"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCDWR + tCK, "ACT", DependencyType::IntraBank, "tRCDWR + tCK"},
{tRTW, "RD", DependencyType::IntraBank, "tRTW"},
{tRTW, "RD", DependencyType::IntraBankGroup, "tRTW"},
{tRTW, "RD", DependencyType::IntraRank, "tRTW"},
{tRTW, "RDA", DependencyType::IntraBankGroup, "tRTW"},
{tRTW, "RDA", DependencyType::IntraRank, "tRTW"},
{tCCDL, "WR", DependencyType::IntraBank, "tCCDL"},
{tCCDL, "WR", DependencyType::IntraBankGroup, "tCCDL"},
{tCCDS, "WR", DependencyType::IntraRank, "tCCDS"},
{tCCDL, "WRA", DependencyType::IntraBankGroup, "tCCDL"},
{tCCDS, "WRA", DependencyType::IntraRank, "tCCDS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREPB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + tCK, "ACT", DependencyType::IntraBank, "tRAS + tCK"},
{tRTP, "RD", DependencyType::IntraBank, "tRTP"},
{tWRPRE, "WR", DependencyType::IntraBank, "tWRPRE"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RDA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCDRD + tCK, "ACT", DependencyType::IntraBank, "tRCDRD + tCK"},
{tCCDL, "RD", DependencyType::IntraBank, "tCCDL"},
{tCCDL, "RD", DependencyType::IntraBankGroup, "tCCDL"},
{tCCDS, "RD", DependencyType::IntraRank, "tCCDS"},
{tCCDL, "RDA", DependencyType::IntraBankGroup, "tCCDL"},
{tCCDS, "RDA", DependencyType::IntraRank, "tCCDS"},
{tWL + tBURST + max({tWR - tRTP, tWTRL}), "WR", DependencyType::IntraBank, "tWL + tBURST + max(tWR - tRTP, tWTRL)"},
{tWRRDL, "WR", DependencyType::IntraBankGroup, "tWRRDL"},
{tWRRDS, "WR", DependencyType::IntraRank, "tWRRDS"},
{tWRRDL, "WRA", DependencyType::IntraBankGroup, "tWRRDL"},
{tWRRDS, "WRA", DependencyType::IntraRank, "tWRRDS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WRA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCDWR + tCK, "ACT", DependencyType::IntraBank, "tRCDWR + tCK"},
{tRTW, "RD", DependencyType::IntraBank, "tRTW"},
{tRTW, "RD", DependencyType::IntraBankGroup, "tRTW"},
{tRTW, "RD", DependencyType::IntraRank, "tRTW"},
{tRTW, "RDA", DependencyType::IntraBankGroup, "tRTW"},
{tRTW, "RDA", DependencyType::IntraRank, "tRTW"},
{tCCDL, "WR", DependencyType::IntraBank, "tCCDL"},
{tCCDL, "WR", DependencyType::IntraBankGroup, "tCCDL"},
{tCCDS, "WR", DependencyType::IntraRank, "tCCDS"},
{tCCDL, "WRA", DependencyType::IntraBankGroup, "tCCDL"},
{tCCDS, "WRA", DependencyType::IntraRank, "tCCDS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFPB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC + tCK, "ACT", DependencyType::IntraBank, "tRC + tCK"},
{tRRDL + tCK, "ACT", DependencyType::IntraBankGroup, "tRRDL + tCK"},
{tRRDS + tCK, "ACT", DependencyType::IntraRank, "tRRDS + tCK"},
{tRTP + tRP, "RDA", DependencyType::IntraBank, "tRTP + tRP"},
{tWRPRE + tRP, "WRA", DependencyType::IntraBank, "tWRPRE + tRP"},
{tRP, "PREPB", DependencyType::IntraBank, "tRP"},
{tRP, "PREAB", DependencyType::IntraRank, "tRP"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFC, "REFAB", DependencyType::IntraRank, "tRFC"},
{tRFCSB, "REFPB", DependencyType::IntraBank, "tRFCSB"},
{tRREFD, "REFPB", DependencyType::IntraBankGroup, "tRREFD"},
{tRREFD, "REFPB", DependencyType::IntraRank, "tRREFD"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
{tFAW, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC + tCK, "ACT", DependencyType::IntraRank, "tRC + tCK"},
{tRTP + tRP, "RDA", DependencyType::IntraRank, "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"},
{tRFCSB, "REFPB", DependencyType::IntraRank, "tRFCSB"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + tCK, "ACT", DependencyType::IntraRank, "tRAS + tCK"},
{tRTP, "RD", DependencyType::IntraRank, "tRTP"},
{tRTP, "RDA", DependencyType::IntraRank, "tRTP"},
{tWRPRE, "WR", DependencyType::IntraRank, "tWRPRE"},
{tWRPRE, "WRA", DependencyType::IntraRank, "tWRPRE"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tRFCSB, "REFPB", DependencyType::IntraRank, "tRFCSB"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDEP"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRDPDE, "RD", DependencyType::IntraRank, "tRDPDE"},
{tRDPDE, "RDA", DependencyType::IntraRank, "tRDPDE"},
{tWRAPDE, "WRA", DependencyType::IntraRank, "tWRAPDE"},
{tCKE, "PDXP", DependencyType::IntraRank, "tCKE"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXP"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEP", DependencyType::IntraRank, "tPD"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SREFEN"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRC + tCK, "ACT", DependencyType::IntraRank, "tRC + tCK"},
{max({tRTP + tRP, tRDSRE}), "RDA", DependencyType::IntraRank, "max(tRTP + tRP, tRDSRE)"},
{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"},
{tRFCSB, "REFPB", DependencyType::IntraRank, "tRFCSB"},
{tXS, "SREFEX", DependencyType::IntraRank, "tXS"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SREFEX"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tCKESR, "SREFEN", DependencyType::IntraRank, "tCKESR"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDEA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRDPDE, "RD", DependencyType::IntraRank, "tRDPDE"},
{tRDPDE, "RDA", DependencyType::IntraRank, "tRDPDE"},
{tWRPDE, "WR", DependencyType::IntraRank, "tWRPDE"},
{tWRAPDE, "WRA", DependencyType::IntraRank, "tWRAPDE"},
{tCKE, "PDXA", DependencyType::IntraRank, "tCKE"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tPD, "PDEA", DependencyType::IntraRank, "tPD"},
{tCK, "RAS_BUS", DependencyType::InterRank, "tCK"},
{tCK, "CAS_BUS", DependencyType::InterRank, "tCK"},
}
)
);
return dmap;
}

View File

@@ -0,0 +1,90 @@
/*
* 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
*/
#pragma once
#include "../dramtimedependenciesbase.h"
class TimeDependenciesInfoHBM2 final : public DRAMTimeDependenciesBase {
public:
TimeDependenciesInfoHBM2(const QJsonObject& memspec, const uint clk);
static const std::vector<QString> getPossiblePhases();
protected:
void mInitializeValues() override;
DependencyMap mSpecializedGetDependencies() const override;
protected:
uint burstLength;
uint dataRate;
uint tRP;
uint tRAS;
uint tRC;
uint tRCDRD;
uint tRCDWR;
uint tRTP;
uint tRRDS;
uint tRRDL;
uint tRL;
uint tPL;
uint tCCDS;
uint tCCDL;
uint tRTW;
uint tWL;
uint tWR;
uint tWTRS;
uint tWTRL;
uint tCKE;
uint tPD;
uint tXP;
uint tRFC;
uint tRFCSB;
uint tRREFD;
uint tXS;
uint tCKESR;
uint tFAW;
uint tBURST;
uint tRDPDE;
uint tRDSRE;
uint tWRPRE;
uint tWRPDE;
uint tWRAPDE;
uint tWRRDS;
uint tWRRDL;
};

View File

@@ -0,0 +1,442 @@
/*
* 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 "TimeDependenciesInfoLPDDR4.h"
using namespace std;
TimeDependenciesInfoLPDDR4::TimeDependenciesInfoLPDDR4(const QJsonObject& memspec, const uint tCK) : DRAMTimeDependenciesBase(memspec, tCK) {
mInitializeValues();
}
void TimeDependenciesInfoLPDDR4::mInitializeValues() {
burstLength = mMemspecJson["memarchitecturespec"].toObject()["burstLength"].toInt();
dataRate = mMemspecJson["memarchitecturespec"].toObject()["dataRate"].toInt();
tRRD = tCK * mMemspecJson["memtimingspec"].toObject()["RRD"].toInt();
tRCD = tCK * mMemspecJson["memtimingspec"].toObject()["RCD"].toInt();
tRAS = tCK * mMemspecJson["memtimingspec"].toObject()["RAS"].toInt();
tFAW = tCK * mMemspecJson["memtimingspec"].toObject()["FAW"].toInt();
tRPpb = tCK * mMemspecJson["memtimingspec"].toObject()["RPpb"].toInt();
tRPab = tCK * mMemspecJson["memtimingspec"].toObject()["RPab"].toInt();
tRCpb = tCK * mMemspecJson["memtimingspec"].toObject()["RCpb"].toInt();
tRCab = tCK * mMemspecJson["memtimingspec"].toObject()["RCab"].toInt();
tCCD = tCK * mMemspecJson["memtimingspec"].toObject()["CCD"].toInt();
tRTP = tCK * mMemspecJson["memtimingspec"].toObject()["RTP"].toInt();
tWR = tCK * mMemspecJson["memtimingspec"].toObject()["WR"].toInt();
tWTR = tCK * mMemspecJson["memtimingspec"].toObject()["WTR"].toInt();
tPPD = tCK * mMemspecJson["memtimingspec"].toObject()["PPD"].toInt();
tWPRE = tCK * mMemspecJson["memtimingspec"].toObject()["WPRE"].toInt();
tRPST = tCK * mMemspecJson["memtimingspec"].toObject()["RPST"].toInt();
tDQSCK = tCK * mMemspecJson["memtimingspec"].toObject()["DQSCK"].toInt();
tDQSS = tCK * mMemspecJson["memtimingspec"].toObject()["DQSS"].toInt();
tDQS2DQ = tCK * mMemspecJson["memtimingspec"].toObject()["DQS2DQ"].toInt();
tRL = tCK * mMemspecJson["memtimingspec"].toObject()["RL"].toInt();
tWL = tCK * mMemspecJson["memtimingspec"].toObject()["WL"].toInt();
tRFCab = tCK * mMemspecJson["memtimingspec"].toObject()["RFCab"].toInt();
tRFCpb = tCK * mMemspecJson["memtimingspec"].toObject()["RFCpb"].toInt();
tESCKE = tCK * mMemspecJson["memtimingspec"].toObject()["ESCKE"].toInt();
tSR = tCK * mMemspecJson["memtimingspec"].toObject()["SR"].toInt();
tXSR = tCK * mMemspecJson["memtimingspec"].toObject()["XSR"].toInt();
tXP = tCK * mMemspecJson["memtimingspec"].toObject()["XP"].toInt();
tCKE = tCK * mMemspecJson["memtimingspec"].toObject()["CKE"].toInt();
tCMDCKE = tCK * mMemspecJson["memtimingspec"].toObject()["CMDCKE"].toInt();
tRTRS = tCK * mMemspecJson["memtimingspec"].toObject()["RTRS"].toInt();
tBURST = (uint) (burstLength / (float) dataRate) * tCK;
tRDWR = tRL + tDQSCK + tBURST - tWL + tWPRE + tRPST;
tRDWR_R = tRL + tBURST + tRTRS - tWL;
tWRRD = tWL + tCK + tBURST + tWTR;
tWRRD_R = tWL + tBURST + tRTRS - tRL;
tRDPRE = tRTP + tBURST - 6 * tCK;
tRDAACT = tRTP + tRPpb + tBURST - 8 * tCK;
tWRPRE = 2 * tCK + tWL + tCK + tBURST + tWR;
tWRAACT = tWL + tBURST + tWR + tCK + tRPpb;
tACTPDEN = 3 * tCK + tCMDCKE;
tPRPDEN = tCK + tCMDCKE;
tRDPDEN = 3 * tCK + tRL + tDQSCK + tBURST + tRPST;
tWRPDEN = 3 * tCK + tWL + (ceil((uint) (tDQSS / (float) tCK)) + ceil((uint) (tDQS2DQ / (float) tCK))) * tCK + tBURST + tWR;
tWRAPDEN = 3 * tCK + tWL + (ceil((uint) (tDQSS / (float) tCK)) + ceil((uint) (tDQS2DQ / (float) tCK))) * tCK + tBURST + tWR + 2 * tCK;
tREFPDEN = tCK + tCMDCKE;
tSREFPDEN = tCK + tESCKE;
mPools.insert({
"CMD_BUS", {
1, {
{"ACT", 4 * tCK},
{"RD", 4 * tCK},
{"WR", 4 * tCK},
{"RDA", 4 * tCK},
{"WRA", 4 * tCK},
{"PREPB", 2 * tCK},
{"PREAB", 2 * tCK},
{"REFAB", 2 * tCK},
{"SREFEN", 2 * tCK},
{"SREFEX", 2 * tCK},
{"REFPB", 2 * tCK},
}
}
});
mPools.insert({
"NAW", {
4, {
{"ACT", tFAW},
{"REFPB", tFAW},
}
}
});
}
const std::vector<QString> TimeDependenciesInfoLPDDR4::getPossiblePhases() {
return {
"ACT",
"RD",
"WR",
"PREPB",
"RDA",
"WRA",
"REFPB",
"REFAB",
"PREAB",
"PDEP",
"PDXP",
"SREFEN",
"SREFEX",
"PDEA",
"PDXA",
"SRPDEN",
"SRPDEX",
};
}
DependencyMap TimeDependenciesInfoLPDDR4::mSpecializedGetDependencies() const {
DependencyMap dmap;
dmap.emplace(
piecewise_construct,
forward_as_tuple("ACT"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCpb, "ACT", DependencyType::IntraBank, "tRCpb"},
{tRRD, "ACT", DependencyType::IntraRank, "tRRD"},
{tRDAACT, "RDA", DependencyType::IntraBank, "tRDAACT"},
{tWRAACT, "WRA", DependencyType::IntraBank, "tWRAACT"},
{tRPpb - 2 * tCK, "PREPB", DependencyType::IntraBank, "tRPpb - 2 * tCK"},
{tRPab - 2 * tCK, "PREAB", DependencyType::IntraRank, "tRPab - 2 * tCK"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFCab - 2 * tCK, "REFAB", DependencyType::IntraRank, "tRFCab - 2 * tCK"},
{tRFCpb - 2 * tCK, "REFPB", DependencyType::IntraBank, "tRFCpb - 2 * tCK"},
{tRRD - 2 * tCK, "REFPB", DependencyType::IntraRank, "tRRD - 2 * tCK"},
{tXSR - 2 * tCK, "SREFEX", DependencyType::IntraRank, "tXSR - 2 * tCK"},
{4 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
{tFAW, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RD"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD, "ACT", DependencyType::IntraBank, "tRCD"},
{tCCD, "RD", DependencyType::IntraBank, "tCCD"}, //
{tCCD, "RD", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "RD", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD, "RDA", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{tWRRD, "WR", DependencyType::IntraBank, "tWRRD"},
{tWRRD, "WR", DependencyType::IntraRank, "tWRRD"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD, "WRA", DependencyType::IntraRank, "tWRRD"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{4 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WR"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD, "ACT", DependencyType::IntraBank, "tRCD"},
{tRDWR, "RD", DependencyType::IntraBank, "tRDWR"}, //
{tRDWR, "RD", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RD", DependencyType::InterRank, "tRDWR_R"},
{tRDWR, "RDA", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tCCD, "WR", DependencyType::IntraBank, "tCCD"},
{tCCD, "WR", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD, "WRA", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{4 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREPB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + 2 * tCK, "ACT", DependencyType::IntraBank, "tRAS + 2 * tCK"},
{tRDPRE, "RD", DependencyType::IntraBank, "tRDPRE"},
{tWRPRE, "WR", DependencyType::IntraBank, "tWRPRE"},
{tPPD, "PREPB", DependencyType::IntraRank, "tPPD"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{2 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RDA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD, "ACT", DependencyType::IntraBank, "tRCD"},
{tCCD, "RD", DependencyType::IntraBank, "tCCD"},
{tCCD, "RD", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "RD", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD, "RDA", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "RDA", DependencyType::InterRank, "tBURST + tRTRS"},
{max({tWRRD, tWRPRE - tRDPRE}), "WR", DependencyType::IntraBank, "max(tWRRD, tWRPRE - tRDPRE)"},
{tWRRD, "WR", DependencyType::IntraRank, "tWRRD"},
{tWRRD_R, "WR", DependencyType::InterRank, "tWRRD_R"},
{tWRRD, "WRA", DependencyType::IntraRank, "tWRRD"},
{tWRRD_R, "WRA", DependencyType::InterRank, "tWRRD_R"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{4 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WRA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD, "ACT", DependencyType::IntraBank, "tRCD"},
{tRDWR, "RD", DependencyType::IntraBank, "tRDWR"},
{tRDWR, "RD", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RD", DependencyType::InterRank, "tRDWR_R"},
{tRDWR, "RDA", DependencyType::IntraRank, "tRDWR"},
{tRDWR_R, "RDA", DependencyType::InterRank, "tRDWR_R"},
{tCCD, "WR", DependencyType::IntraBank, "tCCD"},
{tCCD, "WR", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "WR", DependencyType::InterRank, "tBURST + tRTRS"},
{tCCD, "WRA", DependencyType::IntraRank, "tCCD"},
{tBURST + tRTRS, "WRA", DependencyType::InterRank, "tBURST + tRTRS"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{4 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFPB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCpb + 2 * tCK, "ACT", DependencyType::IntraBank, "tRCpb + 2 * tCK"},
{tRRD + 2 * tCK, "ACT", DependencyType::IntraRank, "tRRD + 2 * tCK"},
{tRDPRE + tRPpb, "RDA", DependencyType::IntraBank, "tRDPRE + tRPpb"},
{tWRPRE + tRPpb, "WRA", DependencyType::IntraBank, "tWRPRE + tRPpb"},
{tRPpb, "PREPB", DependencyType::IntraBank, "tRPpb"},
{tRPab, "PREAB", DependencyType::IntraRank, "tRPab"},
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tRFCab, "REFAB", DependencyType::IntraRank, "tRFCab"},
{tRFCpb, "REFPB", DependencyType::IntraBank, "tRFCpb"}, //
{tRFCpb, "REFPB", DependencyType::IntraRank, "tRFCpb"},
{tXSR, "SREFEX", DependencyType::IntraRank, "tXSR"},
{2 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
{tFAW, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCpb + 2 * tCK, "ACT", DependencyType::IntraRank, "tRCpb + 2 * tCK"},
{tRDPRE + tRPpb, "RDA", DependencyType::IntraRank, "tRDPRE + tRPpb"},
{tWRPRE + tRPpb, "WRA", DependencyType::IntraRank, "tWRPRE + tRPpb"},
{tRPpb, "PREPB", DependencyType::IntraRank, "tRPpb"},
{tRPab, "PREAB", DependencyType::IntraRank, "tRPab"},
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFCab, "REFAB", DependencyType::IntraRank, "tRFCab"},
{tRFCpb, "REFPB", DependencyType::IntraRank, "tRFCpb"},
{tXSR, "SREFEX", DependencyType::IntraRank, "tXSR"},
{2 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + 2 * tCK, "ACT", DependencyType::IntraRank, "tRAS + 2 * tCK"},
{tRDPRE, "RD", DependencyType::IntraRank, "tRDPRE"},
{tRDPRE, "RDA", DependencyType::IntraRank, "tRDPRE"},
{tWRPRE, "WR", DependencyType::IntraRank, "tWRPRE"},
{tWRPRE, "WRA", DependencyType::IntraRank, "tWRPRE"},
{tPPD, "PREPB", DependencyType::IntraRank, "tPPD"},
{tXP, "PDXA", DependencyType::IntraRank, "tXP"},
{tRFCpb, "REFPB", DependencyType::IntraRank, "tRFCpb"},
{2 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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"},
{tREFPDEN, "REFPB", DependencyType::IntraRank, "tREFPDEN"},
{tXSR, "SREFEX", DependencyType::IntraRank, "tXSR"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXP"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tCKE, "PDEP", DependencyType::IntraRank, "tCKE"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SREFEN"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCpb + 2 * tCK, "ACT", DependencyType::IntraRank, "tRCpb + 2 * tCK"},
{max({tRDPDEN, tRDPRE + tRPpb}), "RDA", DependencyType::IntraRank, "max(tRDPDEN, tRDPRE + tRPpb)"},
{max({tWRAPDEN, tWRPRE + tRPpb}), "WRA", DependencyType::IntraRank, "max(tWRAPDEN, tWRPRE + tRPpb)"},
{tRPpb, "PREPB", DependencyType::IntraRank, "tRPpb"},
{tRPab, "PREAB", DependencyType::IntraRank, "tRPab"},
{tXP, "PDXP", DependencyType::IntraRank, "tXP"},
{tRFCab, "REFAB", DependencyType::IntraRank, "tRFCab"},
{tRFCpb, "REFPB", DependencyType::IntraRank, "tRFCpb"},
{tXSR, "SREFEX", DependencyType::IntraRank, "tXSR"},
{2 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SREFEX"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tSR, "SREFEN", DependencyType::IntraRank, "tSR"},
{tXP, "SRPDEX", DependencyType::IntraRank, "tXP"}, //
{2 * tCK, "CMD_BUS", DependencyType::InterRank, "CommandBus"},
}
)
);
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"},
{tREFPDEN, "REFPB", DependencyType::IntraRank, "tREFPDEN"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PDXA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tCKE, "PDEA", DependencyType::IntraRank, "tCKE"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SRPDEN"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tSREFPDEN, "SREFEN", DependencyType::IntraRank, "tSREFPDEN"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("SRPDEX"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tCKE, "SRPDEN", DependencyType::IntraRank, "tCKE"},
}
)
);
return dmap;
}

View File

@@ -0,0 +1,101 @@
/*
* 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
*/
#pragma once
#include "../dramtimedependenciesbase.h"
class TimeDependenciesInfoLPDDR4 final : public DRAMTimeDependenciesBase {
public:
TimeDependenciesInfoLPDDR4(const QJsonObject& memspec, const uint clk);
static const std::vector<QString> getPossiblePhases();
protected:
void mInitializeValues() override;
DependencyMap mSpecializedGetDependencies() const override;
protected:
uint burstLength;
uint dataRate;
uint tRRD;
uint tRCD;
uint tRAS;
uint tFAW;
uint tRPpb;
uint tRPab;
uint tRCpb;
uint tRCab;
uint tCCD;
uint tRTP;
uint tWR;
uint tWTR;
uint tPPD;
uint tWPRE;
uint tRPST;
uint tDQSCK;
uint tDQSS;
uint tDQS2DQ;
uint tRL;
uint tWL;
uint tRFCab;
uint tRFCpb;
uint tESCKE;
uint tSR;
uint tXSR;
uint tXP;
uint tCKE;
uint tCMDCKE;
uint tRTRS;
uint tBURST;
uint tRDWR;
uint tRDWR_R;
uint tWRRD;
uint tWRRD_R;
uint tRDPRE;
uint tRDAACT;
uint tWRPRE;
uint tWRAACT;
uint tACTPDEN;
uint tPRPDEN;
uint tRDPDEN;
uint tWRPDEN;
uint tWRAPDEN;
uint tREFPDEN;
uint tSREFPDEN;
};

View File

@@ -0,0 +1,405 @@
/*
* 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 "TimeDependenciesInfoLPDDR5.h"
using namespace std;
TimeDependenciesInfoLPDDR5::TimeDependenciesInfoLPDDR5(const QJsonObject& memspec, const uint tCK) : DRAMTimeDependenciesBase(memspec, tCK) {
mInitializeValues();
}
void TimeDependenciesInfoLPDDR5::mInitializeValues() {
burstLength = mMemspecJson["memarchitecturespec"].toObject()["burstLength"].toInt();
dataRate = mMemspecJson["memarchitecturespec"].toObject()["dataRate"].toInt();
per2BankOffset = mMemspecJson["memarchitecturespec"].toObject()["per2BankOffset"].toInt();
tRCD = tCK * mMemspecJson["memtimingspec"].toObject()["RCD"].toInt();
tRPpb = tCK * mMemspecJson["memtimingspec"].toObject()["RPpb"].toInt();
tRPab = tCK * mMemspecJson["memtimingspec"].toObject()["RPab"].toInt();
tRAS = tCK * mMemspecJson["memtimingspec"].toObject()["RAS"].toInt();
tRCpb = tCK * mMemspecJson["memtimingspec"].toObject()["RCpb"].toInt();
tRCab = tCK * mMemspecJson["memtimingspec"].toObject()["RCab"].toInt();
tCL = tCK * mMemspecJson["memtimingspec"].toObject()["CL"].toInt();
tCWL = tCK * mMemspecJson["memtimingspec"].toObject()["CWL"].toInt();
tAL = tCK * mMemspecJson["memtimingspec"].toObject()["AL"].toInt();
tRL = tCK * mMemspecJson["memtimingspec"].toObject()["RL"].toInt();
tRPRE = tCK * mMemspecJson["memtimingspec"].toObject()["RPRE"].toInt();
tWPRE = tCK * mMemspecJson["memtimingspec"].toObject()["WPRE"].toInt();
tWL = tCK * mMemspecJson["memtimingspec"].toObject()["WL"].toInt();
tCCD_S = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_S"].toInt();
tCCD_L = tCK * mMemspecJson["memtimingspec"].toObject()["CCD_L"].toInt();
tRRD = tCK * mMemspecJson["memtimingspec"].toObject()["RRD"].toInt();
tFAW = tCK * mMemspecJson["memtimingspec"].toObject()["FAW"].toInt();
tWTR_S = tCK * mMemspecJson["memtimingspec"].toObject()["WTR_S"].toInt();
tWTR_L = tCK * mMemspecJson["memtimingspec"].toObject()["WTR_L"].toInt();
tRTP = tCK * mMemspecJson["memtimingspec"].toObject()["RTP"].toInt();
tWR = tCK * mMemspecJson["memtimingspec"].toObject()["WR"].toInt();
tRFCab = tCK * mMemspecJson["memtimingspec"].toObject()["RFCab"].toInt();
tRFCpb = tCK * mMemspecJson["memtimingspec"].toObject()["RFCpb"].toInt();
tXS = tCK * mMemspecJson["memtimingspec"].toObject()["XS"].toInt();
tXSDLL = tCK * mMemspecJson["memtimingspec"].toObject()["XSDLL"].toInt();
tXP = tCK * mMemspecJson["memtimingspec"].toObject()["XP"].toInt();
tCKE = tCK * mMemspecJson["memtimingspec"].toObject()["CKE"].toInt();
tCKESR = tCK * mMemspecJson["memtimingspec"].toObject()["CKESR"].toInt();
tPD = tCK * mMemspecJson["memtimingspec"].toObject()["PD"].toInt();
tPRPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["PRPDEN"].toInt();
tREFPDEN = tCK * mMemspecJson["memtimingspec"].toObject()["REFPDEN"].toInt();
tRTRS = tCK * mMemspecJson["memtimingspec"].toObject()["RTRS"].toInt();
tRBTP = tCK * mMemspecJson["memtimingspec"].toObject()["RBTP"].toInt();
BL_n_min_16 = tCK * mMemspecJson["memtimingspec"].toObject()["BL_n_min_16"].toInt();
BL_n_min_32 = tCK * mMemspecJson["memtimingspec"].toObject()["BL_n_min_32"].toInt();
BL_n_max_16 = tCK * mMemspecJson["memtimingspec"].toObject()["BL_n_max_16"].toInt();
BL_n_max_32 = tCK * mMemspecJson["memtimingspec"].toObject()["BL_n_max_32"].toInt();
BL_n_S_16 = tCK * mMemspecJson["memtimingspec"].toObject()["BL_n_S_16"].toInt();
BL_n_S_32 = tCK * mMemspecJson["memtimingspec"].toObject()["BL_n_S_32"].toInt();
BL_n_L_16 = tCK * mMemspecJson["memtimingspec"].toObject()["BL_n_L_16"].toInt();
BL_n_L_32 = tCK * mMemspecJson["memtimingspec"].toObject()["BL_n_L_32"].toInt();
tWCK2DQO = tCK * mMemspecJson["memtimingspec"].toObject()["WCK2DQO"].toInt();
tPPD = tCK * mMemspecJson["memtimingspec"].toObject()["PPD"].toInt();
tpbR2act = tCK * mMemspecJson["memtimingspec"].toObject()["pbR2act"].toInt();
tpbR2pbR = tCK * mMemspecJson["memtimingspec"].toObject()["pbR2pbR"].toInt();
tBURST16 = (uint) (16 / (float) dataRate) * tCK;
tBURST32 = (uint) (32 / (float) dataRate) * tCK;
mPools.insert({
"CMD_BUS", {
1, {
{"ACT", 2 * tCK},
{"RD", tCK},
{"WR", tCK},
{"RDA", tCK},
{"WRA", tCK},
{"PREPB", tCK},
{"PREAB", tCK},
{"REFAB", tCK},
{"REFPB", tCK},
{"REFP2B", tCK},
}
}
});
mPools.insert({
"NAW", {
4, {
{"ACT", tFAW},
{"REFPB", tFAW},
{"REFP2B", tFAW},
}
}
});
}
const std::vector<QString> TimeDependenciesInfoLPDDR5::getPossiblePhases() {
return {
"ACT",
"RD",
"WR",
"PREPB",
"RDA",
"WRA",
"REFPB",
"REFP2B",
"REFAB",
"PREAB",
};
}
DependencyMap TimeDependenciesInfoLPDDR5::mSpecializedGetDependencies() const {
DependencyMap dmap;
auto passBurstLength16 = std::make_shared<PassFunction>(
[] PASSFUNCTIONDECL {
auto other = std::dynamic_pointer_cast<LPDDR5DBPhaseEntry>(otherPhase);
if (!other) return false;
return other->tBurstLength == 16;
}
);
auto passBurstLength32 = std::make_shared<PassFunction>(
[] PASSFUNCTIONDECL {
auto other = std::dynamic_pointer_cast<LPDDR5DBPhaseEntry>(otherPhase);
if (!other) return false;
return other->tBurstLength == 32;
}
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("ACT"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCpb, "ACT", DependencyType::IntraBank, "tRCpb"},
{tRRD, "ACT", DependencyType::IntraRank, "tRRD"},
{BL_n_min_16 + tRBTP + tRPpb - tCK, "RDA", DependencyType::IntraBank, "BL_n_min_16 + tRBTP + tRPpb - tCK", passBurstLength16},
{BL_n_min_32 + tRBTP + tRPpb - tCK, "RDA", DependencyType::IntraBank, "BL_n_min_32 + tRBTP + tRPpb - tCK", passBurstLength32},
{tWL + BL_n_min_16 + tCK + tWR + tRPpb - tCK, "WRA", DependencyType::IntraBank, "tWL + BL_n_min_16 + tCK + tWR + tRPpb - tCK", passBurstLength16},
{tWL + BL_n_min_32 + tCK + tWR + tRPpb - tCK, "WRA", DependencyType::IntraBank, "tWL + BL_n_min_32 + tCK + tWR + tRPpb - tCK", passBurstLength32},
{tRPpb - tCK, "PREPB", DependencyType::IntraBank, "tRPpb - tCK"},
{tRPab - tCK, "PREAB", DependencyType::IntraRank, "tRPab - tCK"},
{tRFCab - tCK, "REFAB", DependencyType::IntraRank, "tRFCab - tCK"},
{tpbR2act - tCK, "REFPB", DependencyType::IntraRank, "tpbR2act - tCK"},
{tpbR2act - tCK, "REFP2B", DependencyType::IntraRank, "tpbR2act - tCK"},
{tRFCpb - tCK, "REFPB", DependencyType::IntraBank, "tRFCpb - tCK"},
{tRFCpb - tCK, "REFP2B", DependencyType::IntraBank, "tRFCpb - tCK"},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
{0, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RD"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD + tCK, "ACT", DependencyType::IntraBank, "tRCD + tCK"},
{BL_n_L_16, "RD", DependencyType::IntraBankGroup, "BL_n_L_16", passBurstLength16},
{BL_n_L_32, "RD", DependencyType::IntraBankGroup, "BL_n_L_32", passBurstLength32},
{BL_n_S_16, "RD", DependencyType::IntraRank, "BL_n_S_16", passBurstLength16},
{BL_n_S_32, "RD", DependencyType::IntraRank, "BL_n_S_32", passBurstLength32},
{tBURST16 + tRTRS, "RD", DependencyType::InterRank, "tBURST16 + tRTRS", passBurstLength16},
{tBURST32 + tRTRS, "RD", DependencyType::InterRank, "tBURST32 + tRTRS", passBurstLength32},
{BL_n_L_16, "RDA", DependencyType::IntraBankGroup, "BL_n_L_16", passBurstLength16},
{BL_n_L_32, "RDA", DependencyType::IntraBankGroup, "BL_n_L_32", passBurstLength32},
{BL_n_S_16, "RDA", DependencyType::IntraRank, "BL_n_S_16", passBurstLength16},
{BL_n_S_32, "RDA", DependencyType::IntraRank, "BL_n_S_32", passBurstLength32},
{tBURST16 + tRTRS, "RDA", DependencyType::InterRank, "tBURST16 + tRTRS", passBurstLength16},
{tBURST32 + tRTRS, "RDA", DependencyType::InterRank, "tBURST32 + tRTRS", passBurstLength32},
{tWL + BL_n_max_16 + tWTR_L, "WR", DependencyType::IntraBankGroup, "tWL + BL_n_max_16 + tWTR_L", passBurstLength16},
{tWL + BL_n_max_32 + tWTR_L, "WR", DependencyType::IntraBankGroup, "tWL + BL_n_max_32 + tWTR_L", passBurstLength32},
{tWL + BL_n_min_16 + tWTR_S, "WR", DependencyType::IntraRank, "tWL + BL_n_min_16 + tWTR_S", passBurstLength16},
{tWL + BL_n_min_32 + tWTR_S, "WR", DependencyType::IntraRank, "tWL + BL_n_min_32 + tWTR_S", passBurstLength32},
{tWL + BL_n_max_16 + tWTR_L, "WRA", DependencyType::IntraBankGroup, "tWL + BL_n_max_16 + tWTR_L", passBurstLength16},
{tWL + BL_n_max_32 + tWTR_L, "WRA", DependencyType::IntraBankGroup, "tWL + BL_n_max_32 + tWTR_L", passBurstLength32},
{tWL + BL_n_min_16 + tWTR_S, "WRA", DependencyType::IntraRank, "tWL + BL_n_min_16 + tWTR_S", passBurstLength16},
{tWL + BL_n_min_32 + tWTR_S, "WRA", DependencyType::IntraRank, "tWL + BL_n_min_32 + tWTR_S", passBurstLength32},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WR"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD + tCK, "ACT", DependencyType::IntraBank, "tRCD + tCK"},
{tRL + BL_n_max_16 + tWCK2DQO - tWL, "RD", DependencyType::IntraBankGroup, "tRL + BL_n_max_16 + tWCK2DQO - tWL", passBurstLength16},
{tRL + BL_n_max_32 + tWCK2DQO - tWL, "RD", DependencyType::IntraBankGroup, "tRL + BL_n_max_32 + tWCK2DQO - tWL", passBurstLength32},
{tRL + BL_n_min_16 + tWCK2DQO - tWL, "RD", DependencyType::IntraRank, "tRL + BL_n_min_16 + tWCK2DQO - tWL", passBurstLength16},
{tRL + BL_n_min_32 + tWCK2DQO - tWL, "RD", DependencyType::IntraRank, "tRL + BL_n_min_32 + tWCK2DQO - tWL", passBurstLength32},
{tRL + BL_n_max_16 + tWCK2DQO - tWL, "RDA", DependencyType::IntraBankGroup, "tRL + BL_n_max_16 + tWCK2DQO - tWL", passBurstLength16},
{tRL + BL_n_max_32 + tWCK2DQO - tWL, "RDA", DependencyType::IntraBankGroup, "tRL + BL_n_max_32 + tWCK2DQO - tWL", passBurstLength32},
{tRL + BL_n_min_16 + tWCK2DQO - tWL, "RDA", DependencyType::IntraRank, "tRL + BL_n_min_16 + tWCK2DQO - tWL", passBurstLength16},
{tRL + BL_n_min_32 + tWCK2DQO - tWL, "RDA", DependencyType::IntraRank, "tRL + BL_n_min_32 + tWCK2DQO - tWL", passBurstLength32},
{BL_n_L_16, "WR", DependencyType::IntraBankGroup, "BL_n_L_16", passBurstLength16},
{BL_n_L_32, "WR", DependencyType::IntraBankGroup, "BL_n_L_32", passBurstLength32},
{BL_n_S_16, "WR", DependencyType::IntraRank, "BL_n_S_16", passBurstLength16},
{BL_n_S_32, "WR", DependencyType::IntraRank, "BL_n_S_32", passBurstLength32},
{tBURST16 + tRTRS, "WR", DependencyType::InterRank, "tBURST16 + tRTRS", passBurstLength16},
{tBURST32 + tRTRS, "WR", DependencyType::InterRank, "tBURST32 + tRTRS", passBurstLength32},
{BL_n_L_16, "WRA", DependencyType::IntraBankGroup, "BL_n_L_16", passBurstLength16},
{BL_n_L_32, "WRA", DependencyType::IntraBankGroup, "BL_n_L_32", passBurstLength32},
{BL_n_S_16, "WRA", DependencyType::IntraRank, "BL_n_S_16", passBurstLength16},
{BL_n_S_32, "WRA", DependencyType::IntraRank, "BL_n_S_32", passBurstLength32},
{tBURST16 + tRTRS, "WRA", DependencyType::InterRank, "tBURST16 + tRTRS", passBurstLength16},
{tBURST32 + tRTRS, "WRA", DependencyType::InterRank, "tBURST32 + tRTRS", passBurstLength32},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREPB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + tCK, "ACT", DependencyType::IntraBank, "tRAS + tCK"},
{BL_n_min_16 + tRBTP, "RD", DependencyType::IntraBank, "BL_n_min_16 + tRBTP", passBurstLength16},
{BL_n_min_32 + tRBTP, "RD", DependencyType::IntraBank, "BL_n_min_32 + tRBTP", passBurstLength32},
{tWL + BL_n_min_16 + tCK + tWR, "WR", DependencyType::IntraBank, "tWL + BL_n_min_16 + tCK + tWR", passBurstLength16},
{tWL + BL_n_min_32 + tCK + tWR, "WR", DependencyType::IntraBank, "tWL + BL_n_min_32 + tCK + tWR", passBurstLength32},
{tPPD, "PREPB", DependencyType::IntraRank, "tPPD"},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("RDA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD + tCK, "ACT", DependencyType::IntraBank, "tRCD + tCK"},
{BL_n_L_16, "RD", DependencyType::IntraBankGroup, "BL_n_L_16", passBurstLength16},
{BL_n_L_32, "RD", DependencyType::IntraBankGroup, "BL_n_L_32", passBurstLength32},
{BL_n_S_16, "RD", DependencyType::IntraRank, "BL_n_S_16", passBurstLength16},
{BL_n_S_32, "RD", DependencyType::IntraRank, "BL_n_S_32", passBurstLength32},
{tBURST16 + tRTRS, "RD", DependencyType::InterRank, "tBURST16 + tRTRS", passBurstLength16},
{tBURST32 + tRTRS, "RD", DependencyType::InterRank, "tBURST32 + tRTRS", passBurstLength32},
{BL_n_L_16, "RDA", DependencyType::IntraBankGroup, "BL_n_L_16", passBurstLength16},
{BL_n_L_32, "RDA", DependencyType::IntraBankGroup, "BL_n_L_32", passBurstLength32},
{BL_n_S_16, "RDA", DependencyType::IntraRank, "BL_n_S_16", passBurstLength16},
{BL_n_S_32, "RDA", DependencyType::IntraRank, "BL_n_S_32", passBurstLength32},
{tBURST16 + tRTRS, "RDA", DependencyType::InterRank, "tBURST16 + tRTRS", passBurstLength16},
{tBURST32 + tRTRS, "RDA", DependencyType::InterRank, "tBURST32 + tRTRS", passBurstLength32},
{tWL + BL_n_max_16 + tWTR_L, "WR", DependencyType::IntraBankGroup, "tWL + BL_n_max_16 + tWTR_L", passBurstLength16},
{tWL + BL_n_max_32 + tWTR_L, "WR", DependencyType::IntraBankGroup, "tWL + BL_n_max_32 + tWTR_L", passBurstLength32},
{tWL + BL_n_min_16 + tWTR_S, "WR", DependencyType::IntraRank, "tWL + BL_n_min_16 + tWTR_S", passBurstLength16},
{tWL + BL_n_min_32 + tWTR_S, "WR", DependencyType::IntraRank, "tWL + BL_n_min_32 + tWTR_S", passBurstLength32},
{tWL + BL_n_max_16 + tWTR_L, "WRA", DependencyType::IntraBankGroup, "tWL + BL_n_max_16 + tWTR_L", passBurstLength16},
{tWL + BL_n_max_32 + tWTR_L, "WRA", DependencyType::IntraBankGroup, "tWL + BL_n_max_32 + tWTR_L", passBurstLength32},
{tWL + BL_n_min_16 + tWTR_S, "WRA", DependencyType::IntraRank, "tWL + BL_n_min_16 + tWTR_S", passBurstLength16},
{tWL + BL_n_min_32 + tWTR_S, "WRA", DependencyType::IntraRank, "tWL + BL_n_min_32 + tWTR_S", passBurstLength32},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("WRA"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCD + tCK, "ACT", DependencyType::IntraBank, "tRCD + tCK"},
{tRL + BL_n_max_16 + tWCK2DQO - tWL, "RD", DependencyType::IntraBankGroup, "tRL + BL_n_max_16 + tWCK2DQO - tWL", passBurstLength16},
{tRL + BL_n_max_32 + tWCK2DQO - tWL, "RD", DependencyType::IntraBankGroup, "tRL + BL_n_max_32 + tWCK2DQO - tWL", passBurstLength32},
{tRL + BL_n_min_16 + tWCK2DQO - tWL, "RD", DependencyType::IntraRank, "tRL + BL_n_min_16 + tWCK2DQO - tWL", passBurstLength16},
{tRL + BL_n_min_32 + tWCK2DQO - tWL, "RD", DependencyType::IntraRank, "tRL + BL_n_min_32 + tWCK2DQO - tWL", passBurstLength32},
{tRL + BL_n_max_16 + tWCK2DQO - tWL, "RDA", DependencyType::IntraBankGroup, "tRL + BL_n_max_16 + tWCK2DQO - tWL", passBurstLength16},
{tRL + BL_n_max_32 + tWCK2DQO - tWL, "RDA", DependencyType::IntraBankGroup, "tRL + BL_n_max_32 + tWCK2DQO - tWL", passBurstLength32},
{tRL + BL_n_min_16 + tWCK2DQO - tWL, "RDA", DependencyType::IntraRank, "tRL + BL_n_min_16 + tWCK2DQO - tWL", passBurstLength16},
{tRL + BL_n_min_32 + tWCK2DQO - tWL, "RDA", DependencyType::IntraRank, "tRL + BL_n_min_32 + tWCK2DQO - tWL", passBurstLength32},
{BL_n_L_16, "WR", DependencyType::IntraBankGroup, "BL_n_L_16", passBurstLength16},
{BL_n_L_32, "WR", DependencyType::IntraBankGroup, "BL_n_L_32", passBurstLength32},
{BL_n_S_16, "WR", DependencyType::IntraRank, "BL_n_S_16", passBurstLength16},
{BL_n_S_32, "WR", DependencyType::IntraRank, "BL_n_S_32", passBurstLength32},
{tBURST16 + tRTRS, "WR", DependencyType::InterRank, "tBURST16 + tRTRS", passBurstLength16},
{tBURST32 + tRTRS, "WR", DependencyType::InterRank, "tBURST32 + tRTRS", passBurstLength32},
{BL_n_L_16, "WRA", DependencyType::IntraBankGroup, "BL_n_L_16", passBurstLength16},
{BL_n_L_32, "WRA", DependencyType::IntraBankGroup, "BL_n_L_32", passBurstLength32},
{BL_n_S_16, "WRA", DependencyType::IntraRank, "BL_n_S_16", passBurstLength16},
{BL_n_S_32, "WRA", DependencyType::IntraRank, "BL_n_S_32", passBurstLength32},
{tBURST16 + tRTRS, "WRA", DependencyType::InterRank, "tBURST16 + tRTRS", passBurstLength16},
{tBURST32 + tRTRS, "WRA", DependencyType::InterRank, "tBURST32 + tRTRS", passBurstLength32},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCpb + tCK, "ACT", DependencyType::IntraRank, "tRCpb + tCK"},
{BL_n_min_16 + tRBTP + tRPpb, "RDA", DependencyType::IntraRank, "BL_n_min_16 + tRBTP + tRPpb", passBurstLength16},
{BL_n_min_32 + tRBTP + tRPpb, "RDA", DependencyType::IntraRank, "BL_n_min_32 + tRBTP + tRPpb", passBurstLength32},
{tWL + BL_n_min_16 + tCK + tWR + tRPpb, "WRA", DependencyType::IntraRank, "tWL + BL_n_min_16 + tCK + tWR + tRPpb", passBurstLength16},
{tWL + BL_n_min_32 + tCK + tWR + tRPpb, "WRA", DependencyType::IntraRank, "tWL + BL_n_min_32 + tCK + tWR + tRPpb", passBurstLength32},
{tRPpb, "PREPB", DependencyType::IntraRank, "tRPpb"},
{tRPab, "PREAB", DependencyType::IntraRank, "tRPab"},
{tRFCab, "REFAB", DependencyType::IntraRank, "tRFCab"},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("PREAB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRAS + tCK, "ACT", DependencyType::IntraRank, "tRAS + tCK"},
{BL_n_min_16 + tRBTP, "RD", DependencyType::IntraRank, "BL_n_min_16 + tRBTP", passBurstLength16},
{BL_n_min_32 + tRBTP, "RD", DependencyType::IntraRank, "BL_n_min_32 + tRBTP", passBurstLength32},
{BL_n_min_16 + tRBTP, "RDA", DependencyType::IntraRank, "BL_n_min_16 + tRBTP", passBurstLength16},
{BL_n_min_32 + tRBTP, "RDA", DependencyType::IntraRank, "BL_n_min_32 + tRBTP", passBurstLength32},
{tWL + BL_n_min_16 + tCK + tWR, "WR", DependencyType::IntraRank, "tWL + BL_n_min_16 + tCK + tWR", passBurstLength16},
{tWL + BL_n_min_32 + tCK + tWR, "WR", DependencyType::IntraRank, "tWL + BL_n_min_32 + tCK + tWR", passBurstLength32},
{tWL + BL_n_min_16 + tCK + tWR, "WRA", DependencyType::IntraRank, "tWL + BL_n_min_16 + tCK + tWR", passBurstLength16},
{tWL + BL_n_min_32 + tCK + tWR, "WRA", DependencyType::IntraRank, "tWL + BL_n_min_32 + tCK + tWR", passBurstLength32},
{tPPD, "PREPB", DependencyType::IntraRank, "tPPD"},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFPB"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCpb + tCK, "ACT", DependencyType::IntraBank, "tRCpb + tCK"},
{tRRD + tCK, "ACT", DependencyType::IntraRank, "tRRD + tCK"},
{BL_n_min_16 + tRBTP + tRPpb, "RDA", DependencyType::IntraBank, "BL_n_min_16 + tRBTP + tRPpb", passBurstLength16},
{BL_n_min_32 + tRBTP + tRPpb, "RDA", DependencyType::IntraBank, "BL_n_min_32 + tRBTP + tRPpb", passBurstLength32},
{tWL + BL_n_min_16 + tCK + tWR + tRPpb, "WRA", DependencyType::IntraBank, "tWL + BL_n_min_16 + tCK + tWR + tRPpb", passBurstLength16},
{tWL + BL_n_min_32 + tCK + tWR + tRPpb, "WRA", DependencyType::IntraBank, "tWL + BL_n_min_32 + tCK + tWR + tRPpb", passBurstLength32},
{tRPpb, "PREPB", DependencyType::IntraBank, "tRPpb"},
{tRPab, "PREAB", DependencyType::IntraRank, "tRPab"},
{tRFCpb, "REFPB", DependencyType::IntraBank, "tRFCpb"},
{tpbR2pbR, "REFPB", DependencyType::IntraRank, "tpbR2pbR"},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
{0, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
dmap.emplace(
piecewise_construct,
forward_as_tuple("REFP2B"),
forward_as_tuple(
initializer_list<TimeDependency>{
{tRCpb + tCK, "ACT", DependencyType::IntraBank, "tRCpb + tCK"},
{tRRD + tCK, "ACT", DependencyType::IntraRank, "tRRD + tCK"},
{BL_n_min_16 + tRBTP + tRPpb, "RDA", DependencyType::IntraBank, "BL_n_min_16 + tRBTP + tRPpb", passBurstLength16},
{BL_n_min_32 + tRBTP + tRPpb, "RDA", DependencyType::IntraBank, "BL_n_min_32 + tRBTP + tRPpb", passBurstLength32},
{tWL + BL_n_min_16 + tCK + tWR + tRPpb, "WRA", DependencyType::IntraBank, "tWL + BL_n_min_16 + tCK + tWR + tRPpb", passBurstLength16},
{tWL + BL_n_min_32 + tCK + tWR + tRPpb, "WRA", DependencyType::IntraBank, "tWL + BL_n_min_32 + tCK + tWR + tRPpb", passBurstLength32},
{tRPpb, "PREPB", DependencyType::IntraBank, "tRPpb"},
{tRPab, "PREAB", DependencyType::IntraRank, "tRPab"},
{tRFCpb, "REFP2B", DependencyType::IntraBank, "tRFCpb"},
{tpbR2pbR, "REFP2B", DependencyType::IntraRank, "tpbR2pbR"},
{0, "CMD_BUS", DependencyType::InterRank, "CMDBus"},
{0, "NAW", DependencyType::IntraRank, "tFAW"},
}
)
);
return dmap;
}

View File

@@ -0,0 +1,119 @@
/*
* 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
*/
#pragma once
#include "../dramtimedependenciesbase.h"
#include "businessObjects/dramTimeDependencies/dbEntries/specialized/LPDDR5dbphaseentry.h"
class TimeDependenciesInfoLPDDR5 final : public DRAMTimeDependenciesBase {
public:
TimeDependenciesInfoLPDDR5(const QJsonObject& memspec, const uint clk);
static const std::vector<QString> getPossiblePhases();
uint getPer2BankOffset() { return per2BankOffset; }
protected:
void mInitializeValues() override;
DependencyMap mSpecializedGetDependencies() const override;
protected:
uint burstLength;
uint dataRate;
uint per2BankOffset;
uint tRCD;
uint tRPpb;
uint tRPab;
uint tRAS;
uint tRCpb;
uint tRCab;
uint tCL;
uint tCWL;
uint tAL;
uint tRL;
uint tRPRE;
uint tWPRE;
uint tWL;
uint tCCD_S;
uint tCCD_L;
uint tRRD;
uint tFAW;
uint tWTR_S;
uint tWTR_L;
uint tRTP;
uint tWR;
uint tRFCab;
uint tRFCpb;
uint tXS;
uint tXSDLL;
uint tXP;
uint tCKE;
uint tCKESR;
uint tPD;
uint tPRPDEN;
uint tREFPDEN;
uint tRTRS;
uint tRBTP;
uint BL_n_min_16;
uint BL_n_min_32;
uint BL_n_max_16;
uint BL_n_max_32;
uint BL_n_S_16;
uint BL_n_S_32;
uint BL_n_L_16;
uint BL_n_L_32;
uint tWCK2DQO;
uint tPPD;
uint tpbR2act;
uint tpbR2pbR;
uint tBURST16;
uint tBURST32;
uint tRDWR;
uint tRDWR_R;
uint tWRRD_S;
uint tWRRD_L;
uint tWRRD_R;
uint tRDAACT;
uint tWRPRE;
uint tWRAACT;
uint tRDPDEN;
uint tWRPDEN;
uint tWRAPDEN;
};

View File

@@ -0,0 +1,329 @@
/*
* 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 "phasedependenciestracker.h"
#include <chrono>
#include <iostream>
void
PhaseDependenciesTracker::calculateDependencies(TraceDB& tdb, std::vector<QString>& commands) {
using std::chrono::high_resolution_clock;
using std::chrono::duration_cast;
using std::chrono::duration;
using std::chrono::microseconds;
auto deviceInstantiationTimeStart = high_resolution_clock::now();
auto deviceConfig = ConfigurationFactory::make(tdb);
auto deviceInstantiationTimeEnd = high_resolution_clock::now();
auto deviceInstantiationTimeDuration = duration_cast<microseconds>(deviceInstantiationTimeEnd - deviceInstantiationTimeStart);
mBeginTransaction(tdb);
mDropTable(tdb);
if (commands.size() > 0) {
auto phasesLoadingTimeStart = high_resolution_clock::now();
auto& phases = mGetFilteredPhases(deviceConfig, tdb, commands);
auto phasesLoadingTimeEnd = high_resolution_clock::now();
auto phasesLoadingTimeDuration = duration_cast<microseconds>(phasesLoadingTimeEnd - phasesLoadingTimeStart);
if (phases.size() != 0) {
auto dependenciesCalcTimeStart = high_resolution_clock::now();
auto& entries = mCalculateDependencies(deviceConfig, phases, commands);
auto dependenciesCalcTimeEnd = high_resolution_clock::now();
auto dependenciesCalcTimeDuration = duration_cast<microseconds>(dependenciesCalcTimeEnd - dependenciesCalcTimeStart);
if (entries.size() > 0) {
mCreateTable(tdb);
}
auto tableInsertionTimeStart = high_resolution_clock::now();
mInsertIntoTable(tdb, entries);
auto tableInsertionTimeEnd = high_resolution_clock::now();
auto tableInsertionTimeDuration = duration_cast<microseconds>(tableInsertionTimeEnd - tableInsertionTimeStart);
auto totalTime = deviceInstantiationTimeDuration + phasesLoadingTimeDuration + dependenciesCalcTimeDuration + tableInsertionTimeDuration;
std::cout << "PhaseDependenciesTracker times (us):" << std::endl
<< "\tDevice instantiation: " << deviceInstantiationTimeDuration.count() << std::endl
<< "\tPhase loading: " << phasesLoadingTimeDuration.count() << std::endl
<< "\tDependencies calculation: " << dependenciesCalcTimeDuration.count() << std::endl
<< "\tDB table population: " << tableInsertionTimeDuration.count() << std::endl
<< " - Total time: " << totalTime.count() << std::endl;
} else {
// TODO - not sure if necessary. Still, a possibility
// mRollbackChanges(tdb);
// return;
}
}
mCommitTransaction(tdb);
}
void PhaseDependenciesTracker::mDropTable(TraceDB& tdb) {
QString command = "DROP TABLE IF EXISTS DirectDependencies; ";
auto query = mExecuteQuery(tdb, command);
query.finish();
}
void PhaseDependenciesTracker::mCreateTable(TraceDB& tdb) {
QString command = "CREATE TABLE DirectDependencies( DelayedPhaseID INT, DelayedPhaseName, DependencyType, TimeDependency, DependencyPhaseID INT, DependencyPhaseName ); ";
auto query = mExecuteQuery(tdb, command);
query.finish();
}
void PhaseDependenciesTracker::mInsertIntoTable(TraceDB& tdb, const std::vector<DBDependencyEntry>& entries) {
static const size_t bulkInsertionSize = 30;
auto numberOfEntries = entries.size();
QString command;
size_t counter = 0;
for (const auto& entry : entries) {
if (counter == 0) {
// Reset command string and add first entry
command = "INSERT INTO 'DirectDependencies' ('DelayedPhaseID', 'DelayedPhaseName', 'DependencyType', 'TimeDependency', 'DependencyPhaseID', 'DependencyPhaseName') ";
mAddFirstEntryCommandString(command, entry);
counter++;
} else if (counter == bulkInsertionSize-1) {
// Write last entry and submit
mAddEntryCommandString(command, entry);
auto query = mExecuteQuery(tdb, command);
query.finish();
counter = 0;
} else {
// Write entry
mAddEntryCommandString(command, entry);
counter++;
}
}
if (counter != 0) {
auto query = mExecuteQuery(tdb, command);
query.finish();
}
}
const std::vector<std::shared_ptr<DBPhaseEntryBase>>
PhaseDependenciesTracker::mGetFilteredPhases(const std::shared_ptr<ConfigurationBase> deviceConfig, TraceDB& tdb, const std::vector<QString>& commands)
{
std::vector<std::shared_ptr<DBPhaseEntryBase>> phases;
QString queryStr = deviceConfig->getQueryStr(commands);
auto query = mExecuteQuery(tdb, queryStr);
if (!query.next())
return phases;
if (!query.last()) {
throw sqlException( ("Query:\n " + tdb.queryToString(query) + "\n failed. Error: \n"
"Could not retrieve number of rows\n").toStdString(),
tdb.pathToDB.toStdString());
}
size_t nrows = query.at() + 1;
if (!query.first()) {
throw sqlException( ("Query:\n " + tdb.queryToString(query) + "\n failed. Error: \n"
"Could not retrieve number of rows safely\n").toStdString(),
tdb.pathToDB.toStdString());
}
phases.resize(nrows);
size_t rowIt = 0;
do {
phases[rowIt] = deviceConfig->makePhaseEntry(query);
++rowIt;
} while (query.next());
if (rowIt != nrows) {
throw std::runtime_error("An error occurred while fetching phases in 'PhaseDependenciesTracker::mGetFilteredPhases': expected " + std::to_string(nrows) + " rows, but found " + std::to_string(rowIt) + "\n");
}
query.finish();
return phases;
}
const std::vector<DBDependencyEntry>
PhaseDependenciesTracker::mCalculateDependencies(const std::shared_ptr<ConfigurationBase> deviceConfig, const std::vector<std::shared_ptr<DBPhaseEntryBase>>& phases, std::vector<QString>& commands) {
std::vector<DBDependencyEntry> entries;
entries.reserve((size_t) (0.4 * phases.size()));
// Get dependencies for device
const DependencyMap deviceDependencies = deviceConfig->getDependencies(commands);
// Tries to find all timing dependencies for each phase on the trace
PoolControllerMap poolController = deviceConfig->getPools();
for (size_t i = 1; i < phases.size(); i++) {
// Pool dependencies variables reset
poolController.clear();
// Auxiliary variables
const auto phase = phases[i];
if (phase == nullptr) continue;
// Get time dependency descriptions for the current phase
const auto& deps = deviceDependencies.at(phase->phaseName);
// Loop all previous phases until there cannot be any more time dependencies
for (int j = i-1; j >= 0; j--) {
// Get next phase to analyse
const auto& otherPhase = phases[j];
// Calculates the time difference in nanoseconds
const auto timeDiff = phase->phaseBegin - otherPhase->phaseBegin;
// Time difference begin greater than the maximum possible dependency time ends the internal loop
if (timeDiff > deps.maxTime) break;
// For each possible dependency for the current phase,
// checks if otherPhase would match as a dependency
for (const auto& dep : deps.dependencies) {
bool isPoolDep = dep.phaseDep.isPool();
if (!isPoolDep && dep.phaseDep != otherPhase->phaseName) continue;
if (!phase->potentialDependency(dep, otherPhase)) {
continue;
}
if (isPoolDep) {
// Captures activate window and command bus dependencies
auto busyTime = poolController.getBusyTime(dep.phaseDep, otherPhase->phaseName);
if (busyTime > 0 && timeDiff <= busyTime) {
if (timeDiff == busyTime) {
// Captures only the first (exactly matching time) phase in
// the pool window as a dependency
poolController.push(dep.phaseDep, DBDependencyEntry{
phase->id,
phase->phaseName.getIDStr(),
PhaseDependency::dependencyTypeName(dep.depType),
dep.timeDepName,
otherPhase->id,
otherPhase->phaseName.getIDStr()
});
}
if (timeDiff < busyTime) {
poolController.increment(dep.phaseDep);
}
}
continue;
}
if (timeDiff == dep.timeValue) {
entries.emplace_back(DBDependencyEntry{
phase->id,
phase->phaseName.getIDStr(),
PhaseDependency::dependencyTypeName(dep.depType),
dep.timeDepName,
otherPhase->id,
otherPhase->phaseName.getIDStr()
});
}
}
}
poolController.merge(entries);
}
return entries;
}
QSqlQuery PhaseDependenciesTracker::mExecuteQuery(TraceDB& tdb, const QString queryStr) {
QSqlQuery query(tdb.database);
query.prepare(queryStr);
tdb.executeQuery(query);
return query;
}
void PhaseDependenciesTracker::mBeginTransaction(TraceDB& tdb) {
const QString queryStr = "BEGIN TRANSACTION;";
auto query = mExecuteQuery(tdb, queryStr);
query.finish();
}
void PhaseDependenciesTracker::mRollbackChanges(TraceDB& tdb) {
const QString queryStr = "ROLLBACK;";
auto query = mExecuteQuery(tdb, queryStr);
query.finish();
}
void PhaseDependenciesTracker::mCommitTransaction(TraceDB& tdb) {
const QString queryStr = "COMMIT;";
auto query = mExecuteQuery(tdb, queryStr);
query.finish();
}
void PhaseDependenciesTracker::mAddFirstEntryCommandString(QString& command, const DBDependencyEntry& entry) {
command = command + " SELECT '" + QString::number(entry.delayedPhaseID) + "' AS 'DelayedPhaseID', '"
+ entry.delayedPhaseName + "' AS 'DelayedPhaseName', '"
+ entry.dependencyType + "' AS 'DependencyType', '"
+ entry.timeDependency + "' AS 'TimeDependency', '"
+ QString::number(entry.dependencyPhaseID) + "' AS 'DependencyPhaseID', '"
+ entry.dependencyPhaseName + "' AS 'DependencyPhaseName' ";
}
void PhaseDependenciesTracker::mAddEntryCommandString(QString& command, const DBDependencyEntry& entry) {
command = command + " UNION ALL SELECT '" + QString::number(entry.delayedPhaseID) + "', '"
+ entry.delayedPhaseName + "', '"
+ entry.dependencyType + "', '"
+ entry.timeDependency + "', '"
+ QString::number(entry.dependencyPhaseID) + "', '"
+ entry.dependencyPhaseName + "' ";
}

View File

@@ -0,0 +1,71 @@
/*
* 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
*/
#pragma once
#include <vector>
#include <string>
#include <QString>
#include "data/tracedb.h"
#include "configurations/configurationfactory.h"
#include "common/common.h"
class PhaseDependenciesTracker {
public:
static void calculateDependencies(TraceDB& tdb, std::vector<QString>& dependencyFilter);
private:
static void mDropTable(TraceDB& tdb);
static void mCreateTable(TraceDB& tdb);
static void mInsertIntoTable(TraceDB& tdb, const std::vector<DBDependencyEntry>& entries);
static const std::vector<std::shared_ptr<DBPhaseEntryBase>> mGetFilteredPhases(const std::shared_ptr<ConfigurationBase>, TraceDB& tdb, const std::vector<QString>& commands);
static const std::vector<DBDependencyEntry> mCalculateDependencies(const std::shared_ptr<ConfigurationBase>, const std::vector<std::shared_ptr<DBPhaseEntryBase>>& phases, std::vector<QString>& commands);
static QSqlQuery mExecuteQuery(TraceDB& tdb, const QString queryStr);
PhaseDependenciesTracker() = delete;
~PhaseDependenciesTracker() = delete;
private:
static void mBeginTransaction(TraceDB& tdb);
static void mRollbackChanges(TraceDB& tdb);
static void mCommitTransaction(TraceDB& tdb);
inline static void mAddFirstEntryCommandString(QString& command, const DBDependencyEntry& entry);
inline static void mAddEntryCommandString(QString& command, const DBDependencyEntry& entry);
};

View File

@@ -0,0 +1,87 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Derek Christ
*/
#ifndef GENERALINFO_H
#define GENERALINFO_H
#include "timespan.h"
#include <QString>
#include <climits>
struct GeneralInfo
{
uint64_t numberOfTransactions = 0;
uint64_t numberOfPhases = 0;
Timespan span = Timespan();
unsigned int numberOfRanks = 1;
unsigned int numberOfBankGroups = 1;
unsigned int numberOfBanks = 1;
unsigned int banksPerRank = 1;
unsigned int groupsPerRank = 1;
unsigned int banksPerGroup = 1;
QString description = "empty";
QString unitOfTime = "PS";
uint64_t clkPeriod = 1000;
uint64_t windowSize = 0;
unsigned int refreshMaxPostponed = 0;
unsigned int refreshMaxPulledin = 0;
unsigned int controllerThread = UINT_MAX;
unsigned int maxBufferDepth = 8;
unsigned int per2BankOffset = 1;
bool rowColumnCommandBus = false;
bool pseudoChannelMode = false;
GeneralInfo() = default;
GeneralInfo(uint64_t numberOfTransactions, uint64_t numberOfPhases, Timespan span, unsigned int numberOfRanks,
unsigned int numberOfBankgroups, unsigned int numberOfBanks, QString description, QString unitOfTime,
uint64_t clkPeriod, uint64_t windowSize, unsigned int refreshMaxPostponed,
unsigned int refreshMaxPulledin, unsigned int controllerThread, unsigned int maxBufferDepth,
unsigned int per2BankOffset, bool rowColumnCommandBus, bool pseudoChannelMode)
: numberOfTransactions(numberOfTransactions), numberOfPhases(numberOfPhases), span(span),
numberOfRanks(numberOfRanks), numberOfBankGroups(numberOfBankgroups), numberOfBanks(numberOfBanks),
banksPerRank(numberOfBanks / numberOfRanks), groupsPerRank(numberOfBankgroups / numberOfRanks),
banksPerGroup(numberOfBanks / numberOfBankgroups), description(std::move(description)),
unitOfTime(std::move(unitOfTime)), clkPeriod(clkPeriod), windowSize(windowSize),
refreshMaxPostponed(refreshMaxPostponed), refreshMaxPulledin(refreshMaxPulledin),
controllerThread(controllerThread), maxBufferDepth(maxBufferDepth), per2BankOffset(per2BankOffset),
rowColumnCommandBus(rowColumnCommandBus), pseudoChannelMode(pseudoChannelMode)
{
}
};
#endif // GENERALINFO_H

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2021, 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 "dependencyinfos.h"
DependencyInfos::DependencyInfos(Type type) : mType(type)
{
}
DependencyInfos::DependencyInfos()
{
mType = DependencyType;
}
DependencyInfos::~DependencyInfos()
{
}
void DependencyInfos::addInfo(DependencyInfo info)
{
mInfos.push_back(info);
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2021, 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
*/
#pragma once
#include <vector>
#include <QString>
struct DependencyInfo
{
QString id;
float value;
};
class DependencyInfos
{
public:
enum Type
{
DependencyType,
TimeDependency,
DelayedPhase,
DependencyPhase
};
public:
DependencyInfos(Type);
DependencyInfos();
~DependencyInfos();
void setType(Type type)
{
mType = type;
}
void addInfo(DependencyInfo);
const std::vector<DependencyInfo> &getInfos() const
{
return mInfos;
}
size_t size() const
{
return mInfos.size();
}
private:
Type mType;
std::vector<DependencyInfo> mInfos;
};

View File

@@ -0,0 +1,374 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Derek Christ
* Iron Prando da Silva
*/
#include "phase.h"
#include "businessObjects/traceplotlinemodel.h"
#include "businessObjects/transaction.h"
#include "presentation/tracedrawing.h"
#include <cmath>
void Phase::draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect,
bool highlight, const TraceDrawingProperties &drawingProperties) const
{
Q_UNUSED(canvasRect);
QColor color = getColor(drawingProperties);
painter->setBrush(QBrush(getColor(drawingProperties), getBrushStyle()));
if (!drawingProperties.drawBorder)
{
painter->setPen(color);
}
else
{
painter->setPen(Qt::black);
}
if (highlight)
{
QPen pen(Qt::red);
pen.setWidth(3);
painter->setPen(pen);
}
for (auto yVal : getYVals(drawingProperties))
{
drawPhaseSymbol(span.Begin(), span.End(), yVal, drawingProperties.drawText, getPhaseSymbol(), painter, xMap,
yMap, drawingProperties.textColor);
DependencyOptions drawDependenciesOptions = drawingProperties.drawDependenciesOption;
if (drawDependenciesOptions.draw == DependencyOption::All ||
(drawDependenciesOptions.draw == DependencyOption::Selected && highlight))
{
drawPhaseDependencies(span.Begin(), span.End(), yVal, drawingProperties, painter, xMap, yMap);
}
}
for (Timespan spanOnCommandBus : spansOnCommandBus)
{
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type == AbstractTracePlotLineModel::RowCommandBusLine)
{
if (isColumnCommand())
continue;
}
else if (line->data.type == AbstractTracePlotLineModel::ColumnCommandBusLine)
{
if (!isColumnCommand())
continue;
}
else if (line->data.type != AbstractTracePlotLineModel::CommandBusLine)
continue;
drawPhaseSymbol(spanOnCommandBus.Begin(), spanOnCommandBus.End(), line->data.yVal, false, PhaseSymbol::Hexagon, painter, xMap, yMap,
drawingProperties.textColor);
}
}
if (spanOnDataStrobe.End() != 0)
{
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type == AbstractTracePlotLineModel::PseudoChannel0Line)
{
if (rank != 0)
continue;
}
else if (line->data.type == AbstractTracePlotLineModel::PseudoChannel1Line)
{
if (rank != 1)
continue;
}
else if (line->data.type != AbstractTracePlotLineModel::DataBusLine)
continue;
drawPhaseSymbol(spanOnDataStrobe.Begin(), spanOnDataStrobe.End(), line->data.yVal, false,
PhaseSymbol::Hexagon, painter, xMap, yMap, drawingProperties.textColor);
}
}
}
void Phase::drawPhaseSymbol(traceTime begin, traceTime end, double y, bool drawtext, PhaseSymbol symbol,
QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QColor& textColor) const
{
double yVal = yMap.transform(y);
double symbolHeight = yMap.transform(0) - yMap.transform(hexagonHeight);
// Increase display size of phases with zero span
traceTime offset = (begin == end) ? static_cast<traceTime>(0.05 * clk) : 0;
if (symbol == PhaseSymbol::Hexagon)
{
QPoint hexFrom(static_cast<int>(xMap.transform(begin)), static_cast<int>(yVal));
QPoint hexTo(static_cast<int>(xMap.transform(end + offset)), static_cast<int>(yVal));
drawHexagon(painter, hexFrom, hexTo, symbolHeight);
}
else
{
QPoint upperLeft(static_cast<int>(xMap.transform(begin)), static_cast<int>(yVal - symbolHeight / 2));
QPoint bottomRight(static_cast<int>(xMap.transform(end)), static_cast<int>(yVal + symbolHeight / 2));
painter->drawRect(QRect(upperLeft, bottomRight));
}
if (drawtext)
drawText(painter, Name(),
QPoint(static_cast<int>(xMap.transform(begin)), static_cast<int>(yVal + symbolHeight / 2)),
TextPositioning::bottomRight, textColor);
}
void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y,
const TraceDrawingProperties &drawingProperties, QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap) const
{
QPen pen;
pen.setWidth(2);
painter->save();
painter->setPen(pen);
painter->setRenderHint(QPainter::Antialiasing);
double yVal = yMap.transform(y);
double symbolHeight = yMap.transform(0) - yMap.transform(hexagonHeight);
traceTime offset = (begin == end) ? static_cast<traceTime>(0.05 * clk) : 0;
size_t invisibleDeps = 0;
QPoint depLineTo(static_cast<int>(xMap.transform(begin /* + (end + offset - begin)/4*/)), static_cast<int>(yVal));
for (const auto& dep : mDependencies)
{
bool visible = false;
if (dep->isVisible())
{
if (!dep->draw(depLineTo, drawingProperties, painter, xMap, yMap))
{
invisibleDeps += 1;
}
}
else
{
invisibleDeps += 1;
}
}
if (invisibleDeps > 0)
{
QPoint invisibleDepsPoint(static_cast<int>(xMap.transform(begin + (end + offset - begin) / 2)),
static_cast<int>(yVal + 0.1 * symbolHeight));
drawText(painter, QString::number(invisibleDeps), invisibleDepsPoint, TextPositioning::centerCenter);
}
painter->restore();
}
std::vector<int> Phase::getYVals(const TraceDrawingProperties &drawingProperties) const
{
std::vector<int> yVals;
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type != AbstractTracePlotLineModel::BankLine)
continue;
unsigned int yVal = line->data.yVal;
unsigned int drawnRank = line->data.rank;
unsigned int drawnBank = line->data.bank;
bool shouldBeDrawn = false;
switch (getGranularity())
{
case Granularity::Rankwise:
shouldBeDrawn = (rank == drawnRank);
break;
case Granularity::Groupwise:
shouldBeDrawn = (rank == drawnRank) && (bank % drawingProperties.banksPerGroup ==
drawnBank % drawingProperties.banksPerGroup);
break;
case Granularity::Bankwise:
shouldBeDrawn = (bank == drawnBank);
break;
case Granularity::TwoBankwise:
shouldBeDrawn = (bank == drawnBank) || ((bank + drawingProperties.per2BankOffset) == drawnBank);
break;
}
if (shouldBeDrawn)
yVals.push_back(yVal);
}
return yVals;
}
std::vector<int> REQ::getYVals(const TraceDrawingProperties &drawingProperties) const
{
std::vector<int> yVals;
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type != AbstractTracePlotLineModel::RequestLine)
continue;
yVals.push_back(line->data.yVal);
}
return yVals;
}
std::vector<int> RESP::getYVals(const TraceDrawingProperties &drawingProperties) const
{
std::vector<int> yVals;
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type != AbstractTracePlotLineModel::ResponseLine)
continue;
yVals.push_back(line->data.yVal);
}
return yVals;
}
QColor Phase::getColor(const TraceDrawingProperties &drawingProperties) const
{
switch (drawingProperties.colorGrouping) {
case ColorGrouping::PhaseType:
return getPhaseColor();
break;
case ColorGrouping::Thread:
return ColorGenerator::getColor(static_cast<unsigned int>(transaction.lock()->thread));
break;
case ColorGrouping::RainbowTransaction:
return ColorGenerator::getRainbowColored(transaction.lock()->id, ColorName::HSV15);
break;
case ColorGrouping::Transaction:
default:
return ColorGenerator::getColor(transaction.lock()->id);
}
}
Qt::BrushStyle Phase::getBrushStyle() const
{
return Qt::SolidPattern;
}
bool Phase::isSelected(Timespan timespan, double yVal, const TraceDrawingProperties &drawingProperties) const
{
if (span.overlaps(timespan))
{
for (auto lineYVal : getYVals(drawingProperties))
if (fabs(yVal - lineYVal) <= hexagonHeight / 2)
return true;
}
for (Timespan _span : spansOnCommandBus)
{
if (_span.overlaps(timespan))
{
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type == AbstractTracePlotLineModel::RowCommandBusLine)
{
if (isColumnCommand())
continue;
}
else if (line->data.type == AbstractTracePlotLineModel::ColumnCommandBusLine)
{
if (!isColumnCommand())
continue;
}
else if (line->data.type != AbstractTracePlotLineModel::CommandBusLine)
continue;
if (fabs(yVal - line->data.yVal) <= hexagonHeight / 2)
return true;
}
}
}
if (spanOnDataStrobe.End() != 0 && spanOnDataStrobe.overlaps(timespan))
{
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type == AbstractTracePlotLineModel::PseudoChannel0Line)
{
if (rank != 0)
continue;
}
else if (line->data.type == AbstractTracePlotLineModel::PseudoChannel1Line)
{
if (rank != 1)
continue;
}
else if (line->data.type != AbstractTracePlotLineModel::DataBusLine)
continue;
if (fabs(yVal - line->data.yVal) <= hexagonHeight / 2)
return true;
}
}
return false;
}
bool Phase::isColumnCommand() const
{
if (dynamic_cast<const RD *>(this) || dynamic_cast<const RDA *>(this) || dynamic_cast<const WR *>(this) ||
dynamic_cast<const WRA *>(this))
return true;
else
return false;
}
Phase::PhaseSymbol Phase::getPhaseSymbol() const
{
return PhaseSymbol::Hexagon;
}
void Phase::addDependency(const std::shared_ptr<PhaseDependency>& dependency)
{
mDependencies.push_back(dependency);
}

View File

@@ -0,0 +1,832 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Derek Christ
* Iron Prando da Silva
*/
#ifndef BANKPHASE_H
#define BANKPHASE_H
#include "businessObjects/phases/phasedependency.h"
#include "businessObjects/timespan.h"
#include "presentation/tracedrawingproperties.h"
#include "presentation/util/colorgenerator.h"
#include <QPainter>
#include <QString>
#include <memory>
#include <qwt_scale_map.h>
#include <utility>
#include <vector>
typedef unsigned int ID;
//enum TextPositioning;
class Transaction;
enum class RelevantAttributes
{
Rank = 0x01,
BankGroup = 0x02,
Bank = 0x04,
Row = 0x08,
Column = 0x10,
BurstLength = 0x20
};
inline RelevantAttributes operator|(RelevantAttributes a, RelevantAttributes b)
{
return static_cast<RelevantAttributes>(static_cast<int>(a) | static_cast<int>(b));
}
inline RelevantAttributes operator&(RelevantAttributes a, RelevantAttributes b)
{
return static_cast<RelevantAttributes>(static_cast<int>(a) & static_cast<int>(b));
}
class Phase
{
public:
Phase(ID id, Timespan span, Timespan spanOnDataStrobe, unsigned int rank, unsigned int bankGroup,
unsigned int bank, unsigned int row, unsigned int column, unsigned int burstLength,
traceTime clk, const std::shared_ptr<Transaction> &transaction, std::vector<Timespan> spansOnCommandBus,
unsigned int groupsPerRank, unsigned int banksPerGroup) :
id(id), span(span), spanOnDataStrobe(spanOnDataStrobe),
rank(rank), bankGroup(bankGroup), bank(bank), row(row), column(column), burstLength(burstLength),
clk(clk), transaction(transaction), spansOnCommandBus(std::move(spansOnCommandBus)),
groupsPerRank(groupsPerRank), banksPerGroup(banksPerGroup),
hexagonHeight(0.6), captionPosition(TextPositioning::bottomRight) {}
void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, bool highlight,
const TraceDrawingProperties &drawingProperties) const;
bool isSelected(Timespan timespan, double yVal, const TraceDrawingProperties &drawingproperties) const;
bool isColumnCommand() const;
const Timespan &Span() const
{
return span;
}
ID Id() const
{
return id;
}
unsigned int getRank() const
{
return rank;
}
unsigned int getBankGroup() const
{
return bankGroup % groupsPerRank;
}
unsigned int getBank() const
{
return bank % banksPerGroup;
}
unsigned int getRow() const
{
return row;
}
unsigned int getColumn() const
{
return column;
}
unsigned int getBurstLength() const
{
return burstLength;
}
virtual RelevantAttributes getRelevantAttributes() const = 0;
virtual QString Name() const = 0;
void addDependency(const std::shared_ptr<PhaseDependency>& dependency);
protected:
ID id;
Timespan span;
Timespan spanOnDataStrobe;
unsigned int rank, bankGroup, bank, row, column, burstLength;
unsigned int groupsPerRank, banksPerGroup;
traceTime clk;
std::weak_ptr<Transaction> transaction;
std::vector<Timespan> spansOnCommandBus;
std::vector<std::shared_ptr<PhaseDependency>> mDependencies;
double hexagonHeight;
TextPositioning captionPosition;
enum PhaseSymbol {Hexagon, Rect};
virtual PhaseSymbol getPhaseSymbol() const;
virtual Qt::BrushStyle getBrushStyle() const;
virtual QColor getColor(const TraceDrawingProperties &drawingProperties) const;
virtual QColor getPhaseColor() const = 0;
virtual std::vector<int> getYVals(const TraceDrawingProperties &drawingProperties) const;
virtual void drawPhaseSymbol(traceTime begin, traceTime end, double y,
bool drawtext, PhaseSymbol symbol, QPainter *painter, const QwtScaleMap &xMap,
const QwtScaleMap &yMap, const QColor& textColor) const;
virtual void drawPhaseDependencies(traceTime begin, traceTime end, double y,
const TraceDrawingProperties &drawingProperties, QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap) const;
enum class Granularity {Bankwise, TwoBankwise, Groupwise, Rankwise};
virtual Granularity getGranularity() const
{
return Granularity::Bankwise;
}
friend class PhaseDependency;
};
class REQ final : public Phase
{
public:
using Phase::Phase;
protected:
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(1);
}
QString Name() const final
{
return "REQ";
}
RelevantAttributes getRelevantAttributes() const override
{
return static_cast<RelevantAttributes>(0);
}
std::vector<int> getYVals(const TraceDrawingProperties &drawingProperties) const override;
};
class RESP final : public Phase
{
public:
using Phase::Phase;
protected:
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(1);
}
QString Name() const override
{
return "RESP";
}
RelevantAttributes getRelevantAttributes() const override
{
return static_cast<RelevantAttributes>(0);
}
std::vector<int> getYVals(const TraceDrawingProperties &drawingProperties) const override;
};
/*
class PREB final : public Phase
{
public:
using Phase::Phase;
protected:
virtual QColor getPhaseColor() const override
{
return ColorGenerator::getColor(1);
}
virtual QString Name() const override
{
return "PREB";
}
};
*/
class PREPB final : public Phase
{
public:
using Phase::Phase;
protected:
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(1);
}
QString Name() const override
{
return "PREPB";
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank;
}
};
class PRESB final : public Phase
{
public:
using Phase::Phase;
protected:
QString Name() const override
{
return "PRESB";
}
virtual std::vector<traceTime> getTimesOnCommandBus() const
{
return {span.Begin()};
}
QColor getColor(const TraceDrawingProperties &drawingProperties) const override
{
Q_UNUSED(drawingProperties)
return getPhaseColor();
}
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(1);
}
Granularity getGranularity() const override
{
return Granularity::Groupwise;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::Bank;
}
};
class PREAB final : public Phase
{
public:
using Phase::Phase;
protected:
QString Name() const override
{
return "PREAB";
}
virtual std::vector<traceTime> getTimesOnCommandBus() const
{
return {span.Begin()};
}
QColor getColor(const TraceDrawingProperties &drawingProperties) const override
{
Q_UNUSED(drawingProperties)
return getPhaseColor();
}
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(10);
}
Granularity getGranularity() const override
{
return Granularity::Rankwise;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank;
}
};
/*
class ACTB final : public Phase
{
public:
using Phase::Phase;
protected:
virtual QColor getPhaseColor() const override
{
return ColorGenerator::getColor(3);
}
virtual QString Name() const override
{
return "ACTB";
}
};
*/
class ACT final : public Phase
{
public:
using Phase::Phase;
protected:
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(3);
}
QString Name() const override
{
return "ACT";
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank |
RelevantAttributes::Row;
}
};
class RD final : public Phase
{
public:
using Phase::Phase;
protected:
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(4);
}
QString Name() const override
{
return "RD";
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank |
RelevantAttributes::Column | RelevantAttributes::BurstLength;
}
};
class RDA final : public Phase
{
public:
using Phase::Phase;
protected:
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(5);
}
QString Name() const override
{
return "RDA";
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank |
RelevantAttributes::Column | RelevantAttributes::BurstLength;
}
};
class WR final : public Phase
{
public:
using Phase::Phase;
protected:
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(6);
}
QString Name() const override
{
return "WR";
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank |
RelevantAttributes::Column | RelevantAttributes::BurstLength;
}
};
class WRA final : public Phase
{
public:
using Phase::Phase;
protected:
QColor getPhaseColor() const override
{
return ColorGenerator::getColor(7);
}
QString Name() const override
{
return "WRA";
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank |
RelevantAttributes::Column | RelevantAttributes::BurstLength;
}
};
class AUTO_REFRESH : public Phase
{
public:
using Phase::Phase;
protected:
QString Name() const override
{
return "REF";
}
virtual std::vector<traceTime> getTimesOnCommandBus() const
{
return {span.Begin()};
}
QColor getColor(const TraceDrawingProperties &drawingProperties) const override
{
Q_UNUSED(drawingProperties)
return getPhaseColor();
}
QColor getPhaseColor() const override
{
auto phaseColor = QColor(Qt::darkCyan);
phaseColor.setAlpha(130);
return phaseColor;
}
};
class REFAB final : public AUTO_REFRESH
{
public:
using AUTO_REFRESH::AUTO_REFRESH;
protected:
QString Name() const override
{
return "REFAB";
}
Granularity getGranularity() const override
{
return Granularity::Rankwise;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank;
}
};
class RFMAB final : public AUTO_REFRESH
{
public:
using AUTO_REFRESH::AUTO_REFRESH;
protected:
QString Name() const override
{
return "RFMAB";
}
Granularity getGranularity() const override
{
return Granularity::Rankwise;
}
QColor getPhaseColor() const override
{
auto phaseColor = QColor(Qt::darkRed);
phaseColor.setAlpha(130);
return phaseColor;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank;
}
};
class REFPB final : public AUTO_REFRESH
{
public:
using AUTO_REFRESH::AUTO_REFRESH;
protected:
QString Name() const override
{
return "REFPB";
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank;
}
};
class RFMPB final : public AUTO_REFRESH
{
public:
using AUTO_REFRESH::AUTO_REFRESH;
protected:
QString Name() const override
{
return "RFMPB";
}
QColor getPhaseColor() const override
{
auto phaseColor = QColor(Qt::darkRed);
phaseColor.setAlpha(130);
return phaseColor;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank;
}
};
class REFP2B final : public AUTO_REFRESH
{
public:
using AUTO_REFRESH::AUTO_REFRESH;
protected:
QString Name() const override
{
return "REFP2B";
}
Granularity getGranularity() const override
{
return Granularity::TwoBankwise;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank;
}
};
class RFMP2B final : public AUTO_REFRESH
{
public:
using AUTO_REFRESH::AUTO_REFRESH;
protected:
QString Name() const override
{
return "RFMP2B";
}
Granularity getGranularity() const override
{
return Granularity::TwoBankwise;
}
QColor getPhaseColor() const override
{
auto phaseColor = QColor(Qt::darkRed);
phaseColor.setAlpha(130);
return phaseColor;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank;
}
};
class REFSB final : public AUTO_REFRESH
{
public:
using AUTO_REFRESH::AUTO_REFRESH;
protected:
QString Name() const override
{
return "REFSB";
}
Granularity getGranularity() const override
{
return Granularity::Groupwise;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::Bank;
}
};
class RFMSB final : public AUTO_REFRESH
{
public:
using AUTO_REFRESH::AUTO_REFRESH;
protected:
QString Name() const override
{
return "RFMSB";
}
Granularity getGranularity() const override
{
return Granularity::Groupwise;
}
QColor getPhaseColor() const override
{
auto phaseColor = QColor(Qt::darkRed);
phaseColor.setAlpha(130);
return phaseColor;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::Bank;
}
};
class PDNAB : public Phase
{
public:
using Phase::Phase;
virtual ~PDNAB() = default;
protected:
QString Name() const override
{
return "PDNAB";
}
Qt::BrushStyle getBrushStyle() const override
{
return Qt::Dense6Pattern;
}
QColor getColor(const TraceDrawingProperties &drawingProperties) const override
{
Q_UNUSED(drawingProperties)
return getPhaseColor();
}
QColor getPhaseColor() const override
{
return {Qt::black};
}
Phase::PhaseSymbol getPhaseSymbol() const override
{
return PhaseSymbol::Rect;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank;
}
};
class PDNA final : public PDNAB
{
public:
using PDNAB::PDNAB;
protected:
QString Name() const override
{
return "PDNA";
}
Granularity getGranularity() const override
{
return Granularity::Rankwise;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank;
}
};
class PDNPB : public Phase
{
public:
using Phase::Phase;
virtual ~PDNPB() = default;
protected:
QString Name() const override
{
return "PDNPB";
}
Qt::BrushStyle getBrushStyle() const override
{
return Qt::Dense4Pattern;
}
QColor getColor(const TraceDrawingProperties &drawingProperties) const override
{
Q_UNUSED(drawingProperties)
return getPhaseColor();
}
QColor getPhaseColor() const override
{
return {Qt::black};
}
Phase::PhaseSymbol getPhaseSymbol() const override
{
return PhaseSymbol::Rect;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank;
}
};
class PDNP final : public PDNPB
{
public:
using PDNPB::PDNPB;
protected:
QString Name() const override
{
return "PDNP";
}
Granularity getGranularity() const override
{
return Granularity::Rankwise;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank;
}
};
class SREFB : public Phase
{
public:
using Phase::Phase;
virtual ~SREFB() = default;
protected:
QString Name() const override
{
return "SREFB";
}
Qt::BrushStyle getBrushStyle() const override
{
return Qt::Dense1Pattern;
}
QColor getColor(const TraceDrawingProperties &drawingProperties) const override
{
Q_UNUSED(drawingProperties)
return getPhaseColor();
}
QColor getPhaseColor() const override
{
return {Qt::black};
}
Phase::PhaseSymbol getPhaseSymbol() const override
{
return PhaseSymbol::Rect;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank | RelevantAttributes::BankGroup | RelevantAttributes::Bank;
}
};
class SREF : public SREFB
{
public:
using SREFB::SREFB;
protected:
QString Name() const override
{
return "SREF";
}
Granularity getGranularity() const override
{
return Granularity::Rankwise;
}
RelevantAttributes getRelevantAttributes() const override
{
return RelevantAttributes::Rank;
}
};
#endif // BANKPHASE_H

View File

@@ -0,0 +1,165 @@
/*
* Copyright (c) 2021, 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 "phasedependency.h"
#include "phase.h"
#include <iostream>
PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr<Phase> dependency)
{
mType = type;
mTimeDependency = timeDependency;
mDependency = dependency;
}
PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency)
{
mType = type;
mTimeDependency = timeDependency;
mDependency = nullptr;
mIsInvisible = true;
}
PhaseDependency::~PhaseDependency()
{
}
bool PhaseDependency::draw(QPoint &end, const TraceDrawingProperties &drawingProperties, QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap)
{
if (mIsInvisible)
return false;
traceTime depBegin = mDependency->span.Begin();
traceTime depEnd = mDependency->span.End();
if (xMap.transform(depEnd) < 0)
return false;
bool drawn = false;
for (auto yVal : mDependency->getYVals(drawingProperties))
{
mDraw(end, yVal, drawingProperties, painter, xMap, yMap);
drawn = true;
}
return drawn;
}
void PhaseDependency::mDraw(QPoint &end, double depY, const TraceDrawingProperties &drawingProperties,
QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap)
{
traceTime depBegin = mDependency->span.Begin();
traceTime depEnd = mDependency->span.End();
traceTime depOffset = (depBegin == depEnd) ? static_cast<traceTime>(0.05 * mDependency->clk) : 0;
double depYVal = yMap.transform(depY);
double depSymbolHeight = yMap.transform(0) - yMap.transform(mDependency->hexagonHeight);
QPoint depLineFrom(static_cast<int>(xMap.transform(depBegin /* + (depEnd + depOffset - depBegin)/4*/)),
static_cast<int>(depYVal));
QLineF line(depLineFrom, end);
double angle = std::atan2(-line.dy(), line.dx());
qreal arrowSize = 10;
QPointF arrowP1 = line.p2() - QPointF(sin(angle + M_PI / 3) * arrowSize, cos(angle + M_PI / 3) * arrowSize);
QPointF arrowP2 =
line.p2() - QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize, cos(angle + M_PI - M_PI / 3) * arrowSize);
QPolygonF arrowHead;
arrowHead << line.p2() << arrowP1 << arrowP2;
QColor color = mDependency->getColor(drawingProperties);
painter->setBrush(QBrush(color, mDependency->getBrushStyle()));
painter->drawLine(line);
painter->drawPolygon(arrowHead);
if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Enabled)
{
QPoint textPosition(line.x1() + (line.x2() - line.x1()) / 2, line.y1() + (line.y2() - line.y1()) / 2);
auto alignment = TextPositioning::topRight;
if (textPosition.y() == line.y1())
{
alignment = TextPositioning::topCenter;
}
else if (textPosition.x() == line.x1())
{
if (line.y1() > line.y2())
{
alignment = TextPositioning::bottomRight;
}
}
drawText(painter, mTimeDependency, textPosition, alignment);
}
}
QString PhaseDependency::dependencyTypeName(DependencyType dtype) {
switch(dtype) {
case IntraBank:
return "IntraBank";
case IntraBankGroup:
return "IntraBankGroup";
case IntraBankInGroup:
return "IntraBankInGroup";
case IntraRank:
return "IntraRank";
case IntraLogicalRank:
return "IntraLogicalRank";
case IntraPhysicalRank:
return "IntraPhysicalRank";
case IntraDIMMRank:
return "IntraDIMMRank";
case InterRank:
return "InterRank";
case InterDIMMRank:
return "InterDIMMRank";
default:
// TODO - maybe throw?
return "";
}
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2021, 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
*/
#pragma once
#include "businessObjects/timespan.h"
#include "presentation/tracedrawingproperties.h"
#include <QPainter>
#include <QString>
#include <QStringList>
#include <memory>
#include <qwt_scale_map.h>
class Phase;
enum DependencyType
{
IntraBank,
IntraBankGroup,
IntraBankInGroup,
IntraRank,
IntraLogicalRank,
IntraPhysicalRank,
IntraDIMMRank,
InterRank,
InterDIMMRank,
};
class PhaseDependency
{
public:
PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr<Phase> dependency);
PhaseDependency(DependencyType type, QString timeDependency);
~PhaseDependency();
bool isVisible()
{
return !mIsInvisible;
}
bool draw(QPoint &end, const TraceDrawingProperties &drawingProperties, QPainter *painter, const QwtScaleMap &xMap,
const QwtScaleMap &yMap);
static QString dependencyTypeName(DependencyType);
protected:
DependencyType mType;
QString mTimeDependency;
std::shared_ptr<Phase> mDependency;
bool mIsInvisible = false;
void mDraw(QPoint &end, double depY, const TraceDrawingProperties &drawingProperties, QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap);
};

View File

@@ -0,0 +1,123 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#include "phasefactory.h"
#include <exception>
#include "phase.h"
#include "businessObjects/transaction.h"
#include "data/tracedb.h"
#include "businessObjects/timespan.h"
std::shared_ptr<Phase> PhaseFactory::createPhase(ID id, const QString &dbPhaseName,
Timespan span, Timespan spanOnDataStrobe,
unsigned int rank, unsigned int bankGroup, unsigned int bank, unsigned int row, unsigned int column,
unsigned int burstLength, const std::shared_ptr<Transaction> &trans, TraceDB &database)
{
auto clk = static_cast<traceTime>(database.getGeneralInfo().clkPeriod);
unsigned int groupsPerRank = database.getGeneralInfo().groupsPerRank;
unsigned int banksPerGroup = database.getGeneralInfo().banksPerGroup;
const CommandLengths &cl = database.getCommandLengths();
if (dbPhaseName == "REQ")
return std::shared_ptr<Phase>(new REQ(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "RESP")
return std::shared_ptr<Phase>(new RESP(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "PREPB")
return std::shared_ptr<Phase>(new PREPB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.PREPB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "ACT")
return std::shared_ptr<Phase>(new ACT(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.ACT)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "PREAB")
return std::shared_ptr<Phase>(new PREAB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.PREAB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "REFAB")
return std::shared_ptr<Phase>(new REFAB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.REFAB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "RFMAB")
return std::shared_ptr<Phase>(new RFMAB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.RFMAB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "REFPB")
return std::shared_ptr<Phase>(new REFPB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.REFPB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "RFMPB")
return std::shared_ptr<Phase>(new RFMPB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.RFMPB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "REFP2B")
return std::shared_ptr<Phase>(new REFP2B(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.REFP2B)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "RFMP2B")
return std::shared_ptr<Phase>(new RFMP2B(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.RFMP2B)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "PRESB")
return std::shared_ptr<Phase>(new PRESB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.PRESB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "REFSB")
return std::shared_ptr<Phase>(new REFSB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.REFSB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "RFMSB")
return std::shared_ptr<Phase>(new RFMSB(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.RFMSB)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "RD")
return std::shared_ptr<Phase>(new RD(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.RD)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "RDA")
return std::shared_ptr<Phase>(new RDA(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.RDA)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "WR")
return std::shared_ptr<Phase>(new WR(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.WR)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "WRA")
return std::shared_ptr<Phase>(new WRA(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.WRA)}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "PDNA")
return std::shared_ptr<Phase>(new PDNA(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.PDEA),
Timespan(span.End() - clk * cl.PDXA, span.End())}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "PDNP")
return std::shared_ptr<Phase>(new PDNP(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.PDEP),
Timespan(span.End() - clk * cl.PDXP, span.End())}, groupsPerRank, banksPerGroup));
else if (dbPhaseName == "SREF")
return std::shared_ptr<Phase>(new SREF(id, span, spanOnDataStrobe, rank, bankGroup, bank, row, column,
burstLength, clk, trans, {Timespan(span.Begin(), span.Begin() + clk * cl.SREFEN),
Timespan(span.End() - clk * cl.SREFEX, span.End())}, groupsPerRank, banksPerGroup));
else
throw std::runtime_error("DB phasename " + dbPhaseName.toStdString() + " unkown to phasefactory");
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#ifndef PHASEFACTORY_H
#define PHASEFACTORY_H
#include "phase.h"
#include <QStringList>
#include <memory>
#include "businessObjects/transaction.h"
class TraceDB;
class PhaseFactory
{
public:
PhaseFactory() = delete;
static std::shared_ptr<Phase> createPhase(ID id, const QString &dbPhaseName,
Timespan span, Timespan spanOnDataStrobe,
unsigned int rank, unsigned int bankGroup, unsigned int bank, unsigned int row, unsigned int column,
unsigned int burstLength, const std::shared_ptr<Transaction> &trans, TraceDB &database);
};
#endif // PHASEFACTORY_H

View File

@@ -0,0 +1,251 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Felipe S. Prado
* Derek Christ
*/
#include "pythoncaller.h"
#include <exception>
#include <string>
#include <iostream>
#include <QFileInfo>
#include <QDebug>
#include <QApplication>
PythonCaller &PythonCaller::instance()
{
static PythonCaller instance;
return instance;
}
PythonCaller::PythonCaller() :
metricModuleName("metrics"),
metricFunctionName("calculateMetrics"),
getMetricFunctionName("getMetrics"),
pathToScripts(QApplication::applicationDirPath().toStdString() +
"/../../DRAMSys/traceAnalyzer/scripts/"),
plotsModuleName("plots"),
plotsFunctionName("generatePlots"),
checkDependenciesModuleName("checkDependencies"),
vcdExportModuleName("vcdExport"),
vcdExportFunctionName("dumpVcd"),
vcdExportDependenciesFunctionName("checkVcdExport")
{
Py_Initialize();
PyObject *sysPath = PySys_GetObject((char *)"path");
PyObject *path = PyUnicode_FromString(this->pathToScripts.c_str());
PyList_Insert(sysPath, 0, path);
Py_DECREF(path);
qDebug() << "Metric:" << metricModuleName.c_str() << metricFunctionName.c_str();
qDebug() << "Plot:" << plotsModuleName.c_str() << plotsFunctionName.c_str();
qDebug() << "VcdExport:" << vcdExportModuleName.c_str() << vcdExportFunctionName.c_str();
qDebug() << "Script: " << pathToScripts.c_str();
pCalculateMetricsFunction = loadFunctionFromModule(metricModuleName,
metricFunctionName);
pGenPlotsFunction = loadFunctionFromModule(plotsModuleName, plotsFunctionName);
pGetMetricsFunction = loadFunctionFromModule(metricModuleName,
getMetricFunctionName);
pVcdExportDependenciesFunction = loadFunctionFromModule(checkDependenciesModuleName, vcdExportDependenciesFunctionName);
if (vcdExportDependenciesAvailable())
pVcdExportFunction = loadFunctionFromModule(vcdExportModuleName, vcdExportFunctionName);
else
std::cerr << "Warning: Python module pyvcd or tqdm not installed! Exporting as VCD not possible." << std::endl;
}
//returns new reference to the function (see: http://edcjones.tripod.com/refcount.html for the difference between "new reference" and "borrowed reference")
PyObject *PythonCaller::loadFunctionFromModule(std::string moduleName, std::string functionName)
{
PyObject *pModuleName = PyUnicode_FromString(moduleName.c_str());
PyObject *pModule = PyImport_Import(pModuleName);
if (!pModule) {
throw std::runtime_error(std::string("Could not load module " + moduleName));
}
PyObject *pFunction = PyObject_GetAttrString(pModule, functionName.c_str());
if (!pFunction || !PyCallable_Check(pFunction)) {
throw std::runtime_error(
std::string("Could not load test function " + functionName + "in module " + moduleName));
}
Py_DECREF(pModuleName);
Py_DECREF(pModule);
return pFunction;
}
PythonCaller::~PythonCaller()
{
Py_DECREF(pCalculateMetricsFunction);
Py_DECREF(pGenPlotsFunction);
Py_DECREF(pGetMetricsFunction);
if (pVcdExportFunction)
Py_DECREF(pVcdExportFunction);
Py_DECREF(pVcdExportDependenciesFunction);
Py_Finalize();
}
PyObject *PythonCaller::callMetricsFunction(PyObject *function, QString argument, std::vector<long> list)
{
assert(PyCallable_Check(function));
PyObject *pArgs = PyTuple_New(2);
PyObject *pArgumentString = PyUnicode_FromString(
argument.toStdString().c_str());
PyObject *pArgumentList = PyList_New(list.size());
for (size_t i = 0; i < list.size(); i++) {
PyList_SetItem(pArgumentList, i, PyBool_FromLong(list[i]));
}
PyTuple_SetItem(pArgs, 0, pArgumentString);
PyTuple_SetItem(pArgs, 1, pArgumentList);
PyObject *pResult = PyObject_CallObject(function, pArgs);
Py_DECREF(pArgs);
if (!pResult) {
PyErr_Print();
throw std::runtime_error(
std::string("Error in calling " + metricFunctionName + " in module " + metricModuleName));
}
return pResult;
}
//returns a new reference to result of function call
PyObject *PythonCaller::callFunctionWithStringArgument(PyObject *function,
QString argument)
{
assert(PyCallable_Check(function));
PyObject *pArgs = PyTuple_New(1);
PyObject *pArgument = PyUnicode_FromString(argument.toStdString().c_str());
PyTuple_SetItem(pArgs, 0, pArgument);
PyObject *pResult = PyObject_CallObject(function, pArgs);
Py_DECREF(pArgument);
if (!pResult) {
PyErr_Print();
throw std::runtime_error(std::string("Error in calling function with string argument"));
}
return pResult;
}
PyObject *PythonCaller::callFunctionWithoutArguments(PyObject *function)
{
assert(PyCallable_Check(function));
PyObject *pResult = PyObject_CallObject(function, NULL);
if (!pResult) {
PyErr_Print();
throw std::runtime_error(std::string("Error in calling python function"));
}
return pResult;
}
TraceCalculatedMetrics PythonCaller::calculateMetricsOnTrace(QString pathToTrace, std::vector<long> list)
{
TraceCalculatedMetrics result(QFileInfo(pathToTrace).baseName());
PyObject *pResult = callMetricsFunction(pCalculateMetricsFunction, pathToTrace,
list);
for (Py_ssize_t i = 0; i < PyList_Size(pResult); ++i) {
PyObject *calculatedMetric = PyList_GetItem(pResult, i);
QString metricName(PyUnicode_AsUTF8(PyTuple_GetItem(calculatedMetric, 0)));
double value = PyFloat_AsDouble(PyTuple_GetItem(calculatedMetric, 1));
result.addCalculatedMetric(CalculatedMetric(metricName, value));
}
Py_DECREF(pResult);
return result;
}
std::vector<std::string> PythonCaller::getMetrics(QString pathToTrace)
{
std::vector<std::string> result;
PyObject *pResult = callFunctionWithStringArgument(pGetMetricsFunction,
pathToTrace);
for (Py_ssize_t i = 0; i < PyList_Size(pResult); ++i) {
PyObject *metric = PyList_GetItem(pResult, i);
QString metricName(PyUnicode_AsUTF8(metric));
result.push_back(metricName.toStdString().c_str());
}
Py_DECREF(pResult);
return result;
}
QString PythonCaller::generatePlotsOnTrace(QString pathToTrace)
{
assert(PyCallable_Check(pGenPlotsFunction));
PyObject *pResult = callFunctionWithStringArgument(pGenPlotsFunction,
pathToTrace);
QString outputFiles (PyUnicode_AsUTF8(pResult));
Py_DECREF(pResult);
return outputFiles;
}
QString PythonCaller::exportAsVcd(QString pathToTrace)
{
if (!pVcdExportFunction)
return QString();
PyObject *pResult = callFunctionWithStringArgument(pVcdExportFunction, pathToTrace);
QString dump(PyUnicode_AsUTF8(pResult));
Py_DECREF(pResult);
return dump;
}
bool PythonCaller::vcdExportDependenciesAvailable()
{
PyObject *result = callFunctionWithoutArguments(pVcdExportDependenciesFunction);
bool available = PyObject_IsTrue(result);
Py_DECREF(result);
return available;
}

View File

@@ -0,0 +1,97 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Felipe S. Prado
* Derek Christ
*/
#ifndef PYTHONCALLER_H
#define PYTHONCALLER_H
// Workaround for CMAKE and Python
#ifdef slots
#undef slots
#endif
#include <Python.h>
#include <QString>
#include <string>
#include <map>
#include "businessObjects/tracecalculatedmetrics.h"
class PythonCaller
{
public:
static PythonCaller &instance();
TraceCalculatedMetrics calculateMetricsOnTrace(QString pathToTrace,
std::vector<long> list);
std::vector<std::string> getMetrics(QString pathToTrace);
QString generatePlotsOnTrace(QString pathToTrace);
bool vcdExportDependenciesAvailable();
QString exportAsVcd(QString pathToTrace);
private:
PythonCaller();
~PythonCaller();
PythonCaller(const PythonCaller &other) = delete;
PythonCaller &operator=(const PythonCaller &other) = delete;
PyObject *pCalculateMetricsFunction, *pGetMetricsFunction;
PyObject *pGenPlotsFunction;
PyObject *pVcdExportFunction = nullptr;
PyObject *pVcdExportDependenciesFunction;
PyObject *loadFunctionFromModule(std::string moduleName,
std::string functionName);
std::string metricModuleName, metricFunctionName, getMetricFunctionName, pathToScripts;
std::string plotsModuleName;
std::string plotsFunctionName;
std::string checkDependenciesModuleName;
std::string vcdExportModuleName;
std::string vcdExportFunctionName;
std::string vcdExportDependenciesFunctionName;
PyObject *callFunctionWithStringArgument(PyObject *function, QString argument);
PyObject *callFunctionWithoutArguments(PyObject *function);
PyObject *callMetricsFunction(PyObject *function, QString argument,
std::vector<long> list);
};
#endif // PYTHONCALLER_H

View File

@@ -0,0 +1,68 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#ifndef TESTRESULT_H
#define TESTRESULT_H
#include <QString>
class TestResult
{
public:
TestResult(const QString &testName, bool passed, QString &message) :
testName(testName), passed(passed), message(message) {}
QString getTestName() const
{
return testName;
}
QString getMessage() const
{
return message;
}
bool hasPassed() const
{
return passed;
}
private:
QString testName;
bool passed;
QString message;
};
#endif // TESTRESULT_H

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#include "timespan.h"
bool Timespan::contains(traceTime time) const
{
return (begin <= time && time <= end);
}
bool Timespan::overlaps(const Timespan &other) const
{
return other.Begin() < this->end && this->begin < other.End();
}
void Timespan::shift(traceTime offset)
{
begin += offset;
end += offset;
}

View File

@@ -0,0 +1,80 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#ifndef TIMESPAN_H
#define TIMESPAN_H
#include <QString>
#include <cstdlib>
#include "tracetime.h"
class Timespan
{
traceTime begin;
traceTime end;
public:
explicit Timespan(traceTime begin = 0, traceTime end = 0) : begin(begin), end(end) {}
traceTime timeCovered() const
{
return std::abs(End() - Begin());
}
traceTime Begin() const
{
return begin;
}
void setBegin(traceTime time)
{
begin = time;
}
traceTime End() const
{
return end;
}
traceTime Middle() const
{
return (begin + end) / 2;
}
void setEnd(traceTime time)
{
end = time;
}
bool contains(traceTime time) const;
bool overlaps(const Timespan &other) const;
void shift(traceTime offset);
};
#endif // TIMESPAN_H

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#ifndef TRACEMETRICRESULTS_H
#define TRACEMETRICRESULTS_H
#include <QString>
#include <vector>
#include "calculatedMetric.h"
class TraceCalculatedMetrics
{
public:
TraceCalculatedMetrics(const QString &traceName): traceName(traceName) {}
void addCalculatedMetric(const CalculatedMetric &result)
{
calculatedMetrics.push_back(result);
}
QString getTraceName() const
{
return traceName;
}
const std::vector<CalculatedMetric> &getCalculatedMetrics() const
{
return calculatedMetrics;
}
QString toCSVHeader()
{
QString result = "";
result.append("Trace");
for (CalculatedMetric calculatedMetric : calculatedMetrics) {
result.append(",");
result.append(calculatedMetric.getName());
}
return result;
}
QString toCSVLine()
{
QString result = "";
result.append(traceName);
for (CalculatedMetric calculatedMetric : calculatedMetrics) {
result.append(",");
result.append(QString::number(calculatedMetric.getValue()));
}
return result;
}
private:
QString traceName;
std::vector<CalculatedMetric> calculatedMetrics;
};
#endif // TRACEMETRICRESULTS_H

View File

@@ -0,0 +1,658 @@
/*
* Copyright (c) 2021, 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:
* Derek Christ
*/
#include "traceplotlinemodel.h"
#include "../presentation/traceplot.h"
#include "../presentation/util/customlabelscaledraw.h"
#include <QItemSelectionModel>
#include <QKeyEvent>
#include <QMimeData>
AbstractTracePlotLineModel::AbstractTracePlotLineModel(const GeneralInfo &generalInfo, QObject *parent)
: QAbstractItemModel(parent), internalSelectionModel(new QItemSelectionModel(this, this)),
rootNode(std::make_shared<Node>()), numberOfRanks(generalInfo.numberOfRanks),
groupsPerRank(generalInfo.groupsPerRank), banksPerGroup(generalInfo.banksPerGroup),
banksPerRank(generalInfo.banksPerRank), commandBusType(getCommandBusType(generalInfo)),
dataBusType(getDataBusType(generalInfo))
{
createInitialNodes();
}
AvailableTracePlotLineModel::AvailableTracePlotLineModel(const GeneralInfo &generalInfo, QObject *parent)
: AbstractTracePlotLineModel(generalInfo, parent)
{
}
SelectedTracePlotLineModel::SelectedTracePlotLineModel(const GeneralInfo &generalInfo, QObject *parent)
: AbstractTracePlotLineModel(generalInfo, parent)
{
}
void AbstractTracePlotLineModel::addTopLevelNode(std::shared_ptr<Node> &&node)
{
rootNode->children.push_back(std::move(node));
}
void AbstractTracePlotLineModel::createInitialNodes()
{
addTopLevelNode(
std::unique_ptr<Node>(new Node({LineType::RequestLine, getLabel(LineType::RequestLine)}, rootNode.get())));
addTopLevelNode(
std::unique_ptr<Node>(new Node({LineType::ResponseLine, getLabel(LineType::ResponseLine)}, rootNode.get())));
for (unsigned int rank = 0; rank < numberOfRanks; rank++)
addTopLevelNode(createRankGroupNode(rank));
if (commandBusType == CommandBusType::SingleCommandBus)
{
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::CommandBusLine, getLabel(LineType::CommandBusLine)}, rootNode.get())));
}
else // commandBusType == CommandBusType::RowColumnCommandBus
{
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::RowCommandBusLine, getLabel(LineType::RowCommandBusLine)}, rootNode.get())));
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::ColumnCommandBusLine, getLabel(LineType::ColumnCommandBusLine)}, rootNode.get())));
}
if (dataBusType == DataBusType::LegacyMode)
{
addTopLevelNode(
std::unique_ptr<Node>(new Node({LineType::DataBusLine, getLabel(LineType::DataBusLine)}, rootNode.get())));
}
else // dataBusType == DataBusType::PseudoChannelMode
{
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::PseudoChannel0Line, getLabel(LineType::PseudoChannel0Line)}, rootNode.get())));
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::PseudoChannel1Line, getLabel(LineType::PseudoChannel1Line)}, rootNode.get())));
}
}
std::shared_ptr<AbstractTracePlotLineModel::Node>
AbstractTracePlotLineModel::createRankGroupNode(unsigned int rank) const
{
auto rankGroup = std::unique_ptr<Node>(new Node({LineType::RankGroup, getLabel(rank), rank}, rootNode.get()));
for (unsigned int group = 0; group < groupsPerRank; group++)
{
for (unsigned int bank = 0; bank < banksPerGroup; bank++)
{
unsigned int absoluteRank = rank;
unsigned int absoluteGroup = group + rank * groupsPerRank;
unsigned int absoluteBank = bank + rank * banksPerRank + group * banksPerGroup;
auto bankLine = std::unique_ptr<Node>(
new Node({LineType::BankLine, getLabel(rank, group, bank), absoluteRank, absoluteGroup, absoluteBank},
rankGroup.get()));
rankGroup->children.push_back(std::move(bankLine));
}
}
return rankGroup;
}
int AbstractTracePlotLineModel::rowCount(const QModelIndex &parent) const
{
if (parent.column() > 0)
return 0;
const Node *parentNode;
if (!parent.isValid())
parentNode = rootNode.get();
else
parentNode = static_cast<const Node *>(parent.internalPointer());
return parentNode->childCount();
}
int AbstractTracePlotLineModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return 1;
}
QVariant AbstractTracePlotLineModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
auto *node = static_cast<const Node *>(index.internalPointer());
switch (role)
{
case Qt::DisplayRole:
return node->data.label;
case Role::TypeRole:
return QVariant::fromValue(node->data.type);
case Role::CollapsedRole:
return node->data.collapsed;
}
return QVariant();
}
bool SelectedTracePlotLineModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (!index.isValid())
return false;
auto *node = static_cast<Node *>(index.internalPointer());
switch (role)
{
case Role::CollapsedRole:
node->data.collapsed = value.toBool();
emit dataChanged(index, index, {role});
return true;
case Qt::DisplayRole:
case Role::TypeRole:
// Not allowed
return false;
}
return false;
}
QVariant AvailableTracePlotLineModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation == Qt::Horizontal && section == 0)
return "Available Items";
return QVariant();
}
QVariant SelectedTracePlotLineModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation == Qt::Horizontal && section == 0)
{
return "Selected Items";
}
return QVariant();
}
QModelIndex AbstractTracePlotLineModel::index(int row, int column, const QModelIndex &parent) const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
const Node *parentNode;
if (!parent.isValid())
parentNode = rootNode.get();
else
parentNode = static_cast<const Node *>(parent.internalPointer());
const Node *node = parentNode->children[row].get();
return createIndex(row, column, const_cast<Node *>(node));
}
QModelIndex AbstractTracePlotLineModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
const Node *childNode = static_cast<const Node *>(index.internalPointer());
const Node *parentNode = childNode->parent;
if (!parentNode || parentNode == rootNode.get())
return QModelIndex();
return createIndex(parentNode->getRow(), 0, const_cast<Node *>(parentNode));
}
void SelectedTracePlotLineModel::recreateCollapseButtons(TracePlot *tracePlot,
CustomLabelScaleDraw *customLabelScaleDraw)
{
// Remove old buttons
for (auto button : collapseButtons)
{
button->hide();
button->deleteLater();
}
collapseButtons.clear();
for (const auto &node : rootNode->children)
{
if (node->data.type != LineType::RankGroup)
continue;
QPushButton *collapseButton = new QPushButton(tracePlot);
unsigned int yVal = [node]()
{
if (node->data.collapsed)
return node->data.yVal;
else
return node->children.at(0)->data.yVal;
}();
bool isCollapsed = node->data.collapsed;
QModelIndex nodeIndex = index(node->getRow(), 0);
auto repositionButton = [=]()
{
QPointF point = tracePlot->axisScaleDraw(QwtPlot::yLeft)->labelPosition(yVal);
collapseButton->setGeometry(point.x(), point.y() - 4, 25, 25);
};
repositionButton();
auto updateLabel = [=]() { collapseButton->setText(isCollapsed ? "+" : "-"); };
updateLabel();
auto toggleCollapsed = [=]()
{
setData(nodeIndex, !isCollapsed, Role::CollapsedRole);
recreateCollapseButtons(tracePlot, customLabelScaleDraw);
};
// Important: The context of the connection is `collapseButton` as it should be disconnected when the button
// ceases to exist.
connect(customLabelScaleDraw, &CustomLabelScaleDraw::scaleRedraw, collapseButton, repositionButton);
connect(collapseButton, &QPushButton::pressed, this, toggleCollapsed);
connect(collapseButton, &QPushButton::pressed, tracePlot, &TracePlot::recreateCollapseButtons);
collapseButton->show();
collapseButtons.push_back(collapseButton);
}
}
int AbstractTracePlotLineModel::Node::getRow() const
{
if (!parent)
return 0;
const auto &siblings = parent->children;
const auto siblingsIt = std::find_if(siblings.begin(), siblings.end(),
[this](const std::shared_ptr<Node> &node) { return node.get() == this; });
Q_ASSERT(siblingsIt != siblings.end());
return std::distance(siblings.begin(), siblingsIt);
}
std::shared_ptr<AbstractTracePlotLineModel::Node> AbstractTracePlotLineModel::Node::cloneNode(const Node *node,
const Node *parent)
{
std::shared_ptr<Node> clonedNode = std::make_shared<Node>(node->data, parent);
for (const auto &child : node->children)
clonedNode->children.push_back(cloneNode(child.get(), clonedNode.get()));
return clonedNode;
}
QString AbstractTracePlotLineModel::getLabel(LineType type)
{
switch (type)
{
case LineType::RequestLine:
return "REQ";
case LineType::ResponseLine:
return "RESP";
case LineType::CommandBusLine:
return "Command Bus";
case LineType::RowCommandBusLine:
return "Command Bus [R]";
case LineType::ColumnCommandBusLine:
return "Command Bus [C]";
case LineType::DataBusLine:
return "Data Bus";
case LineType::PseudoChannel0Line:
return "Data Bus [PC0]";
case LineType::PseudoChannel1Line:
return "Data Bus [PC1]";
default:
return "";
}
}
QString AbstractTracePlotLineModel::getLabel(unsigned int rank) const
{
std::string_view rankLabel = dataBusType == DataBusType::LegacyMode ? "RA" : "PC";
return rankLabel.data() + QString::number(rank);
}
QString AbstractTracePlotLineModel::getLabel(unsigned int rank, unsigned int group, unsigned int bank) const
{
std::string_view rankLabel = dataBusType == DataBusType::LegacyMode ? "RA" : "PC";
return rankLabel.data() + QString::number(rank) + " BG" + QString::number(group) + " BA" + QString::number(bank);
}
AbstractTracePlotLineModel::CommandBusType AbstractTracePlotLineModel::getCommandBusType(const GeneralInfo &generalInfo)
{
if (generalInfo.rowColumnCommandBus)
return CommandBusType::RowColumnCommandBus;
else
return CommandBusType::SingleCommandBus;
}
AbstractTracePlotLineModel::DataBusType AbstractTracePlotLineModel::getDataBusType(const GeneralInfo &generalInfo)
{
if (generalInfo.pseudoChannelMode)
return DataBusType::PseudoChannelMode;
else
return DataBusType::LegacyMode;
}
bool SelectedTracePlotLineModel::removeRows(int row, int count, const QModelIndex &parent)
{
if (parent != QModelIndex())
return false;
// Note: beginRemoveRows requires [first, last], but erase requires [first, last)
beginRemoveRows(QModelIndex(), row, row + count - 1);
rootNode->children.erase(rootNode->children.begin() + row, rootNode->children.begin() + row + count);
endRemoveRows();
return true;
}
void AvailableTracePlotLineModel::itemsDoubleClicked(const QModelIndex &index)
{
QModelIndexList indexList({index});
emit returnPressed(indexList);
}
void SelectedTracePlotLineModel::itemsDoubleClicked(const QModelIndex &index)
{
if (index.parent() != QModelIndex())
return;
removeRow(index.row(), QModelIndex());
}
bool AvailableTracePlotLineModel::eventFilter(QObject *object, QEvent *event)
{
Q_UNUSED(object)
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Return)
{
const QModelIndexList indexes = internalSelectionModel->selectedRows();
emit returnPressed(indexes);
}
else
{
return false;
}
}
return false;
}
bool SelectedTracePlotLineModel::eventFilter(QObject *object, QEvent *event)
{
Q_UNUSED(object)
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Delete)
{
// Note: This implementation requires the selection to be contiguous
const QModelIndexList indexes = internalSelectionModel->selectedRows();
if (indexes.count() == 0)
return true;
for (const auto &index : indexes)
{
// Only remove toplevel indexes
if (index.parent() != QModelIndex())
return true;
}
removeRows(indexes.at(0).row(), indexes.size(), QModelIndex());
return true;
}
else
{
return false;
}
}
return false;
}
void SelectedTracePlotLineModel::addIndexesFromAvailableModel(const QModelIndexList &indexes)
{
for (const auto &index : indexes)
{
auto node = static_cast<const Node *>(index.internalPointer());
auto clonedNode = Node::cloneNode(node, rootNode.get());
beginInsertRows(QModelIndex(), rootNode->children.size(), rootNode->children.size());
addTopLevelNode(std::move(clonedNode));
endInsertRows();
}
}
QItemSelectionModel *AbstractTracePlotLineModel::selectionModel() const
{
return internalSelectionModel;
}
QStringList AbstractTracePlotLineModel::mimeTypes() const
{
QStringList types = QAbstractItemModel::mimeTypes();
types << TRACELINE_MIMETYPE;
return types;
}
QMimeData *AbstractTracePlotLineModel::mimeData(const QModelIndexList &indexes) const
{
QByteArray traceLineData;
QDataStream dataStream(&traceLineData, QIODevice::WriteOnly);
for (const auto &index : indexes)
{
const Node *node = static_cast<const Node *>(index.internalPointer());
dataStream << node->data.type << node->data.label << node->data.rank << node->data.group << node->data.bank
<< node->data.collapsed;
}
QMimeData *mimeData = new QMimeData;
mimeData->setData(TRACELINE_MIMETYPE, traceLineData);
return mimeData;
}
bool AbstractTracePlotLineModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column,
const QModelIndex &parent) const
{
Q_UNUSED(action);
Q_UNUSED(row);
Q_UNUSED(parent);
if (!data->hasFormat(TRACELINE_MIMETYPE))
return false;
if (column > 0)
return false;
return true;
}
bool AbstractTracePlotLineModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column,
const QModelIndex &parent)
{
if (!canDropMimeData(data, action, row, column, parent))
return false;
if (action == Qt::IgnoreAction)
return true;
bool dropHandled = false;
int beginRow;
if (row != -1)
beginRow = row;
else
beginRow = rowCount(QModelIndex());
if (action == Qt::CopyAction || action == Qt::MoveAction)
{
dropHandled = true;
QByteArray traceLineData = data->data(TRACELINE_MIMETYPE);
QDataStream dataStream(&traceLineData, QIODevice::ReadOnly);
std::vector<std::shared_ptr<Node>> droppedNodes;
while (!dataStream.atEnd())
{
LineType type;
QString label;
unsigned int rank, group, bank;
bool isCollapsed;
dataStream >> type >> label >> rank >> group >> bank >> isCollapsed;
std::shared_ptr<Node> node;
if (type == LineType::BankLine)
node = std::make_shared<Node>(Node::NodeData{type, label, rank, group, bank}, rootNode.get());
else if (type == LineType::RankGroup)
node = createRankGroupNode(rank);
else
node = std::make_shared<Node>(Node::NodeData{type, label}, rootNode.get());
if (node->data.type == RankGroup)
node->data.collapsed = isCollapsed;
droppedNodes.push_back(std::move(node));
}
// Note: beginRemoveRows requires [first, last]
beginInsertRows(QModelIndex(), beginRow, beginRow + droppedNodes.size() - 1);
rootNode->children.insert(rootNode->children.begin() + beginRow, std::make_move_iterator(droppedNodes.begin()),
std::make_move_iterator(droppedNodes.end()));
endInsertRows();
}
else
{
dropHandled = QAbstractItemModel::dropMimeData(data, action, row, column, parent);
}
return dropHandled;
}
Qt::DropActions AbstractTracePlotLineModel::supportedDropActions() const
{
return (Qt::MoveAction | Qt::CopyAction);
}
Qt::ItemFlags AbstractTracePlotLineModel::flags(const QModelIndex &index) const
{
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index);
if (index.isValid())
return Qt::ItemIsDragEnabled | defaultFlags;
else
return Qt::ItemIsDropEnabled | defaultFlags;
}
std::shared_ptr<AbstractTracePlotLineModel::Node> SelectedTracePlotLineModel::getClonedRootNode()
{
return Node::cloneNode(rootNode.get(), nullptr);
}
void SelectedTracePlotLineModel::setRootNode(std::shared_ptr<AbstractTracePlotLineModel::Node> node)
{
removeRows(0, rootNode->childCount(), QModelIndex());
beginInsertRows(QModelIndex(), 0, node->childCount() - 1);
rootNode = std::move(node);
endInsertRows();
}
TracePlotLineDataSource::TracePlotLineDataSource(SelectedTracePlotLineModel *selectedModel, QObject *parent)
: selectedModel(selectedModel)
{
Q_UNUSED(parent)
updateModel();
}
void TracePlotLineDataSource::updateModel()
{
entries.clear();
std::function<void(std::shared_ptr<AbstractTracePlotLineModel::Node> & parent)> addNodes;
addNodes = [=, &addNodes](std::shared_ptr<AbstractTracePlotLineModel::Node> &parent)
{
for (auto &childNode : parent->children)
{
if (childNode->data.type == AbstractTracePlotLineModel::RankGroup && !childNode->data.collapsed)
{
addNodes(childNode);
continue; // Don't add the parent node itself when not collapsed.
}
entries.push_back(childNode);
}
};
addNodes(selectedModel->rootNode);
emit modelChanged();
}

View File

@@ -0,0 +1,280 @@
/*
* Copyright (c) 2021, 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:
* Derek Christ
*/
#ifndef TRACEPLOTLINEMODEL_H
#define TRACEPLOTLINEMODEL_H
#include "generalinfo.h"
#include <QAbstractItemModel>
#include <QPushButton>
#include <memory>
class TracePlot;
class CustomLabelScaleDraw;
class QItemSelectionModel;
class AbstractTracePlotLineModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit AbstractTracePlotLineModel(const GeneralInfo &generalInfo, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &index) const override;
QItemSelectionModel *selectionModel() const;
enum Role
{
TypeRole = Qt::UserRole + 1,
CollapsedRole
};
Q_ENUM(Role)
enum LineType
{
RequestLine,
ResponseLine,
CommandBusLine,
RowCommandBusLine,
ColumnCommandBusLine,
DataBusLine,
PseudoChannel0Line,
PseudoChannel1Line,
RankGroup,
BankLine
};
Q_ENUM(LineType)
struct Node
{
struct NodeData
{
NodeData() = default;
NodeData(LineType type, const QString &label) : type(type), label(label)
{
}
NodeData(LineType type, const QString &label, unsigned int rank) : type(type), label(label), rank(rank)
{
}
NodeData(LineType type, const QString &label, unsigned int rank, unsigned int group, unsigned int bank)
: type(type), label(label), rank(rank), group(group), bank(bank)
{
}
LineType type;
QString label;
unsigned int yVal = 0;
/**
* Used to store the collapsed state in the traceplot.
* The value has only an effect when the type is Type::RankGroup.
*/
bool collapsed = true;
/**
* Only used when the type is Type::BankLine.
* (Absolute numbering)
*/
unsigned int rank = 0, group = 0, bank = 0;
};
/**
* Constructor only used for the root node that does not contain any data.
*/
Node() = default;
Node(NodeData data, const Node *parent) : data(data), parent(parent)
{
}
/**
* Gets the row relative to its parent.
*/
int getRow() const;
int childCount() const
{
return children.size();
}
static std::shared_ptr<Node> cloneNode(const Node *node, const Node *parent);
NodeData data;
const Node *parent = nullptr;
std::vector<std::shared_ptr<Node>> children;
};
protected:
enum class CommandBusType
{
SingleCommandBus,
RowColumnCommandBus
};
enum class DataBusType
{
LegacyMode,
PseudoChannelMode
};
QStringList mimeTypes() const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column,
const QModelIndex &parent) override;
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column,
const QModelIndex &parent) const override;
Qt::DropActions supportedDropActions() const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
void addTopLevelNode(std::shared_ptr<Node> &&node);
void createInitialNodes();
std::shared_ptr<Node> createRankGroupNode(unsigned int rank) const;
static QString getLabel(LineType type);
QString getLabel(unsigned int rank) const;
QString getLabel(unsigned int rank, unsigned int group, unsigned int bank) const;
static CommandBusType getCommandBusType(const GeneralInfo &generalInfo);
static DataBusType getDataBusType(const GeneralInfo &generalInfo);
static constexpr auto TRACELINE_MIMETYPE = "application/x-tracelinedata";
QItemSelectionModel *const internalSelectionModel;
std::shared_ptr<Node> rootNode;
const unsigned int numberOfRanks;
const unsigned int groupsPerRank;
const unsigned int banksPerGroup;
const unsigned int banksPerRank;
const CommandBusType commandBusType;
const DataBusType dataBusType;
};
class AvailableTracePlotLineModel : public AbstractTracePlotLineModel
{
Q_OBJECT
public:
explicit AvailableTracePlotLineModel(const GeneralInfo &generalInfo, QObject *parent = nullptr);
public Q_SLOTS:
void itemsDoubleClicked(const QModelIndex &index);
Q_SIGNALS:
void returnPressed(const QModelIndexList &indexes);
protected:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool eventFilter(QObject *object, QEvent *event) override;
};
class SelectedTracePlotLineModel : public AbstractTracePlotLineModel
{
Q_OBJECT
public:
explicit SelectedTracePlotLineModel(const GeneralInfo &generalInfo, QObject *parent = nullptr);
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
void recreateCollapseButtons(TracePlot *tracePlot, CustomLabelScaleDraw *customLabelScaleDraw);
std::shared_ptr<Node> getClonedRootNode();
void setRootNode(std::shared_ptr<Node> node);
public Q_SLOTS:
void itemsDoubleClicked(const QModelIndex &index);
void addIndexesFromAvailableModel(const QModelIndexList &indexes);
protected:
bool eventFilter(QObject *object, QEvent *event) override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
private:
std::vector<QPushButton *> collapseButtons;
friend class TracePlotLineDataSource;
};
/*
* Simple list that is the true source for the traceplot.
*/
class TracePlotLineDataSource : public QObject
{
Q_OBJECT
public:
using TracePlotLine = AbstractTracePlotLineModel::Node;
explicit TracePlotLineDataSource(SelectedTracePlotLineModel *selectedModel, QObject *parent = nullptr);
SelectedTracePlotLineModel *getSelectedModel() const
{
return selectedModel;
};
std::vector<std::shared_ptr<TracePlotLine>> &getTracePlotLines()
{
return entries;
}
public Q_SLOTS:
void updateModel();
Q_SIGNALS:
void modelChanged();
private:
SelectedTracePlotLineModel *selectedModel;
std::vector<std::shared_ptr<TracePlotLine>> entries;
};
#endif // TRACEPLOTLINEMODEL_H

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#ifndef TRACETIME_H
#define TRACETIME_H
#include <QString>
#include <math.h>
// time in picoseconds
typedef long long traceTime;
inline QString prettyFormatTime(traceTime time)
{
return QString::number(time / 1000.0, 'f') + QString(" ns");
}
inline QString formatInClks(traceTime time, unsigned int clkPeriod)
{
long long numberOfClockCovered = time / clkPeriod;
QString suffix = (numberOfClockCovered != 1) ? QString(" clks") :
QString(" clk");
return QString::number(numberOfClockCovered) + suffix;
}
inline traceTime alignToClk(traceTime time, unsigned int clkPeriod)
{
return round(1.0 * time / clkPeriod) * clkPeriod;
}
#endif // TRACETIME_H

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Iron Prando da Silva
*/
#include "transaction.h"
#include <utility>
using namespace std;
unsigned int Transaction::mSNumTransactions = 0;
Transaction::Transaction(ID id, QString command, unsigned int address, unsigned int dataLength,
unsigned int thread, unsigned int channel, Timespan span, traceTime clk)
: clk(clk), command(std::move(command)), address(address), dataLength(dataLength), thread(thread), channel(channel),
span(span), id(id) {}
void Transaction::addPhase(const shared_ptr<Phase>& phase)
{
phases.push_back(phase);
}
void Transaction::draw(QPainter *painter, const QwtScaleMap &xMap,
const QwtScaleMap &yMap, const QRectF &canvasRect, bool highlight,
const TraceDrawingProperties &drawingProperties) const
{
for (const shared_ptr<Phase>& phase : phases)
phase->draw(painter, xMap, yMap, canvasRect, highlight, drawingProperties);
}
bool Transaction::isSelected(Timespan timespan, double yVal, const TraceDrawingProperties &drawingproperties) const
{
if (span.overlaps(timespan))
{
for (const shared_ptr<Phase>& phase : phases)
{
if (phase->isSelected(timespan, yVal, drawingproperties))
return true;
}
}
return false;
}

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Iron Prando da Silva
*/
#ifndef TRANSACTION_H
#define TRANSACTION_H
#include <vector>
#include <memory>
#include "timespan.h"
#include "phases/phase.h"
#include "presentation/tracedrawingproperties.h"
typedef unsigned int ID;
class Transaction
{
private:
std::vector<std::shared_ptr<Phase>> phases;
traceTime clk;
public:
const QString command;
const uint64_t address;
const unsigned int dataLength, thread, channel;
const Timespan span;
const ID id;
Transaction(ID id, QString command, unsigned int address, unsigned int dataLength, unsigned int thread,
unsigned int channel, Timespan span, traceTime clk);
void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, bool highlight,
const TraceDrawingProperties &drawingProperties) const;
void addPhase(const std::shared_ptr<Phase>& phase);
bool isSelected(Timespan timespan, double yVal, const TraceDrawingProperties &drawingproperties) const;
const std::vector<std::shared_ptr<Phase>> &Phases() const
{
return phases;
}
public:
static void setNumTransactions(const unsigned int numTransactions)
{
mSNumTransactions = numTransactions;
}
static unsigned int getNumTransactions(const unsigned int numTransactions)
{
return mSNumTransactions;
}
private:
static unsigned int mSNumTransactions;
};
#endif // TRANSACTION_H

View File

@@ -0,0 +1,131 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Iron Prando da Silva
*/
#ifndef QUERYTEXTS_H
#define QUERYTEXTS_H
#include <QString>
struct TransactionQueryTexts {
QString queryHead;
QString selectTransactionsByTimespan, selectTransactionById;
QString checkDependenciesExist, selectDependenciesByTimespan;
QString selectDependencyTypePercentages, selectTimeDependencyPercentages, selectDelayedPhasePercentages,
selectDependencyPhasePercentages;
TransactionQueryTexts()
{
queryHead =
"SELECT Transactions.ID AS TransactionID, Ranges.begin, Ranges.end, Address, DataLength, Thread, Channel, Command, Phases.ID AS PhaseID, PhaseName, PhaseBegin, PhaseEnd, DataStrobeBegin, DataStrobeEnd, Rank, BankGroup, Bank, Row, Column, BurstLength "
" FROM Transactions INNER JOIN Phases ON Phases.Transact = Transactions.ID INNER JOIN Ranges ON Transactions.Range = Ranges.ID ";
selectTransactionsByTimespan = queryHead + " WHERE Ranges.end >= :begin AND Ranges.begin <= :end";
selectTransactionById = queryHead + " WHERE Transactions.ID = :id";
checkDependenciesExist = "SELECT CASE WHEN 0 < (SELECT count(*) FROM sqlite_master WHERE type = 'table' AND "
"name = 'DirectDependencies') THEN 1 ELSE 0 END AS result";
selectDependenciesByTimespan =
"WITH timespanTransactions AS (" + selectTransactionsByTimespan +
") SELECT * from DirectDependencies WHERE DelayedPhaseID IN ("
" SELECT DirectDependencies.DelayedPhaseID FROM DirectDependencies JOIN timespanTransactions "
" ON DirectDependencies.DelayedPhaseID = timespanTransactions.PhaseID ) ";
// For some reason I could not use a parameter for these below
selectDependencyTypePercentages =
"WITH TotalDeps (total) AS ( "
"SELECT COUNT(*) FROM DirectDependencies "
"), "
"DependencyTypeDeps (param, ndeps) AS ( "
"SELECT "
"DependencyType, "
"COUNT(*) "
"FROM DirectDependencies "
"GROUP BY \"DependencyType\" "
") "
"SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage "
"FROM DependencyTypeDeps "
"ORDER BY percentage DESC ;";
selectTimeDependencyPercentages =
"WITH TotalDeps (total) AS ( "
"SELECT COUNT(*) FROM DirectDependencies "
"), "
"DependencyTypeDeps (param, ndeps) AS ( "
"SELECT "
"TimeDependency, "
"COUNT(*) "
"FROM DirectDependencies "
"GROUP BY \"TimeDependency\" "
") "
"SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage "
"FROM DependencyTypeDeps "
"ORDER BY percentage DESC ;";
selectDelayedPhasePercentages =
"WITH TotalDeps (total) AS ( "
"SELECT COUNT(*) FROM DirectDependencies "
"), "
"DependencyTypeDeps (param, ndeps) AS ( "
"SELECT "
"DelayedPhaseName, "
"COUNT(*) "
"FROM DirectDependencies "
"GROUP BY \"DelayedPhaseName\" "
") "
"SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage "
"FROM DependencyTypeDeps "
"ORDER BY percentage DESC ;";
selectDependencyPhasePercentages =
"WITH TotalDeps (total) AS ( "
"SELECT COUNT(*) FROM DirectDependencies "
"), "
"DependencyTypeDeps (param, ndeps) AS ( "
"SELECT "
"DependencyPhaseName, "
"COUNT(*) "
"FROM DirectDependencies "
"GROUP BY \"DependencyPhaseName\" "
") "
"SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage "
"FROM DependencyTypeDeps "
"ORDER BY percentage DESC ;";
}
};
#endif // QUERYTEXTS_H

View File

@@ -0,0 +1,717 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Derek Christ
* Iron Prando da Silva
*/
#include <QString>
#include <QFile>
#include <QStringList>
#include <QTextStream>
#include <QSqlError>
#include <iostream>
#include <QFileInfo>
#include <QDebug>
#include "data/tracedb.h"
#include "businessObjects/phases/phasefactory.h"
//define symbol printqueries if all queries should be printed to the console
//#define printqueries
TraceDB::TraceDB(const QString& path, bool openExisting)
{
this->pathToDB = path;
database = QSqlDatabase::database(path);
if (database.isValid() && database.isOpen())
{
// Close the database connection if it exists and was not closed yet.
database.close();
QSqlDatabase::removeDatabase(path);
}
database = QSqlDatabase::addDatabase("QSQLITE", path);
database.setDatabaseName(path);
if (!database.open())
{
qDebug() << database.lastError().text();
}
if (!openExisting)
dropAndCreateTables();
prepareQueries();
generalInfo = getGeneralInfoFromDB();
commandLengths = getCommandLengthsFromDB();
}
void TraceDB::prepareQueries()
{
selectTransactionsByTimespan = QSqlQuery(database);
if (!selectTransactionsByTimespan.prepare(queryTexts.selectTransactionsByTimespan))
qDebug() << database.lastError().text();
selectTransactionById = QSqlQuery(database);
if (!selectTransactionById.prepare(queryTexts.selectTransactionById))
qDebug() << database.lastError().text();
selectDebugMessagesByTimespan = QSqlQuery(database);
if (!selectDebugMessagesByTimespan.prepare("SELECT time, Message FROM DebugMessages WHERE :begin <= time AND time <= :end "))
qDebug() << database.lastError().text();
selectDebugMessagesByTimespanWithLimit = QSqlQuery(database);
if (!selectDebugMessagesByTimespanWithLimit.prepare("SELECT time, Message FROM DebugMessages WHERE :begin <= time AND time <= :end LIMIT :limit"))
qDebug() << database.lastError().text();
checkDependenciesExist = QSqlQuery(database);
if (!checkDependenciesExist.prepare(queryTexts.checkDependenciesExist))
qDebug() << database.lastError().text();
selectDependenciesByTimespan = QSqlQuery(database);
if (!selectDependenciesByTimespan.prepare(queryTexts.selectDependenciesByTimespan))
qDebug() << database.lastError().text();
}
void TraceDB::updateComments(const std::vector<CommentModel::Comment> &comments)
{
QSqlQuery query(database);
query.prepare("DELETE FROM Comments");
executeQuery(query);
query.prepare("insert into Comments values(:time,:text)");
for (const auto &comment : comments)
{
query.bindValue(":time", comment.time);
query.bindValue(":text", comment.text);
executeQuery(query);
}
}
void TraceDB::updateFileDescription(const QString &description)
{
QSqlQuery query(database);
query.prepare("UPDATE GeneralInfo SET Description=:description");
query.bindValue(":description", description);
executeQuery(query);
}
void TraceDB::refreshData()
{
prepareQueries();
generalInfo = getGeneralInfoFromDB();
}
//QueryText must select the fields
//TransactionID, Ranges.begin, Ranges.end, Address, TThread, TChannel, TBank, TRow, TColumn, Phases.ID AS PhaseID, PhaseName, PhaseBegin, PhaseEnd
std::vector<std::shared_ptr<Transaction>> TraceDB::getTransactionsWithCustomQuery(const QString& queryText)
{
QSqlQuery query(database);
query.prepare(queryText);
executeQuery(query);
return parseTransactionsFromQuery(query);
}
std::vector<std::shared_ptr<Transaction>> TraceDB::getTransactionsInTimespan(const Timespan &span, bool updateVisiblePhases)
{
selectTransactionsByTimespan.bindValue(":begin", span.Begin());
selectTransactionsByTimespan.bindValue(":end", span.End());
executeQuery(selectTransactionsByTimespan);
return parseTransactionsFromQuery(selectTransactionsByTimespan, updateVisiblePhases);
}
bool TraceDB::checkDependencyTableExists()
{
executeQuery(checkDependenciesExist);
bool exists = checkDependenciesExist.next() && checkDependenciesExist.value(0).toInt() == 1;
checkDependenciesExist.finish();
return exists;
}
void TraceDB::updateDependenciesInTimespan(const Timespan &span)
{
if (checkDependencyTableExists())
{
selectDependenciesByTimespan.bindValue(":begin", span.Begin());
selectDependenciesByTimespan.bindValue(":end", span.End());
executeQuery(selectDependenciesByTimespan);
mUpdateDependenciesFromQuery(selectDependenciesByTimespan);
}
}
//TODO Remove exception
std::shared_ptr<Transaction> TraceDB::getTransactionByID(ID id)
{
selectTransactionById.bindValue(":id", id);
executeQuery(selectTransactionById);
auto result = parseTransactionsFromQuery(selectTransactionById);
if (!result.empty())
return result[0];
else
throw sqlException(("Transaction with ID " + QString::number(
id) + " not in DB").toStdString(), this->pathToDB.toStdString());
}
std::shared_ptr<Transaction> TraceDB::getNextActivate(traceTime time)
{
QSqlQuery query(database);
QString queryText = queryTexts.queryHead +
"WHERE PhaseBegin > :traceTime AND PhaseName = 'ACT' ORDER BY PhaseBegin ASC LIMIT 1";
query.prepare(queryText);
query.bindValue(":traceTime", time);
executeQuery(query);
return parseTransactionFromQuery(query);
}
std::shared_ptr<Transaction> TraceDB::getNextPrecharge(traceTime time)
{
QSqlQuery query(database);
QString queryText = queryTexts.queryHead +
"WHERE PhaseBegin > :traceTime AND PhaseName "
"IN ('PRE','PREPB','PREA','PREAB','PRESB') ORDER BY PhaseBegin ASC LIMIT 1";
query.prepare(queryText);
query.bindValue(":traceTime", time);
executeQuery(query);
return parseTransactionFromQuery(query);
}
// shared_ptr<Transaction> TraceDB::getNextActb(ID currentTransactionId)
// {
// QSqlQuery query(database);
// QString queryText = queryTexts.queryHead +
// "WHERE TransactionID > :currentID AND PhaseName = 'ACTB' LIMIT 1";
//
// query.prepare(queryText);
// query.bindValue(":currentID", currentTransactionId);
// executeQuery(query);
// return parseTransactionFromQuery(query);
// }
// shared_ptr<Transaction> TraceDB::getNextPreb(ID currentTransactionId)
// {
// QSqlQuery query(database);
// QString queryText = queryTexts.queryHead +
// "WHERE TransactionID > :currentID AND PhaseName = 'PREB' LIMIT 1";
//
// query.prepare(queryText);
// query.bindValue(":currentID", currentTransactionId);
// executeQuery(query);
// return parseTransactionFromQuery(query);
// }
std::shared_ptr<Transaction> TraceDB::getNextRefresh(traceTime time)
{
QSqlQuery query(database);
QString queryText = queryTexts.queryHead +
"WHERE PhaseBegin > :traceTime AND PhaseName "
"IN ('REFAB','REFA','REFB','REFPB','REFP2B','REFSB','SREF','SREFB') ORDER BY PhaseBegin ASC LIMIT 1";
query.prepare(queryText);
query.bindValue(":traceTime", time);
executeQuery(query);
return parseTransactionFromQuery(query);
}
std::shared_ptr<Transaction> TraceDB::getNextCommand(traceTime time)
{
QSqlQuery query(database);
QString queryText = queryTexts.queryHead +
"WHERE PhaseBegin > :traceTime ORDER BY PhaseBegin ASC LIMIT 1";
query.prepare(queryText);
query.bindValue(":traceTime", time);
executeQuery(query);
return parseTransactionFromQuery(query);
}
// shared_ptr<Transaction> TraceDB::getNextRefb(ID currentTransactionId)
// {
// QSqlQuery query(database);
// QString queryText = queryTexts.queryHead +
// "WHERE TransactionID > :currentID AND PhaseName = 'REFB' LIMIT 1";
//
// query.prepare(queryText);
// query.bindValue(":currentID", currentTransactionId);
// executeQuery(query);
// return parseTransactionFromQuery(query);
// }
ID TraceDB::getTransactionIDFromPhaseID(ID phaseID)
{
QSqlQuery query(database);
query.prepare("SELECT Transact FROM Phases WHERE ID=:id");
query.bindValue(":id", phaseID);
executeQuery(query);
if (query.next()) {
return query.value(0).toInt();
} else {
throw sqlException("Phase with ID " + std::to_string(phaseID) + " not in db",
this->pathToDB.toStdString());
}
}
GeneralInfo TraceDB::getGeneralInfoFromDB()
{
QVariant parameter;
parameter = getParameterFromTable("NumberOfTransactions", "GeneralInfo");
uint64_t numberOfTransactions = parameter.isValid() ? parameter.toULongLong() : 0;
parameter = getParameterFromTable("TraceEnd", "GeneralInfo");
traceTime traceEnd = parameter.isValid() ? static_cast<traceTime>(parameter.toULongLong()) : 0;
parameter = getParameterFromTable("NumberOfRanks", "GeneralInfo");
unsigned numberOfRanks = parameter.isValid() ? parameter.toUInt() : 1;
parameter = getParameterFromTable("NumberOfBankgroups", "GeneralInfo");
unsigned numberOfBankGroups = parameter.isValid() ? parameter.toUInt() : numberOfRanks;
parameter = getParameterFromTable("NumberOfBanks", "GeneralInfo");
unsigned numberOfBanks = parameter.isValid() ? parameter.toUInt() : numberOfBankGroups;
parameter = getParameterFromTable("Clk", "GeneralInfo");
uint64_t clkPeriod = parameter.isValid() ? parameter.toULongLong() : 1000;
parameter = getParameterFromTable("UnitOfTime", "GeneralInfo");
QString unitOfTime = parameter.isValid() ? parameter.toString() : "PS";
parameter = getParameterFromTable("Traces", "GeneralInfo");
QString traces = parameter.isValid() ? "Traces: " + parameter.toString() : "Traces: empty";
parameter = getParameterFromTable("Memspec", "GeneralInfo");
QString memspec = parameter.isValid() ? "Memspec: " + parameter.toString() : "Memspec: empty";
parameter = getParameterFromTable("MCconfig", "GeneralInfo");
QString mcconfig = parameter.isValid() ? "MCconfig: " + parameter.toString() : "MCconfig: empty";
parameter = getParameterFromTable("WindowSize", "GeneralInfo");
uint64_t windowSize = parameter.isValid() ? parameter.toULongLong() : 0;
parameter = getParameterFromTable("RefreshMaxPostponed", "GeneralInfo");
unsigned refreshMaxPostponed = parameter.isValid() ? parameter.toUInt() : 0;
parameter = getParameterFromTable("RefreshMaxPulledin", "GeneralInfo");
unsigned refreshMaxPulledin = parameter.isValid() ? parameter.toUInt() : 0;
parameter = getParameterFromTable("ControllerThread", "GeneralInfo");
unsigned controllerThread = parameter.isValid() ? parameter.toUInt() : UINT_MAX;
parameter = getParameterFromTable("MaxBufferDepth", "GeneralInfo");
unsigned maxBufferDepth = parameter.isValid() ? parameter.toUInt() : 8;
parameter = getParameterFromTable("Per2BankOffset", "GeneralInfo");
unsigned per2BankOffset = parameter.isValid() ? parameter.toUInt() : 1;
parameter = getParameterFromTable("RowColumnCommandBus", "GeneralInfo");
bool rowColumnCommandBus = parameter.isValid() && parameter.toBool();
parameter = getParameterFromTable("PseudoChannelMode", "GeneralInfo");
bool pseudoChannelMode = parameter.isValid() && parameter.toBool();
uint64_t numberOfPhases = getNumberOfPhases();
QString description = (traces + "\n");
description += mcconfig + "\n";
description += memspec + "\n";
description += "Number of Transactions: " + QString::number(numberOfTransactions) + "\n";
description += "Clock period: " + QString::number(clkPeriod) + " " + unitOfTime + "\n";
description += "Length of trace: " + prettyFormatTime(traceEnd) + "\n";
description += "Window size: " + QString::number(windowSize) + "\n";
return {numberOfTransactions, numberOfPhases, Timespan(0, traceEnd),
numberOfRanks, numberOfBankGroups, numberOfBanks,
description, unitOfTime, clkPeriod,
windowSize, refreshMaxPostponed, refreshMaxPulledin,
controllerThread, maxBufferDepth, per2BankOffset,
rowColumnCommandBus, pseudoChannelMode};
}
CommandLengths TraceDB::getCommandLengthsFromDB()
{
const std::string table = "CommandLengths";
auto getLengthFromDb = [=, &table](const std::string &command) -> QVariant
{
QSqlQuery query(("SELECT Length FROM " + table + " WHERE Command = \"" + command + "\"").c_str(), database);
if (query.first())
return query.value(0);
else
return {};
};
auto getCommandLength = [=, &table](const std::string &command) -> double
{
QVariant length = getLengthFromDb(command);
if (length.isValid())
return length.toDouble();
else
{
qDebug() << "CommandLength for" << command.c_str() << "not present in table" << table.c_str()
<< ". Defaulting to 1.";
return 1;
}
};
double NOP = getCommandLength("NOP");
double RD = getCommandLength("RD");
double WR = getCommandLength("RD");
double RDA = getCommandLength("RDA");
double WRA = getCommandLength("WRA");
double ACT = getCommandLength("ACT");
double PREPB = getCommandLength("PREPB");
double REFPB = getCommandLength("REFPB");
double RFMPB = getCommandLength("RFMPB");
double REFP2B = getCommandLength("REFP2B");
double RFMP2B = getCommandLength("RFMP2B");
double PRESB = getCommandLength("PRESB");
double REFSB = getCommandLength("REFSB");
double RFMSB = getCommandLength("RFMSB");
double PREAB = getCommandLength("PREAB");
double REFAB = getCommandLength("REFAB");
double RFMAB = getCommandLength("RFMAB");
double PDEA = getCommandLength("PDEA");
double PDXA = getCommandLength("PDXA");
double PDEP = getCommandLength("PDEP");
double PDXP = getCommandLength("PDXP");
double SREFEN = getCommandLength("SREFEN");
double SREFEX = getCommandLength("SREFEX");
return {NOP, RD, WR, RDA, WRA, ACT, PREPB, REFPB, RFMPB, REFP2B, RFMP2B, PRESB, REFSB, RFMSB,
PREAB, REFAB, RFMAB, PDEA, PDXA, PDEP, PDXP, SREFEN, SREFEX};
}
QVariant TraceDB::getParameterFromTable(const std::string& parameter, const std::string& table)
{
QSqlQuery query(("SELECT " + parameter + " FROM " + table).c_str(), database);
if (query.first())
return query.value(0);
else
{
qDebug() << "Parameter " << parameter.c_str() << " not present in table " << table.c_str();
return {};
}
}
uint64_t TraceDB::getNumberOfPhases()
{
QSqlQuery query(database);
query.prepare("SELECT COUNT(ID) FROM Phases");
executeQuery(query);
query.next();
return query.value(0).toULongLong();
}
std::vector<CommentModel::Comment> TraceDB::getComments()
{
QSqlQuery query(database);
query.prepare("SELECT Time,Text From Comments");
executeQuery(query);
return parseCommentsFromQuery(query);
}
std::vector<CommentModel::Comment> TraceDB::getDebugMessagesInTimespan(const Timespan &span)
{
selectDebugMessagesByTimespan.bindValue(":begin", span.Begin());
selectDebugMessagesByTimespan.bindValue(":end", span.End());
executeQuery(selectDebugMessagesByTimespan);
return parseCommentsFromQuery(selectDebugMessagesByTimespan);
}
std::vector<CommentModel::Comment> TraceDB::getDebugMessagesInTimespan(const Timespan &span,
unsigned int limit = 50)
{
selectDebugMessagesByTimespanWithLimit.bindValue(":begin", span.Begin());
selectDebugMessagesByTimespanWithLimit.bindValue(":end", span.End());
selectDebugMessagesByTimespanWithLimit.bindValue(":limit", limit);
executeQuery(selectDebugMessagesByTimespanWithLimit);
return parseCommentsFromQuery(selectDebugMessagesByTimespanWithLimit);
}
DependencyInfos TraceDB::getDependencyInfos(DependencyInfos::Type infoType)
{
DependencyInfos dummy;
if (!checkDependencyTableExists())
{
return dummy;
}
switch (infoType)
{
case DependencyInfos::Type::DependencyType:
{
selectDependencyTypePercentages = QSqlQuery(database);
if (!selectDependencyTypePercentages.prepare(queryTexts.selectDependencyTypePercentages))
qDebug() << database.lastError().text();
executeQuery(selectDependencyTypePercentages);
return parseDependencyInfos(selectDependencyTypePercentages, infoType);
}
case DependencyInfos::Type::TimeDependency:
{
selectTimeDependencyPercentages = QSqlQuery(database);
if (!selectTimeDependencyPercentages.prepare(queryTexts.selectTimeDependencyPercentages))
qDebug() << database.lastError().text();
executeQuery(selectTimeDependencyPercentages);
return parseDependencyInfos(selectTimeDependencyPercentages, infoType);
}
case DependencyInfos::Type::DelayedPhase:
{
selectDelayedPhasePercentages = QSqlQuery(database);
if (!selectDelayedPhasePercentages.prepare(queryTexts.selectDelayedPhasePercentages))
qDebug() << database.lastError().text();
executeQuery(selectDelayedPhasePercentages);
return parseDependencyInfos(selectDelayedPhasePercentages, infoType);
}
case DependencyInfos::Type::DependencyPhase:
{
selectDependencyPhasePercentages = QSqlQuery(database);
if (!selectDependencyPhasePercentages.prepare(queryTexts.selectDependencyPhasePercentages))
qDebug() << database.lastError().text();
executeQuery(selectDependencyPhasePercentages);
return parseDependencyInfos(selectDependencyPhasePercentages, infoType);
}
}
return dummy;
}
QSqlDatabase TraceDB::getDatabase() const
{
return database;
}
/* Helpers
*
*
*
*/
std::shared_ptr<Transaction> TraceDB::parseTransactionFromQuery(QSqlQuery &query)
{
auto result = parseTransactionsFromQuery(query);
if (!result.empty())
return result[0];
else
return {};
}
std::vector<std::shared_ptr<Transaction>> TraceDB::parseTransactionsFromQuery(QSqlQuery &query, bool updateVisiblePhases)
{
if (updateVisiblePhases)
{
_visiblePhases.clear();
}
std::vector<std::shared_ptr<Transaction>> result;
bool firstIteration = true;
ID currentID = 0;
int i = -1;
while (query.next())
{
ID id = query.value(0).toInt();
if (currentID != id || firstIteration)
{
++i;
firstIteration = false;
currentID = id;
Timespan span(query.value(1).toLongLong(), query.value(2).toLongLong());
uint64_t address = query.value(3).toULongLong();
unsigned int dataLength = query.value(4).toUInt();
unsigned int thread = query.value(5).toUInt();
unsigned int channel = query.value(6).toUInt();
QString command = query.value(7).toString();
result.push_back(std::make_shared<Transaction>(id, std::move(command), address, dataLength, thread, channel,
span, generalInfo.clkPeriod));
}
unsigned int phaseID = query.value(8).toInt();
QString phaseName = query.value(9).toString();
Timespan span(query.value(10).toLongLong(), query.value(11).toLongLong());
Timespan spanOnDataStrobe(query.value(12).toLongLong(), query.value(13).toLongLong());
unsigned int rank = query.value(14).toUInt();
unsigned int bankGroup = query.value(15).toUInt();
unsigned int bank = query.value(16).toUInt();
unsigned int row = query.value(17).toUInt();
unsigned int column = query.value(18).toUInt();
unsigned int burstLength = query.value(19).toUInt();
auto phase = PhaseFactory::createPhase(phaseID, phaseName, span, spanOnDataStrobe, rank, bankGroup, bank,
row, column, burstLength, result.at(result.size() - 1), *this);
result.at(result.size() - 1)->addPhase(phase);
if (updateVisiblePhases)
{
_visiblePhases[phaseID] = phase;
}
}
return result;
}
void TraceDB::mUpdateDependenciesFromQuery(QSqlQuery &query)
{
DependencyType type;
while (query.next())
{
ID delayedID = query.value(0).toInt();
ID dependencyID = query.value(4).toInt();
QString dependencyTypeStr = query.value(2).toString();
if (dependencyTypeStr == "bank")
{
type = DependencyType::IntraBank;
}
else if (dependencyTypeStr == "rank")
{
type = DependencyType::IntraRank;
}
else if (dependencyTypeStr == "interRank")
{
type = DependencyType::InterRank;
}
QString timeDependencyStr = query.value(3).toString();
if (_visiblePhases.count(delayedID) > 0)
{
if (_visiblePhases.count(dependencyID) > 0)
{
_visiblePhases[delayedID]->addDependency(std::make_shared<PhaseDependency>(
PhaseDependency(type, timeDependencyStr, _visiblePhases[dependencyID])));
}
else
{
_visiblePhases[delayedID]->addDependency(
std::make_shared<PhaseDependency>(PhaseDependency(type, timeDependencyStr)));
}
}
else
{
// TODO delayed phase not visible?
}
}
}
std::vector<CommentModel::Comment> TraceDB::parseCommentsFromQuery(QSqlQuery &query)
{
std::vector<CommentModel::Comment> result;
while (query.next())
{
result.push_back(CommentModel::Comment{query.value(0).toLongLong(),
query.value(1).toString()});
}
return result;
}
DependencyInfos TraceDB::parseDependencyInfos(QSqlQuery &query, const DependencyInfos::Type infoType)
{
DependencyInfos infos(infoType);
while (query.next())
{
infos.addInfo({query.value(0).toString(), query.value(1).toFloat()});
}
query.finish();
return infos;
}
void TraceDB::executeQuery(QSqlQuery query)
{
//query.exec returns bool indicating if the query was sucessfull
if (query.exec()) {
#ifdef printqueries
cout << queryToString(query).toStdString() << endl;
#endif
}
else {
query.finish();
throw sqlException( ("Query:\n " + queryToString(query) + "\n failed. Error: \n"
+
query.lastError().text()).toStdString(), this->pathToDB.toStdString());
}
}
QString TraceDB::queryToString(const QSqlQuery& query)
{
QString str = query.lastQuery();
QMapIterator<QString, QVariant> it(query.boundValues());
while (it.hasNext()) {
it.next();
str.replace(it.key(), it.value().toString());
}
return str;
}
void TraceDB::dropAndCreateTables()
{
executeScriptFile("common/static/createTraceDB.sql");
}
void TraceDB::executeScriptFile(const QString& fileName)
{
QSqlQuery query(database);
QFile scriptFile(fileName);
if (scriptFile.open(QIODevice::ReadOnly)) {
// The SQLite driver executes only a single (the first) query in the QSqlQuery
// if the script contains more queries, it needs to be splitted.
QStringList scriptQueries = QTextStream(&scriptFile).readAll().split(';');
for (QString &queryTxt : scriptQueries) {
if (queryTxt.trimmed().isEmpty()) {
continue;
}
if (!query.exec(queryTxt)) {
throw sqlException("Querry failed:" + query.lastError().text().toStdString(),
this->pathToDB.toStdString());
}
query.finish();
}
}
}

View File

@@ -0,0 +1,179 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Derek Christ
* Iron Prando da Silva
*/
#ifndef TRACEDB_H
#define TRACEDB_H
#include "QueryTexts.h"
#include "businessObjects/commandlengths.h"
#include "businessObjects/commentmodel.h"
#include "businessObjects/generalinfo.h"
#include "businessObjects/phases/dependencyinfos.h"
#include "businessObjects/phases/phasefactory.h"
#include "businessObjects/transaction.h"
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlTableModel>
#include <QString>
#include <exception>
#include <string>
#include <vector>
/* TraceDB handles the connection to a SQLLite database containing trace data.
* A TraceDB object always holds an open connection to a valid database.
*/
class TraceDB : public QObject
{
Q_OBJECT
public:
TraceDB(const QString& path, bool openExisting);
const QString &getPathToDB() const
{
return pathToDB;
}
void updateComments(const std::vector<CommentModel::Comment> &comments);
void updateFileDescription(const QString &description);
void updateDependenciesInTimespan(const Timespan &span);
void refreshData();
const GeneralInfo &getGeneralInfo() const
{
return generalInfo;
}
const CommandLengths &getCommandLengths() const
{
return commandLengths;
}
std::vector<std::shared_ptr<Transaction>> getTransactionsWithCustomQuery(
const QString& queryText);
std::vector<std::shared_ptr<Transaction>> getTransactionsInTimespan(const Timespan &span,
bool updateVisiblePhases = false);
std::shared_ptr<Transaction> getNextPrecharge(traceTime time);
std::shared_ptr<Transaction> getNextActivate(traceTime time);
std::shared_ptr<Transaction> getNextRefresh(traceTime time);
std::shared_ptr<Transaction> getNextCommand(traceTime time);
// std::shared_ptr<Transaction> getNextPreb(ID currentTransactionId);
// std::shared_ptr<Transaction> getNextActb(ID currentTransactionId);
// std::shared_ptr<Transaction> getNextRefb(ID currentTransactionId);
std::shared_ptr<Transaction> getTransactionByID(ID id);
ID getTransactionIDFromPhaseID(ID phaseID);
std::vector<CommentModel::Comment> getComments();
std::vector<CommentModel::Comment> getDebugMessagesInTimespan(const Timespan &span);
std::vector<CommentModel::Comment> getDebugMessagesInTimespan(const Timespan &span,
unsigned int limit);
bool checkDependencyTableExists();
DependencyInfos getDependencyInfos(DependencyInfos::Type infoType);
QSqlDatabase getDatabase() const;
private:
QString pathToDB;
QSqlDatabase database;
GeneralInfo generalInfo;
CommandLengths commandLengths;
QSqlQuery insertPhaseQuery;
QSqlQuery insertTransactionQuery;
QSqlQuery selectTransactionsByTimespan;
QSqlQuery selectTransactionById;
QSqlQuery selectDebugMessagesByTimespan;
QSqlQuery selectDebugMessagesByTimespanWithLimit;
QSqlQuery checkDependenciesExist;
QSqlQuery selectDependenciesByTimespan;
QSqlQuery selectDependencyTypePercentages;
QSqlQuery selectTimeDependencyPercentages;
QSqlQuery selectDelayedPhasePercentages;
QSqlQuery selectDependencyPhasePercentages;
TransactionQueryTexts queryTexts;
void prepareQueries();
void executeQuery(QSqlQuery query);
static QString queryToString(const QSqlQuery& query);
std::shared_ptr<Transaction> parseTransactionFromQuery(QSqlQuery &query);
std::vector<std::shared_ptr<Transaction>> parseTransactionsFromQuery(QSqlQuery &query,
bool updateVisiblePhases = false);
static std::vector<CommentModel::Comment> parseCommentsFromQuery(QSqlQuery &query);
void mUpdateDependenciesFromQuery(QSqlQuery &query);
static DependencyInfos parseDependencyInfos(QSqlQuery &query, const DependencyInfos::Type infoType);
void executeScriptFile(const QString& fileName);
void dropAndCreateTables();
uint64_t getNumberOfPhases();
GeneralInfo getGeneralInfoFromDB();
CommandLengths getCommandLengthsFromDB();
QVariant getParameterFromTable(const std::string& parameter, const std::string& table);
std::map<unsigned int, std::shared_ptr<Phase>> _visiblePhases; // Updated at parseTransactionsFromQuery
// At businessObjects/phasedependenciestracker.h
friend class PhaseDependenciesTracker;
};
class sqlException : public std::exception
{
private:
std::string message;
public:
sqlException(std::string message, std::string filename)
{
this->message = std::string("Error in file ") + filename + std::string(" ") +
message;
}
const char *what() const noexcept override
{
return message.c_str();
}
};
#endif // TRACEDB_H

View File

@@ -0,0 +1,203 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Éder F. Zulian
* Felipe S. Prado
* Derek Christ
*/
#include <QFileInfo>
#include <QtAlgorithms>
#include <QPainter>
#include <QDebug>
#include <stdio.h>
#include <iostream>
#include <QApplication>
#include <QFile>
#include <QTextStream>
#include <QFileDialog>
#include "evaluationtool.h"
#include "ui_evaluationtool.h"
using namespace std;
EvaluationTool::EvaluationTool(QWidget *parent) :
QWidget(parent),
ui(new Ui::EvaluationTool), resourcesRelPath("/../../dram/resources/scripts""")
{
ui->setupUi(this);
traceFilesModel = new QStandardItemModel(this);
ui->listView->setModel(traceFilesModel);
selectMetrics = new SelectMetrics(this);
QObject::connect(selectMetrics, SIGNAL(getSelectedMetrics()), this,
SLOT(getSelectedMetrics()));
}
EvaluationTool::~EvaluationTool()
{
delete ui;
}
void EvaluationTool::showForFiles(QList<QString> paths)
{
cleanUpUI();
fillFileList(paths);
show();
ui->toolBox->setCurrentIndex(0);
}
void EvaluationTool::showAndEvaluateMetrics(QList<QString> paths)
{
cleanUpUI();
fillFileList(paths);
show();
ui->toolBox->setCurrentIndex(1);
selectMetrics->setMetrics(getMetrics());
cout << "done" << endl;
}
vector<string> EvaluationTool::getMetrics()
{
vector<string> metrics;
for (int row = 0; row < traceFilesModel->rowCount(); ++row) {
TraceFileItem *item = static_cast<TraceFileItem *>(traceFilesModel->item(row));
vector<string> result = PythonCaller::instance().getMetrics(item->getPath());
if (result.size() > metrics.size())
metrics = result;
}
return metrics;
}
void EvaluationTool::cleanUpUI()
{
traceFilesModel->clear();
calculatedMetrics.clear();
ui->traceMetricTreeWidget->clear();
}
void EvaluationTool::fillFileList(QList<QString> paths)
{
std::sort(paths.begin(), paths.end(), [] (const QString & path1,
const QString & path2) {
return QFileInfo(path1).baseName() < QFileInfo(path2).baseName();
});
for (const QString &path : paths) {
traceFilesModel->appendRow(new TraceFileItem(path));
}
}
void EvaluationTool::on_btn_calculateMetrics_clicked()
{
selectMetrics->raise();
selectMetrics->activateWindow();
selectMetrics->show();
}
void EvaluationTool::getSelectedMetrics()
{
vector<long> selectedMetrics;
for (QCheckBox *metric : selectMetrics->metrics) {
selectedMetrics.push_back(metric->isChecked());
}
calculateMetrics(selectedMetrics);
}
void EvaluationTool::calculateMetrics(vector<long> selectedMetrics)
{
ui->traceMetricTreeWidget->clear();
for (int row = 0; row < traceFilesModel->rowCount(); ++row) {
TraceFileItem *item = static_cast<TraceFileItem *>(traceFilesModel->item(row));
if (item->checkState() == Qt::Checked)
{
TraceCalculatedMetrics result = PythonCaller::instance().calculateMetricsOnTrace(
item->getPath(), selectedMetrics);
calculatedMetrics.push_back(result);
ui->traceMetricTreeWidget->addTraceMetricResults(result);
}
}
ui->traceMetricTreeWidget->expandAll();
}
EvaluationTool::TraceFileItem::TraceFileItem(const QString &path)
{
this->path = path;
setText(QFileInfo(this->path).baseName());
setCheckable(true);
setCheckState(Qt::Checked);
setEditable(false);
}
void EvaluationTool::on_btn_exportCSV_clicked()
{
if (calculatedMetrics.size() > 0) {
QString filename = QFileDialog::getSaveFileName(this, "Export to CSV", "",
"Comma separated Values(*.csv)");
if (filename != "") {
QFile file(filename);
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out(&file);
out << calculatedMetrics[0].toCSVHeader() << "\n";
for (TraceCalculatedMetrics &metrics : calculatedMetrics) {
out << metrics.toCSVLine() << "\n";
}
file.close();
}
}
}
void EvaluationTool::on_btn_genPlots_clicked()
{
genPlots();
}
void EvaluationTool::genPlots()
{
ui->traceMetricTreeWidget->clear();
if (traceFilesModel->rowCount() == 0)
return;
for (int row = 0; row < traceFilesModel->rowCount(); ++row)
{
TraceFileItem *item = static_cast<TraceFileItem *>(traceFilesModel->item(row));
if (item->checkState() == Qt::Checked)
{
ui->traceMetricTreeWidget->addTracePlotResults(QFileInfo(
item->getPath()).baseName(),
PythonCaller::instance().generatePlotsOnTrace(item->getPath()));
}
}
ui->traceMetricTreeWidget->expandAll();
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
* Éder F. Zulian
* Felipe S. Prado
* Derek Christ
*/
#ifndef EVALUATIONTOOL_H
#define EVALUATIONTOOL_H
#include "selectmetrics.h"
#include <QWidget>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QList>
#include <QString>
#include <vector>
#include "businessObjects/pythoncaller.h"
#include "businessObjects/tracecalculatedmetrics.h"
namespace Ui {
class EvaluationTool;
}
class EvaluationTool : public QWidget
{
Q_OBJECT
public:
explicit EvaluationTool(QWidget *parent = 0);
~EvaluationTool();
void showForFiles(QList<QString> paths);
void showAndEvaluateMetrics(QList<QString> paths);
private Q_SLOTS:
void on_btn_calculateMetrics_clicked();
void on_btn_exportCSV_clicked();
void on_btn_genPlots_clicked();
void getSelectedMetrics();
private:
void fillFileList(QList<QString> paths);
void cleanUpUI();
void genPlots();
void calculateMetrics(std::vector<long> selectedMetrics);
std::vector<std::string> getMetrics();
Ui::EvaluationTool *ui;
QStandardItemModel *traceFilesModel;
std::vector<TraceCalculatedMetrics> calculatedMetrics;
QString resourcesRelPath;
SelectMetrics *selectMetrics;
class TraceFileItem : public QStandardItem
{
public:
TraceFileItem(const QString &path);
QString getPath()
{
return path;
}
private:
QString path;
};
};
#endif // EVALUATIONTOOL_H

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EvaluationTool</class>
<widget class="QWidget" name="EvaluationTool">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>869</width>
<height>514</height>
</rect>
</property>
<property name="windowTitle">
<string>Evaluate Traces</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListView" name="listView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolBox" name="toolBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>707</width>
<height>464</height>
</rect>
</property>
<attribute name="label">
<string>Calculate Metrics</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_calculateMetrics">
<property name="text">
<string>Calculate metrics</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_genPlots">
<property name="text">
<string>Generate plots</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_exportCSV">
<property name="text">
<string>Export to CSV</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="TraceMetricTreeWidget" name="traceMetricTreeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>TraceMetricTreeWidget</class>
<extends>QTreeWidget</extends>
<header>presentation/tracemetrictreewidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#include "gototimedialog.h"
#include "ui_gototimedialog.h"
#include <QMessageBox>
GoToTimeDialog::GoToTimeDialog(double *goToSecond, QWidget *parent) :
QDialog(parent),
goToSecond(goToSecond),
ui(new Ui::GoToTimeDialog)
{
ui->setupUi(this);
}
GoToTimeDialog::~GoToTimeDialog()
{
delete ui;
}
void GoToTimeDialog::on_pushButton_clicked()
{
QLocale c(QLocale::C);
bool validNumber;
*goToSecond = c.toDouble(ui->timeEdit->text(), &validNumber);
if (validNumber)
accept();
else {
QMessageBox::warning(this, "Invalid number",
"Please enter a valid floating point number");
}
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) 2015, 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:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#ifndef GOTOTIMEDIALOG_H
#define GOTOTIMEDIALOG_H
#include <QDialog>
namespace Ui {
class GoToTimeDialog;
}
class GoToTimeDialog : public QDialog
{
Q_OBJECT
public:
explicit GoToTimeDialog(double *goToSecond, QWidget *parent = 0);
~GoToTimeDialog();
private:
double *goToSecond;
private Q_SLOTS:
void on_pushButton_clicked();
private:
Ui::GoToTimeDialog *ui;
};
#endif // GOTOTIMEDIALOG_H

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GoToTimeDialog</class>
<widget class="QDialog" name="GoToTimeDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>395</width>
<height>45</height>
</rect>
</property>
<property name="windowTitle">
<string>Go to time</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="timeEdit"/>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>ns</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="132"
height="132"
id="svg2"
inkscape:version="0.92.1 r15371"
sodipodi:docname="icon.svg"
viewBox="0 0 132 132">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1137"
id="namedview37"
showgrid="false"
inkscape:zoom="2.600739"
inkscape:cx="66.000744"
inkscape:cy="106.85864"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
showguides="true"
inkscape:guide-bbox="true"
inkscape:document-units="px"
inkscape:document-rotation="0" />
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-39.832809,-234.78106)"
id="g4392">
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4395"
y="234.78108"
x="39.832809"
height="40"
width="40" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4397"
y="234.78108"
x="85.832809"
height="40"
width="40" />
<rect
style="fill:#2d5016;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4399"
y="234.78108"
x="131.83281"
height="40"
width="40" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4401"
y="280.78107"
x="39.832809"
height="40"
width="40" />
<rect
style="fill:#2d5016;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4403"
y="280.78107"
x="85.832809"
height="40"
width="40" />
<rect
style="fill:#338000;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4405"
y="280.78107"
x="131.83281"
height="40"
width="40" />
<rect
style="fill:#2d5016;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4407"
y="326.78107"
x="39.832809"
height="40"
width="40" />
<rect
style="fill:#338000;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4409"
y="326.78107"
x="85.832809"
height="40"
width="40" />
<rect
style="fill:#71c837;fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4411"
y="326.78107"
x="131.83281"
height="40"
width="40" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

Some files were not shown because too many files have changed in this diff Show More