Isolated DRAMSys TLM model
This commit is contained in:
@@ -11,4 +11,5 @@
|
||||
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
|
||||
<!--3 Modes: NoStorage, Store (store data without errormodel), ErrorModel (store data with errormodel)-->
|
||||
<StoreMode value="NoStorage" />
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
</mcconfig>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<ErrorChipSeed value="42" />
|
||||
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
|
||||
<!-- Modes: NoStorage, Store (store data without errormodel), ErrorModel (store data with errormodel) -->
|
||||
<StoreMode value="NoStorage" />
|
||||
<StoreMode value="Store" />
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
</mcconfig>
|
||||
|
||||
|
||||
@@ -11,12 +11,6 @@
|
||||
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
|
||||
<!-- Modes: NoStorage, Store (store data without errormodel), ErrorModel (store data with errormodel) -->
|
||||
<StoreMode value="NoStorage" />
|
||||
<!--
|
||||
<ReadWriteGrouping value="false" />
|
||||
<ModelStorage value="false" />
|
||||
<ModelErrorInjection value="false" />
|
||||
<ReorderBuffer value="false" />
|
||||
<DatabaseRecording value="true" />
|
||||
-->
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
</mcconfig>
|
||||
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
|
||||
<!-- Modes: NoStorage, Store (store data without errormodel), ErrorModel (store data with errormodel) -->
|
||||
<StoreMode value="NoStorage" />
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
</mcconfig>
|
||||
|
||||
|
||||
12
DRAMSys/simulator/resources/configs/simulator/ddr3.xml
Normal file
12
DRAMSys/simulator/resources/configs/simulator/ddr3.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<simconfig>
|
||||
<SimulationName value="wideio" />
|
||||
<Debug value="0" />
|
||||
<DatabaseRecording value="1" />
|
||||
<PowerAnalysis value="1" />
|
||||
<EnableWindowing value = "1" />
|
||||
<WindowSize value="100" />
|
||||
<ThermalSimulation value="0"/>
|
||||
<SimulationProgressBar value="1"/>
|
||||
<NumberOfMemChannels value="1"/>
|
||||
<NumberOfDevicesOnDIMM value = "8" />
|
||||
</simconfig>
|
||||
13
DRAMSys/simulator/resources/configs/simulator/wideio.xml
Normal file
13
DRAMSys/simulator/resources/configs/simulator/wideio.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<simconfig>
|
||||
<SimulationName value="wideio" />
|
||||
<Debug value="0" />
|
||||
<DatabaseRecording value="1" />
|
||||
<PowerAnalysis value="1" />
|
||||
<EnableWindowing value = "1" />
|
||||
<WindowSize value="100" />
|
||||
<ThermalSimulation value="0"/>
|
||||
<SimulationProgressBar value="1"/>
|
||||
<NumberOfMemChannels value="1"/>
|
||||
<NumberOfDevicesOnDIMM value = "1" />
|
||||
</simconfig>
|
||||
|
||||
14
DRAMSys/simulator/resources/configs/thermalsim/config.xml
Normal file
14
DRAMSys/simulator/resources/configs/thermalsim/config.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<!-- Temperature Simulator Configuration (used for all simulation setups) -->
|
||||
<thermalsimconfig>
|
||||
<TemperatureScale value="Celsius" />
|
||||
<StaticTemperatureDefaultValue value="89" />
|
||||
<ThermalSimPeriod value="100" />
|
||||
<ThermalSimUnit value="us" />
|
||||
<PowerInfoFile value="../../DRAMSys/simulator/resources/configs/thermalsim/powerInfo.xml"/>
|
||||
<IceServerIp value="127.0.0.1" />
|
||||
<IceServerPort value="11880" />
|
||||
<SimPeriodAdjustFactor value="10" />
|
||||
<NPowStableCyclesToIncreasePeriod value="5" />
|
||||
<GenerateTemperatureMap value="1" />
|
||||
<GeneratePowerMap value="1" />
|
||||
</thermalsimconfig>
|
||||
@@ -6,6 +6,9 @@ OTHER_FILES += resources/simulations/sim-batch.xml
|
||||
OTHER_FILES += resources/simulations/ddr3-example.xml
|
||||
OTHER_FILES += resources/simulations/ddr3-single-device.xml
|
||||
|
||||
# Simulator Configuration:
|
||||
OTHER_FILES +=
|
||||
|
||||
# scripts
|
||||
OTHER_FILES += resources/scripts/address_scrambler.pl
|
||||
OTHER_FILES += resources/scripts/createTraceDB.sql
|
||||
@@ -68,7 +71,7 @@ OTHER_FILES += resources/configs/mcconfigs/par_bs.xml
|
||||
OTHER_FILES += resources/configs/memspecs/memspec.dtd
|
||||
OTHER_FILES += resources/configs/memspecs/MatzesWideIO.xml
|
||||
OTHER_FILES += resources/configs/memspecs/DDR4.xml
|
||||
OTHER_FILES += resources/configs/memspecs/WideIO.xml
|
||||
OTHER_FILES +=
|
||||
OTHER_FILES += resources/configs/memspecs/MatzesWideIO-short.xml
|
||||
OTHER_FILES += resources/configs/memspecs/MICRON_1Gb_DDR3-1600_8bit_G.xml
|
||||
OTHER_FILES += resources/configs/memspecs/JEDEC_256Mb_WIDEIO_SDR-200_128bit.xml
|
||||
@@ -131,3 +134,9 @@ OTHER_FILES += resources/configs/thermalsim/mem.flp
|
||||
OTHER_FILES += resources/configs/thermalsim/powerInfo.xml
|
||||
OTHER_FILES += resources/configs/thermalsim/stack.stk
|
||||
|
||||
DISTFILES += \
|
||||
$$PWD/configs/thermalsim/config.xml \
|
||||
$$PWD/configs/simulator/wideio.xml \
|
||||
$$PWD/configs/simulator/ddr3.xml \
|
||||
$$PWD/configs/memspecs/wideio.xml
|
||||
|
||||
|
||||
@@ -1,32 +1,10 @@
|
||||
<simulation>
|
||||
<!-- General Simulator Configuration (used for all simulation setups) -->
|
||||
<simconfig>
|
||||
<Debug value="0" />
|
||||
<DatabaseRecording value="1" />
|
||||
<PowerAnalysis value="1" />
|
||||
<EnableWindowing value = "1" />
|
||||
<WindowSize value="100" />
|
||||
<NumberOfTracePlayers value="1"/>
|
||||
<NumberOfMemChannels value="1"/>
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
<ThermalSimulation value="0"/>
|
||||
<SimulationProgressBar value="1"/>
|
||||
<NumberOfDevicesOnDIMM value = "8" />
|
||||
</simconfig>
|
||||
|
||||
<!-- Temperature Simulator Configuration (used for all simulation setups) -->
|
||||
<thermalsimconfig>
|
||||
<TemperatureScale value="Celsius" />
|
||||
<StaticTemperatureDefaultValue value="89" />
|
||||
<ThermalSimPeriod value="100" />
|
||||
<ThermalSimUnit value="us" />
|
||||
<PowerInfoFile value="../../DRAMSys/simulator/resources/configs/thermalsim/powerInfo.xml"/>
|
||||
<IceServerIp value="127.0.0.1" />
|
||||
<IceServerPort value="11880" />
|
||||
<SimPeriodAdjustFactor value="10" />
|
||||
<NPowStableCyclesToIncreasePeriod value="5" />
|
||||
<GenerateTemperatureMap value="1" />
|
||||
<GeneratePowerMap value="1" />
|
||||
</thermalsimconfig>
|
||||
|
||||
|
||||
@@ -50,12 +28,12 @@
|
||||
</mcconfigs>
|
||||
|
||||
<tracesetups>
|
||||
<tracesetup id="fifo">
|
||||
<tracesetup id="fifo_scram">
|
||||
<!--
|
||||
This device mimics an image processing application
|
||||
running on an FPGA with 200 Mhz.
|
||||
-->
|
||||
<device clkMhz="200">ddr3_example.stl</device>
|
||||
<device clkMhz="200">_128x128_64-Pixelgroesse_scram.stl</device>
|
||||
</tracesetup>
|
||||
</tracesetups>
|
||||
|
||||
|
||||
@@ -1,32 +1,10 @@
|
||||
<simulation>
|
||||
<!-- General Simulator Configuration (used for all simulation setups) -->
|
||||
<simconfig>
|
||||
<Debug value="0" />
|
||||
<DatabaseRecording value="1" />
|
||||
<PowerAnalysis value="1" />
|
||||
<EnableWindowing value = "1" />
|
||||
<WindowSize value="100" />
|
||||
<NumberOfTracePlayers value="1"/>
|
||||
<NumberOfMemChannels value="1"/>
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
<ThermalSimulation value="0"/>
|
||||
<SimulationProgressBar value="1"/>
|
||||
<NumberOfDevicesOnDIMM value = "1" />
|
||||
</simconfig>
|
||||
|
||||
<!-- Temperature Simulator Configuration (used for all simulation setups) -->
|
||||
<thermalsimconfig>
|
||||
<TemperatureScale value="Celsius" />
|
||||
<StaticTemperatureDefaultValue value="89" />
|
||||
<ThermalSimPeriod value="100" />
|
||||
<ThermalSimUnit value="us" />
|
||||
<PowerInfoFile value="../../DRAMSys/simulator/resources/configs/thermalsim/powerInfo.xml"/>
|
||||
<IceServerIp value="127.0.0.1" />
|
||||
<IceServerPort value="11880" />
|
||||
<SimPeriodAdjustFactor value="10" />
|
||||
<NPowStableCyclesToIncreasePeriod value="5" />
|
||||
<GenerateTemperatureMap value="1" />
|
||||
<GeneratePowerMap value="1" />
|
||||
</thermalsimconfig>
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +1,15 @@
|
||||
<simulation>
|
||||
<!-- General Simulator Configuration (used for all simulation setups) -->
|
||||
<simconfig>
|
||||
<Debug value="0" />
|
||||
<DatabaseRecording value="0" />
|
||||
<PowerAnalysis value="0" />
|
||||
<EnableWindowing value = "0" />
|
||||
<WindowSize value="1000" />
|
||||
<NumberOfTracePlayers value="1"/>
|
||||
<NumberOfMemChannels value="4"/>
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
<ThermalSimulation value="0"/>
|
||||
<SimulationProgressBar value="0"/>
|
||||
<NumberOfDevicesOnDIMM value = "1" />
|
||||
<CheckTLM2Protocol value = "0" />
|
||||
</simconfig>
|
||||
|
||||
<!-- Temperature Simulator Configuration (used for all simulation setups) -->
|
||||
<thermalsimconfig>
|
||||
<TemperatureScale value="Celsius" />
|
||||
<StaticTemperatureDefaultValue value="89" />
|
||||
<ThermalSimPeriod value="100" />
|
||||
<ThermalSimUnit value="us" />
|
||||
<PowerInfoFile value="../../DRAMSys/simulator/resources/configs/thermalsim/powerInfo.xml"/>
|
||||
<IceServerIp value="127.0.0.1" />
|
||||
<IceServerPort value="11880" />
|
||||
<SimPeriodAdjustFactor value="10" />
|
||||
<NPowStableCyclesToIncreasePeriod value="5" />
|
||||
<GenerateTemperatureMap value="1" />
|
||||
<GeneratePowerMap value="1" />
|
||||
</thermalsimconfig>
|
||||
|
||||
<memspecs>
|
||||
<memspec src="../../DRAMSys/simulator/resources/configs/memspecs/WideIO.xml"></memspec>
|
||||
</memspecs>
|
||||
|
||||
<thermalsimconfig>
|
||||
</thermalsimconfig>
|
||||
|
||||
<addressmappings>
|
||||
<addressmapping src="../../DRAMSys/simulator/resources/configs/amconfigs/am_wideio.xml"></addressmapping>
|
||||
</addressmappings>
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
using namespace std;
|
||||
using namespace tinyxml2;
|
||||
|
||||
|
||||
bool TimeInterval::timeIsInInterval(sc_time time)
|
||||
{
|
||||
return (start < time && time < end);
|
||||
|
||||
@@ -48,6 +48,15 @@
|
||||
#include "dramExtension.h"
|
||||
#include "third_party/tinyxml2/tinyxml2.h"
|
||||
|
||||
|
||||
#define DEF_SINGLETON( NAME ) \
|
||||
public: \
|
||||
static NAME& getInstance() \
|
||||
{ \
|
||||
static NAME _instance; \
|
||||
return _instance; \
|
||||
}
|
||||
|
||||
//TODO : move to timing specific header
|
||||
sc_time getDistance(sc_time a, sc_time b);
|
||||
|
||||
|
||||
@@ -44,32 +44,44 @@
|
||||
using namespace std;
|
||||
using namespace tinyxml2;
|
||||
|
||||
tinyxml2::XMLElement* xmlAddressDecoder::addressmapping = NULL;
|
||||
//tinyxml2::XMLElement* xmlAddressDecoder::addressmapping = NULL;
|
||||
//xmlAddressDecoder* xmlAddressDecoder::decoder = NULL;
|
||||
|
||||
xmlAddressDecoder::xmlAddressDecoder()
|
||||
{
|
||||
addressmapping = NULL;
|
||||
}
|
||||
|
||||
xmlAddressDecoder::xmlAddressDecoder(string addressConfigURI)
|
||||
{
|
||||
tinyxml2::XMLDocument doc;
|
||||
|
||||
loadXML(addressConfigURI, doc);
|
||||
xmlAddressDecoder(doc.FirstChildElement("dramconfig")->FirstChildElement("addressmap"));
|
||||
|
||||
setConfiguration(addressConfigURI);
|
||||
}
|
||||
|
||||
xmlAddressDecoder::xmlAddressDecoder(XMLElement* addressmap)
|
||||
{
|
||||
tinyxml2::XMLDocument doc;
|
||||
string xmlNodeName(addressmap->Name());
|
||||
if( xmlNodeName != "addressmapping")
|
||||
reportFatal("AddressDecorder", "addressmap node expected");
|
||||
setConfiguration(addressmap);
|
||||
}
|
||||
|
||||
if(addressmap->Attribute("src"))
|
||||
void xmlAddressDecoder::setConfiguration(std::string addressConfigURI)
|
||||
{
|
||||
tinyxml2::XMLDocument doc;
|
||||
loadXML(addressConfigURI, doc);
|
||||
setConfiguration(doc.RootElement());
|
||||
}
|
||||
|
||||
void xmlAddressDecoder::setConfiguration(tinyxml2::XMLElement* addressMap)
|
||||
{
|
||||
tinyxml2::XMLDocument doc;
|
||||
string xmlNodeName(addressMap->Name());
|
||||
|
||||
if( xmlNodeName != "addressmapping")
|
||||
{
|
||||
string src(addressmap->Attribute("src"));
|
||||
loadXML(src, doc);
|
||||
addressmap = (doc.FirstChildElement("addressmapping"));
|
||||
reportFatal("AddressDecorder", "addressmap node expected");
|
||||
}
|
||||
|
||||
for(XMLElement* child = addressmap->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
|
||||
for(XMLElement* child = addressMap->FirstChildElement();
|
||||
child != NULL;
|
||||
child = child->NextSiblingElement())
|
||||
{
|
||||
int from;
|
||||
int to;
|
||||
@@ -80,10 +92,10 @@ xmlAddressDecoder::xmlAddressDecoder(XMLElement* addressmap)
|
||||
shifts[child->Name()] = from;
|
||||
masks[child->Name()] = pow(2.0, to + 1.0) - pow(2.0, from + 0.0);
|
||||
amount[child->Name()] = pow(2.0, to - from + 1.0);
|
||||
//std::cout << child->Name() << " XXXX " << pow(2.0, to - from + 1.0) <<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DecodedAddress xmlAddressDecoder::decodeAddress(sc_dt::uint64 addr)
|
||||
{
|
||||
DecodedAddress result;
|
||||
@@ -112,8 +124,8 @@ sc_dt::uint64 xmlAddressDecoder::encodeAddress(DecodedAddress n)
|
||||
|
||||
void xmlAddressDecoder::print()
|
||||
{
|
||||
cout << "Used addressmapping:" << endl;
|
||||
cout<<"===================="<<endl;
|
||||
cout << "Used addressmapping:" << endl;
|
||||
cout << "====================" << endl;
|
||||
for(auto& pair : masks)
|
||||
{
|
||||
cout<<pair.first<<"\t:\t" << bitset<32>(pair.second)<<endl;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <math.h>
|
||||
#include <map>
|
||||
|
||||
#include "Utils.h"
|
||||
#include "third_party/tinyxml2/tinyxml2.h"
|
||||
|
||||
struct DecodedAddress
|
||||
@@ -62,35 +63,27 @@ struct DecodedAddress
|
||||
class xmlAddressDecoder
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static tinyxml2::XMLElement* addressmapping;
|
||||
static inline xmlAddressDecoder& getInstance()
|
||||
{
|
||||
static xmlAddressDecoder decoder(xmlAddressDecoder::addressmapping);
|
||||
return decoder;
|
||||
}
|
||||
|
||||
static inline void Initialize(tinyxml2::XMLElement* mapping)
|
||||
{
|
||||
addressmapping = mapping;
|
||||
xmlAddressDecoder::getInstance();
|
||||
addressmapping = NULL;
|
||||
}
|
||||
|
||||
DecodedAddress decodeAddress(sc_dt::uint64 addr);
|
||||
sc_dt::uint64 encodeAddress(DecodedAddress n);
|
||||
|
||||
|
||||
void print();
|
||||
private:
|
||||
|
||||
xmlAddressDecoder();
|
||||
xmlAddressDecoder(std::string URI);
|
||||
xmlAddressDecoder(tinyxml2::XMLElement* addressMap);
|
||||
|
||||
std::map<std::string, sc_dt::uint64> masks;
|
||||
std::map<std::string, unsigned int> shifts;
|
||||
|
||||
tinyxml2::XMLElement* addressmapping;
|
||||
|
||||
public:
|
||||
DEF_SINGLETON(xmlAddressDecoder);
|
||||
|
||||
DecodedAddress decodeAddress(sc_dt::uint64 addr);
|
||||
sc_dt::uint64 encodeAddress(DecodedAddress n);
|
||||
|
||||
void setConfiguration(std::string url);
|
||||
void setConfiguration(tinyxml2::XMLElement* addressMap);
|
||||
void print();
|
||||
|
||||
std::map<std::string, unsigned int> amount;
|
||||
};
|
||||
|
||||
|
||||
@@ -133,6 +133,8 @@ void Configuration::setParameter(std::string name, std::string value)
|
||||
ReorderBuffer = string2bool(value);
|
||||
|
||||
//SimConfig------------------------------------------------
|
||||
else if(name == "SimulationName")
|
||||
SimulationName = value;
|
||||
else if(name == "DatabaseRecording")
|
||||
DatabaseRecording = string2bool(value);
|
||||
else if(name == "PowerAnalysis")
|
||||
@@ -264,6 +266,9 @@ unsigned int Configuration::getBytesPerBurst()
|
||||
// offset of the N-byte-wide memory module (DIMM) (a single data word
|
||||
// or burst element has N bytes. N = 2^(# bits for byte offset)).
|
||||
unsigned int burstElementSizeInBytes = xmlAddressDecoder::getInstance().amount["bytes"];
|
||||
cout << "burstElementSizeInBytes:" << burstElementSizeInBytes << endl;
|
||||
cout << "bytesPerBurst:" << bytesPerBurst << endl;
|
||||
cout << "BurstLength:" << memSpec.BurstLength << endl;
|
||||
assert(bytesPerBurst == (burstElementSizeInBytes * memSpec.BurstLength));
|
||||
}
|
||||
|
||||
|
||||
@@ -50,18 +50,14 @@ DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS(StorageMode, (NoStorage)(Store)(ErrorM
|
||||
|
||||
enum class EPowerDownMode{NoPowerDown, Staggered, TimeoutPDN, TimeoutSREF};
|
||||
|
||||
struct Configuration
|
||||
struct Configuration
|
||||
{
|
||||
static std::string memspecUri;
|
||||
static std::string mcconfigUri;
|
||||
|
||||
static inline Configuration& getInstance()
|
||||
{
|
||||
static Configuration configuration;
|
||||
return configuration;
|
||||
}
|
||||
DEF_SINGLETON(Configuration);
|
||||
|
||||
//MCConfig
|
||||
// MCConfig:
|
||||
bool BankwiseLogic = false;
|
||||
bool OpenPagePolicy = true;
|
||||
unsigned int MaxNrOfTransactions = 8;
|
||||
@@ -72,7 +68,8 @@ struct Configuration
|
||||
bool ReadWriteGrouping = false;
|
||||
bool ReorderBuffer = false;
|
||||
|
||||
//SimConfig
|
||||
// SimConfig
|
||||
std::string SimulationName = "default";
|
||||
bool DatabaseRecording = true;
|
||||
bool PowerAnalysis = false;
|
||||
bool EnableWindowing = false;
|
||||
@@ -86,7 +83,7 @@ struct Configuration
|
||||
unsigned int NumberOfDevicesOnDIMM = 1;
|
||||
bool CheckTLM2Protocol = false;
|
||||
|
||||
//MemSpec(from DRAM-Power XML)
|
||||
// MemSpec (from DRAM-Power XML)
|
||||
MemSpec memSpec;
|
||||
|
||||
void setParameter(std::string name, std::string value);
|
||||
|
||||
@@ -107,13 +107,6 @@ void ConfigurationLoader::loadMemSpec(Configuration& config, string memspecUri)
|
||||
|
||||
void ConfigurationLoader::loadMemSpec(Configuration& config, XMLElement* memspec)
|
||||
{
|
||||
XMLDocument doc;
|
||||
|
||||
string src(memspec->Attribute("src"));
|
||||
config.memspecUri = src;
|
||||
loadXML(src, doc);
|
||||
memspec = doc.FirstChildElement("memspec");
|
||||
|
||||
config.memSpec.MemoryId = queryStringParameter(memspec, "memoryId");
|
||||
config.memSpec.MemoryType = queryStringParameter(memspec, "memoryType");
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
class ConfigurationLoader
|
||||
{
|
||||
public:
|
||||
static void loadMCConfig(Configuration& config, std::string mcconfigUri);
|
||||
|
||||
static void loadMCConfig(Configuration& config, std::string amconfigUri);
|
||||
static void loadMCConfig(Configuration& config, tinyxml2::XMLElement* mcconfig);
|
||||
|
||||
static void loadSimConfig(Configuration& config, std::string simconfigUri);
|
||||
|
||||
@@ -53,38 +53,59 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
dramSys::dramSys(sc_module_name __attribute__((unused)) name,
|
||||
DRAMSys::DRAMSys(sc_module_name __attribute__((unused)) name,
|
||||
string pathToResources,
|
||||
string memspec,
|
||||
string mcconfig,
|
||||
string amconfig)
|
||||
string amconfig,
|
||||
string simconfig,
|
||||
string thermalconfig)
|
||||
{
|
||||
logo();
|
||||
|
||||
SC_THREAD(stop);
|
||||
|
||||
// TODO:
|
||||
|
||||
cout << memspec << endl;
|
||||
cout << mcconfig << endl;
|
||||
cout << amconfig << endl;
|
||||
|
||||
// The xmlAddressDecoder MUST be initialized before calling the
|
||||
// ConfigurationLoader because some information from the xmlAddressDecoder
|
||||
// is needed to assure the coherence of the configuration.
|
||||
xmlAddressDecoder::Initialize(setup.addressmapping);
|
||||
xmlAddressDecoder::getInstance().setConfiguration(pathToResources
|
||||
+ "configs/amconfigs/"
|
||||
+ amconfig);
|
||||
xmlAddressDecoder::getInstance().print();
|
||||
|
||||
ConfigurationLoader::loadMCConfig(Configuration::getInstance(), setup.mcconfig);
|
||||
ConfigurationLoader::loadMemSpec(Configuration::getInstance(), setup.memspec);
|
||||
ConfigurationLoader::loadSimConfig(Configuration::getInstance(), setup.simconfig);
|
||||
ConfigurationLoader::loadTemperatureSimConfig(Configuration::getInstance(), setup.thermalsimconfig);
|
||||
// Setup the memory controller with the propriate xml file
|
||||
ConfigurationLoader::loadMCConfig(Configuration::getInstance(),
|
||||
pathToResources
|
||||
+ "configs/mcconfigs/"
|
||||
+ mcconfig);
|
||||
|
||||
instantiateModules(traceName, setup.pathToResources);
|
||||
ConfigurationLoader::loadMemSpec(Configuration::getInstance(),
|
||||
pathToResources
|
||||
+ "configs/memspecs/"
|
||||
+ memspec);
|
||||
|
||||
ConfigurationLoader::loadSimConfig(Configuration::getInstance(),
|
||||
pathToResources
|
||||
+ "configs/simulator/"
|
||||
+ simconfig);
|
||||
|
||||
ConfigurationLoader::loadTemperatureSimConfig(Configuration::getInstance(),
|
||||
pathToResources
|
||||
+ "configs/thermalsim/"
|
||||
+ thermalconfig);
|
||||
|
||||
// Instantiate all internal DRAMSys modules:
|
||||
instantiateModules(Configuration::getInstance().SimulationName,
|
||||
pathToResources);
|
||||
|
||||
// Connect all internal DRAMSys modules:
|
||||
bindSockets();
|
||||
setupDebugManager(traceName);
|
||||
|
||||
// Setup the debug manager:
|
||||
setupDebugManager(Configuration::getInstance().SimulationName);
|
||||
}
|
||||
|
||||
void dramSys::logo()
|
||||
void DRAMSys::logo()
|
||||
{
|
||||
#define REDTXT(s) string(("\033[0;31m"+string((s))+"\033[0m"))
|
||||
#define BOLDBLUETXT(s) string(("\033[1;34m"+string((s))+"\033[0m"))
|
||||
@@ -92,15 +113,18 @@ void dramSys::logo()
|
||||
cout << REDTXT(" |||") << endl;
|
||||
cout << REDTXT(" +---+ Microelectronic Systems") << endl;
|
||||
cout << REDTXT("=| |= Design Research Group") << endl;
|
||||
cout << REDTXT("=| |= ") << BOLDBLUETXT("University of Kaiserslautern") << endl;
|
||||
cout << REDTXT("=| |= ") << BOLDBLUETXT("University of Kaiserslautern")
|
||||
<< endl;
|
||||
cout << REDTXT(" +---+ ") << endl;
|
||||
cout << REDTXT(" ||| ") << "DRAMSys - Approximately-Timed TLM Models for DDR and Wide I/0 DRAM -" << endl;
|
||||
cout << REDTXT(" ||| ") << "DRAMSys -"
|
||||
<< " Approximately-Timed TLM Models for DDR and Wide I/0 DRAM -"
|
||||
<< endl;
|
||||
cout << endl;
|
||||
#undef REDTXT
|
||||
#undef BOLDBLUETXT
|
||||
}
|
||||
|
||||
void dramSys::setupDebugManager(const string& traceName)
|
||||
void DRAMSys::setupDebugManager(const string& traceName)
|
||||
{
|
||||
auto& dbg = DebugManager::getInstance();
|
||||
dbg.writeToConsole = true;
|
||||
@@ -109,21 +133,35 @@ void dramSys::setupDebugManager(const string& traceName)
|
||||
dbg.openDebugFile(traceName + ".txt");
|
||||
}
|
||||
|
||||
void dramSys::setupTlmRecorders(const string &traceName, const string &pathToResources)
|
||||
void DRAMSys::setupTlmRecorders(const string &traceName,
|
||||
const string &pathToResources)
|
||||
{
|
||||
// Create TLM Recorders, one per channel.
|
||||
for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; i++) {
|
||||
std::string sqlScriptURI = pathToResources + string("scripts/createTraceDB.sql");
|
||||
std::string dbName = traceName + string("_channel") + std::to_string(i) + ".tdb";
|
||||
for (size_t i = 0;
|
||||
i < Configuration::getInstance().NumberOfMemChannels;
|
||||
i++)
|
||||
{
|
||||
std::string sqlScriptURI = pathToResources
|
||||
+ string("scripts/createTraceDB.sql");
|
||||
|
||||
std::string dbName = traceName
|
||||
+ string("_channel")
|
||||
+ std::to_string(i)
|
||||
+ ".tdb";
|
||||
|
||||
std::string recorderName = "tlmRecorder" + std::to_string(i);
|
||||
TlmRecorder *tlmRecorder = new TlmRecorder(recorderName.c_str(), sqlScriptURI.c_str(), dbName.c_str(), Configuration::getInstance().DatabaseRecording);
|
||||
TlmRecorder *tlmRecorder =
|
||||
new TlmRecorder(recorderName.c_str(),
|
||||
sqlScriptURI.c_str(),
|
||||
dbName.c_str(),
|
||||
Configuration::getInstance().DatabaseRecording);
|
||||
|
||||
tlmRecorder->recordMCconfig(Configuration::getInstance().mcconfigUri);
|
||||
tlmRecorder->recordMemspec(Configuration::getInstance().memspecUri);
|
||||
|
||||
tlmRecorders.push_back(tlmRecorder);
|
||||
|
||||
std::string traceNames = "FOO"; /// TODO
|
||||
std::string traceNames = "FOO"; // TODO
|
||||
//for (size_t i = 0; i < devices.size(); i++) {
|
||||
// traceNames.append(devices[i].trace);
|
||||
// if (i == devices.size() - 1)
|
||||
@@ -134,20 +172,25 @@ void dramSys::setupTlmRecorders(const string &traceName, const string &pathToRes
|
||||
}
|
||||
}
|
||||
|
||||
void dramSys::instantiateModules(const string &traceName, const string &pathToResources)
|
||||
void DRAMSys::instantiateModules(const string &traceName,
|
||||
const string &pathToResources)
|
||||
{
|
||||
// The first call to getInstance() creates the Temperature Controller.
|
||||
// The same instance will be accessed by all other modules.
|
||||
TemperatureController::getInstance();
|
||||
|
||||
// Create and properly initialize TLM recorders. They need to be ready before creating some modules.
|
||||
// Create and properly initialize TLM recorders.
|
||||
// They need to be ready before creating some modules.
|
||||
setupTlmRecorders(traceName, pathToResources);
|
||||
|
||||
arbiter = new Arbiter("arbiter");
|
||||
arbiter->setTlmRecorders(tlmRecorders);
|
||||
|
||||
|
||||
for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; i++) {
|
||||
for (size_t i = 0;
|
||||
i < Configuration::getInstance().NumberOfMemChannels;
|
||||
i++)
|
||||
{
|
||||
std::string str = "controller" + std::to_string(i);
|
||||
Controller *controller = new Controller(str.c_str(), tlmRecorders[i]);
|
||||
controllers.push_back(controller);
|
||||
@@ -158,80 +201,103 @@ void dramSys::instantiateModules(const string &traceName, const string &pathToRe
|
||||
dram->setDramController(controllers[i]);
|
||||
drams.push_back(dram);
|
||||
|
||||
if(Configuration::getInstance().CheckTLM2Protocol) {
|
||||
if(Configuration::getInstance().CheckTLM2Protocol)
|
||||
{
|
||||
str = "TLMCheckerController"+ std::to_string(i);
|
||||
tlm_utils::tlm2_base_protocol_checker<> * controllerTlmChecker = new tlm_utils::tlm2_base_protocol_checker<>(str.c_str());
|
||||
tlm_utils::tlm2_base_protocol_checker<> * controllerTlmChecker =
|
||||
new tlm_utils::tlm2_base_protocol_checker<>(str.c_str());
|
||||
controllersTlmCheckers.push_back(controllerTlmChecker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dramSys::bindSockets()
|
||||
void DRAMSys::bindSockets()
|
||||
{
|
||||
tSocket.bind(arbiter->tSocket);
|
||||
if(Configuration::getInstance().CheckTLM2Protocol) {
|
||||
if(Configuration::getInstance().CheckTLM2Protocol)
|
||||
{
|
||||
|
||||
for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; i++) {
|
||||
for (size_t i = 0;
|
||||
i < Configuration::getInstance().NumberOfMemChannels;
|
||||
i++)
|
||||
{
|
||||
arbiter->iSocket.bind(controllersTlmCheckers[i]->target_socket);
|
||||
controllersTlmCheckers[i]->initiator_socket.bind(controllers[i]->tSocket);
|
||||
controllersTlmCheckers[i]->initiator_socket.bind(
|
||||
controllers[i]->tSocket);
|
||||
controllers[i]->iSocket.bind(drams[i]->tSocket);
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; i++) {
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0;
|
||||
i < Configuration::getInstance().NumberOfMemChannels;
|
||||
i++)
|
||||
{
|
||||
arbiter->iSocket.bind(controllers[i]->tSocket);
|
||||
controllers[i]->iSocket.bind(drams[i]->tSocket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dramSys::~dramSys()
|
||||
DRAMSys::~DRAMSys()
|
||||
{
|
||||
|
||||
delete arbiter;
|
||||
|
||||
for (auto controller : controllers) {
|
||||
for (auto controller : controllers)
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
for (auto dram : drams) {
|
||||
for (auto dram : drams)
|
||||
{
|
||||
delete dram;
|
||||
}
|
||||
|
||||
for (auto rec : tlmRecorders) {
|
||||
for (auto rec : tlmRecorders)
|
||||
{
|
||||
delete rec;
|
||||
}
|
||||
|
||||
for (auto tlmChecker : controllersTlmCheckers) {
|
||||
for (auto tlmChecker : controllersTlmCheckers)
|
||||
{
|
||||
delete tlmChecker;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dramSys::stop()
|
||||
void DRAMSys::stop()
|
||||
{
|
||||
wait(terminateSimulation);
|
||||
|
||||
unsigned int pending_payloads = 0;
|
||||
do {
|
||||
do
|
||||
{
|
||||
pending_payloads = 0;
|
||||
for (auto controller : controllers) {
|
||||
for (auto controller : controllers)
|
||||
{
|
||||
pending_payloads += controller->getTotalNumberOfPayloadsInSystem();
|
||||
}
|
||||
wait(sc_time(200, SC_NS));
|
||||
} while(pending_payloads != 0);
|
||||
}
|
||||
while(pending_payloads != 0);
|
||||
|
||||
for (auto controller : controllers) {
|
||||
for (auto controller : controllers)
|
||||
{
|
||||
controller->terminateSimulation();
|
||||
}
|
||||
|
||||
wait(sc_time(200, SC_NS));
|
||||
for (auto rec : tlmRecorders) {
|
||||
|
||||
for (auto rec : tlmRecorders)
|
||||
{
|
||||
rec->closeConnection();
|
||||
}
|
||||
sc_stop();
|
||||
}
|
||||
|
||||
|
||||
void dramSys::report(string message)
|
||||
void DRAMSys::report(string message)
|
||||
{
|
||||
DebugManager::getInstance().printDebugMessage(this->name(), message);
|
||||
cout << message << endl;
|
||||
|
||||
@@ -50,74 +50,23 @@
|
||||
#include "../common/third_party/tinyxml2/tinyxml2.h"
|
||||
#include "../common/tlm2_base_protocol_checker.h"
|
||||
|
||||
|
||||
struct DramSetup
|
||||
|
||||
{
|
||||
tinyxml2::XMLElement* memspec;
|
||||
tinyxml2::XMLElement* mcconfig;
|
||||
tinyxml2::XMLElement* simconfig;
|
||||
tinyxml2::XMLElement* addressmapping;
|
||||
tinyxml2::XMLElement* thermalsimconfig;
|
||||
|
||||
string pathToResources;
|
||||
|
||||
DramSetup() : memspec(NULL),
|
||||
mcconfig(NULL),
|
||||
simconfig(NULL),
|
||||
addressmapping(NULL),
|
||||
thermalsimconfig(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
DramSetup(tinyxml2::XMLElement* memspec,
|
||||
tinyxml2::XMLElement* mcconfig,
|
||||
tinyxml2::XMLElement* simconfig,
|
||||
tinyxml2::XMLElement* addressmapping,
|
||||
tinyxml2::XMLElement *tsc) :
|
||||
memspec(memspec),
|
||||
mcconfig(mcconfig),
|
||||
simconfig(simconfig),
|
||||
addressmapping(addressmapping),
|
||||
thermalsimconfig(tsc)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct Device
|
||||
{
|
||||
std::string trace;
|
||||
unsigned int clkMhz;
|
||||
unsigned int burstLength;
|
||||
|
||||
Device():trace("empty.stl"), burstLength(0)
|
||||
{
|
||||
}
|
||||
|
||||
Device(std::string trace,
|
||||
unsigned int clkMhz,
|
||||
unsigned int burstLength = 8) :
|
||||
trace(trace),
|
||||
clkMhz (clkMhz),
|
||||
burstLength(burstLength)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class dramSys: public sc_module
|
||||
class DRAMSys: public sc_module
|
||||
{
|
||||
public:
|
||||
tlm_utils::multi_passthrough_target_socket<dramSys> tSocket;
|
||||
tlm_utils::multi_passthrough_target_socket<DRAMSys> tSocket;
|
||||
|
||||
sc_event terminateSimulation;
|
||||
|
||||
SC_HAS_PROCESS(dramSys);
|
||||
dramSys(sc_module_name name,
|
||||
SC_HAS_PROCESS(DRAMSys);
|
||||
DRAMSys(sc_module_name name,
|
||||
string pathToResources,
|
||||
string memspec,
|
||||
string mcconfig,
|
||||
string amconfig);
|
||||
string amconfig,
|
||||
string simconfig,
|
||||
string thermalconfig);
|
||||
|
||||
~dramSys();
|
||||
~DRAMSys();
|
||||
|
||||
void stop();
|
||||
void logo();
|
||||
@@ -125,7 +74,7 @@ public:
|
||||
|
||||
private:
|
||||
std::string traceName;
|
||||
DramSetup setup;
|
||||
//DramSetup setup;
|
||||
|
||||
//TLM 2.0 Protocol Checkers
|
||||
std::vector<tlm_utils::tlm2_base_protocol_checker<>*> controllersTlmCheckers;
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
//XXX
|
||||
//#include "SimulationManager.h"
|
||||
#include "dramSys.h"
|
||||
#include "ExampleInitiator.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -65,7 +67,8 @@ int sc_main(int argc, char **argv)
|
||||
sc_set_time_resolution(1, SC_PS);
|
||||
|
||||
// Get path of resources:
|
||||
resources = pathOfFile(argv[0]) + string("/../../DRAMSys/simulator/resources/");
|
||||
resources = pathOfFile(argv[0])
|
||||
+ string("/../../DRAMSys/simulator/resources/");
|
||||
|
||||
string simulationToRun;
|
||||
if(argc > 1)
|
||||
@@ -74,10 +77,23 @@ int sc_main(int argc, char **argv)
|
||||
simulationToRun = resources + "simulations/sim-batch.xml";
|
||||
|
||||
|
||||
dramSys dramSystem("dramSystem",
|
||||
"../../DRAMSys/simulator/resources/memspec/WideIO.xml",
|
||||
"../../DRAMSys/simulator/resources/fifoStrict.xml",
|
||||
"../../DRAMSys/simulator/resources/am_wideio.xml");
|
||||
DRAMSys dramSystem("dramSystem",
|
||||
"../../DRAMSys/simulator/resources/",
|
||||
"wideio.xml",
|
||||
"fifoStrict.xml",
|
||||
"am_wideio.xml",
|
||||
"wideio.xml",
|
||||
"config.xml");
|
||||
|
||||
ExampleInitiator trageGenerator("traceGenerator");
|
||||
|
||||
trageGenerator.socket.bind(dramSystem.tSocket);
|
||||
|
||||
SC_REPORT_INFO("sc_main", "Start of Simulation");
|
||||
|
||||
sc_core::sc_start();
|
||||
|
||||
SC_REPORT_INFO("sc_main", "End of Simulation");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user