20#ifndef __simpleAddressMap_h__
21#define __simpleAddressMap_h__
34 typedef std::map<sc_dt::uint64, unsigned int>
mapType;
56 std::cout<<
"Address check successful."<<std::endl;
67 std::cout<<
"SimpleAddressMap: printing the sorted MAP:"<<std::endl;
71 printf(
"key: %x value: %i \n", (
unsigned int) ((pos->first+1)>>1)-1, pos->second);
73 printf(
"key: %x value: %i \n", (
unsigned int) (pos->first>>1)-1, pos->second);
90 if((lbound->second == 255) | (lbound==
m_addressMap.end())){
91 SC_REPORT_ERROR(
"SimpleAddressMap",
"Address does not match any registered address range.");
94 return lbound->second;
107 SC_REPORT_ERROR(
"SimpleAddressMap",
"get_max() called on empty address map.");
115 retval=((i->first+1)>>1)-1;
119 SC_REPORT_ERROR(
"SimpleAddressMap",
"get_min() called on empty address map.");
131 if(baseAddress_>highAddress_)
132 SC_REPORT_ERROR(
"SimpleAddressMap",
"Base address must be lower than high address.");
134 SC_REPORT_ERROR(
"SimpleAddressMap",
"Only ;-) 255 targets can be handled.");
135 m_addressMap.insert(mapType::value_type(((baseAddress_+1)<<1)-1, 255 ));
136 m_addressMap.insert(mapType::value_type( (highAddress_+1)<<1 ,portNumber_));
Simple address map implementation for the generic protocol.
std::map< sc_dt::uint64, unsignedint >::iterator addressMapIterator
unsigned int decode(sc_dt::uint64 address_)
Decode slave address.
void insert(sc_dt::uint64 baseAddress_, sc_dt::uint64 highAddress_, unsigned int portNumber_)
Insert a slave into the address map.
const sc_dt::uint64 & get_min()
std::map< sc_dt::uint64, unsigned int > mapType
void checkSanity()
Check for overlapping address ranges.
const sc_dt::uint64 & get_max()
mapType m_addressMap
the address map
#define SC_REPORT_ERROR(msg_type, msg)