AddrRange: Transition from Range<T> to AddrRange
This patch takes the final plunge and transitions from the templated Range class to the more specific AddrRange. In doing so it changes the obvious Range<Addr> to AddrRange, and also bumps the range_map to be AddrRangeMap. In addition to the obvious changes, including the removal of redundant includes, this patch also does some house keeping in preparing for the introduction of address interleaving support in the ranges. The Range class is also stripped of all the functionality that is never used. --HG-- rename : src/base/range.hh => src/base/addr_range.hh rename : src/base/range_map.hh => src/base/addr_range_map.hh
This commit is contained in:
@@ -85,9 +85,8 @@ AbstractMemory::AbstractMemory(const Params *p) :
|
||||
int fd = open(params()->file.c_str(), O_RDONLY);
|
||||
long _size = lseek(fd, 0, SEEK_END);
|
||||
if (_size != range.size()) {
|
||||
warn("Specified size %d does not match file %s %d\n", range.size(),
|
||||
params()->file, _size);
|
||||
range = RangeSize(range.start, _size);
|
||||
fatal("Specified size %d does not match file %s %d\n",
|
||||
range.size(), params()->file, _size);
|
||||
}
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
pmemAddr = (uint8_t *)mmap(NULL, roundUp(_size, sysconf(_SC_PAGESIZE)),
|
||||
@@ -222,7 +221,7 @@ AbstractMemory::regStats()
|
||||
bwTotal = (bytesRead + bytesWritten) / simSeconds;
|
||||
}
|
||||
|
||||
Range<Addr>
|
||||
AddrRange
|
||||
AbstractMemory::getAddrRange() const
|
||||
{
|
||||
return range;
|
||||
|
||||
@@ -68,7 +68,7 @@ class AbstractMemory : public MemObject
|
||||
protected:
|
||||
|
||||
// Address range of this memory
|
||||
Range<Addr> range;
|
||||
AddrRange range;
|
||||
|
||||
// Pointer to host memory used to implement this memory
|
||||
uint8_t* pmemAddr;
|
||||
@@ -209,7 +209,7 @@ class AbstractMemory : public MemObject
|
||||
*
|
||||
* @return a single contigous address range
|
||||
*/
|
||||
Range<Addr> getAddrRange() const;
|
||||
AddrRange getAddrRange() const;
|
||||
|
||||
/**
|
||||
* Get the memory size.
|
||||
|
||||
@@ -57,7 +57,7 @@ Bridge::BridgeSlavePort::BridgeSlavePort(const std::string& _name,
|
||||
Bridge& _bridge,
|
||||
BridgeMasterPort& _masterPort,
|
||||
Cycles _delay, int _resp_limit,
|
||||
std::vector<Range<Addr> > _ranges)
|
||||
std::vector<AddrRange> _ranges)
|
||||
: SlavePort(_name, &_bridge), bridge(_bridge), masterPort(_masterPort),
|
||||
delay(_delay), ranges(_ranges.begin(), _ranges.end()),
|
||||
outstandingResponses(0), retryReq(false),
|
||||
|
||||
@@ -193,7 +193,7 @@ class Bridge : public MemObject
|
||||
*/
|
||||
BridgeSlavePort(const std::string& _name, Bridge& _bridge,
|
||||
BridgeMasterPort& _masterPort, Cycles _delay,
|
||||
int _resp_limit, std::vector<Range<Addr> > _ranges);
|
||||
int _resp_limit, std::vector<AddrRange> _ranges);
|
||||
|
||||
/**
|
||||
* Queue a response packet to be sent out later and also schedule
|
||||
|
||||
@@ -355,7 +355,6 @@ BaseBus::findPort(Addr addr)
|
||||
void
|
||||
BaseBus::recvRangeChange(PortID master_port_id)
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
AddrRangeIter iter;
|
||||
|
||||
if (inRecvRangeChange.count(master_port_id))
|
||||
@@ -394,7 +393,7 @@ BaseBus::recvRangeChange(PortID master_port_id)
|
||||
}
|
||||
|
||||
// get the address ranges of the connected slave port
|
||||
ranges = port->getAddrRanges();
|
||||
AddrRangeList ranges = port->getAddrRanges();
|
||||
|
||||
for (iter = ranges.begin(); iter != ranges.end(); iter++) {
|
||||
DPRINTF(BusAddrRanges, "Adding range %#llx - %#llx for id %d\n",
|
||||
|
||||
@@ -54,8 +54,7 @@
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
#include "base/range.hh"
|
||||
#include "base/range_map.hh"
|
||||
#include "base/addr_range_map.hh"
|
||||
#include "base/types.hh"
|
||||
#include "mem/mem_object.hh"
|
||||
#include "params/BaseBus.hh"
|
||||
@@ -233,9 +232,9 @@ class BaseBus : public MemObject
|
||||
/** the width of the bus in bytes */
|
||||
int width;
|
||||
|
||||
typedef range_map<Addr, PortID>::iterator PortMapIter;
|
||||
typedef range_map<Addr, PortID>::const_iterator PortMapConstIter;
|
||||
range_map<Addr, PortID> portMap;
|
||||
typedef AddrRangeMap<PortID>::iterator PortMapIter;
|
||||
typedef AddrRangeMap<PortID>::const_iterator PortMapConstIter;
|
||||
AddrRangeMap<PortID> portMap;
|
||||
|
||||
AddrRangeList defaultRange;
|
||||
|
||||
|
||||
1
src/mem/cache/cache_impl.hh
vendored
1
src/mem/cache/cache_impl.hh
vendored
@@ -51,7 +51,6 @@
|
||||
*/
|
||||
|
||||
#include "base/misc.hh"
|
||||
#include "base/range.hh"
|
||||
#include "base/types.hh"
|
||||
#include "debug/Cache.hh"
|
||||
#include "debug/CachePort.hh"
|
||||
|
||||
@@ -64,7 +64,6 @@ PhysicalMemory::PhysicalMemory(const vector<AbstractMemory*>& _memories) :
|
||||
"Skipping memory %s that is not in global address map\n",
|
||||
(*m)->name());
|
||||
}
|
||||
rangeCache.invalidate();
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -73,8 +72,7 @@ PhysicalMemory::isMemAddr(Addr addr) const
|
||||
// see if the address is within the last matched range
|
||||
if (addr != rangeCache) {
|
||||
// lookup in the interval tree
|
||||
range_map<Addr, AbstractMemory*>::const_iterator r =
|
||||
addrMap.find(addr);
|
||||
AddrRangeMap<AbstractMemory*>::const_iterator r = addrMap.find(addr);
|
||||
if (r == addrMap.end()) {
|
||||
// not in the cache, and not in the tree
|
||||
return false;
|
||||
@@ -110,7 +108,7 @@ PhysicalMemory::access(PacketPtr pkt)
|
||||
{
|
||||
assert(pkt->isRequest());
|
||||
Addr addr = pkt->getAddr();
|
||||
range_map<Addr, AbstractMemory*>::const_iterator m = addrMap.find(addr);
|
||||
AddrRangeMap<AbstractMemory*>::const_iterator m = addrMap.find(addr);
|
||||
assert(m != addrMap.end());
|
||||
m->second->access(pkt);
|
||||
}
|
||||
@@ -120,7 +118,7 @@ PhysicalMemory::functionalAccess(PacketPtr pkt)
|
||||
{
|
||||
assert(pkt->isRequest());
|
||||
Addr addr = pkt->getAddr();
|
||||
range_map<Addr, AbstractMemory*>::const_iterator m = addrMap.find(addr);
|
||||
AddrRangeMap<AbstractMemory*>::const_iterator m = addrMap.find(addr);
|
||||
assert(m != addrMap.end());
|
||||
m->second->functionalAccess(pkt);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#ifndef __PHYSICAL_MEMORY_HH__
|
||||
#define __PHYSICAL_MEMORY_HH__
|
||||
|
||||
#include "base/range_map.hh"
|
||||
#include "base/addr_range_map.hh"
|
||||
#include "mem/abstract_mem.hh"
|
||||
#include "mem/packet.hh"
|
||||
|
||||
@@ -55,10 +55,10 @@ class PhysicalMemory
|
||||
private:
|
||||
|
||||
// Global address map
|
||||
range_map<Addr, AbstractMemory* > addrMap;
|
||||
AddrRangeMap<AbstractMemory*> addrMap;
|
||||
|
||||
// a mutable cache for the last range that matched an address
|
||||
mutable Range<Addr> rangeCache;
|
||||
mutable AddrRange rangeCache;
|
||||
|
||||
// All address-mapped memories
|
||||
std::vector<AbstractMemory*> memories;
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "base/range.hh"
|
||||
#include "base/addr_range.hh"
|
||||
#include "mem/packet.hh"
|
||||
|
||||
/**
|
||||
@@ -62,9 +62,9 @@
|
||||
* defined.
|
||||
*/
|
||||
|
||||
typedef std::list<Range<Addr> > AddrRangeList;
|
||||
typedef std::list<Range<Addr> >::iterator AddrRangeIter;
|
||||
typedef std::list<Range<Addr> >::const_iterator AddrRangeConstIter;
|
||||
typedef std::list<AddrRange> AddrRangeList;
|
||||
typedef std::list<AddrRange>::iterator AddrRangeIter;
|
||||
typedef std::list<AddrRange>::const_iterator AddrRangeConstIter;
|
||||
|
||||
class MemObject;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user