ranksPerChannel(p->ranks_per_channel),
bankGroupsPerRank(p->bank_groups_per_rank),
bankGroupArch(p->bank_groups_per_rank > 0),
- banksPerRank(p->banks_per_rank), channels(p->channels), rowsPerBank(0),
+ banksPerRank(p->banks_per_rank), rowsPerBank(0),
readBufferSize(p->read_buffer_size),
writeBufferSize(p->write_buffer_size),
writeHighThreshold(writeBufferSize * p->write_high_thresh_perc / 100.0),
// a bit of sanity checks on the interleaving, save it for here to
// ensure that the system pointer is initialised
if (range.interleaved()) {
- if (channels != range.stripes())
- fatal("%s has %d interleaved address stripes but %d channel(s)\n",
- name(), range.stripes(), channels);
-
if (addrMapping == Enums::RoRaBaChCo) {
if (rowBufferSize != range.granularity()) {
fatal("Channel interleaving of %s doesn't match RoRaBaChCo "
// we have removed the lowest order address bits that denote the
// position within the column
- if (addrMapping == Enums::RoRaBaChCo) {
+ if (addrMapping == Enums::RoRaBaChCo || addrMapping == Enums::RoRaBaCoCh) {
// the lowest order bits denote the column to ensure that
// sequential cache lines occupy the same row
addr = addr / columnsPerRowBuffer;
- // take out the channel part of the address
- addr = addr / channels;
-
// after the channel bits, get the bank bits to interleave
// over the banks
bank = addr % banksPerRank;
rank = addr % ranksPerChannel;
addr = addr / ranksPerChannel;
- // lastly, get the row bits, no need to remove them from addr
- row = addr % rowsPerBank;
- } else if (addrMapping == Enums::RoRaBaCoCh) {
- // take out the lower-order column bits
- addr = addr / columnsPerStripe;
-
- // take out the channel part of the address
- addr = addr / channels;
-
- // next, the higher-order column bites
- addr = addr / (columnsPerRowBuffer / columnsPerStripe);
-
- // after the column bits, we get the bank bits to interleave
- // over the banks
- bank = addr % banksPerRank;
- addr = addr / banksPerRank;
-
- // after the bank, we get the rank bits which thus interleaves
- // over the ranks
- rank = addr % ranksPerChannel;
- addr = addr / ranksPerChannel;
-
// lastly, get the row bits, no need to remove them from addr
row = addr % rowsPerBank;
} else if (addrMapping == Enums::RoCoRaBaCh) {
// take out the lower-order column bits
addr = addr / columnsPerStripe;
- // take out the channel part of the address, not that this has
- // to match with how accesses are interleaved between the
- // controllers in the address mapping
- addr = addr / channels;
-
// start with the bank bits, as this provides the maximum
// opportunity for parallelism between requests
bank = addr % banksPerRank;
// address of first DRAM packet is kept unaliged. Subsequent DRAM packets
// are aligned to burst size boundaries. This is to ensure we accurately
// check read packets against packets in write queue.
- Addr addr = pkt->getAddr();
+ const Addr base_addr = getCtrlAddr(pkt->getAddr());
+ Addr addr = base_addr;
unsigned pktsServicedByWrQ = 0;
BurstHelper* burst_helper = NULL;
for (int cnt = 0; cnt < pktCount; ++cnt) {
unsigned size = std::min((addr | (burstSize - 1)) + 1,
- pkt->getAddr() + pkt->getSize()) - addr;
+ base_addr + pkt->getSize()) - addr;
stats.readPktSize[ceilLog2(size)]++;
stats.readBursts++;
stats.masterReadAccesses[pkt->masterId()]++;
// if the request size is larger than burst size, the pkt is split into
// multiple DRAM packets
- Addr addr = pkt->getAddr();
+ const Addr base_addr = getCtrlAddr(pkt->getAddr());
+ Addr addr = base_addr;
for (int cnt = 0; cnt < pktCount; ++cnt) {
unsigned size = std::min((addr | (burstSize - 1)) + 1,
- pkt->getAddr() + pkt->getSize()) - addr;
+ base_addr + pkt->getSize()) - addr;
stats.writePktSize[ceilLog2(size)]++;
stats.writeBursts++;
stats.masterWriteAccesses[pkt->masterId()]++;
DRAMPacket* decodeAddr(const PacketPtr pkt, Addr dramPktAddr,
unsigned int size, bool isRead) const;
+ /**
+ * Get an address in a dense range which starts from 0. The input
+ * address is the physical address of the request in an address
+ * space that contains other SimObjects apart from this
+ * controller.
+ *
+ * @param addr The intput address which should be in the addrRange
+ * @return An address in the continues range [0, max)
+ */
+ Addr getCtrlAddr(Addr addr)
+ {
+ return range.getOffset(addr);
+ }
+
/**
* The memory schduler/arbiter - picks which request needs to
* go next, based on the specified policy such as FCFS or FR-FCFS
const uint32_t bankGroupsPerRank;
const bool bankGroupArch;
const uint32_t banksPerRank;
- const uint32_t channels;
uint32_t rowsPerBank;
const uint32_t readBufferSize;
const uint32_t writeBufferSize;