#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 2012 // /// \file /// \brief XML address decoder /// \author Matthias Jung /// \date 02.07.2012 // #include #include #include #include #include #include #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 masks; std::map shifts; }; #endif