print mapping

This commit is contained in:
Janik Schlemminger
2014-09-06 20:21:43 +02:00
parent 30b1fbbd0c
commit 938dbb3fdb
5 changed files with 30 additions and 50 deletions

View File

@@ -3,15 +3,15 @@
<Debug value="1" />
</simconfig>
<memspecs>
<memspec src="/home/schlemmi/dram/dram/resources/configs/memspecs/WideIO.xml"></memspec>
<memspec src="/home/jonny/git/dram.vp.system/dram/resources/configs/memspecs/WideIO.xml"></memspec>
</memspecs>
<addressmappings>
<addressmapping src="/home/schlemmi/dram/dram/resources/configs/amconfigs/am_wideio.xml"></addressmapping>
<addressmapping src="/home/jonny/git/dram.vp.system/dram/resources/configs/amconfigs/am_wideio.xml"></addressmapping>
</addressmappings>
<memconfigs>
<!-- <memconfig>fr_fcfs.xml</memconfig>
-->
<memconfig src="/home/schlemmi/dram/dram/resources/configs/memconfigs/fr_fcfs.xml">
<memconfig src="/home/jonny/git/dram.vp.system/dram/resources/configs/memconfigs/fr_fcfs.xml">
<!-- <Debug value="1"></Debug>-->
</memconfig>
</memconfigs>

View File

@@ -1,13 +1,11 @@
#include "xmlAddressdecoder.h"
#include <systemc.h>
#include "Utils.h"
#include "bitset"
using namespace std;
using namespace tinyxml2;
//string xmlAddressDecoder::addressConfigURI = "";
//tinyxml2::XMLElement* xmlAddressDecoder::addressMap = NULL;
tinyxml2::XMLElement* xmlAddressDecoder::addressmapping = NULL;
xmlAddressDecoder::xmlAddressDecoder(string addressConfigURI)
@@ -22,26 +20,17 @@ xmlAddressDecoder::xmlAddressDecoder(string addressConfigURI)
xmlAddressDecoder::xmlAddressDecoder(XMLElement* addressmap)
{
tinyxml2::XMLDocument doc;
//std::cout<<"fffffff"<<addressmap->Name()<<endl;
string xmlNodeName(addressmap->Name());
if( xmlNodeName != "addressmapping")
reportFatal("AddressDecorder", "addressmap node expected");
cout<<addressmap<<endl;
if(addressmap->Attribute("src"))
{
string src(addressmap->Attribute("src"));
std::cout<<src<<endl;
loadXML(src, doc);
addressmap = (doc.FirstChildElement("addressmapping"));
string src(addressmap->Attribute("src"));
loadXML(src, doc);
addressmap = (doc.FirstChildElement("addressmapping"));
}
cout<<addressmap<<endl;
//tinyxml2::XMLDocument doc2;
//loadXML("/home/jonny/git/dram.vp.system/dram/resources/configs/amconfigs/am_wideio.xml", doc2);
//XMLElement* addressmap = doc2.FirstChildElement("addressmapping");
for(XMLElement* child = addressmap->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
{
int from;
@@ -67,3 +56,14 @@ DecodedAddress xmlAddressDecoder::decodeAddress(sc_dt::uint64 addr)
result.bytes = (addr & masks["bytes"]) >> shifts["bytes"];
return result;
}
void xmlAddressDecoder::print()
{
cout << "Used addressmapping:" << endl;
cout<<"===================="<<endl;
for(auto& pair : masks)
{
cout<<pair.first<<"\t:\t" << bitset<32>(pair.second)<<endl;
}
cout<<"\n"<<endl;
}

View File

@@ -38,12 +38,10 @@ class xmlAddressDecoder
{
public:
//static std::string addressConfigURI;
//static tinyxml2::XMLElement* addressmapping;
static tinyxml2::XMLElement* addressmapping;
static inline xmlAddressDecoder& getInstance()
{
//if(decoder==NULL) std::cout<<"ERROR: AddressDecoder has been called before initialization"<<std::endl;
static xmlAddressDecoder decoder(xmlAddressDecoder::addressmapping);
return decoder;
}
@@ -51,17 +49,14 @@ static tinyxml2::XMLElement* addressmapping;
static inline void Initialize(tinyxml2::XMLElement* mapping)
{
addressmapping = mapping;
//decoder = xmlAddressDecoder(addressmapping);
xmlAddressDecoder::getInstance();
addressmapping = NULL;
}
DecodedAddress decodeAddress(sc_dt::uint64 addr);
void print();
private:
//static xmlAddressDecoder decoder;
//xmlAddressDecoder();
xmlAddressDecoder(std::string URI);
xmlAddressDecoder(tinyxml2::XMLElement* addressMap);

View File

@@ -37,13 +37,10 @@ void ConfigurationLoader::loadMemConfig(Configuration& config, XMLElement* memco
{
if(memconfig->Attribute("src"))
{
XMLDocument doc;
string src(memconfig->Attribute("src"));
std::cout<<"inner first"<<src<<endl;
loadXML(src, doc);
loadMemConfig(config, doc.FirstChildElement("memconfig"));
string src(memconfig->Attribute("src"));
loadXML(src, doc);
loadMemConfig(config, doc.FirstChildElement("memconfig"));
}
loadConfig(config, memconfig);
}
@@ -52,13 +49,11 @@ void ConfigurationLoader::loadSimConfig(Configuration& config, XMLElement* simco
{
if(simconfig->Attribute("src"))
{
XMLDocument doc;
string src(simconfig->Attribute("src"));
std::cout<<"inner first"<<src<<endl;
loadXML(src, doc);
loadSimConfig(config, doc.FirstChildElement("simconfig"));
string src(simconfig->Attribute("src"));
std::cout<<"inner first"<<src<<endl;
loadXML(src, doc);
loadSimConfig(config, doc.FirstChildElement("simconfig"));
}
loadConfig(config, simconfig);
}
@@ -85,17 +80,12 @@ void ConfigurationLoader::loadMemSpec(Configuration& config, string memspecUri)
void ConfigurationLoader::loadMemSpec(Configuration& config, XMLElement* memspec)
{
//if(memspec->Attribute("src"))
//{
XMLDocument doc;
XMLDocument doc;
string src(memspec->Attribute("src"));
config.memspecUri = src;
std::cout<<"inner first"<<src<<endl;
loadXML(src, doc);
memspec = doc.FirstChildElement("memspec");
//}
config.memSpec.MemoryId = queryStringParameter(memspec, "memoryId");
config.memSpec.MemoryType = queryStringParameter(memspec, "memoryType");

View File

@@ -27,13 +27,8 @@ Simulation::Simulation(sc_module_name /*name*/, string pathToResources, string t
{
SC_THREAD(stop);
cout<<setup.addressmapping->Name()<<endl;
//xmlAddressDecoder::addressConfigURI = pathToResources + string("configs/amconfigs/") + setup.addressmapping;
xmlAddressDecoder::Initialize(setup.addressmapping);
//Configuration::memconfigUri = pathToResources + string("configs/memconfigs/") + setup.memconfig;
//Configuration::memspecUri = pathToResources + string("configs/memspecs/") + setup.memspec;
xmlAddressDecoder::getInstance().print();
ConfigurationLoader::loadMemConfig(Configuration::getInstance(), setup.memconfig);//pathToResources + string("configs/memconfigs/") + setup.memconfig);
ConfigurationLoader::loadMemSpec(Configuration::getInstance(), setup.memspec);//pathToResources + string("configs/memspecs/") + setup.memspec);