changeset a465576671d4 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=a465576671d4
description:
ext: add the source code for DSENT
This patch adds a tool called DSENT to the ext/ directory. DSENT
is a tool that models power and area for on-chip networks. The next
patch adds a script for using the tool.
diffstat:
ext/dsent/DSENT.cc | 423 ++++++
ext/dsent/DSENT.h | 64 +
ext/dsent/LICENSE | 19 +
ext/dsent/Makefile | 55 +
ext/dsent/README | 374 +++++
ext/dsent/configs/electrical-clos.cfg | 84 +
ext/dsent/configs/electrical-link.cfg | 57 +
ext/dsent/configs/electrical-mesh.cfg | 81 +
ext/dsent/configs/example.cfg | 40 +
ext/dsent/configs/photonic-clos.cfg | 112 +
ext/dsent/configs/photonic-link.cfg | 75 +
ext/dsent/configs/router.cfg | 131 +
ext/dsent/libutil/Assert.h | 22 +
ext/dsent/libutil/Calculator.cc | 239 +++
ext/dsent/libutil/Calculator.h | 86 +
ext/dsent/libutil/Config.cc | 144 ++
ext/dsent/libutil/Config.h | 37 +
ext/dsent/libutil/Exception.cc | 17 +
ext/dsent/libutil/Exception.h | 29 +
ext/dsent/libutil/LibUtil.h | 37 +
ext/dsent/libutil/Log.cc | 86 +
ext/dsent/libutil/Log.h | 43 +
ext/dsent/libutil/Makefile | 43 +
ext/dsent/libutil/Map.h | 242 +++
ext/dsent/libutil/MathUtil.cc | 7 +
ext/dsent/libutil/MathUtil.h | 21 +
ext/dsent/libutil/OptionParser.cc | 177 ++
ext/dsent/libutil/OptionParser.h | 57 +
ext/dsent/libutil/String.cc | 347 +++++
ext/dsent/libutil/String.h | 218 +++
ext/dsent/main.cc | 10 +
ext/dsent/model/ElectricalModel.cc | 871 +++++++++++++
ext/dsent/model/ElectricalModel.h | 244 +++
ext/dsent/model/EventInfo.cc | 86 +
ext/dsent/model/EventInfo.h | 32 +
ext/dsent/model/Model.cc | 698 ++++++++++
ext/dsent/model/Model.h | 223 +++
ext/dsent/model/ModelGen.cc | 306 ++++
ext/dsent/model/ModelGen.h | 30 +
ext/dsent/model/OpticalModel.cc | 277 ++++
ext/dsent/model/OpticalModel.h | 143 ++
ext/dsent/model/PortInfo.cc | 35 +
ext/dsent/model/PortInfo.h | 37 +
ext/dsent/model/TransitionInfo.cc | 70 +
ext/dsent/model/TransitionInfo.h | 50 +
ext/dsent/model/electrical/BarrelShifter.cc | 241 +++
ext/dsent/model/electrical/BarrelShifter.h | 34 +
ext/dsent/model/electrical/BroadcastHTree.cc | 400 +++++
ext/dsent/model/electrical/BroadcastHTree.h | 54 +
ext/dsent/model/electrical/DFFRAM.cc | 321 ++++
ext/dsent/model/electrical/DFFRAM.h | 33 +
ext/dsent/model/electrical/Decoder.cc | 235 +++
ext/dsent/model/electrical/Decoder.h | 33 +
ext/dsent/model/electrical/DemuxTreeDeserializer.cc | 378 +++++
ext/dsent/model/electrical/DemuxTreeDeserializer.h | 33 +
ext/dsent/model/electrical/MatrixArbiter.cc | 434 ++++++
ext/dsent/model/electrical/MatrixArbiter.h | 33 +
ext/dsent/model/electrical/Multiplexer.cc | 347 +++++
ext/dsent/model/electrical/Multiplexer.h | 34 +
ext/dsent/model/electrical/MultiplexerCrossbar.cc | 214 +++
ext/dsent/model/electrical/MultiplexerCrossbar.h | 38 +
ext/dsent/model/electrical/MuxTreeSerializer.cc | 226 +++
ext/dsent/model/electrical/MuxTreeSerializer.h | 33 +
ext/dsent/model/electrical/OR.cc | 239 +++
ext/dsent/model/electrical/OR.h | 36 +
ext/dsent/model/electrical/RepeatedLink.cc | 305 ++++
ext/dsent/model/electrical/RepeatedLink.h | 44 +
ext/dsent/model/electrical/RippleAdder.cc | 106 +
ext/dsent/model/electrical/RippleAdder.h | 30 +
ext/dsent/model/electrical/SeparableAllocator.cc | 270 ++++
ext/dsent/model/electrical/SeparableAllocator.h | 33 +
ext/dsent/model/electrical/TestModel.cc | 218 +++
ext/dsent/model/electrical/TestModel.h | 32 +
ext/dsent/model/electrical/router/Router.cc | 536 ++++++++
ext/dsent/model/electrical/router/Router.h | 46 +
ext/dsent/model/electrical/router/RouterInputPort.cc | 201 +++
ext/dsent/model/electrical/router/RouterInputPort.h | 33 +
ext/dsent/model/electrical/router/RouterSwitchAllocator.cc | 199 ++
ext/dsent/model/electrical/router/RouterSwitchAllocator.h | 33 +
ext/dsent/model/network/ElectricalClos.cc | 489 +++++++
ext/dsent/model/network/ElectricalClos.h | 37 +
ext/dsent/model/network/ElectricalMesh.cc | 296 ++++
ext/dsent/model/network/ElectricalMesh.h | 37 +
ext/dsent/model/network/PhotonicClos.cc | 512 +++++++
ext/dsent/model/network/PhotonicClos.h | 37 +
ext/dsent/model/optical/GatedLaserSource.cc | 106 +
ext/dsent/model/optical/GatedLaserSource.h | 33 +
ext/dsent/model/optical/LaserSource.cc | 105 +
ext/dsent/model/optical/LaserSource.h | 33 +
ext/dsent/model/optical/OpticalLinkBackendRx.cc | 364 +++++
ext/dsent/model/optical/OpticalLinkBackendRx.h | 39 +
ext/dsent/model/optical/OpticalLinkBackendTx.cc | 355 +++++
ext/dsent/model/optical/OpticalLinkBackendTx.h | 39 +
ext/dsent/model/optical/OpticalTestModel.cc | 121 +
ext/dsent/model/optical/OpticalTestModel.h | 30 +
ext/dsent/model/optical/RingDetector.cc | 338 +++++
ext/dsent/model/optical/RingDetector.h | 54 +
ext/dsent/model/optical/RingFilter.cc | 77 +
ext/dsent/model/optical/RingFilter.h | 30 +
ext/dsent/model/optical/RingModulator.cc | 403 ++++++
ext/dsent/model/optical/RingModulator.h | 54 +
ext/dsent/model/optical/SWMRLink.cc | 309 ++++
ext/dsent/model/optical/SWMRLink.h | 38 +
ext/dsent/model/optical/SWSRLink.cc | 328 ++++
ext/dsent/model/optical/SWSRLink.h | 38 +
ext/dsent/model/optical/ThrottledLaserSource.cc | 137 ++
ext/dsent/model/optical/ThrottledLaserSource.h | 40 +
ext/dsent/model/optical_graph/OpticalDetector.cc | 32 +
ext/dsent/model/optical_graph/OpticalDetector.h | 45 +
ext/dsent/model/optical_graph/OpticalFilter.cc | 65 +
ext/dsent/model/optical_graph/OpticalFilter.h | 48 +
ext/dsent/model/optical_graph/OpticalGraph.cc | 216 +++
ext/dsent/model/optical_graph/OpticalGraph.h | 62 +
ext/dsent/model/optical_graph/OpticalLaser.cc | 31 +
ext/dsent/model/optical_graph/OpticalLaser.h | 32 +
ext/dsent/model/optical_graph/OpticalModulator.cc | 54 +
ext/dsent/model/optical_graph/OpticalModulator.h | 51 +
ext/dsent/model/optical_graph/OpticalNode.cc | 96 +
ext/dsent/model/optical_graph/OpticalNode.h | 92 +
ext/dsent/model/optical_graph/OpticalReceiver.h | 25 +
ext/dsent/model/optical_graph/OpticalTransmitter.h | 28 +
ext/dsent/model/optical_graph/OpticalWaveguide.cc | 20 +
ext/dsent/model/optical_graph/OpticalWaveguide.h | 27 +
ext/dsent/model/optical_graph/OpticalWavelength.cc | 129 +
ext/dsent/model/optical_graph/OpticalWavelength.h | 57 +
ext/dsent/model/std_cells/ADDF.cc | 671 ++++++++++
ext/dsent/model/std_cells/ADDF.h | 39 +
ext/dsent/model/std_cells/AND2.cc | 272 ++++
ext/dsent/model/std_cells/AND2.h | 32 +
ext/dsent/model/std_cells/BUF.cc | 216 +++
ext/dsent/model/std_cells/BUF.h | 33 +
ext/dsent/model/std_cells/CellMacros.cc | 477 +++++++
ext/dsent/model/std_cells/CellMacros.h | 57 +
ext/dsent/model/std_cells/DFFQ.cc | 536 ++++++++
ext/dsent/model/std_cells/DFFQ.h | 38 +
ext/dsent/model/std_cells/INV.cc | 219 +++
ext/dsent/model/std_cells/INV.h | 34 +
ext/dsent/model/std_cells/LATQ.cc | 380 +++++
ext/dsent/model/std_cells/LATQ.h | 34 +
ext/dsent/model/std_cells/MUX2.cc | 420 ++++++
ext/dsent/model/std_cells/MUX2.h | 34 +
ext/dsent/model/std_cells/NAND2.cc | 267 +++
ext/dsent/model/std_cells/NAND2.h | 33 +
ext/dsent/model/std_cells/NOR2.cc | 268 ++++
ext/dsent/model/std_cells/NOR2.h | 33 +
ext/dsent/model/std_cells/OR2.cc | 279 ++++
ext/dsent/model/std_cells/OR2.h | 33 +
ext/dsent/model/std_cells/StdCell.cc | 71 +
ext/dsent/model/std_cells/StdCell.h | 53 +
ext/dsent/model/std_cells/StdCellLib.cc | 180 ++
ext/dsent/model/std_cells/StdCellLib.h | 63 +
ext/dsent/model/std_cells/XOR2.cc | 345 +++++
ext/dsent/model/std_cells/XOR2.h | 34 +
ext/dsent/model/timing_graph/ElectricalDelay.cc | 55 +
ext/dsent/model/timing_graph/ElectricalDelay.h | 43 +
ext/dsent/model/timing_graph/ElectricalDriver.cc | 95 +
ext/dsent/model/timing_graph/ElectricalDriver.h | 57 +
ext/dsent/model/timing_graph/ElectricalDriverMultiplier.cc | 53 +
ext/dsent/model/timing_graph/ElectricalDriverMultiplier.h | 42 +
ext/dsent/model/timing_graph/ElectricalLoad.cc | 49 +
ext/dsent/model/timing_graph/ElectricalLoad.h | 43 +
ext/dsent/model/timing_graph/ElectricalNet.cc | 73 +
ext/dsent/model/timing_graph/ElectricalNet.h | 50 +
ext/dsent/model/timing_graph/ElectricalTimingNode.cc | 174 ++
ext/dsent/model/timing_graph/ElectricalTimingNode.h | 104 +
ext/dsent/model/timing_graph/ElectricalTimingOptimizer.cc | 73 +
ext/dsent/model/timing_graph/ElectricalTimingOptimizer.h | 30 +
ext/dsent/model/timing_graph/ElectricalTimingTree.cc | 247 +++
ext/dsent/model/timing_graph/ElectricalTimingTree.h | 73 +
ext/dsent/tech/TechModel.cc | 320 ++++
ext/dsent/tech/TechModel.h | 71 +
ext/dsent/tech/tech_models/Bulk22LVT.model | 179 ++
ext/dsent/tech/tech_models/Bulk32LVT.model | 168 ++
ext/dsent/tech/tech_models/Bulk45LVT.model | 168 ++
ext/dsent/tech/tech_models/Photonics.model | 89 +
ext/dsent/tech/tech_models/TG11LVT.model | 181 ++
ext/dsent/util/CommonType.h | 36 +
ext/dsent/util/Config.cc | 105 +
ext/dsent/util/Config.h | 40 +
ext/dsent/util/Constants.cc | 20 +
ext/dsent/util/Constants.h | 21 +
ext/dsent/util/Result.cc | 249 +++
ext/dsent/util/Result.h | 105 +
183 files changed, 25714 insertions(+), 0 deletions(-)
diffs (truncated from 26448 to 300 lines):
diff -r bb00790bc85c -r a465576671d4 ext/dsent/DSENT.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ext/dsent/DSENT.cc Sat Oct 11 15:02:23 2014 -0500
@@ -0,0 +1,423 @@
+#include "DSENT.h"
+
+#include <cstdlib>
+#include <iostream>
+
+namespace DSENT
+{
+ Model* DSENT::ms_model_ = NULL;
+ bool DSENT::ms_is_verbose_ = false;
+
+ void DSENT::run(int argc_, char** argv_)
+ {
+ // Initialize DSENT framework (setup log file, config file, ...)
+ initialize(argc_, argv_);
+
+ // Build the specified model in the config file
+ buildModel();
+
+ // Process the specified queries
+ processQuery();
+ // Process the specified evaluation
+ processEvaluate();
+
+ // Finalize DSENT framework (close log file, ...)
+ finalize();
+ return;
+ }
+
+ void DSENT::setRuntimeOptions(OptionParser* option_parser_)
+ {
+ option_parser_->addOption("-cfg", "ConfigFilename", true, "filename",
false, "",
+ "Specify the config filename.");
+
+ option_parser_->addOption("-available_models", "IsListModels", false,
"", true, "false",
+ "List available DSENT models.");
+
+ option_parser_->addOption("-log", "LogFilename", true, "filename",
true, "./dsent.log",
+ "Specify the log filename.");
+
+ option_parser_->addOption("-overwrite", "OverwriteString", true,
"options", true, "",
+ "Overwrite dynamically the options set in the config file.
Options are separated by a comma (;).");
+
+ option_parser_->addOption("-overwrite_tech", "OverwriteTechString",
true, "options", true, "",
+ "Overwrite dynamically the options set in the technology file.
Options are separated by a comma (;).");
+
+ option_parser_->addOption("-print_config", "IsPrintConfig", false, "",
true, "false",
+ "Print the config used at DSENT runtime.");
+
+ option_parser_->addOption("-query", "QueryString", true, "query
string", true, "",
+ "Specify the list of items to query. This command is the same
as owerwriting the 'QueryString'.");
+
+ option_parser_->addOption("-eval", "EvaluateString", true, "evaluate
string", true, "",
+ "Specify the list of statements to evaluate. This command is
the same as owerwriting the 'EvaluateString'.");
+
+ option_parser_->addOption("-verbose", "IsVerbose", false, "", true,
"false",
+ "Enable verbose mode which prints out more detailed
messages.");
+ return;
+ }
+
+ void DSENT::initialize(int argc_, char** argv_)
+ {
+ OptionParser* option_parser = new OptionParser();
+
+ // Init the option parser and setup available options
+ setRuntimeOptions(option_parser);
+
+ // Parse the options
+ option_parser->parseArguments(argc_, argv_);
+
+ // If -available_models is specified, print out a list of available
+ // models and exit DSENT.
+ if(option_parser->get("IsListModels").toBool())
+ {
+ ModelGen::printAvailableModels();
+ exit(0);
+ }
+
+ // Init the log file
+ Log::allocate(option_parser->get("LogFilename"));
+
+ // Init the config file
+ Config::allocate(option_parser->get("ConfigFilename"));
+ Config* dsent_config = Config::getSingleton();
+
+ // Overwrite the existing options
+ dsent_config->readString(option_parser->get("OverwriteString"));
+
+ // Overwrite the technology file
+
dsent_config->constructTechModel(option_parser->get("OverwriteTechString"));
+
+ ms_is_verbose_ = option_parser->get("IsVerbose").toBool();
+
+ // Overwrite the query string if it is specified from command line
+ if(option_parser->get("QueryString").size() != 0)
+ {
+ dsent_config->set("QueryString",
option_parser->get("QueryString"));
+ }
+ // Overwrite the evaluation string if it is specified from command line
+ if(option_parser->get("EvaluateString").size() != 0)
+ {
+ dsent_config->set("EvaluateString",
option_parser->get("EvaluateString"));
+ }
+
+ // Print the config used for this run
+ if(option_parser->get("IsPrintConfig").toBool())
+ {
+ if(ms_is_verbose_)
+ {
+ cout << "Configuration:" << endl;
+ cout << "==============" << endl;
+ }
+ cout << *dsent_config;
+
+ if(ms_is_verbose_)
+ {
+ cout << "==============" << endl;
+ }
+ }
+
+ delete option_parser;
+ return;
+ }
+
+ void DSENT::buildModel()
+ {
+ Config* dsent_config = Config::getSingleton();
+
+ // Create the model specified
+ const String& model_name = dsent_config->get("ModelName");
+ ms_model_ = ModelGen::createModel(model_name, model_name,
dsent_config->getTechModel());
+
+ // Construct the model
+ // Read all parameters the model requires
+ const vector<String>* parameter_names = ms_model_->getParameterNames();
+ // For all parameters, grab values from the config file
+ for(vector<String>::const_iterator it = parameter_names->begin(); it
!= parameter_names->end(); ++it)
+ {
+ const String& parameter_name = *it;
+ // If it exists in the config file, set the parameter
+ if(dsent_config->keyExist(parameter_name))
+ {
+ ms_model_->setParameter(parameter_name,
dsent_config->get(parameter_name));
+ }
+ }
+ ms_model_->construct();
+
+ // Update the model
+ // Read all properties the model requires
+ const vector<String>* property_names = ms_model_->getPropertyNames();
+ // For all properties, grab values from the config file
+ for(vector<String>::const_iterator it = property_names->begin(); it !=
property_names->end(); ++it)
+ {
+ const String& property_name = *it;
+ // If it exists in the config file, set the parameter
+ if(dsent_config->keyExist(property_name))
+ {
+ ms_model_->setProperty(property_name,
dsent_config->get(property_name));
+ }
+ }
+ ms_model_->update();
+
+ // Evaluate the model
+ // Perform timing optimization if needed
+ if(dsent_config->getIfKeyExist("IsPerformTimingOptimization",
"false").toBool())
+ {
+ performTimingOpt();
+ }
+ ms_model_->evaluate();
+
+ // Report timing if needed
+ if(dsent_config->getIfKeyExist("IsReportTiming", "false").toBool())
+ {
+ reportTiming();
+ }
+
+ return;
+ }
+
+ void DSENT::processQuery()
+ {
+ Config* dsent_config = Config::getSingleton();
+ vector<String> queries = dsent_config->get("QueryString").split("
;\r\n");
+
+ if(ms_is_verbose_)
+ {
+ cout << "Query results:" << endl;
+ cout << "==============" << endl;
+ }
+
+ for(unsigned int i = 0; i < queries.size(); ++i)
+ {
+ const String& curr_query = queries[i];
+
+ if(ms_is_verbose_)
+ {
+ String str = "Process query: '" + curr_query + "'";
+ cout << str << endl;
+ cout << String(str.size(), '-') << endl;
+ }
+
+ processQuery(curr_query, true);
+
+ if(ms_is_verbose_)
+ {
+ cout << endl;
+ }
+ }
+ if(ms_is_verbose_)
+ {
+ cout << "==============" << endl;
+ }
+ return;
+ }
+
+ const void* DSENT::processQuery(const String& query_str_, bool is_print_)
+ {
+ vector<String> type_split =
query_str_.splitByString(Model::TYPE_SEPARATOR);
+ ASSERT((type_split.size() == 2), "[Error] Invalid query format: " +
query_str_);
+ String query_type = type_split[0];
+
+ vector<String> detail_split =
type_split[1].splitByString(Model::DETAIL_SEPARATOR);
+ ASSERT((detail_split.size() == 2), "[Error] Invalid query format: " +
query_str_);
+ String query_detail = detail_split[1];
+
+ vector<String> subfield_split =
detail_split[0].splitByString(Model::SUBFIELD_SEPARATOR);
+ ASSERT(((subfield_split.size() == 2) || (subfield_split.size() == 1)),
"[Error] Invalid query format: " + query_str_);
+ String query_hier = subfield_split[0];
+ String query_subfield = "";
+ if(subfield_split.size() == 2)
+ {
+ query_subfield = subfield_split[1];
+ }
+
+ const void* query_result = ms_model_->parseQuery(query_type,
query_hier, query_subfield);
+ if(query_type == "Property")
+ {
+ const PropertyMap* property = (const PropertyMap*)query_result;
+ if(is_print_)
+ {
+ cout << *property;
+ }
+ }
+ else if(query_type == "Parameter")
+ {
+ const ParameterMap* parameter = (const ParameterMap*)query_result;
+ if(is_print_)
+ {
+ cout << *parameter;
+ }
+ }
+ else if(query_type.contain("Hier"))
+ {
+ const Model* model = (const Model*)query_result;
+ if(is_print_)
+ {
+ model->printHierarchy(query_type, query_subfield, "",
query_detail, cout);
+ }
+ }
+ else
+ {
+ const Result* result = (const Result*)query_result;
+ if(is_print_)
+ {
+ result->print(query_type + Model::TYPE_SEPARATOR + query_hier
+
+ Model::SUBFIELD_SEPARATOR + query_subfield,
query_detail, cout);
+ }
+ }
+ return query_result;
+ }
+
+ void DSENT::finalize()
+ {
+ // Release the constructed model
+ delete ms_model_;
+ ms_model_ = NULL;
+
+ // Release the config file
+ Config::release();
+
+ // Release the log file
+ Log::release();
+
+ return;
+ }
+
+ void DSENT::performTimingOpt()
+ {
+ Config* dsent_config = Config::getSingleton();
+
+ // Get the frequency it is optimizing to
+ double freq = dsent_config->get("Frequency").toDouble();
+
+ // Get all the starting net names
+ const vector<String>& start_net_names =
dsent_config->get("TimingOptimization->StartNetNames").split("[,]");
+
+ ASSERT((start_net_names.size() > 0), "[Error] Expecting net names in
TimingOptimization->StartNetNames");
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev