From 68d747f76769ce6e517cc72263ccc89ef5dff43f Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 2 Jun 2020 22:19:34 +0000 Subject: [PATCH 1/4] techmap: use +/techmap.v instead of an ad-hoc code generator. --- passes/techmap/.gitignore | 1 - passes/techmap/Makefile.inc | 12 ------------ passes/techmap/techmap.cc | 4 +--- 3 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 passes/techmap/.gitignore diff --git a/passes/techmap/.gitignore b/passes/techmap/.gitignore deleted file mode 100644 index e6dcc6bc0..000000000 --- a/passes/techmap/.gitignore +++ /dev/null @@ -1 +0,0 @@ -techmap.inc diff --git a/passes/techmap/Makefile.inc b/passes/techmap/Makefile.inc index 1802ba0de..873286608 100644 --- a/passes/techmap/Makefile.inc +++ b/passes/techmap/Makefile.inc @@ -45,18 +45,6 @@ OBJS += passes/techmap/flowmap.o OBJS += passes/techmap/extractinv.o endif -GENFILES += passes/techmap/techmap.inc - -passes/techmap/techmap.inc: techlibs/common/techmap.v - $(Q) mkdir -p $(dir $@) - $(P) echo "// autogenerated from $<" > $@.new - $(Q) echo "static char stdcells_code[] = {" >> $@.new - $(Q) od -v -td1 -An $< | $(SED) -e 's/[0-9][0-9]*/&,/g' >> $@.new - $(Q) echo "0};" >> $@.new - $(Q) mv $@.new $@ - -passes/techmap/techmap.o: passes/techmap/techmap.inc - ifeq ($(DISABLE_SPAWN),0) TARGETS += $(PROGRAM_PREFIX)yosys-filterlib$(EXE) EXTRA_OBJS += passes/techmap/filterlib.o diff --git a/passes/techmap/techmap.cc b/passes/techmap/techmap.cc index 6ac1d1113..fc24c33b0 100644 --- a/passes/techmap/techmap.cc +++ b/passes/techmap/techmap.cc @@ -27,7 +27,6 @@ #include #include "simplemap.h" -#include "passes/techmap/techmap.inc" YOSYS_NAMESPACE_BEGIN @@ -1282,8 +1281,7 @@ struct TechmapPass : public Pass { RTLIL::Design *map = new RTLIL::Design; if (map_files.empty()) { - std::istringstream f(stdcells_code); - Frontend::frontend_call(map, &f, "", verilog_frontend); + Frontend::frontend_call(map, nullptr, "+/techmap.v", verilog_frontend); } else { for (auto &fn : map_files) if (fn.compare(0, 1, "%") == 0) { From f3e86bb32a745d300df38173b41347263696ed4b Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 2 Jun 2020 22:34:01 +0000 Subject: [PATCH 2/4] techmap: simplify. `rewrite_filename` is already called in `Frontend::extra_args`. --- passes/techmap/techmap.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/passes/techmap/techmap.cc b/passes/techmap/techmap.cc index fc24c33b0..0d7c10d0c 100644 --- a/passes/techmap/techmap.cc +++ b/passes/techmap/techmap.cc @@ -1293,13 +1293,7 @@ struct TechmapPass : public Pass { if (!map->module(mod->name)) map->add(mod->clone()); } else { - std::ifstream f; - rewrite_filename(fn); - f.open(fn.c_str()); - yosys_input_files.insert(fn); - if (f.fail()) - log_cmd_error("Can't open map file `%s'\n", fn.c_str()); - Frontend::frontend_call(map, &f, fn, (fn.size() > 3 && fn.compare(fn.size()-3, std::string::npos, ".il") == 0 ? "ilang" : verilog_frontend)); + Frontend::frontend_call(map, nullptr, fn, (fn.size() > 3 && fn.compare(fn.size()-3, std::string::npos, ".il") == 0 ? "ilang" : verilog_frontend)); } } From 0a74368bfc1d4fadaf9efb5eb28f9e706dfdf6c9 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 2 Jun 2020 23:17:46 +0000 Subject: [PATCH 3/4] techmap: use C++11 default member initializers. NFC. --- passes/techmap/techmap.cc | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/passes/techmap/techmap.cc b/passes/techmap/techmap.cc index 0d7c10d0c..9227385b3 100644 --- a/passes/techmap/techmap.cc +++ b/passes/techmap/techmap.cc @@ -80,22 +80,12 @@ struct TechmapWorker typedef dict> TechmapWires; - bool extern_mode; - bool assert_mode; - bool flatten_mode; - bool recursive_mode; - bool autoproc_mode; - bool ignore_wb; - - TechmapWorker() - { - extern_mode = false; - assert_mode = false; - flatten_mode = false; - recursive_mode = false; - autoproc_mode = false; - ignore_wb = false; - } + bool extern_mode = false; + bool assert_mode = false; + bool flatten_mode = false; + bool recursive_mode = false; + bool autoproc_mode = false; + bool ignore_wb = false; std::string constmap_tpl_name(SigMap &sigmap, RTLIL::Module *tpl, RTLIL::Cell *cell, bool verbose) { From fb5b070e7e9e22b02a3ee94217c8ae20cef41f0b Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 3 Jun 2020 01:44:06 +0000 Subject: [PATCH 4/4] techmap: remove dead variable. NFC. --- passes/techmap/techmap.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/passes/techmap/techmap.cc b/passes/techmap/techmap.cc index 9227385b3..c88f7bd0a 100644 --- a/passes/techmap/techmap.cc +++ b/passes/techmap/techmap.cc @@ -268,7 +268,6 @@ struct TechmapWorker tpl_written_bits.insert(bit); SigMap port_signal_map; - SigSig port_signal_assign; for (auto &it : cell->connections()) {