diff options
author | Benedikt Tutzer <e1225461@student.tuwien.ac.at> | 2019-04-03 12:21:21 +0200 |
---|---|---|
committer | Benedikt Tutzer <e1225461@student.tuwien.ac.at> | 2019-04-03 12:21:21 +0200 |
commit | 0774a500d4a03104787e6514c69ff4995633a65f (patch) | |
tree | 10f729cedff80da40b3b80656795b03588a570b8 | |
parent | 539a7f3fbce2f27f0de9a298993b13623c5c8f95 (diff) | |
download | yosys-0774a500d4a03104787e6514c69ff4995633a65f.tar.gz yosys-0774a500d4a03104787e6514c69ff4995633a65f.tar.bz2 yosys-0774a500d4a03104787e6514c69ff4995633a65f.zip |
Added support for changing Yosys namespace
-rw-r--r-- | kernel/yosys.h | 1 | ||||
-rw-r--r-- | py_wrap_generator.py | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/kernel/yosys.h b/kernel/yosys.h index a630798bb..2cf6188b4 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -119,6 +119,7 @@ extern const char *Tcl_GetStringResult(Tcl_Interp *interp); # define PATH_MAX 4096 #endif +#define YOSYS_NAMESPACE Yosys #define PRIVATE_NAMESPACE_BEGIN namespace { #define PRIVATE_NAMESPACE_END } #define YOSYS_NAMESPACE_BEGIN namespace Yosys { diff --git a/py_wrap_generator.py b/py_wrap_generator.py index aa2c46b2c..09f934040 100644 --- a/py_wrap_generator.py +++ b/py_wrap_generator.py @@ -972,7 +972,7 @@ sources = [ Source("kernel/cost",[]) ] -blacklist_methods = ["Yosys::Pass::run_register", "Yosys::Module::Pow", "Yosys::Module::Bu0", "Yosys::CaseRule::optimize"] +blacklist_methods = ["YOSYS_NAMESPACE::Pass::run_register", "YOSYS_NAMESPACE::Module::Pow", "YOSYS_NAMESPACE::Module::Bu0", "YOSYS_NAMESPACE::CaseRule::optimize"] enum_names = ["State","SyncType","ConstFlags"] @@ -1765,7 +1765,7 @@ def parse_header(source): private_segment = False while i < len(source_text): - line = source_text[i].replace("YOSYS_NAMESPACE_BEGIN", " namespace Yosys{").replace("YOSYS_NAMESPACE_END"," }") + line = source_text[i].replace("YOSYS_NAMESPACE_BEGIN", " namespace YOSYS_NAMESPACE{").replace("YOSYS_NAMESPACE_END"," }") ugly_line = unpretty_string(line) if str.startswith(ugly_line, "namespace "):# and ugly_line.find("std") == -1 and ugly_line.find("__") == -1: @@ -1892,7 +1892,7 @@ def parse_header(source): if candidate != None: while i < j: i += 1 - line = source_text[i].replace("YOSYS_NAMESPACE_BEGIN", " namespace Yosys{").replace("YOSYS_NAMESPACE_END"," }") + line = source_text[i].replace("YOSYS_NAMESPACE_BEGIN", " namespace YOSYS_NAMESPACE{").replace("YOSYS_NAMESPACE_END"," }") ugly_line = unpretty_string(line) if len(namespaces) != 0: namespaces[-1] = (namespaces[-1][0], namespaces[-1][1] + ugly_line.count("{") - ugly_line.count("}")) @@ -2028,7 +2028,7 @@ def gen_wrappers(filename, debug_level_ = 0): #include <boost/python.hpp> #include <boost/log/exceptions.hpp> -using namespace Yosys; +USING_YOSYS_NAMESPACE namespace YOSYS_PYTHON { """) |