Included address range check. Fixed bug with FIFO Strict in controllerMethod().

This commit is contained in:
Lukas Steiner (2)
2020-02-21 14:55:06 +01:00
parent e3c4a923cf
commit 169627de2e
3 changed files with 12 additions and 2 deletions

View File

@@ -119,6 +119,8 @@ void XmlAddressDecoder::setConfiguration(std::string addressConfigURI)
bankgroupsPerRank = amount.bankgroup;
amount.bankgroup = bankgroupsPerRank * amount.rank;
maximumAddress = amount.bytes * amount.column * amount.row * banksPerGroup * bankgroupsPerRank * amount.rank * amount.channel - 1;
Configuration &config = Configuration::getInstance();
MemSpec *memSpec = config.memSpec;
@@ -132,6 +134,9 @@ void XmlAddressDecoder::setConfiguration(std::string addressConfigURI)
DecodedAddress XmlAddressDecoder::decodeAddress(uint64_t addr)
{
if (addr > maximumAddress)
SC_REPORT_WARNING("XmlAddressDecoder", ("Address " + std::to_string(addr) + " out of range (maximum address is " + std::to_string(maximumAddress) + ")").c_str());
DecodedAddress result;
result.channel = (addr & masks.channel) >> shifts.channel;
result.rank = (addr & masks.rank) >> shifts.rank;

View File

@@ -78,6 +78,7 @@ private:
unsigned bankgroupsPerRank;
tinyxml2::XMLElement *addressmapping;
uint64_t maximumAddress;
public:
XmlAddressDecoder();

View File

@@ -305,7 +305,11 @@ void Controller::controllerMethod()
// TODO: check if all calls are necessary
sc_time delayForNextTrigger = sc_max_time();
for (auto it : bankMachines)
delayForNextTrigger = std::min(delayForNextTrigger, it->start());
{
sc_time localDelay = it->start();
if (!(localDelay == SC_ZERO_TIME && readyCmdBlocked))
delayForNextTrigger = std::min(delayForNextTrigger, localDelay);
}
if (payloadToAcquire != nullptr && sc_time_stamp() >= timeToAcquire && scheduler->hasBufferSpace(payloadToAcquire))
acquirePayload();
for (auto it : refreshManagers)
@@ -313,7 +317,7 @@ void Controller::controllerMethod()
for (auto it : powerDownManagers)
delayForNextTrigger = std::min(delayForNextTrigger, it->start());
if (!((delayForNextTrigger == SC_ZERO_TIME && readyCmdBlocked) || (delayForNextTrigger == (sc_max_time() - sc_time_stamp()))))
if (!(delayForNextTrigger == (sc_max_time() - sc_time_stamp())))
controllerEvent.notify(delayForNextTrigger);
}