Files
DRAMSys/extensions/apps/traceAnalyzer/businessObjects/dramTimeDependencies/configurations/configurationfactory.cpp

117 lines
2.7 KiB
C++

/*
* Copyright (c) 2025 Fraunhofer IESE. All rights reserved.
*
* 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)
{
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;
}
}