changeset bc1a3b7ab5ef in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=bc1a3b7ab5ef
description:
        ext: dsent: adds a Python interface, drops C++ one
        This patch extensively modifies DSENT so that it can be accessed using 
Python.
        To access the Python interface, DSENT needs to compiled as a shared 
library.
        For this purpose a CMakeLists.txt file has been added.  Some of the 
code that
        is not required is being removed.

diffstat:

 ext/dsent/CMakeLists.txt                                   |   46 +
 ext/dsent/DSENT.cc                                         |  534 +++++-------
 ext/dsent/DSENT.h                                          |   71 +-
 ext/dsent/Makefile                                         |   55 -
 ext/dsent/configs/electrical-link.cfg                      |    2 +-
 ext/dsent/configs/router.cfg                               |    2 +-
 ext/dsent/interface.cc                                     |  213 +++++
 ext/dsent/libutil/Assert.h                                 |   21 +
 ext/dsent/libutil/Calculator.cc                            |   78 +-
 ext/dsent/libutil/Calculator.h                             |   51 +-
 ext/dsent/libutil/Config.cc                                |   96 +-
 ext/dsent/libutil/Config.h                                 |   50 +-
 ext/dsent/libutil/Exception.cc                             |   21 +
 ext/dsent/libutil/Exception.h                              |   21 +
 ext/dsent/libutil/LibUtil.h                                |   21 +
 ext/dsent/libutil/Log.cc                                   |   21 +
 ext/dsent/libutil/Log.h                                    |   21 +
 ext/dsent/libutil/Makefile                                 |   43 -
 ext/dsent/libutil/Map.h                                    |   21 +
 ext/dsent/libutil/MathUtil.cc                              |   21 +
 ext/dsent/libutil/MathUtil.h                               |   21 +
 ext/dsent/libutil/OptionParser.cc                          |  177 ----
 ext/dsent/libutil/OptionParser.h                           |   57 -
 ext/dsent/libutil/String.cc                                |   21 +
 ext/dsent/libutil/String.h                                 |   21 +
 ext/dsent/main.cc                                          |   10 -
 ext/dsent/model/ElectricalModel.cc                         |   21 +
 ext/dsent/model/ElectricalModel.h                          |   21 +
 ext/dsent/model/EventInfo.cc                               |   21 +
 ext/dsent/model/EventInfo.h                                |   21 +
 ext/dsent/model/Model.cc                                   |   21 +
 ext/dsent/model/Model.h                                    |   21 +
 ext/dsent/model/ModelGen.cc                                |   21 +
 ext/dsent/model/ModelGen.h                                 |   21 +
 ext/dsent/model/OpticalModel.cc                            |   21 +
 ext/dsent/model/OpticalModel.h                             |   21 +
 ext/dsent/model/PortInfo.cc                                |   21 +
 ext/dsent/model/PortInfo.h                                 |   21 +
 ext/dsent/model/TransitionInfo.cc                          |   21 +
 ext/dsent/model/TransitionInfo.h                           |   21 +
 ext/dsent/model/electrical/BarrelShifter.cc                |   21 +
 ext/dsent/model/electrical/BarrelShifter.h                 |   21 +
 ext/dsent/model/electrical/BroadcastHTree.cc               |   21 +
 ext/dsent/model/electrical/BroadcastHTree.h                |   21 +
 ext/dsent/model/electrical/DFFRAM.cc                       |   21 +
 ext/dsent/model/electrical/DFFRAM.h                        |   21 +
 ext/dsent/model/electrical/Decoder.cc                      |   21 +
 ext/dsent/model/electrical/Decoder.h                       |   21 +
 ext/dsent/model/electrical/DemuxTreeDeserializer.cc        |   21 +
 ext/dsent/model/electrical/DemuxTreeDeserializer.h         |   21 +
 ext/dsent/model/electrical/MatrixArbiter.cc                |   21 +
 ext/dsent/model/electrical/MatrixArbiter.h                 |   21 +
 ext/dsent/model/electrical/Multiplexer.cc                  |   21 +
 ext/dsent/model/electrical/Multiplexer.h                   |   21 +
 ext/dsent/model/electrical/MultiplexerCrossbar.cc          |   21 +
 ext/dsent/model/electrical/MultiplexerCrossbar.h           |   21 +
 ext/dsent/model/electrical/MuxTreeSerializer.cc            |   21 +
 ext/dsent/model/electrical/MuxTreeSerializer.h             |   21 +
 ext/dsent/model/electrical/OR.cc                           |   21 +
 ext/dsent/model/electrical/OR.h                            |   21 +
 ext/dsent/model/electrical/RepeatedLink.cc                 |   21 +
 ext/dsent/model/electrical/RepeatedLink.h                  |   21 +
 ext/dsent/model/electrical/RippleAdder.cc                  |   21 +
 ext/dsent/model/electrical/RippleAdder.h                   |   21 +
 ext/dsent/model/electrical/SeparableAllocator.cc           |   21 +
 ext/dsent/model/electrical/SeparableAllocator.h            |   21 +
 ext/dsent/model/electrical/TestModel.cc                    |   21 +
 ext/dsent/model/electrical/TestModel.h                     |   21 +
 ext/dsent/model/electrical/router/Router.cc                |   21 +
 ext/dsent/model/electrical/router/Router.h                 |   21 +
 ext/dsent/model/electrical/router/RouterInputPort.cc       |   21 +
 ext/dsent/model/electrical/router/RouterInputPort.h        |   21 +
 ext/dsent/model/electrical/router/RouterSwitchAllocator.cc |   21 +
 ext/dsent/model/electrical/router/RouterSwitchAllocator.h  |   21 +
 ext/dsent/model/network/ElectricalClos.cc                  |   21 +
 ext/dsent/model/network/ElectricalClos.h                   |   21 +
 ext/dsent/model/network/ElectricalMesh.cc                  |   21 +
 ext/dsent/model/network/ElectricalMesh.h                   |   21 +
 ext/dsent/model/network/PhotonicClos.cc                    |   21 +
 ext/dsent/model/network/PhotonicClos.h                     |   21 +
 ext/dsent/model/optical/GatedLaserSource.cc                |   21 +
 ext/dsent/model/optical/GatedLaserSource.h                 |   21 +
 ext/dsent/model/optical/LaserSource.cc                     |   21 +
 ext/dsent/model/optical/LaserSource.h                      |   21 +
 ext/dsent/model/optical/OpticalLinkBackendRx.cc            |   21 +
 ext/dsent/model/optical/OpticalLinkBackendRx.h             |   21 +
 ext/dsent/model/optical/OpticalLinkBackendTx.cc            |   21 +
 ext/dsent/model/optical/OpticalLinkBackendTx.h             |   21 +
 ext/dsent/model/optical/OpticalTestModel.cc                |   21 +
 ext/dsent/model/optical/OpticalTestModel.h                 |   21 +
 ext/dsent/model/optical/RingDetector.cc                    |   21 +
 ext/dsent/model/optical/RingDetector.h                     |   21 +
 ext/dsent/model/optical/RingFilter.cc                      |   21 +
 ext/dsent/model/optical/RingFilter.h                       |   21 +
 ext/dsent/model/optical/RingModulator.cc                   |   21 +
 ext/dsent/model/optical/RingModulator.h                    |   21 +
 ext/dsent/model/optical/SWMRLink.cc                        |   21 +
 ext/dsent/model/optical/SWMRLink.h                         |   21 +
 ext/dsent/model/optical/SWSRLink.cc                        |   21 +
 ext/dsent/model/optical/SWSRLink.h                         |   21 +
 ext/dsent/model/optical/ThrottledLaserSource.cc            |   21 +
 ext/dsent/model/optical/ThrottledLaserSource.h             |   21 +
 ext/dsent/model/optical_graph/OpticalDetector.cc           |   21 +
 ext/dsent/model/optical_graph/OpticalDetector.h            |   21 +
 ext/dsent/model/optical_graph/OpticalFilter.cc             |   21 +
 ext/dsent/model/optical_graph/OpticalFilter.h              |   21 +
 ext/dsent/model/optical_graph/OpticalGraph.cc              |   21 +
 ext/dsent/model/optical_graph/OpticalGraph.h               |   21 +
 ext/dsent/model/optical_graph/OpticalLaser.cc              |   21 +
 ext/dsent/model/optical_graph/OpticalLaser.h               |   21 +
 ext/dsent/model/optical_graph/OpticalModulator.cc          |   21 +
 ext/dsent/model/optical_graph/OpticalModulator.h           |   21 +
 ext/dsent/model/optical_graph/OpticalNode.cc               |   21 +
 ext/dsent/model/optical_graph/OpticalNode.h                |   21 +
 ext/dsent/model/optical_graph/OpticalReceiver.h            |   21 +
 ext/dsent/model/optical_graph/OpticalTransmitter.h         |   21 +
 ext/dsent/model/optical_graph/OpticalWaveguide.cc          |   21 +
 ext/dsent/model/optical_graph/OpticalWaveguide.h           |   21 +
 ext/dsent/model/optical_graph/OpticalWavelength.cc         |   21 +
 ext/dsent/model/optical_graph/OpticalWavelength.h          |   21 +
 ext/dsent/model/std_cells/ADDF.cc                          |   21 +
 ext/dsent/model/std_cells/ADDF.h                           |   21 +
 ext/dsent/model/std_cells/AND2.cc                          |   21 +
 ext/dsent/model/std_cells/AND2.h                           |   21 +
 ext/dsent/model/std_cells/BUF.cc                           |   21 +
 ext/dsent/model/std_cells/BUF.h                            |   21 +
 ext/dsent/model/std_cells/CellMacros.cc                    |   21 +
 ext/dsent/model/std_cells/CellMacros.h                     |   21 +
 ext/dsent/model/std_cells/DFFQ.cc                          |   21 +
 ext/dsent/model/std_cells/DFFQ.h                           |   21 +
 ext/dsent/model/std_cells/INV.cc                           |   21 +
 ext/dsent/model/std_cells/INV.h                            |   21 +
 ext/dsent/model/std_cells/LATQ.cc                          |   21 +
 ext/dsent/model/std_cells/LATQ.h                           |   21 +
 ext/dsent/model/std_cells/MUX2.cc                          |   21 +
 ext/dsent/model/std_cells/MUX2.h                           |   21 +
 ext/dsent/model/std_cells/NAND2.cc                         |   21 +
 ext/dsent/model/std_cells/NAND2.h                          |   21 +
 ext/dsent/model/std_cells/NOR2.cc                          |   21 +
 ext/dsent/model/std_cells/NOR2.h                           |   21 +
 ext/dsent/model/std_cells/OR2.cc                           |   21 +
 ext/dsent/model/std_cells/OR2.h                            |   21 +
 ext/dsent/model/std_cells/StdCell.cc                       |   21 +
 ext/dsent/model/std_cells/StdCell.h                        |   21 +
 ext/dsent/model/std_cells/StdCellLib.cc                    |   21 +
 ext/dsent/model/std_cells/StdCellLib.h                     |   21 +
 ext/dsent/model/std_cells/XOR2.cc                          |   21 +
 ext/dsent/model/std_cells/XOR2.h                           |   21 +
 ext/dsent/model/timing_graph/ElectricalDelay.cc            |   21 +
 ext/dsent/model/timing_graph/ElectricalDelay.h             |   21 +
 ext/dsent/model/timing_graph/ElectricalDriver.cc           |   21 +
 ext/dsent/model/timing_graph/ElectricalDriver.h            |   21 +
 ext/dsent/model/timing_graph/ElectricalDriverMultiplier.cc |   21 +
 ext/dsent/model/timing_graph/ElectricalDriverMultiplier.h  |   21 +
 ext/dsent/model/timing_graph/ElectricalLoad.cc             |   21 +
 ext/dsent/model/timing_graph/ElectricalLoad.h              |   21 +
 ext/dsent/model/timing_graph/ElectricalNet.cc              |   21 +
 ext/dsent/model/timing_graph/ElectricalNet.h               |   21 +
 ext/dsent/model/timing_graph/ElectricalTimingNode.cc       |   21 +
 ext/dsent/model/timing_graph/ElectricalTimingNode.h        |   21 +
 ext/dsent/model/timing_graph/ElectricalTimingOptimizer.cc  |   21 +
 ext/dsent/model/timing_graph/ElectricalTimingOptimizer.h   |   21 +
 ext/dsent/model/timing_graph/ElectricalTimingTree.cc       |   21 +
 ext/dsent/model/timing_graph/ElectricalTimingTree.h        |   21 +
 ext/dsent/tech/TechModel.cc                                |   44 +-
 ext/dsent/tech/TechModel.h                                 |   29 +-
 ext/dsent/tech/tech_models/Bulk22LVT.model                 |   20 +
 ext/dsent/tech/tech_models/Bulk32LVT.model                 |   20 +
 ext/dsent/tech/tech_models/Bulk45LVT.model                 |   20 +
 ext/dsent/tech/tech_models/Photonics.model                 |   20 +
 ext/dsent/tech/tech_models/TG11LVT.model                   |   20 +
 ext/dsent/util/CommonType.h                                |   21 +
 ext/dsent/util/Config.cc                                   |  105 --
 ext/dsent/util/Config.h                                    |   40 -
 ext/dsent/util/Constants.cc                                |   21 +
 ext/dsent/util/Constants.h                                 |   21 +
 ext/dsent/util/Result.cc                                   |   21 +
 ext/dsent/util/Result.h                                    |   21 +
 178 files changed, 4082 insertions(+), 955 deletions(-)

diffs (truncated from 6601 to 300 lines):

diff -r a465576671d4 -r bc1a3b7ab5ef ext/dsent/CMakeLists.txt
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/ext/dsent/CMakeLists.txt  Sat Oct 11 16:16:00 2014 -0500
@@ -0,0 +1,46 @@
+# Copyright (c) 2014 Mark D. Hill and David A. Wood
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cmake_minimum_required (VERSION 2.6)
+
+project (DSENT)
+# find out all the file that need to be compiled
+file(GLOB_RECURSE SRCS  "*.h" "*.cc")
+
+# add the library
+add_library(dsent MODULE ${SRCS})
+
+SET(PYTHON_CONFIG "python-config")
+
+# add the binary tree to the search path for include files
+include_directories("${CMAKE_SOURCE_DIR}" "`${PYTHON_CONFIG} --includes`")
+EXEC_PROGRAM(${PYTHON_CONFIG} ARGS --cflags OUTPUT_VARIABLE PYTHON_CFLAGS)
+EXEC_PROGRAM(${PYTHON_CONFIG} ARGS --ldflags OUTPUT_VARIABLE PYTHON_LFLAGS)
+
+set_target_properties(dsent PROPERTIES
+        PREFIX ""
+        COMPILE_FLAGS "${PYTHON_CFLAGS} -std=c++11"
+        LINK_FLAGS "${PYTHON_LFLAGS}")
diff -r a465576671d4 -r bc1a3b7ab5ef ext/dsent/DSENT.cc
--- a/ext/dsent/DSENT.cc        Sat Oct 11 15:02:23 2014 -0500
+++ b/ext/dsent/DSENT.cc        Sat Oct 11 16:16:00 2014 -0500
@@ -1,237 +1,209 @@
-#include "DSENT.h"
+/* Copyright (c) 2012 Massachusetts Institute of Technology
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
 
 #include <cstdlib>
 #include <iostream>
 
+#include "DSENT.h"
+#include "model/std_cells/StdCellLib.h"
+
+using namespace std;
+
 namespace DSENT
 {
-    Model* DSENT::ms_model_ = NULL;
-    bool DSENT::ms_is_verbose_ = false;
+    static void performTimingOpt(const map<String, String> &params,
+                                 Model *ms_model)
+    {
+        // Get the frequency it is optimizing to
+        double freq = params.at("Frequency").toDouble();
 
-    void DSENT::run(int argc_, char** argv_)
-    {
-        // Initialize DSENT framework (setup log file, config file, ...)
-        initialize(argc_, argv_);
+        // Get all the starting net names
+        const vector<String>& start_net_names =
+            params.at("TimingOptimization->StartNetNames").split("[,]");
 
-        // Build the specified model in the config file
-        buildModel();
+        ASSERT((start_net_names.size() > 0),
+               "[Error] Expecting net names in 
TimingOptimization->StartNetNames");
 
-        // Process the specified queries
-        processQuery();
-        // Process the specified evaluation
-        processEvaluate();
+        if(start_net_names[0] == "*")
+        {
+            // Optimize from all input ports
+            ElectricalModel* electrical_model = (ElectricalModel*)ms_model;
 
-        // Finalize DSENT framework (close log file, ...)
-        finalize();
-        return;
+            ElectricalTimingOptimizer timing_optimizer(
+                    "Optimizer", electrical_model->getTechModel());
+            timing_optimizer.setModel(electrical_model);
+            timing_optimizer.construct();
+            timing_optimizer.update();
+
+            ElectricalTimingTree timing_tree(
+                    timing_optimizer.getInstanceName(), &timing_optimizer);
+
+            const Map<PortInfo*>* input_ports = timing_optimizer.getInputs();
+            Map<PortInfo*>::ConstIterator it_begin = input_ports->begin();
+            Map<PortInfo*>::ConstIterator it_end = input_ports->end();
+            Map<PortInfo*>::ConstIterator it;
+            for(it = it_begin; it != it_end; ++it)
+            {
+                const String& net_name = it->first;
+                Log::printLine("Optimizing net: " + net_name);
+                timing_tree.performTimingOpt(
+                        timing_optimizer.getNet(net_name, makeNetIndex(0)), 
1.0 / freq);
+            }
+
+            // Loop the second times 
+            for(it = it_begin; it != it_end; ++it)
+            {
+                const String& net_name = it->first;
+                Log::printLine("Optimizing net: " + net_name);
+            }
+        }
+        else
+        {
+            // TODO : parse the net name so that we could do hierarchical 
optimization
+            // Currently we can only optimize timing at the top level
+            ElectricalModel* electrical_model = (ElectricalModel*)ms_model;
+            ElectricalTimingTree timing_tree(
+                    electrical_model->getInstanceName(), electrical_model);
+
+            for(unsigned int i = 0; i < start_net_names.size(); ++i)
+            {
+                const String& net_name = start_net_names[i];
+                timing_tree.performTimingOpt(
+                        electrical_model->getNet(net_name), 1.0 / freq);
+            }
+        }
     }
 
-    void DSENT::setRuntimeOptions(OptionParser* option_parser_)
+    static void reportTiming(const map<String, String> &params, Model 
*ms_model)
     {
-        option_parser_->addOption("-cfg", "ConfigFilename", true, "filename", 
false, "",
-                "Specify the config filename.");
+        // Get all the starting net names
+        const vector<String>& start_net_names =
+            params.at("ReportTiming->StartNetNames").split("[,]");
 
-        option_parser_->addOption("-available_models", "IsListModels", false, 
"", true, "false",
-                "List available DSENT models.");
+        ElectricalModel* electrical_model = (ElectricalModel*)ms_model;
+        ElectricalTimingTree timing_tree(
+                electrical_model->getInstanceName(), electrical_model);
 
-        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;
+        cout << "Report timing:" << endl;
+        cout << "==============" << endl;
+        for(unsigned int i = 0; i < start_net_names.size(); ++i)
+        {
+            const String& net_name = start_net_names[i];
+            double timing = 
timing_tree.performCritPathExtract(electrical_model->getNet(net_name));
+            cout << net_name << " = " << timing << endl;
+        }
+        cout << "==============" << endl;
     }
 
-    void DSENT::initialize(int argc_, char** argv_)
+    static Model *buildModel(const map<String, String> &params,
+                             TechModel *tech_model)
     {
-        OptionParser* option_parser = new OptionParser();
+        // Create the model specified
+        const String& model_name = params.at("ModelName");
+        Model *ms_model = ModelGen::createModel(model_name, model_name,
+                                                tech_model);
 
-        // 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())
+        // 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)
         {
-            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_)
+            const String& parameter_name = *it;
+            // If it exists in the config file, set the parameter
+            if(params.count(parameter_name) > 0)
             {
-                cout << "Configuration:" << endl;
-                cout << "==============" << endl;
-            }
-            cout << *dsent_config;
-
-            if(ms_is_verbose_)
-            {
-                cout << "==============" << endl;
+                ms_model->setParameter(parameter_name,
+                                       params.at(parameter_name));
             }
         }
 
-        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());
-
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to