adressmappings

This commit is contained in:
robert
2014-06-16 17:41:47 +02:00
parent c74b544f3e
commit 4760ec4a5b
8 changed files with 153 additions and 137 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<dramconfig>
<!-- <dramconfig>
<addressmap length="29">
<channel from="27" to="28" />
<row from="14" to="26" />
@@ -9,3 +9,13 @@
<bytes from="0" to="3" />
</addressmap>
</dramconfig>
-->
<dramconfig>
<addressmap length="29">
<channel from="27" to="28" />
<row from="14" to="26" />
<colum from="7" to="13" />
<bank from="4" to="6" />
<bytes from="0" to="3" />
</addressmap>
</dramconfig>

View File

@@ -4,10 +4,10 @@
<parameter id="openPagePolicy" type="bool" value="1" />
<parameter id="adaptiveOpenPagePolicy" type="bool" value="0" />
<parameter id="refreshAwareScheduling" type="bool" value="0" />
<parameter id="maxNrOfTransactionsInDram" type="uint" value="2000" />
<parameter id="maxNrOfTransactionsInDram" type="uint" value="50" />
<parameter id="scheduler" type="string" value="FIFO" />
<parameter id="capsize" type="uint" value="5" />
<parameter id="powerDownMode" type="string" value="TimeoutPDN" />
<parameter id="powerDownMode" type="string" value="Staggered" />
<parameter id="powerDownTimeout" type="uint" value="100" />
</memconfig>
</memspec>

View File

@@ -4,10 +4,10 @@
<parameter id="openPagePolicy" type="bool" value="1" />
<parameter id="adaptiveOpenPagePolicy" type="bool" value="0" />
<parameter id="refreshAwareScheduling" type="bool" value="1" />
<parameter id="maxNrOfTransactionsInDram" type="uint" value="2000" />
<parameter id="maxNrOfTransactionsInDram" type="uint" value="50" />
<parameter id="scheduler" type="string" value="FR_FCFS" />
<parameter id="capsize" type="uint" value="5" />
<parameter id="powerDownMode" type="string" value="TimeoutPDN" />
<parameter id="powerDownMode" type="string" value="Staggered" />
<parameter id="powerDownTimeout" type="uint" value="100" />
</memconfig>
</memspec>

View File

@@ -0,0 +1,13 @@
<memspec>
<memconfig>
<parameter id="bankwiseLogic" type="bool" value="0" />
<parameter id="openPagePolicy" type="bool" value="1" />
<parameter id="adaptiveOpenPagePolicy" type="bool" value="0" />
<parameter id="refreshAwareScheduling" type="bool" value="1" />
<parameter id="maxNrOfTransactionsInDram" type="uint" value="50" />
<parameter id="scheduler" type="string" value="PAR_BS" />
<parameter id="capsize" type="uint" value="8" />
<parameter id="powerDownMode" type="string" value="Staggered" />
<parameter id="powerDownTimeout" type="uint" value="3" />
</memconfig>
</memspec>

View File

@@ -6,7 +6,7 @@
<parameter id="refreshAwareScheduling" type="bool" value="0" />
<parameter id="maxNrOfTransactionsInDram" type="uint" value="50" />
<parameter id="scheduler" type="string" value="PAR_BS" />
<parameter id="capsize" type="uint" value="5" />
<parameter id="capsize" type="uint" value="8" />
<parameter id="powerDownMode" type="string" value="Staggered" />
<parameter id="powerDownTimeout" type="uint" value="3" />
</memconfig>

View File

@@ -32,6 +32,12 @@ def getTraceLength(connection):
result = cursor.fetchone()
return result[0]
def getClock(connection):
cursor = connection.cursor()
cursor.execute("SELECT clk FROM GeneralInfo")
result = cursor.fetchone()
return result[0]
@metric
def average_response_latency_in_ns(connection):
cursor = connection.cursor()
@@ -41,8 +47,6 @@ def average_response_latency_in_ns(connection):
result = cursor.fetchone()
return round(result[0],1)
def refreshMissDecision(connection,calculatedMetrics):
cursor = connection.cursor()
cursor.execute("""SELECT phases.ID,PhaseBegin,PhaseEnd,TBank FROM Phases INNER JOIN transactions on transactions.id = phases.transact WHERE PhaseName='AUTO_REFRESH' """)
@@ -76,51 +80,18 @@ def refreshMissDecision(connection,calculatedMetrics):
totalDecisios = totalDecisios + 1
if(earliestReq[0] != earliestResp[0]):
missDecisions = missDecisions + 1
print("earliest Req: {0}| earliest Res: {1}".format(earliestReq[0], earliestResp[0]))
#print("earliest Req: {0}| earliest Res: {1}".format(earliestReq[0], earliestResp[0]))
end
if(totalDecisios != 0):
calculatedMetrics.append(("Total Missdecisions", missDecisions))
#calculatedMetrics.append(("Total Missdecisions", missDecisions))
calculatedMetrics.append(("Relative Missdecisions", 1.0*missDecisions/totalDecisios))
else:
calculatedMetrics.append(("Total Missdecisions", 0))
calculatedMetrics.append(("Relative Missdecisions", 0))
# @metric
# def median_response_latency_in_ns(connection):
# cursor = connection.cursor()
# cursor.execute("""SELECT median(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases
# ON phases.transact = transactions.ID WHERE PhaseName='RESP' """)
# result = cursor.fetchone()
# return round(result[0],1)
# @metric
# def max_response_latency_in_ns(connection):
# cursor = connection.cursor()
# cursor.execute("""SELECT max(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases
# ON phases.transact = transactions.ID WHERE PhaseName='RESP' """)
# result = cursor.fetchone()
# return round(result[0],1)
# @metric
# def min_response_latency_in_ns(connection):
# cursor = connection.cursor()
# cursor.execute("""SELECT min(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases
# ON phases.transact = transactions.ID WHERE PhaseName='RESP' """)
# result = cursor.fetchone()
# return round(result[0],1)
# @metric
# def stdDev_response_latency_in_ns(connection):
# cursor = connection.cursor()
# cursor.execute("""SELECT stdev(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases
# ON phases.transact = transactions.ID WHERE PhaseName='RESP' """)
# result = cursor.fetchone()
# return round(result[0],1)
@threadMetric
def average_response_latency_in_ns(connection, thread):
cursor = connection.cursor()
@@ -131,22 +102,37 @@ def average_response_latency_in_ns(connection, thread):
result = cursor.fetchone()
return round(result[0],1)
# @threadMetric
# def median_response_latency_in_ns(connection, thread):
# cursor = connection.cursor()
# query = """SELECT median(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases
# ON phases.transact = transactions.ID WHERE PhaseName='RESP' AND TThread = :Thread """
def addStallTime(times,begin,end):
time = begin
while time <= end:
if(time in times):
times[time] = times[time] + 1
else:
times[time] = 1
time = time + 1
# cursor.execute(query, {"Thread": thread})
# result = cursor.fetchone()
# return round(result[0],1)
#@threadMetric
def paralellism(connection, thread):
cursor = connection.cursor()
stalltimes = {}
query = """SELECT transactions.ID,MIN(phaseBegin)/:clk,MAX(phaseEnd)/:clk
from phases inner join transactions on phases.transact=transactions.id
where phaseName Not in ('REQ','RESP') and tthread=:Thread group by transactions.ID """
# @metric
# def number_of_activates(connection):
# cursor = connection.cursor()
# cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName = 'ACT'")
# result = cursor.fetchone()
# return result[0]
cursor.execute(query, {"Thread": thread, "clk" : getClock(connection)})
for currentRow in cursor:
addStallTime(stalltimes,currentRow[1],currentRow[2])
para = 0
for time in stalltimes:
para = para + stalltimes[time]
return round(para/len(stalltimes),2)
@metric
def number_of_activates(connection):
cursor = connection.cursor()
cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName = 'ACT'")
result = cursor.fetchone()
return result[0]
# @metric
# def number_of_precharges(connection):
@@ -155,12 +141,12 @@ def average_response_latency_in_ns(connection, thread):
# result = cursor.fetchone()
# return result[0]
# @metric
# def accesses_per_activate(connection):
# cursor = connection.cursor()
# cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName IN ('REQ')")
# result = cursor.fetchone()
# return round(result[0]*1.0/number_of_activates(connection),1)
@metric
def accesses_per_activate(connection):
cursor = connection.cursor()
cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName IN ('REQ')")
result = cursor.fetchone()
return round(result[0]*1.0/number_of_activates(connection),1)
def timeInPowerStates(connection):
totalTimeAllBanks = getTraceLength(connection)*getNumberOfBanks(connection)
@@ -247,33 +233,31 @@ def passRatio(connection):
def calculateMetrics(pathToTrace):
connection = sqlite3.connect(pathToTrace)
#connection.create_aggregate("median", 1, pystaggrelite3.median)
#connection.create_aggregate("stdev", 1, pystaggrelite3.stdev)
calculatedMetrics = []
print("================================")
print("Calculating metrics for {0}".format(pathToTrace))
for metric in metrics:
res = (metric.__name__.replace("_"," "), metric(connection))
print("{0}: {1}".format(res[0],res[1]))
calculatedMetrics.append(res)
for thread in getThreads(connection):
for metric in threadMetrics:
res = ("Thread " + str(thread) + " " + metric.__name__.replace("_"," "), metric(connection, thread))
if(len(getThreads(connection))==1):
for metric in metrics:
res = (metric.__name__.replace("_"," "), metric(connection))
print("{0}: {1}".format(res[0],res[1]))
calculatedMetrics.append(res)
calculatedMetrics.append(("test",0))
#calculatedMetrics.extend(passRatio(connection))
if(len(getThreads(connection))>1):
# for thread in getThreads(connection):
# for metric in threadMetrics:
# res = ("Thread " + str(thread) + " " + metric.__name__.replace("_"," "), metric(connection, thread))
# print("{0}: {1}".format(res[0],res[1]))
# calculatedMetrics.append(res)
calculatedMetrics.extend(passRatio(connection))
#refreshMissDecision(connection, calculatedMetrics)
#calculatedMetrics.extend(timeInPowerStates(connection))
#print(calculatedMetrics[-1])
#print(calculatedMetrics[-2])
refreshMissDecision(connection, calculatedMetrics)
print(calculatedMetrics[-1])
print(calculatedMetrics[-2])
connection.close()
return calculatedMetrics

View File

@@ -10,14 +10,22 @@
<memconfigs>
<memconfig>fifo.xml</memconfig>
<memconfig>fr_fcfs.xml</memconfig>
<memconfig>par_bs.xml</memconfig>
</memconfigs>
<trace-setups>
<trace-setup id="simple">
<device >test2.stl</device>
</trace-setup>
<trace-setup id="aes">
<device>chstone-aes_32.stl</device>
</trace-setup>
<trace-setup id="mediabench">
<device >mediabench-h263decode_32.stl</device>
</trace-setup>
<trace-setup id="shared">
<device >chstone-aes_32.stl</device>
<device >mediabench-h263decode_32.stl</device>
</trace-setup>
</trace-setups>
</simulation>

View File

@@ -18,18 +18,18 @@ using namespace std;
using namespace core;
PAR_BS::PAR_BS(const core::BankStates& bankstates, bool useExternalBankstates, unsigned int capsize) :
externalBankstates(bankstates), useExternalBankstates(useExternalBankstates), capsize(capsize)
externalBankstates(bankstates), useExternalBankstates(useExternalBankstates), capsize(capsize)
{
if (useExternalBankstates)
{
batch = new FR_FCFS(externalBankstates, true, false);
buffer = new FR_FCFS(externalBankstates, true, false);
}
else
{
batch = new FR_FCFS(internalBankstates, true, false);
buffer = new FR_FCFS(internalBankstates, true, false);
}
if (useExternalBankstates)
{
batch = new FR_FCFS(externalBankstates, true, false);
buffer = new FR_FCFS(externalBankstates, true, false);
}
else
{
batch = new FR_FCFS(internalBankstates, true, false);
buffer = new FR_FCFS(internalBankstates, true, false);
}
}
PAR_BS::~PAR_BS()
@@ -39,74 +39,75 @@ PAR_BS::~PAR_BS()
bool PAR_BS::hasTransactionForBank(Bank bank)
{
return batch->hasTransactionForBank(bank) || buffer->hasTransactionForBank(bank);
return batch->hasTransactionForBank(bank) || buffer->hasTransactionForBank(bank);
}
void PAR_BS::schedule(gp* payload)
{
buffer->schedule(payload);
buffer->schedule(payload);
}
gp* PAR_BS::getTransactionForBank(Bank bank)
{
sc_assert(hasTransactionForBank(bank));
sc_assert(hasTransactionForBank(bank));
if (batch->isEmpty())
{
formBatch();
sc_assert(!batch->isEmpty());
}
if (batch->isEmpty())
{
formBatch();
cout << "Formed new batch at: " << sc_time_stamp() << std::endl;
sc_assert(!batch->isEmpty());
}
//prioritize batch first
if (batch->hasTransactionForBank(bank))
{
return batch->getTransactionForBank(bank);
}
else
{
return buffer->getTransactionForBank(bank);
}
//prioritize batch first
if (batch->hasTransactionForBank(bank))
{
return batch->getTransactionForBank(bank);
}
else
{
return buffer->getTransactionForBank(bank);
}
}
void PAR_BS::popTransactionForBank(Bank bank, gp* payload)
{
sc_assert(DramExtension::getExtension(payload).getBank() == bank);
buffer->popTransactionForBank(bank, payload);
batch->popTransactionForBank(bank, payload);
sc_assert(DramExtension::getExtension(payload).getBank() == bank);
buffer->popTransactionForBank(bank, payload);
batch->popTransactionForBank(bank, payload);
if (!useExternalBankstates)
{
internalBankstates.openRowInRowBuffer(bank, DramExtension::getExtension(payload).getRow());
}
if (!useExternalBankstates)
{
internalBankstates.openRowInRowBuffer(bank, DramExtension::getExtension(payload).getRow());
}
}
void PAR_BS::formBatch()
{
map<Thread, ThreadLoad> loads;
map<Thread, ThreadLoad> loads;
for (unsigned int b = 0; b < Configuration::getInstance().NumberOfBanks; ++b)
{
Bank bank(b);
for (unsigned int i = 0; i < capsize && buffer->hasTransactionForBank(bank); i++)
{
gp* payload = buffer->popOldest(bank);
loads[DramExtension::getExtension(payload).getThread()].addTransaction(payload);
}
}
for (unsigned int b = 0; b < Configuration::getInstance().NumberOfBanks; ++b)
{
Bank bank(b);
for (unsigned int i = 0; i < capsize && buffer->hasTransactionForBank(bank); i++)
{
gp* payload = buffer->popOldest(bank);
loads[DramExtension::getExtension(payload).getThread()].addTransaction(payload);
}
}
vector<ThreadLoad*> sortedLoads;
for (auto& threadLoadPair : loads)
{
sortedLoads.push_back(&threadLoadPair.second);
}
vector<ThreadLoad*> sortedLoads;
for (auto& threadLoadPair : loads)
{
sortedLoads.push_back(&threadLoadPair.second);
}
sort(sortedLoads.begin(), sortedLoads.end(), LoadPointerComparer());
sort(sortedLoads.begin(), sortedLoads.end(), LoadPointerComparer());
for (auto& load : sortedLoads)
{
batch->schedule(load->getTransactions());
}
for (auto& load : sortedLoads)
{
batch->schedule(load->getTransactions());
}
}