Error test fixed.
Some improvements on debugging.
This commit is contained in:
@@ -62,7 +62,7 @@ void errorModel::init()
|
||||
}
|
||||
|
||||
// The name is set when the context is clear.
|
||||
name = "";
|
||||
contextStr = "";
|
||||
|
||||
// Parse data input:
|
||||
parseInputData();
|
||||
@@ -109,13 +109,13 @@ void errorModel::init()
|
||||
markBitFlips();
|
||||
}
|
||||
|
||||
errorModel::errorModel(libDRAMPower *dp)
|
||||
errorModel::errorModel(sc_module_name /*name*/, libDRAMPower *dp)
|
||||
{
|
||||
this->DRAMPower = dp;
|
||||
init();
|
||||
}
|
||||
|
||||
errorModel::errorModel()
|
||||
errorModel::errorModel(sc_module_name /*name*/)
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -142,7 +142,7 @@ errorModel::~errorModel()
|
||||
// If an access happened to a bank the numner of error events should be shown:
|
||||
if(myChannel != -1 && myBank != -1 && myBankgroup != -1 && myRank != -1 )
|
||||
{
|
||||
std::cout << name
|
||||
std::cout << contextStr
|
||||
<< ": Number of Retention Error Events = " << numberOfBitErrorEvents
|
||||
<< std::endl;
|
||||
}
|
||||
@@ -155,17 +155,22 @@ void errorModel::store(tlm::tlm_generic_payload &trans)
|
||||
|
||||
// Get the key for the dataMap from the transaction's address:
|
||||
DecodedAddress key = xmlAddressDecoder::getInstance().decodeAddress(trans.get_address());
|
||||
|
||||
// Set context:
|
||||
setContext(key);
|
||||
|
||||
std::stringstream msg;
|
||||
msg << "bank: " << key.bank << " group: " << key.bankgroup << " bytes: " << key.bytes << " channel: " << key.channel << " column: " << key.column << " rank: " << key.rank << " row: " << key.row;
|
||||
printDebugMessage(msg.str());
|
||||
|
||||
// Check if the provided data length is correct:
|
||||
assert((bytesPerColumn * burstLenght) == trans.get_data_length());
|
||||
|
||||
printDebugMessage(("Data length: " + std::to_string(trans.get_data_length()) + " bytesPerColumn: " + std::to_string(bytesPerColumn)).c_str());
|
||||
|
||||
// Handle the DRAM burst,
|
||||
for (unsigned int i = 0; i < trans.get_data_length(); i+=bytesPerColumn)
|
||||
for (unsigned int i = 0; i < trans.get_data_length(); i += bytesPerColumn)
|
||||
{
|
||||
unsigned char * data;
|
||||
unsigned char *data;
|
||||
|
||||
// Check if address is not already stored:
|
||||
if(dataMap.count(key) == 0)
|
||||
@@ -179,23 +184,23 @@ void errorModel::store(tlm::tlm_generic_payload &trans)
|
||||
}
|
||||
|
||||
// Copy the data from the transaction to the data pointer
|
||||
memcpy(data, trans.get_data_ptr()+i, bytesPerColumn);
|
||||
memcpy(data, trans.get_data_ptr() + i, bytesPerColumn);
|
||||
|
||||
// Save part of the burst in the dataMap
|
||||
// TODO: Check if we can have double entries, is key unique?
|
||||
dataMap.insert(std::pair<DecodedAddress, unsigned char*>(key,data));
|
||||
dataMap.insert(std::pair<DecodedAddress, unsigned char*>(key, data));
|
||||
|
||||
// Reset flipped weak cells in this area, since they are rewritten now
|
||||
for(unsigned int i = 0; i < maxNumberOfWeakCells; i++)
|
||||
for (unsigned int j = 0; j < maxNumberOfWeakCells; j++)
|
||||
{
|
||||
// If the current written column in a row has a week cell:
|
||||
if(weakCells[i].row == key.row && weakCells[i].col == key.column)
|
||||
if(weakCells[j].row == key.row && weakCells[j].col == key.column)
|
||||
{
|
||||
// If the bit was marked as flipped due to a retention error
|
||||
// mark it as unflipped:
|
||||
if(weakCells[i].flipped == true)
|
||||
if(weakCells[j].flipped == true)
|
||||
{
|
||||
weakCells[i].flipped = false;
|
||||
weakCells[j].flipped = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,6 +209,9 @@ void errorModel::store(tlm::tlm_generic_payload &trans)
|
||||
key.column++;
|
||||
|
||||
// Check that there is no column overfow:
|
||||
std::stringstream msg;
|
||||
msg << "key.column is " << key.column << " numberOfColumns is " << numberOfColumns;
|
||||
printDebugMessage(msg.str());
|
||||
assert(key.column <= numberOfColumns);
|
||||
}
|
||||
}
|
||||
@@ -265,7 +273,7 @@ void errorModel::markBitFlips()
|
||||
{
|
||||
std::stringstream msg;
|
||||
msg << "Maked weakCell[" << i << "] as flipped" << std::endl;
|
||||
DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
printDebugMessage(msg.str());
|
||||
|
||||
weakCells[i].flipped = true;
|
||||
}
|
||||
@@ -334,7 +342,7 @@ void errorModel::activate(unsigned int row)
|
||||
<< " row: " << key.row
|
||||
<< " col: " << key.column
|
||||
<< " bit: " << weakCells[i].bit;
|
||||
DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
printDebugMessage(msg.str());
|
||||
|
||||
numberOfBitErrorEvents++;
|
||||
|
||||
@@ -391,7 +399,7 @@ void errorModel::activate(unsigned int row)
|
||||
<< grid[0] << grid[1] << grid[2] << std::endl
|
||||
<< grid[3] << grid[4] << grid[5] << std::endl
|
||||
<< grid[6] << grid[7] << grid[8];
|
||||
DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
printDebugMessage(msg.str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -405,7 +413,7 @@ void errorModel::activate(unsigned int row)
|
||||
<< grid[0] << grid[1] << grid[2] << std::endl
|
||||
<< grid[3] << grid[4] << grid[5] << std::endl
|
||||
<< grid[6] << grid[7] << grid[8];
|
||||
DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
printDebugMessage(msg.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -439,7 +447,7 @@ unsigned int errorModel::getBit(DecodedAddress key, unsigned int byteInColumn, u
|
||||
<< " tempByte = " << (unsigned int)tempByte
|
||||
<< " result = " << result;
|
||||
|
||||
DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
printDebugMessage(msg.str());
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -585,7 +593,7 @@ void errorModel::parseInputData()
|
||||
<< " independent = " << errorMap[temp][retentionTime].independent
|
||||
<< " dependent = " << errorMap[temp][retentionTime].dependent;
|
||||
|
||||
DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
printDebugMessage(msg.str());
|
||||
}
|
||||
inputFile.close();
|
||||
}
|
||||
@@ -705,7 +713,7 @@ void errorModel::prepareWeakCells()
|
||||
<< " bit=" << weakCells[i].bit
|
||||
<< " flip=" << weakCells[i].flipped
|
||||
<< " dep=" << weakCells[i].dependent;
|
||||
DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
printDebugMessage(msg.str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,7 +763,7 @@ unsigned int errorModel::getNumberOfFlips(double temp, sc_time time)
|
||||
// << " ind:" << e.independent
|
||||
// << " dep:" << e.dependent;
|
||||
|
||||
//DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
//printDebugMessage(msg.str());
|
||||
|
||||
return e.independent + e.dependent;
|
||||
}
|
||||
@@ -771,6 +779,13 @@ void errorModel::setContext(DecodedAddress addr)
|
||||
myBankgroup = addr.bankgroup;
|
||||
myRank = addr.rank;
|
||||
|
||||
name = "Channel_" + std::to_string(myChannel) + "_Bank_" + std::to_string(myBank);
|
||||
contextStr = "Channel_" + std::to_string(myChannel) + "_Bank_" + std::to_string(myBank) + " ";
|
||||
}
|
||||
}
|
||||
|
||||
void errorModel::printDebugMessage(std::string message)
|
||||
{
|
||||
std::stringstream msg;
|
||||
msg << contextStr << message;
|
||||
DebugManager::getInstance().printDebugMessage(this->name(), msg.str());
|
||||
}
|
||||
|
||||
@@ -35,17 +35,19 @@
|
||||
|
||||
#ifndef ERRORMODEL_H
|
||||
#define ERRORMODEL_H
|
||||
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <systemc.h>
|
||||
#include "../controller/core/configuration/Configuration.h"
|
||||
#include "../common/xmlAddressdecoder.h"
|
||||
#include "../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h"
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
|
||||
class errorModel
|
||||
class errorModel : public sc_module
|
||||
{
|
||||
public:
|
||||
errorModel(libDRAMPower *dp);
|
||||
errorModel();
|
||||
errorModel(sc_module_name /*name*/, libDRAMPower *dp);
|
||||
errorModel(sc_module_name /*name*/);
|
||||
~errorModel();
|
||||
|
||||
// Access Methods:
|
||||
@@ -68,8 +70,10 @@ class errorModel
|
||||
unsigned int bytesPerColumn;
|
||||
unsigned int numberOfRows;
|
||||
|
||||
// Name:
|
||||
std::string name;
|
||||
// context:
|
||||
std::string contextStr;
|
||||
|
||||
void printDebugMessage(std::string message);
|
||||
|
||||
// Online Parameters:
|
||||
unsigned int numberOfBitErrorEvents;
|
||||
|
||||
@@ -200,10 +200,11 @@ struct Dram : sc_module
|
||||
{
|
||||
for (unsigned i = 0; i < Configuration::getInstance().memSpec.NumberOfBanks; i++) {
|
||||
errorModel *em;
|
||||
std::string errorModelStr = "errorModel_bank" + std::to_string(i);
|
||||
if (powerAnalysis == true) {
|
||||
em = new errorModel(DRAMPower);
|
||||
em = new errorModel(errorModelStr.c_str(), DRAMPower);
|
||||
} else {
|
||||
em = new errorModel();
|
||||
em = new errorModel(errorModelStr.c_str());
|
||||
}
|
||||
ememory.push_back(em);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ use strict;
|
||||
|
||||
my $numberOfRows = 8192;
|
||||
my $numberOfColumnsPerRow = 128;
|
||||
my $bytesPerColumn = 16;
|
||||
my $burstLength = 4; # burst length of 4 columns --> 4 columns written or read per access
|
||||
my $dataLength = $bytesPerColumn * $burstLength;
|
||||
|
||||
my $rowOffset = 0x4000;
|
||||
my $colOffset = 0x80;
|
||||
@@ -24,7 +27,7 @@ my $colOffset = 0x80;
|
||||
my $dataPatternByte = "ff";
|
||||
|
||||
my $dataPattern = "";
|
||||
for(my $i = 0; $i < 64; $i++)
|
||||
for(my $i = 0; $i < $dataLength; $i++)
|
||||
{
|
||||
$dataPattern .= $dataPatternByte;
|
||||
}
|
||||
@@ -35,12 +38,12 @@ my $addr = 0;
|
||||
# Generate Trace file (writes):
|
||||
for(my $row = 0; $row < ($numberOfRows * $rowOffset); $row = $row + $rowOffset)
|
||||
{
|
||||
for(my $col = 0; $col < ($numberOfColumnsPerRow * $colOffset); $col = $col + $colOffset)
|
||||
for(my $col = 0; $col < ($numberOfColumnsPerRow * $colOffset); $col = $col + ($colOffset * $burstLength))
|
||||
{
|
||||
my $addrHex = sprintf("0x%x", $addr);
|
||||
print "$clkCounter:\twrite\t$addrHex\t$dataPattern\n";
|
||||
$clkCounter++;
|
||||
$addr += $colOffset;
|
||||
$addr += $colOffset * $burstLength;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,11 +53,11 @@ $addr = 0;
|
||||
# Generate Trace file (reads):
|
||||
for(my $row = 0; $row < ($numberOfRows * $rowOffset); $row = $row + $rowOffset)
|
||||
{
|
||||
for(my $col = 0; $col < ($numberOfColumnsPerRow * $colOffset); $col = $col + $colOffset)
|
||||
for(my $col = 0; $col < ($numberOfColumnsPerRow * $colOffset); $col = $col + ($colOffset * $burstLength))
|
||||
{
|
||||
my $addrHex = sprintf("0x%x", $addr);
|
||||
print "$clkCounter:\tread\t$addrHex\t$dataPattern\n";
|
||||
$clkCounter++;
|
||||
$addr += $colOffset;
|
||||
$addr += $colOffset * $burstLength;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user