merged everythin into one project
This commit is contained in:
87
dram/src/common/xmlAddressdecoder.h
Executable file
87
dram/src/common/xmlAddressdecoder.h
Executable file
@@ -0,0 +1,87 @@
|
||||
#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 "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 URI;
|
||||
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 <class T>
|
||||
T getAttribute(TiXmlElement * element, const std::string s)
|
||||
{
|
||||
T d;
|
||||
element->QueryValueAttribute<T>(s, &d);
|
||||
return d;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user