summaryrefslogtreecommitdiff
path: root/ext/dsent/util
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2014-10-11 16:16:00 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2014-10-11 16:16:00 -0500
commitc1aecc05e6cad977423a15905f6bd4f5f33b53c8 (patch)
treeb013259fe0a6ec5e4fca8c47f757b50e92871f4d /ext/dsent/util
parente8ed7b1d1b5bef31e9874f679a5797c2e00d06f1 (diff)
downloadgem5-c1aecc05e6cad977423a15905f6bd4f5f33b53c8.tar.xz
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 (limited to 'ext/dsent/util')
-rw-r--r--ext/dsent/util/CommonType.h21
-rw-r--r--ext/dsent/util/Config.cc105
-rw-r--r--ext/dsent/util/Config.h40
-rw-r--r--ext/dsent/util/Constants.cc21
-rw-r--r--ext/dsent/util/Constants.h21
-rw-r--r--ext/dsent/util/Result.cc21
-rw-r--r--ext/dsent/util/Result.h21
7 files changed, 105 insertions, 145 deletions
diff --git a/ext/dsent/util/CommonType.h b/ext/dsent/util/CommonType.h
index e8c9705bb..543cca866 100644
--- a/ext/dsent/util/CommonType.h
+++ b/ext/dsent/util/CommonType.h
@@ -1,3 +1,24 @@
+/* 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.
+ */
+
#ifndef __DSENT_UTIL_COMMON_TYPE_H__
#define __DSENT_UTIL_COMMON_TYPE_H__
diff --git a/ext/dsent/util/Config.cc b/ext/dsent/util/Config.cc
deleted file mode 100644
index a12a30070..000000000
--- a/ext/dsent/util/Config.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "util/Config.h"
-
-#include "model/std_cells/StdCellLib.h"
-
-namespace DSENT
-{
-
- Config* Config::ms_singleton_ = NULL;
-
- void Config::allocate(const String& cfg_file_name_)
- {
- Log::printLine("Config::allocate");
-
- // Allocate static Config instance
- ASSERT(!ms_singleton_, "Config singleton is allocated");
- ms_singleton_ = new Config();
- ms_singleton_->readFile(cfg_file_name_);
-
- Log::printLine("Config::allocate - End");
- return;
- }
-
- void Config::release()
- {
- Log::printLine("Config::release");
-
- // Release static Config instance
- ASSERT(ms_singleton_, "Config singleton is not allocated");
- delete ms_singleton_;
- ms_singleton_ = NULL;
-
- Log::printLine("Config::release - End");
- return;
- }
-
- Config* Config::getSingleton()
- {
- ASSERT(ms_singleton_, "Config singleton is not allocated");
- return ms_singleton_;
- }
-
- Config::Config()
- : m_tech_model_(NULL)
- {}
-
- Config::~Config()
- {
- delete m_tech_model_;
- }
-
- void Config::setTechModel(const TechModel* tech_model_)
- {
- ASSERT((tech_model_ != NULL), "tech_model_ is null");
-
- m_tech_model_ = tech_model_;
- return;
- }
-
- const TechModel* Config::getTechModel() const
- {
- ASSERT((m_tech_model_ != NULL), "m_tech_model_ is null");
-
- return m_tech_model_;
- }
-
- void Config::readFile(const String& file_name_)
- {
- Log::printLine("Config::readFile");
-
- LibUtil::Config::readFile(file_name_);
-
- Log::printLine("Config::readFile - End");
- return;
- }
-
- void Config::constructTechModel(const String& overwrite_str_)
- {
- Log::printLine("Config::constructTechModel");
-
- // Allocate static TechModel instance
- const String& electrical_tech_model_filename = get("ElectricalTechModelFilename");
-
- TechModel* tech_model = new TechModel();
- tech_model->readFile(electrical_tech_model_filename);
- if(keyExist("PhotonicTechModelFilename"))
- {
- const String& photonic_tech_model_filename = get("PhotonicTechModelFilename");
- tech_model->readFile(photonic_tech_model_filename);
- }
-
- // Overwrite the settings at runtime
- tech_model->readString(overwrite_str_);
-
- // Allocate static StdCellLib instance
- StdCellLib* std_cell_lib = new StdCellLib(tech_model);
-
- // Set the StdCellLib pointer in static TechModel instance
- tech_model->setStdCellLib(std_cell_lib);
-
- m_tech_model_ = tech_model;
- Log::printLine("Config::constructTechModel - End");
- return;
- }
-} // namespace DSENT
-
diff --git a/ext/dsent/util/Config.h b/ext/dsent/util/Config.h
deleted file mode 100644
index 910f5ca8c..000000000
--- a/ext/dsent/util/Config.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef __DSENT_UTIL_CONFIG_H__
-#define __DSENT_UTIL_CONFIG_H__
-
-#include "util/CommonType.h"
-
-namespace DSENT
-{
- class TechModel;
- class StdCellLib;
-
- class Config : public LibUtil::Config
- {
- public:
- static void allocate(const String& cfg_file_name_);
- static void release();
- static Config* getSingleton();
-
- protected:
- static Config* ms_singleton_;
-
- public:
- Config();
- ~Config();
-
- public:
- void setTechModel(const TechModel* tech_model_);
- const TechModel* getTechModel() const;
-
- void constructTechModel(const String& overwrite_str_);
-
- protected:
- void readFile(const String& file_name_);
-
- protected:
- const TechModel* m_tech_model_;
- }; // class Config
-} // namespace DSENT
-
-#endif // __DSENT_UTIL_CONFIG_H__
-
diff --git a/ext/dsent/util/Constants.cc b/ext/dsent/util/Constants.cc
index 6af0a275a..d01ca4faf 100644
--- a/ext/dsent/util/Constants.cc
+++ b/ext/dsent/util/Constants.cc
@@ -1,3 +1,24 @@
+/* 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 "util/Constants.h"
diff --git a/ext/dsent/util/Constants.h b/ext/dsent/util/Constants.h
index 4447e6991..c3450760a 100644
--- a/ext/dsent/util/Constants.h
+++ b/ext/dsent/util/Constants.h
@@ -1,3 +1,24 @@
+/* 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.
+ */
+
#ifndef __DSENT_UTIL_CONSTANTS_H__
#define __DSENT_UTIL_CONSTANTS_H__
diff --git a/ext/dsent/util/Result.cc b/ext/dsent/util/Result.cc
index f2a1b23ea..f9f762660 100644
--- a/ext/dsent/util/Result.cc
+++ b/ext/dsent/util/Result.cc
@@ -1,3 +1,24 @@
+/* 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 "util/Result.h"
#include <iostream>
diff --git a/ext/dsent/util/Result.h b/ext/dsent/util/Result.h
index 96f0e5805..daa07d67c 100644
--- a/ext/dsent/util/Result.h
+++ b/ext/dsent/util/Result.h
@@ -1,3 +1,24 @@
+/* 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.
+ */
+
#ifndef __DSENT_UTIL_RESULT_H__
#define __DSENT_UTIL_RESULT_H__