diff --git a/analyzer/analyzer/presentation/traceplot.cpp b/analyzer/analyzer/presentation/traceplot.cpp
index f17da2f4..5a398481 100644
--- a/analyzer/analyzer/presentation/traceplot.cpp
+++ b/analyzer/analyzer/presentation/traceplot.cpp
@@ -409,6 +409,14 @@ void TracePlot::keyPressEvent(QKeyEvent *keyPressedEvent)
navigator->selectNextTransaction();
else if(Qt::Key_Left == key)
navigator->selectPreviousTransaction();
+ else if(Qt::Key_Minus == key)
+ {
+ zoomOut(GetCurrentTimespan().Middle());
+ }
+ else if(Qt::Key_Plus == key)
+ {
+ zoomIn(GetCurrentTimespan().Middle());
+ }
}
void TracePlot::keyReleaseEvent(QKeyEvent *keyReleasedEvent)
diff --git a/dram/dramSys/dramSys.pro b/dram/dramSys/dramSys.pro
index 35a52edf..fc4cba8e 100644
--- a/dram/dramSys/dramSys.pro
+++ b/dram/dramSys/dramSys.pro
@@ -22,7 +22,10 @@ INCLUDEPATH += ../src/common/third_party/DRAMPower/src/libdrampower
DEFINES += TIXML_USE_STL
DEFINES += SC_INCLUDE_DYNAMIC_PROCESSES
DEFINES += USE_XERCES=1
-DEFINES += NDEBUG
+release {
+ DEFINES += NDEBUG
+}
+
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -isystem /opt/systemc/include
@@ -36,7 +39,6 @@ SOURCES += \
../src/common/TlmRecorder.cpp \
../src/common/dramExtension.cpp \
../src/common/DebugManager.cpp \
- ../src/controller/core/configuration/MemSpecLoader.cpp \
../src/controller/core/configuration/Configuration.cpp \
../src/controller/core/powerdown/PowerDownManagerTimeout.cpp \
../src/controller/core/powerdown/PowerDownManagerBankwise.cpp \
@@ -69,6 +71,8 @@ SOURCES += \
../src/controller/core/RowBufferStates.cpp \
../src/controller/scheduler/Scheduler.cpp \
../src/controller/scheduler/readwritegrouper.cpp \
+ ../src/controller/core/configuration/ConfigurationLoader.cpp \
+ ../src/controller/core/powerdown/NoPowerDown.cpp
../src/error/nest_map.cpp \
../src/error/flip_memory.cpp
@@ -81,7 +85,6 @@ HEADERS += \
../src/common/protocol.h \
../src/common/dramExtension.h \
../src/common/DebugManager.h \
- ../src/controller/core/configuration/MemSpecLoader.h \
../src/controller/core/configuration/Configuration.h \
../src/controller/core/powerdown/PowerDownManagerTimeout.h \
../src/controller/core/powerdown/PowerDownManagerBankwise.h \
@@ -118,7 +121,6 @@ HEADERS += \
../src/simulation/SimulationManager.h \
../src/simulation/Simulation.h \
../src/simulation/MemoryManager.h \
- ../src/simulation/ISimulation.h \
../src/simulation/Dram.h \
../src/simulation/Arbiter.h \
../src/common/libDRAMPower.h \
@@ -126,6 +128,11 @@ HEADERS += \
../src/controller/scheduler/readwritegrouper.h \
../src/simulation/ReorderBuffer.h \
../src/controller/core/configuration/MemSpec.h \
+ ../src/simulation/StlPlayer.h \
+ ../src/simulation/TracePlayerListener.h \
+ ../src/simulation/TraceGenerator.h \
+ ../src/controller/core/powerdown/NoPowerDown.h
+ ../src/controller/core/configuration/ConfigurationLoader.h
../src/error/nest_map.h \
../src/error/flip_memory.h
diff --git a/dram/resources/configs/amconfigs/am_wideio.xml b/dram/resources/configs/amconfigs/am_wideio.xml
index 85ec0876..76d14bac 100755
--- a/dram/resources/configs/amconfigs/am_wideio.xml
+++ b/dram/resources/configs/amconfigs/am_wideio.xml
@@ -1,32 +1,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/dram/resources/configs/memconfigs/fr_fcfs_bankwise.xml b/dram/resources/configs/memconfigs/_old/fr_fcfs_bankwise.xml
similarity index 100%
rename from dram/resources/configs/memconfigs/fr_fcfs_bankwise.xml
rename to dram/resources/configs/memconfigs/_old/fr_fcfs_bankwise.xml
diff --git a/dram/resources/configs/memconfigs/fr_fcfs_unaware.xml b/dram/resources/configs/memconfigs/_old/fr_fcfs_unaware.xml
similarity index 100%
rename from dram/resources/configs/memconfigs/fr_fcfs_unaware.xml
rename to dram/resources/configs/memconfigs/_old/fr_fcfs_unaware.xml
diff --git a/dram/resources/configs/memconfigs/memconfig.xml b/dram/resources/configs/memconfigs/_old/grouper.xml
similarity index 62%
rename from dram/resources/configs/memconfigs/memconfig.xml
rename to dram/resources/configs/memconfigs/_old/grouper.xml
index 1c2d4e9d..73116e13 100644
--- a/dram/resources/configs/memconfigs/memconfig.xml
+++ b/dram/resources/configs/memconfigs/_old/grouper.xml
@@ -1,15 +1,14 @@
-
+
-
-
-
+
+
+
-
-
+
diff --git a/dram/resources/configs/memconfigs/par_bs.xml b/dram/resources/configs/memconfigs/_old/par_bs.xml
similarity index 100%
rename from dram/resources/configs/memconfigs/par_bs.xml
rename to dram/resources/configs/memconfigs/_old/par_bs.xml
diff --git a/dram/resources/configs/memconfigs/par_bs_unaware.xml b/dram/resources/configs/memconfigs/_old/par_bs_unaware.xml
similarity index 100%
rename from dram/resources/configs/memconfigs/par_bs_unaware.xml
rename to dram/resources/configs/memconfigs/_old/par_bs_unaware.xml
diff --git a/dram/resources/configs/memconfigs/fifo.xml b/dram/resources/configs/memconfigs/fifo.xml
index 2e23e330..eff47892 100644
--- a/dram/resources/configs/memconfigs/fifo.xml
+++ b/dram/resources/configs/memconfigs/fifo.xml
@@ -1,15 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dram/resources/configs/memconfigs/fr_fcfs.xml b/dram/resources/configs/memconfigs/fr_fcfs.xml
index 0cb3b908..faeeee5f 100644
--- a/dram/resources/configs/memconfigs/fr_fcfs.xml
+++ b/dram/resources/configs/memconfigs/fr_fcfs.xml
@@ -1,17 +1,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dram/resources/configs/simconfigs/simple.xml b/dram/resources/configs/simconfigs/simple.xml
new file mode 100644
index 00000000..2afec97e
--- /dev/null
+++ b/dram/resources/configs/simconfigs/simple.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/dram/resources/scripts/address_scrambler.pl b/dram/resources/scripts/address_scrambler.pl
new file mode 100644
index 00000000..65396cb8
--- /dev/null
+++ b/dram/resources/scripts/address_scrambler.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+my $filename = shift || die;
+
+open(FH, "$filename");
+
+while()
+{
+ # Get all the data adress:
+ $_ =~ /(\d+):\s+(\w+)\s+0x([\w\d]+)/;
+ my $time = $1;
+ my $command = $2;
+ my $address = $3;
+ my $new_address;
+
+ # Convert to binary:
+ $address = sprintf( "%032b", hex( $address ) );
+
+ # example:
+ # 31 0
+ # 00000000000000000000000000000001
+ # 00000000000000000000010000000000
+
+ # Swap adresses:
+ $new_address = substr($address,31 - 31,1). # R 31
+ substr($address,31 - 30,1). # R 30
+ substr($address,31 - 29,1). # R 29
+ substr($address,31 - 28,1). # R 28
+ substr($address,31 - 27,1). # R 27
+ substr($address,31 - 26,1). # R 26
+ substr($address,31 - 25,1). # R 25
+ substr($address,31 - 24,1). # R 24
+ substr($address,31 - 23,1). # R 23
+ substr($address,31 - 22,1). # R 22
+ substr($address,31 - 21,1). # R 21
+ substr($address,31 - 20,1). # R 20
+ substr($address,31 - 19,1). # R 19
+ substr($address,31 - 18,1). # R 18
+ substr($address,31 - 17,1). # R 17
+ substr($address,31 - 16,1). # R 16
+ substr($address,31 - 8,1). # R 15
+ substr($address,31 - 7,1). # R 14
+ substr($address,31 - 6,1). # R 13
+ substr($address,31 - 11,1). # B 12
+ substr($address,31 - 9,1). # B 11
+ substr($address,31 - 0,1). # B 10
+ substr($address,31 - 15,1). # C 9
+ substr($address,31 - 14,1). # C 8
+ substr($address,31 - 13,1). # C 7
+ substr($address,31 - 12,1). # C 6
+ substr($address,31 - 10,1). # C 5
+ substr($address,31 - 5,1). # C 4
+ substr($address,31 - 4,1). # C 3
+ substr($address,31 - 3,1). # C 2
+ substr($address,31 - 2,1). # C 1
+ substr($address,31 - 1,1); # C 0
+
+ $new_address = sprintf("%X", oct( "0b$new_address" ) );
+
+ print $time.":\t".$command."\t0x".$new_address."\n";
+}
+
diff --git a/dram/resources/scripts/analyse_trace.pl b/dram/resources/scripts/analyse_trace.pl
new file mode 100644
index 00000000..8061c8ba
--- /dev/null
+++ b/dram/resources/scripts/analyse_trace.pl
@@ -0,0 +1,113 @@
+#!/usr/bin/perl
+use List::Util 'max';
+use warnings;
+use strict;
+
+my $filename = shift || die("Please provide a input STL file");
+
+my $numberOfRows = 16384;
+my $numberOfBanks = 8;
+my $numberOfColumns = 1024;
+
+my $numberOfRowBits = log($numberOfRows)/log(2);
+my $numberOfBankBits = log($numberOfBanks)/log(2);
+my $numberOfColumnBits = log($numberOfColumns)/log(2);
+
+open(FH, "$filename");
+
+my @activityCounter;
+my @mapping;
+
+for(my $i = 0; $i < 32; $i++)
+{
+ $activityCounter[$i] = 0;
+ $mapping[$i] = "X";
+}
+
+my $old_address = "00000000000000000000000000000000";
+
+while()
+{
+ # Get the adress:
+ $_ =~ /\d+:\s+\w+\s+0x([\w\d]+)\s*[\d\w]*/;
+ my $address = $1;
+ $address = sprintf( "%032b", hex( $address ) );
+
+ # $i = 0 :: most significant bit
+ for(my $i = 0; $i < 32; $i++)
+ {
+ my $new = substr($address, $i, 1);
+ my $old = substr($old_address, $i, 1);
+
+ if($new ne $old)
+ {
+ $activityCounter[31-$i]++;
+ }
+ }
+
+ $old_address = $address;
+}
+
+# Print bit numbers:
+print "Bits\t";
+for(my $i = 31; $i >= 0; $i--)
+{
+ print $i."\t";
+}
+
+#Print Activity
+print "\nActivity\t";
+for(my $i = 31; $i >= 0; $i--)
+{
+ print $activityCounter[$i]."\t";
+}
+
+#Print relative Activity
+print "\nPercent\t";
+my $sum = 0;
+for(my $i = 31; $i >= 0; $i--)
+{
+ $sum = $sum + $activityCounter[$i];
+}
+for(my $i = 31; $i >= 0; $i--)
+{
+ my $string = $activityCounter[$i]/$sum."\t";
+ $string =~ s/\./,/g;
+ print $string;
+}
+
+#Search Bank Locations
+for(my $i = 0; $i < $numberOfBankBits; $i++)
+{
+ my $maximum = max(@activityCounter);
+ my ($index) = grep $activityCounter[$_] == $maximum , 0.. $#activityCounter;
+ $mapping[$index] = "B$i";
+ $activityCounter[$index] = -1;
+}
+
+#Search Column Locations
+for(my $i = 0; $i < $numberOfColumnBits; $i++)
+{
+ my $maximum = max(@activityCounter);
+ my ($index) = grep $activityCounter[$_] == $maximum , 0.. $#activityCounter;
+ $mapping[$index] = "C$i";
+ $activityCounter[$index] = -1;
+}
+
+#Search Row Locations
+for(my $i = 0; $i < $numberOfRowBits; $i++)
+{
+ my $maximum = max(@activityCounter);
+ my ($index) = grep $activityCounter[$_] == $maximum , 0.. $#activityCounter;
+ $mapping[$index] = "R$i";
+ $activityCounter[$index] = -1;
+}
+
+#Print final mapping
+print "\nMapping\t";
+my $maximum = max(@activityCounter);
+for(my $i = 31; $i >= 0; $i--)
+{
+ print $mapping[$i]."\t";
+}
+print "\n";
diff --git a/dram/resources/scripts/metrics.py b/dram/resources/scripts/metrics.py
index dfcf491a..b5c20047 100644
--- a/dram/resources/scripts/metrics.py
+++ b/dram/resources/scripts/metrics.py
@@ -50,15 +50,38 @@ def getClock(connection):
# plt.savefig('hist.png')
# return "Saved as hist.png"
+#@metric
+#def average_response_latency_in_ns(connection):
+# cursor = connection.cursor()
+# cursor.execute("""SELECT avg(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 trace_length_in_ns(connection):
+ cursor = connection.cursor()
+ cursor.execute(""" SELECT max(PhaseEnd)/1000 FROM PHASES; """)
+ result = cursor.fetchone()
+ return result[0]
+
@metric
def average_response_latency_in_ns(connection):
cursor = connection.cursor()
- cursor.execute("""SELECT avg(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases
- ON phases.transact = transactions.ID WHERE PhaseName='RESP' """)
+ cursor.execute("""SELECT AVG(RESP.PHASEBEGIN - REQ.PHASEBEGIN)/1000 FROM PHASES REQ, PHASES RESP WHERE REQ.PHASENAME = 'REQ' AND RESP.PHASENAME='RESP' AND REQ.TRANSACT = RESP.TRANSACT """)
result = cursor.fetchone()
return round(result[0],1)
+@metric
+def trans_with_max_response_latency(connection):
+ cursor = connection.cursor()
+ cursor.execute(""" SELECT REQ.TRANSACT, max(RESP.PHASEBEGIN - REQ.PHASEBEGIN)/1000 FROM PHASES REQ, PHASES RESP WHERE REQ.PHASENAME = 'REQ' AND RESP.PHASENAME='RESP' AND REQ.TRANSACT = RESP.TRANSACT """)
+
+ result = cursor.fetchone()
+ return result[0]
+
@metric
def memory_utilisation_percent(connection):
cursor = connection.cursor()
diff --git a/dram/resources/scripts/stride_detection.pl b/dram/resources/scripts/stride_detection.pl
new file mode 100644
index 00000000..c15b2c28
--- /dev/null
+++ b/dram/resources/scripts/stride_detection.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+use List::Util 'max';
+use warnings;
+use strict;
+
+my $filename = shift || die("Please provide a input STL file");
+my $command = shift || die ("Pleas provide read/write");
+
+open(FH, "$filename");
+
+my $old_address = 0;
+my %histogram;
+my $command_occurance = 0;
+
+while()
+{
+ # Get the adress:
+ $_ =~ /\d+:\s+(\w+)\s+0x([\w\d]+)\s*[\d\w]*/;
+ if($command eq $1)
+ {
+ my $address = hex($2);
+ my $distance = $address - $old_address;
+ $histogram{$distance} ++;
+ $old_address = $address;
+ $command_occurance++;
+ }
+}
+
+foreach my $key ( keys %histogram)
+{
+ my $percent = $histogram{$key}/$command_occurance;
+ my $hexkey = sprintf( "%032b", abs($key) );
+ print "0x".$hexkey." ".abs($key)." = ".$histogram{$key}." (".$percent.")\n";
+}
diff --git a/dram/resources/simulations/sim-batch.xml b/dram/resources/simulations/sim-batch.xml
index 3e19862c..4d4d7562 100644
--- a/dram/resources/simulations/sim-batch.xml
+++ b/dram/resources/simulations/sim-batch.xml
@@ -1,20 +1,25 @@
-
-WideIO.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- am_wideio.xml
+
-
- fr_fcfs.xml
-
-
+
+
+ small.stl
+
-
-
- mediabench-fractal_32.stl
-
-
-
+
-
diff --git a/dram/src/common/Utils.cpp b/dram/src/common/Utils.cpp
index 0425aef2..82a96635 100644
--- a/dram/src/common/Utils.cpp
+++ b/dram/src/common/Utils.cpp
@@ -96,7 +96,7 @@ double queryDoubleParameter(XMLElement* node, string name)
bool queryBoolParameter(XMLElement* node, string name)
{
bool result;
- XMLElement* element;
+ XMLElement* element;// = node->FirstChildElement("parameter");
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
@@ -129,14 +129,40 @@ string queryStringParameter(XMLElement* node, string name)
return 0;
}
+string errorToString(XMLError error)
+{
+ switch(error){
+ case XML_NO_ERROR: return "no error"; case XML_NO_ATTRIBUTE: return "NO_ATTRIBUTE";
+ case XML_WRONG_ATTRIBUTE_TYPE: return "WRONG_ATTRIBUTE_TYPE";
+ case XML_ERROR_FILE_NOT_FOUND: return "FILE_NOT_FOUND";
+ case XML_ERROR_FILE_COULD_NOT_BE_OPENED: return "FILE_COULD_NOT_BE_OPENED";
+ case XML_ERROR_FILE_READ_ERROR: return "FILE_READ_ERROR";
+ case XML_ERROR_ELEMENT_MISMATCH: return "ERROR_ELEMENT_MISMATCH";
+ case XML_ERROR_PARSING_ELEMENT: return "ERROR_PARSING_ELEMENT";
+ case XML_ERROR_PARSING_ATTRIBUTE: return "ERROR_PARSING_ATTRIBUTE";
+ case XML_ERROR_IDENTIFYING_TAG: return "ERROR_IDENTIFYING_TAG";
+ case XML_ERROR_PARSING_TEXT: return "ERROR_PARSING_TEXT";
+ case XML_ERROR_PARSING_CDATA: return "ERROR_PARSING_CDATA";
+ case XML_ERROR_PARSING_COMMENT: return "ERROR_PARSING_COMMENT";
+ case XML_ERROR_PARSING_DECLARATION: return "ERROR_PARSING_DECLARATION";
+ case XML_ERROR_PARSING_UNKNOWN: return "ERROR_PARSING_UNKNOWN";
+ case XML_ERROR_EMPTY_DOCUMENT: return "ERROR_EMPTY_DOCUMENT";
+ case XML_ERROR_MISMATCHED_ELEMENT: return "ERROR_MISMATCHED_ELEMENT";
+ case XML_ERROR_PARSING: return "ERROR_PARSING";
+ case XML_CAN_NOT_CONVERT_TEXT: return "CAN_NOT_CONVERT_TEXT";
+ case XML_NO_TEXT_NODE: return "NO_TEXT_NODE";
+ default: "";
+ }
+}
+
void loadXML(string uri, XMLDocument& doc)
{
XMLError error = doc.LoadFile(uri.c_str());
if (error)
{
- //TODO specify error
- reportFatal("Configuration", "Error loading xml from: " + uri);
+ reportFatal("Configuration", "Error loading xml from: " + uri + " "
+ + errorToString(error));
}
}
diff --git a/dram/src/common/third_party/DRAMPower b/dram/src/common/third_party/DRAMPower
new file mode 160000
index 00000000..7723662d
--- /dev/null
+++ b/dram/src/common/third_party/DRAMPower
@@ -0,0 +1 @@
+Subproject commit 7723662db4edd6b8ccd7424edd17073fbfbff601
diff --git a/dram/src/common/xmlAddressdecoder.cpp b/dram/src/common/xmlAddressdecoder.cpp
index 03aadf0e..4c720eaa 100644
--- a/dram/src/common/xmlAddressdecoder.cpp
+++ b/dram/src/common/xmlAddressdecoder.cpp
@@ -1,19 +1,36 @@
#include "xmlAddressdecoder.h"
#include
#include "Utils.h"
+#include "bitset"
+#include "../controller/core/configuration/Configuration.h"
using namespace std;
using namespace tinyxml2;
-string xmlAddressDecoder::addressConfigURI = "";
+tinyxml2::XMLElement* xmlAddressDecoder::addressmapping = NULL;
xmlAddressDecoder::xmlAddressDecoder(string addressConfigURI)
{
-
tinyxml2::XMLDocument doc;
loadXML(addressConfigURI, doc);
- tinyxml2::XMLElement* addressmap = doc.FirstChildElement("dramconfig")->FirstChildElement("addressmap");
+ xmlAddressDecoder(doc.FirstChildElement("dramconfig")->FirstChildElement("addressmap"));
+
+}
+
+xmlAddressDecoder::xmlAddressDecoder(XMLElement* addressmap)
+{
+ tinyxml2::XMLDocument doc;
+ string xmlNodeName(addressmap->Name());
+ if( xmlNodeName != "addressmapping")
+ reportFatal("AddressDecorder", "addressmap node expected");
+
+ if(addressmap->Attribute("src"))
+ {
+ string src(addressmap->Attribute("src"));
+ loadXML(src, doc);
+ addressmap = (doc.FirstChildElement("addressmapping"));
+ }
for(XMLElement* child = addressmap->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
{
@@ -32,10 +49,12 @@ DecodedAddress xmlAddressDecoder::decodeAddress(sc_dt::uint64 addr)
{
DecodedAddress result;
result.channel = (addr & masks["channel"]) >> shifts["channel"];
- result.rank = (addr & masks["rank"]) >> shifts["rank"];
- result.bankgroup = (addr & masks["bankgroup"]) >> shifts["bankgroup"];
- result.row = (addr & masks["row"]) >> shifts["row"];
+ //result.rank = (addr & masks["rank"]) >> shifts["rank"];
+ //result.bankgroup = (addr & masks["bankgroup"]) >> shifts["bankgroup"];
result.bank = (addr & masks["bank"]) >> shifts["bank"];
+ result.bankgroup = result.bank % core::Configuration::getInstance().memSpec.NumberOfBankGroups;
+ result.rank = result.bank % core::Configuration::getInstance().memSpec.NumberOfRanks;
+ result.row = (addr & masks["row"]) >> shifts["row"];
result.column = (addr & masks["column"]) >> shifts["column"];
result.bytes = (addr & masks["bytes"]) >> shifts["bytes"];
return result;
@@ -51,3 +70,14 @@ sc_dt::uint64 xmlAddressDecoder::encodeAddress(DecodedAddress n)
n.column << shifts["column"] |
n.bytes << shifts["bytes"];
}
+
+void xmlAddressDecoder::print()
+{
+ cout << "Used addressmapping:" << endl;
+ cout<<"===================="<(pair.second)< masks;
std::map shifts;
diff --git a/dram/src/controller/Controller.h b/dram/src/controller/Controller.h
index b08a835d..05142081 100644
--- a/dram/src/controller/Controller.h
+++ b/dram/src/controller/Controller.h
@@ -11,6 +11,7 @@
#include