Code formatting.
This commit is contained in:
@@ -1,86 +1,128 @@
|
||||
/*
|
||||
* Copyright (c) 2018, University of 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:
|
||||
* Johannes Feldmann
|
||||
* Lukas Steiner
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <bitset>
|
||||
|
||||
#include "AddressDecoder.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "../configuration/Configuration.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
unsigned int AddressDecoder::getUnsignedAttrFromJson(nlohmann::json obj, std::string strName)
|
||||
{
|
||||
|
||||
if (!obj[strName].empty()){
|
||||
if (obj[strName].is_number_unsigned()){
|
||||
return obj[strName];
|
||||
if (!obj[strName].empty())
|
||||
{
|
||||
if (obj[strName].is_number_unsigned())
|
||||
{
|
||||
return obj[strName];
|
||||
}
|
||||
else {
|
||||
reportFatal("AddressDecoder",
|
||||
"Attribute " + strName + " is not a number.");
|
||||
return (unsigned)(-1);
|
||||
else
|
||||
{
|
||||
SC_REPORT_FATAL("AddressDecoder", ("Attribute " + strName + " is not a number.").c_str());
|
||||
return (unsigned)(-1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
reportFatal("AddressDecoder",
|
||||
"Attribute " + strName + " is empty or not found");
|
||||
return (unsigned)(-1);
|
||||
else
|
||||
{
|
||||
SC_REPORT_FATAL("AddressDecoder", ("Attribute " + strName + " is empty or not found.").c_str());
|
||||
return (unsigned)(-1);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<unsigned> AddressDecoder::getAttrToVectorFromJson(nlohmann::json obj,
|
||||
std::string strName)
|
||||
std::vector<unsigned> AddressDecoder::getAttrToVectorFromJson(nlohmann::json obj, std::string strName)
|
||||
{
|
||||
std::vector<unsigned> vParameter;
|
||||
if (!obj[strName].empty()){
|
||||
for ( auto it: obj[strName].items() ){
|
||||
auto valor = it.value();
|
||||
if (valor.is_number_unsigned())
|
||||
vParameter.push_back(it.value());
|
||||
else {
|
||||
reportFatal("AddressDecoder",
|
||||
"Attribute " + strName + " is not a number.");
|
||||
}
|
||||
}
|
||||
}
|
||||
return vParameter;
|
||||
|
||||
if (!obj[strName].empty())
|
||||
{
|
||||
for (auto it : obj[strName].items())
|
||||
{
|
||||
auto valor = it.value();
|
||||
if (valor.is_number_unsigned())
|
||||
vParameter.push_back(it.value());
|
||||
else
|
||||
SC_REPORT_FATAL("AddressDecoder", ("Attribute " + strName + " is not a number.").c_str());
|
||||
}
|
||||
}
|
||||
return vParameter;
|
||||
}
|
||||
|
||||
AddressDecoder::AddressDecoder(std::string pathToAddressMapping)
|
||||
{
|
||||
json AddrFile = parseJSON(pathToAddressMapping);
|
||||
json j;
|
||||
if (AddrFile["CONGEN"].empty())
|
||||
reportFatal("AddressDecorder",
|
||||
"Root node name differs from \"CONGEN\". File format not supported.");
|
||||
json addrFile = parseJSON(pathToAddressMapping);
|
||||
json mapping;
|
||||
if (addrFile["CONGEN"].empty())
|
||||
SC_REPORT_FATAL("AddressDecorder", "Root node name differs from \"CONGEN\". File format not supported.");
|
||||
|
||||
// Load address mapping
|
||||
if (!AddrFile["CONGEN"]["SOLUTION"].empty()) {
|
||||
for ( auto it: AddrFile["CONGEN"]["SOLUTION"].items()){
|
||||
if (getUnsignedAttrFromJson(it.value(), "ID") == 0){
|
||||
ID=true;
|
||||
j = it.value();
|
||||
if (!addrFile["CONGEN"]["SOLUTION"].empty())
|
||||
{
|
||||
bool foundID0 = false;
|
||||
for (auto it : addrFile["CONGEN"]["SOLUTION"].items())
|
||||
{
|
||||
if (getUnsignedAttrFromJson(it.value(), "ID") == 0)
|
||||
{
|
||||
foundID0 = true;
|
||||
mapping = it.value();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ID != true)
|
||||
if (!foundID0)
|
||||
SC_REPORT_FATAL("AddressDecoder", "No mapping with ID 0 was found.");
|
||||
}
|
||||
else
|
||||
j = AddrFile["CONGEN"];
|
||||
}
|
||||
else
|
||||
mapping = addrFile["CONGEN"];
|
||||
|
||||
for ( auto xorItem: j["XOR"].items() ){
|
||||
for (auto xorItem : mapping["XOR"].items())
|
||||
{
|
||||
auto value = xorItem.value();
|
||||
if (!value.empty())
|
||||
vXor.push_back(std::pair<unsigned, unsigned>(getUnsignedAttrFromJson(value, "FIRST"),
|
||||
getUnsignedAttrFromJson(value, "SECOND")));
|
||||
}
|
||||
vChannelBits = getAttrToVectorFromJson(j,"CHANNEL_BIT");
|
||||
vRankBits = getAttrToVectorFromJson(j,"RANK_BIT");
|
||||
vBankGroupBits = getAttrToVectorFromJson(j,"BANKGROUP_BIT");
|
||||
vBankBits = getAttrToVectorFromJson(j,"BANK_BIT");
|
||||
vRowBits = getAttrToVectorFromJson(j,"ROW_BIT");
|
||||
vColumnBits = getAttrToVectorFromJson(j,"COLUMN_BIT");
|
||||
vByteBits = getAttrToVectorFromJson(j,"BYTE_BIT");
|
||||
}
|
||||
|
||||
vChannelBits = getAttrToVectorFromJson(mapping,"CHANNEL_BIT");
|
||||
vRankBits = getAttrToVectorFromJson(mapping,"RANK_BIT");
|
||||
vBankGroupBits = getAttrToVectorFromJson(mapping,"BANKGROUP_BIT");
|
||||
vBankBits = getAttrToVectorFromJson(mapping,"BANK_BIT");
|
||||
vRowBits = getAttrToVectorFromJson(mapping,"ROW_BIT");
|
||||
vColumnBits = getAttrToVectorFromJson(mapping,"COLUMN_BIT");
|
||||
vByteBits = getAttrToVectorFromJson(mapping,"BYTE_BIT");
|
||||
|
||||
unsigned channels = pow(2.0, vChannelBits.size());
|
||||
unsigned ranks = pow(2.0, vRankBits.size());
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
#ifndef ADRESSDECODER_H
|
||||
#define ADRESSDECODER_H
|
||||
/*
|
||||
* Copyright (c) 2018, University of 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:
|
||||
* Johannes Feldmann
|
||||
* Lukas Steiner
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#ifndef ADDRESSDECODER_H
|
||||
#define ADDRESSDECODER_H
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -38,18 +75,14 @@ public:
|
||||
void print();
|
||||
|
||||
private:
|
||||
|
||||
std::vector<unsigned> getAttrToVectorFromJson(nlohmann::json obj,
|
||||
std::string strName);
|
||||
unsigned int getUnsignedAttrFromJson(nlohmann::json obj,
|
||||
std::string strName);
|
||||
std::vector<unsigned> getAttrToVectorFromJson(nlohmann::json obj, std::string strName);
|
||||
unsigned int getUnsignedAttrFromJson(nlohmann::json obj, std::string strName);
|
||||
|
||||
unsigned banksPerGroup;
|
||||
unsigned bankgroupsPerRank;
|
||||
|
||||
uint64_t maximumAddress;
|
||||
|
||||
bool ID;
|
||||
// This container stores for each used xor gate a pair of address bits, the first bit is overwritten with the result
|
||||
std::vector<std::pair<unsigned, unsigned>> vXor;
|
||||
std::vector<unsigned> vChannelBits;
|
||||
|
||||
@@ -428,10 +428,10 @@ void TlmRecorder::insertPhaseInDB(std::string phaseName, const sc_time &begin,
|
||||
void TlmRecorder::executeSqlStatement(sqlite3_stmt *statement)
|
||||
{
|
||||
int errorCode = sqlite3_step(statement);
|
||||
if (errorCode != SQLITE_DONE) {
|
||||
reportFatal("Error in TraceRecorder",
|
||||
std::string("Could not execute statement. Error code: ") + std::to_string(errorCode));
|
||||
}
|
||||
if (errorCode != SQLITE_DONE)
|
||||
SC_REPORT_FATAL("Error in TraceRecorder",
|
||||
(std::string("Could not execute statement. Error code: ") + std::to_string(errorCode)).c_str());
|
||||
|
||||
sqlite3_reset(statement);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
* Janik Schlemminger
|
||||
* Robert Gernhardt
|
||||
* Matthias Jung
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#include "utils.h"
|
||||
@@ -63,11 +64,6 @@ sc_time getDistance(sc_time a, sc_time b)
|
||||
return b - a;
|
||||
}
|
||||
|
||||
void reportFatal(std::string sender, std::string message)
|
||||
{
|
||||
SC_REPORT_FATAL(sender.c_str(), message.c_str());
|
||||
}
|
||||
|
||||
std::string phaseNameToString(tlm_phase phase)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@@ -76,55 +72,50 @@ std::string phaseNameToString(tlm_phase phase)
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
unsigned int uIntParameter(nlohmann::json obj, std::string name)
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
if (!obj.empty()){
|
||||
if (obj.is_number_unsigned()){
|
||||
return obj;
|
||||
}
|
||||
else throw std::invalid_argument("Expected type for '" + name + "': unsigned int");
|
||||
if (!obj.empty())
|
||||
{
|
||||
if (obj.is_number_unsigned())
|
||||
return obj;
|
||||
else
|
||||
throw std::invalid_argument("Expected type for '" + name + "': unsigned int");
|
||||
}
|
||||
else reportFatal("Query json", "Parameter '" + name + "' does not exist.");
|
||||
else
|
||||
SC_REPORT_FATAL("Query json", ("Parameter '" + name + "' does not exist.").c_str());
|
||||
}
|
||||
|
||||
|
||||
double doubleParameter(nlohmann::json obj, std::string name)
|
||||
{
|
||||
|
||||
if (!obj.empty()){
|
||||
if (obj.is_number() & obj>0){
|
||||
return obj;
|
||||
}
|
||||
else {
|
||||
throw std::invalid_argument("Expected type for " + name + ": positive double");
|
||||
}
|
||||
}
|
||||
else {reportFatal("Query json", "Parameter '" + name + "' does not exist.");
|
||||
return 0;
|
||||
if (!obj.empty())
|
||||
{
|
||||
if (obj.is_number() && (obj > 0))
|
||||
return obj;
|
||||
else
|
||||
throw std::invalid_argument("Expected type for " + name + ": positive double");
|
||||
}
|
||||
else
|
||||
SC_REPORT_FATAL("Query json", ("Parameter '" + name + "' does not exist.").c_str());
|
||||
}
|
||||
|
||||
|
||||
std::string stringParameter(nlohmann::json obj)
|
||||
std::string stringParameter(nlohmann::json obj, std::string name)
|
||||
{
|
||||
if (!obj.empty()){
|
||||
if (obj.is_string()){
|
||||
return obj;
|
||||
}
|
||||
else throw std::invalid_argument("Expected type for parameter string");
|
||||
if (!obj.empty())
|
||||
{
|
||||
if (obj.is_string())
|
||||
return obj;
|
||||
else
|
||||
throw std::invalid_argument("Expected type for " + name + ": string");
|
||||
}
|
||||
else reportFatal("Query json", "Parameter does not exist.");
|
||||
return 0;
|
||||
else
|
||||
SC_REPORT_FATAL("Query json", ("Parameter '" + name + "' does not exist.").c_str());
|
||||
}
|
||||
|
||||
|
||||
std::string loadTextFileContents(std::string filename)
|
||||
{
|
||||
|
||||
ifstream in(filename.c_str(), ios::in | ios::binary);
|
||||
if (in) {
|
||||
if (in)
|
||||
{
|
||||
std::string contents;
|
||||
in.seekg(0, ios::end);
|
||||
contents.resize(in.tellg());
|
||||
@@ -132,25 +123,28 @@ std::string loadTextFileContents(std::string filename)
|
||||
in.read(&contents[0], contents.size());
|
||||
in.close();
|
||||
return (contents);
|
||||
} else {
|
||||
reportFatal("Error loading file", "Could not load textfile from " + filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
SC_REPORT_FATAL("Error loading file", ("Could not load textfile from " + filename).c_str());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
nlohmann::json parseJSON(std::string path){
|
||||
nlohmann::json parseJSON(std::string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
// parsing input with a syntax error
|
||||
nlohmann::json j = nlohmann::json::parse(std::ifstream(path));
|
||||
return j;
|
||||
}
|
||||
catch (nlohmann::json::parse_error& e)
|
||||
{
|
||||
// output exception information
|
||||
std::cout << "Error while trying to parse file: " << path << '\n'
|
||||
<< "message: " << e.what() << std::endl;
|
||||
}
|
||||
{
|
||||
// parsing input with a syntax error
|
||||
nlohmann::json j = nlohmann::json::parse(std::ifstream(path));
|
||||
return j;
|
||||
}
|
||||
catch (nlohmann::json::parse_error& e)
|
||||
{
|
||||
// output exception information
|
||||
std::cout << "Error while trying to parse file: " << path << '\n'
|
||||
<< "message: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void setUpDummy(tlm_generic_payload &payload, Rank rank, Bank bank)
|
||||
@@ -173,14 +167,13 @@ std::string getFileName(std::string uri)
|
||||
// Remove directory if present.
|
||||
// Do this before extension removal incase directory has a period character.
|
||||
const size_t last_slash_idx = uri.find_last_of("\\/");
|
||||
if (std::string::npos != last_slash_idx) {
|
||||
if (std::string::npos != last_slash_idx)
|
||||
uri.erase(0, last_slash_idx + 1);
|
||||
}
|
||||
|
||||
// Remove extension if present.
|
||||
const size_t period_idx = uri.rfind('.');
|
||||
if (std::string::npos != period_idx) {
|
||||
if (std::string::npos != period_idx)
|
||||
uri.erase(period_idx);
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
* Robert Gernhardt
|
||||
* Matthias Jung
|
||||
* Eder F. Zulian
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#ifndef UTILS_H
|
||||
@@ -134,7 +135,6 @@ static inline void loadbar(unsigned int x,
|
||||
}
|
||||
|
||||
//TODO : Move to debug manager
|
||||
void reportFatal(std::string sender, std::string message);
|
||||
std::string phaseNameToString(tlm::tlm_phase phase);
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ std::string loadTextFileContents(std::string filename);
|
||||
|
||||
unsigned int uIntParameter(nlohmann::json obj, std::string name);
|
||||
double doubleParameter(nlohmann::json obj, std::string name);
|
||||
std::string stringParameter(nlohmann::json obj);
|
||||
std::string stringParameter(nlohmann::json obj, std::string name);
|
||||
|
||||
nlohmann::json parseJSON(std::string path);
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
* Matthias Jung
|
||||
* Éder F. Zulian
|
||||
* Felipe S. Prado
|
||||
* Lukas Steiner
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
* Matthias Jung
|
||||
* Eder F. Zulian
|
||||
* Felipe S. Prado
|
||||
* Lukas Steiner
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#ifndef CONFIGURATION_H
|
||||
|
||||
@@ -62,9 +62,8 @@ void ConfigurationLoader::loadConfigJson(Configuration &config,
|
||||
json::object_t *configNode)
|
||||
{
|
||||
json j = *configNode;
|
||||
for (auto& x : j.items()) {
|
||||
for (auto& x : j.items())
|
||||
config.setParameter(x.key(), x.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,18 +91,19 @@ void ConfigurationLoader::loadMemSpec(Configuration &config,
|
||||
using json = nlohmann::json;
|
||||
json j = *memspec;
|
||||
auto memoryType = j["memoryType"];
|
||||
if (memoryType == "DDR4")
|
||||
{
|
||||
Configuration::getInstance().memSpec = new MemSpecDDR4();
|
||||
loadCommons(config, memspec);
|
||||
loadDDR4(config, memspec);
|
||||
}
|
||||
else if (memoryType == "DDR3")
|
||||
|
||||
if (memoryType == "DDR3")
|
||||
{
|
||||
Configuration::getInstance().memSpec = new MemSpecDDR3();
|
||||
loadCommons(config, memspec);
|
||||
loadDDR3(config, memspec);
|
||||
}
|
||||
else if (memoryType == "DDR4")
|
||||
{
|
||||
Configuration::getInstance().memSpec = new MemSpecDDR4();
|
||||
loadCommons(config, memspec);
|
||||
loadDDR4(config, memspec);
|
||||
}
|
||||
else if (memoryType == "LPDDR4")
|
||||
{
|
||||
Configuration::getInstance().memSpec = new MemSpecLPDDR4();
|
||||
@@ -147,16 +147,15 @@ void ConfigurationLoader::loadMemSpec(Configuration &config,
|
||||
loadGDDR6(config, memspec);
|
||||
}
|
||||
else
|
||||
reportFatal("ConfigurationLoader", "Unsupported DRAM type");
|
||||
SC_REPORT_FATAL("ConfigurationLoader", "Unsupported DRAM type");
|
||||
}
|
||||
|
||||
void ConfigurationLoader::loadCommons(Configuration &config, json::object_t *jsonSpec)
|
||||
{
|
||||
MemSpec *memSpec = config.memSpec;
|
||||
json j = *jsonSpec;
|
||||
memSpec->memoryId = stringParameter(j["memoryId"]);
|
||||
memSpec->memoryType = stringParameter(j["memoryType"]);
|
||||
|
||||
memSpec->memoryId = stringParameter(j["memoryId"], "memoryId");
|
||||
memSpec->memoryType = stringParameter(j["memoryType"], "memoryType");
|
||||
|
||||
// MemArchitecture
|
||||
memSpec->burstLength = uIntParameter( j["memarchitecturespec"]["burstLength"],"burstLength");
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
* Janik Schlemminger
|
||||
* Matthias Jung
|
||||
* Lukas Steiner
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#ifndef CONFIGURATIONLOADER_H
|
||||
@@ -56,11 +57,8 @@
|
||||
class ConfigurationLoader
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
static void loadMCConfig(Configuration &config, std::string amconfigUri);
|
||||
|
||||
|
||||
static void loadSimConfig(Configuration &config, std::string simconfigUri);
|
||||
|
||||
static void loadMemSpec(Configuration &config, std::string memspecUri);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* Authors:
|
||||
* Eder F. Zulian
|
||||
* Matthias Jung
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#ifndef TEMPERATURESIMCONFIG_H
|
||||
|
||||
@@ -404,7 +404,7 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerDDR3", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerDDR3", "Unknown command!");
|
||||
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK);
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerDDR4", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerDDR4", "Unknown command!");
|
||||
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK);
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankG
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerGDDR5", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerGDDR5", "Unknown command!");
|
||||
|
||||
// Check if command bus is free
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK);
|
||||
|
||||
@@ -516,7 +516,7 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, Bank
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerGDDR5X", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerGDDR5X", "Unknown command!");
|
||||
|
||||
// Check if command bus is free
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK);
|
||||
|
||||
@@ -537,7 +537,7 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankG
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerGDDR6", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerGDDR6", "Unknown command!");
|
||||
|
||||
// Check if command bus is free
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK);
|
||||
|
||||
@@ -482,7 +482,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerHBM2", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerHBM2", "Unknown command!");
|
||||
|
||||
return earliestTimeToStart;
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tSR);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerLPDDR4", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerLPDDR4", "Unknown command!");
|
||||
|
||||
// Check if command bus is free
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK);
|
||||
|
||||
@@ -376,7 +376,7 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerWideIO", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerWideIO", "Unknown command!");
|
||||
|
||||
// Check if command bus is free
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastScheduled + memSpec->tCK);
|
||||
|
||||
@@ -454,7 +454,7 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR);
|
||||
}
|
||||
else
|
||||
reportFatal("CheckerWideIO2", "Unknown command!");
|
||||
SC_REPORT_FATAL("CheckerWideIO2", "Unknown command!");
|
||||
|
||||
// Check if command bus is free
|
||||
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK);
|
||||
|
||||
@@ -123,10 +123,8 @@ DRAMSys::DRAMSys(sc_module_name name,
|
||||
if (!simulationdoc["simulation"]["simulationid"].empty()) {
|
||||
std::string sid = simulationdoc["simulation"]["simulationid"];
|
||||
simName = sid + '_' + Configuration::getInstance().simulationName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Instantiate all internal DRAMSys modules:
|
||||
instantiateModules(simName, pathToResources, amconfig);
|
||||
// Connect all internal DRAMSys modules:
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
*
|
||||
* Authors:
|
||||
* Matthias Jung
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#include "Setup.h"
|
||||
@@ -47,7 +48,7 @@ Setup::Setup(std::string uri,
|
||||
nlohmann::json simulationdoc = parseJSON(uri);
|
||||
|
||||
if (simulationdoc["simulation"].empty())
|
||||
reportFatal("SimulationManager",
|
||||
SC_REPORT_FATAL("SimulationManager",
|
||||
"Cannot load simulation: simulation node expected");
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
*
|
||||
* Authors:
|
||||
* Matthias Jung
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#include "TraceSetup.h"
|
||||
@@ -42,29 +43,29 @@ TraceSetup::TraceSetup(std::string uri,
|
||||
// Load Simulation:
|
||||
nlohmann::json simulationdoc = parseJSON(uri);
|
||||
|
||||
|
||||
if (simulationdoc["simulation"].empty())
|
||||
reportFatal("traceSetup",
|
||||
SC_REPORT_FATAL("traceSetup",
|
||||
"Cannot load simulation: simulation node expected");
|
||||
|
||||
// Load TracePlayers:
|
||||
for ( auto it: simulationdoc["simulation"]["tracesetup"].items() ){
|
||||
for (auto it : simulationdoc["simulation"]["tracesetup"].items())
|
||||
{
|
||||
auto value = it.value();
|
||||
if (!value.empty()){
|
||||
sc_time playerClk;
|
||||
unsigned int frequencyMHz = value["clkMhz"];
|
||||
if (!value.empty())
|
||||
{
|
||||
sc_time playerClk;
|
||||
unsigned int frequencyMHz = value["clkMhz"];
|
||||
|
||||
if (frequencyMHz == 0)
|
||||
reportFatal("traceSetup", "No Frequency Defined");
|
||||
SC_REPORT_FATAL("traceSetup", "No Frequency Defined");
|
||||
else
|
||||
playerClk = sc_time(1.0 / frequencyMHz, SC_US);
|
||||
|
||||
std::string name = value["name"];
|
||||
|
||||
size_t pos = name.rfind('.');
|
||||
if (pos == std::string::npos) {
|
||||
if (pos == std::string::npos)
|
||||
throw std::runtime_error("Name of the trace file does not contain a valid extension.");
|
||||
}
|
||||
|
||||
// Get the extension and make it lower case
|
||||
std::string ext = name.substr(pos + 1);
|
||||
@@ -77,23 +78,20 @@ TraceSetup::TraceSetup(std::string uri,
|
||||
std::replace(moduleName.begin(), moduleName.end(), '.', '_');
|
||||
|
||||
TracePlayer *player;
|
||||
if (ext == "stl") {
|
||||
if (ext == "stl")
|
||||
player = new StlPlayer<false>(moduleName.c_str(), stlFile, playerClk, this);
|
||||
} else if (ext == "rstl") {
|
||||
else if (ext == "rstl")
|
||||
player = new StlPlayer<true>(moduleName.c_str(), stlFile, playerClk, this);
|
||||
} else {
|
||||
std::string error = "Unsupported file extension in " + name;
|
||||
throw std::runtime_error(error);
|
||||
}
|
||||
else
|
||||
throw std::runtime_error("Unsupported file extension in " + name);
|
||||
|
||||
devices->push_back(player);
|
||||
|
||||
if (Configuration::getInstance().simulationProgressBar) {
|
||||
if (Configuration::getInstance().simulationProgressBar)
|
||||
totalTransactions += player->getNumberOfLines(stlFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
remainingTransactions = totalTransactions;
|
||||
numberOfTracePlayers = devices->size();
|
||||
}
|
||||
@@ -102,9 +100,8 @@ void TraceSetup::tracePlayerTerminates()
|
||||
{
|
||||
finishedTracePlayers++;
|
||||
|
||||
if (finishedTracePlayers == numberOfTracePlayers) {
|
||||
if (finishedTracePlayers == numberOfTracePlayers)
|
||||
sc_stop();
|
||||
}
|
||||
}
|
||||
void TraceSetup::transactionFinished()
|
||||
{
|
||||
@@ -112,7 +109,6 @@ void TraceSetup::transactionFinished()
|
||||
|
||||
loadbar(totalTransactions - remainingTransactions, totalTransactions);
|
||||
|
||||
if (remainingTransactions == 0) {
|
||||
if (remainingTransactions == 0)
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* Authors:
|
||||
* Robert Gernhardt
|
||||
* Matthias Jung
|
||||
* Luiza Correa
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -118,4 +118,3 @@ def get_total_time_in_phase(connection, phase):
|
||||
if (totalTime is None):
|
||||
totalTime = 0.0
|
||||
return totalTime
|
||||
|
||||
|
||||
@@ -484,6 +484,7 @@ def time_in_power_down_states_percent(connection):
|
||||
mcconfig = MCConfig(connection)
|
||||
#bankwiseLogic = mcconfig.getValue("BankwiseLogic")
|
||||
bankwiseLogic = "0"
|
||||
|
||||
if bankwiseLogic == "0":
|
||||
totalTimeAllBanks = trace_length_in_ns(connection)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user