gmon.out bla bla

This commit is contained in:
Janik Schlemminger
2014-04-07 20:09:38 +02:00
4 changed files with 97 additions and 2 deletions

Binary file not shown.

View File

@@ -3,6 +3,7 @@
#include <tlm.h>
using namespace std;
using namespace tinyxml2;
void reportFatal(std::string sender, std::string message)
{
@@ -17,3 +18,75 @@ std::string phaseNameToString(tlm::tlm_phase phase)
std::string str = oss.str();
return str;
}
unsigned int queryIntParameter(XMLElement* node, string name) {
int result;
XMLElement* element;
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
if (element->Attribute("id") == name)
{
assert(!strcmp(element->Attribute("type"), "uint"));
XMLError error = element->QueryIntAttribute("value", &result);
assert(!error);
return result;
}
}
std::cout << "error: " + name + " element not found" << endl;
return 0;
}
double queryDoubleParameter(XMLElement* node, string name) {
double result;
XMLElement* element;
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
if (element->Attribute("id") == name)
{
assert(!strcmp(element->Attribute("type"), "double"));
XMLError error = element->QueryDoubleAttribute("value", &result);
assert(!error);
return result;
}
}
std::cout << "error: " + name + " element not found" << endl;
return 0;
}
bool queryBoolParameter(XMLElement* node, string name) {
bool result;
XMLElement* element;
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
if (element->Attribute("id") == name)
{
assert(!strcmp(element->Attribute("type"), "double"));
XMLError error = element->QueryBoolAttribute("value", &result);
assert(!error);
return result;
}
}
std::cout << "error: " + name + " element not found" << endl;
return 0;
}
string queryStringParameter(XMLElement* node, string name) {
XMLElement* element;
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
if (element->Attribute("id") == name)
{
return element->Attribute("value");
}
}
std::cout << "error: element not found" << endl;
return 0;
}

View File

@@ -14,6 +14,8 @@
#include <ostream>
#include <tlm.h>
#include "third_party/tinyxml2.h"
template<typename Key, typename Val>
Val getElementFromMap(std::map<Key, Val>& m, Key key)
{
@@ -39,4 +41,9 @@ bool isIn(const T& value, const std::vector<T>& collection)
void reportFatal(std::string sender, std::string message);
std::string phaseNameToString(tlm::tlm_phase phase);
unsigned int queryIntParameter(tinyxml2::XMLElement* node, std::string name);
std::string queryStringParameter(tinyxml2::XMLElement* node, std::string name);
bool queryBoolParameter(tinyxml2::XMLElement* node, std::string name);
double queryDoubleParameter(tinyxml2::XMLElement* node, std::string name);
#endif /* UTILS_COMMON_H_ */

View File

@@ -15,9 +15,20 @@ namespace core{
struct Configuration
{
static std::string memspecUri;
static std::string memconfigUri;
Configuration(): NumberOfBanks(8), NumberOfBankGroups(4), Burstlength(2), Timings(NumberOfBanks), BankwiseRefresh(true),BankwisePowerDown(true),
nActivate(2)
{}
{
readMemSpec();
}
string MemoryId;
string MemmoryType;
unsigned int NumberOfBanks;
unsigned int NumberOfBankGroups;
unsigned int Burstlength;
@@ -26,9 +37,13 @@ struct Configuration
bool BankwiseRefresh;
bool BankwisePowerDown;
unsigned int nActivate;
void readMemSpec();
void readMemConfig();
};
} /* namespace controller */
} /* namespace core */
#endif /* CONFIGURATION_H_ */