Conflicts: dram/dramSys/dramSys.pro dram/resources/configs/amconfigs/am_wideio.xml dram/resources/configs/memconfigs/fr_fcfs.xml dram/src/common/xmlAddressdecoder.cpp dram/src/controller/core/configuration/ConfigurationLoader.cpp dram/src/simulation/Simulation.cpp dram/src/simulation/Simulation.h dram/src/simulation/TracePlayer.h
70 lines
1.5 KiB
C++
Executable File
70 lines
1.5 KiB
C++
Executable File
#ifndef _XMLADDRESSDECODER_H
|
|
#define _XMLADDRESSDECODER_H
|
|
// Copyright (C) 2011 University of Kaiserslautern
|
|
// Microelectronic System Design Research Group
|
|
//
|
|
// de.uni-kl.eit.ems.vp
|
|
//
|
|
// Matthias Jung <jungma@eit.uni-kl.de> 2012
|
|
//
|
|
/// \file
|
|
/// \brief XML address decoder
|
|
/// \author Matthias Jung <jungma@eit.uni-kl.de>
|
|
/// \date 02.07.2012
|
|
//
|
|
|
|
#include <tlm.h>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include <string>
|
|
#include <math.h>
|
|
#include <map>
|
|
|
|
#include "third_party/tinyxml2.h"
|
|
|
|
struct DecodedAddress
|
|
{
|
|
DecodedAddress():channel(0),rank(0),bankgroup(0),row(0),bank(0),column(0),bytes(0){}
|
|
unsigned int channel;
|
|
unsigned int rank;
|
|
unsigned int bankgroup;
|
|
unsigned int row;
|
|
unsigned int bank;
|
|
unsigned int column;
|
|
unsigned int bytes;
|
|
};
|
|
|
|
class xmlAddressDecoder
|
|
{
|
|
|
|
public:
|
|
|
|
static tinyxml2::XMLElement* addressmapping;
|
|
static inline xmlAddressDecoder& getInstance()
|
|
{
|
|
static xmlAddressDecoder decoder(xmlAddressDecoder::addressmapping);
|
|
return decoder;
|
|
}
|
|
|
|
static inline void Initialize(tinyxml2::XMLElement* mapping)
|
|
{
|
|
addressmapping = mapping;
|
|
xmlAddressDecoder::getInstance();
|
|
addressmapping = NULL;
|
|
}
|
|
|
|
DecodedAddress decodeAddress(sc_dt::uint64 addr);
|
|
sc_dt::uint64 encodeAddress(DecodedAddress n);
|
|
|
|
|
|
void print();
|
|
private:
|
|
xmlAddressDecoder(std::string URI);
|
|
xmlAddressDecoder(tinyxml2::XMLElement* addressMap);
|
|
|
|
std::map<std::string, sc_dt::uint64> masks;
|
|
std::map<std::string, unsigned int> shifts;
|
|
};
|
|
|
|
#endif
|