#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 "third_party/tinyxml.h" struct node { unsigned int channel; unsigned int row; unsigned int bank; unsigned int colum; tlm::tlm_command command; tlm::tlm_phase phase; }; class xmlAddressDecoder { public: static std::string addressConfigURI; static xmlAddressDecoder& getInstance(); void getNode(unsigned int addr, node * n); void getBRC(unsigned int addr, unsigned int &bank, unsigned int &row, unsigned int &colum); void getCBRC(unsigned int addr, unsigned int &channel, unsigned int &bank, unsigned int &row, unsigned int &colum); void getC(unsigned int addr, unsigned int &channel); unsigned int getNumberOfBanks(); unsigned int getNumberOfRowsPerBank(); unsigned int getNumberOfColumsPerRow(); unsigned int getNumberOfBytesPerColumn(); private: xmlAddressDecoder(std::string URI); ~xmlAddressDecoder(); unsigned int channelMask; unsigned int rowMask; unsigned int bankMask; unsigned int columMask; unsigned int bytesMask; unsigned int channelShift; unsigned int rowShift; unsigned int bankShift; unsigned int columShift; unsigned int bytesShift; unsigned int channelSize; unsigned int bankSize; unsigned int rowSize; unsigned int columSize; unsigned int bytesSize; TiXmlDocument * doc; TiXmlElement * dramconfig; TiXmlElement * addressmap; template T getAttribute(TiXmlElement * element, const std::string s) { T d; element->QueryValueAttribute(s, &d); return d; } }; #endif