From ec93680bd583b670e03ed98b4b1081eab8d0f3f6 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 31 Mar 2016 08:52:49 +0200 Subject: [PATCH] Renamed opt_share to opt_merge --- manual/CHAPTER_Optimize.tex | 6 +++--- manual/CHAPTER_Overview.tex | 4 ++-- manual/PRESENTATION_ExSyn.tex | 4 ++-- passes/memory/memory_share.cc | 2 +- passes/opt/Makefile.inc | 2 +- passes/opt/opt.cc | 16 ++++++++-------- passes/opt/{opt_share.cc => opt_merge.cc} | 18 +++++++++--------- techlibs/ice40/ice40_opt.cc | 4 ++-- 8 files changed, 28 insertions(+), 28 deletions(-) rename passes/opt/{opt_share.cc => opt_merge.cc} (96%) diff --git a/manual/CHAPTER_Optimize.tex b/manual/CHAPTER_Optimize.tex index 07f5a26e6..4b09c2231 100644 --- a/manual/CHAPTER_Optimize.tex +++ b/manual/CHAPTER_Optimize.tex @@ -16,13 +16,13 @@ passes that each perform a simple optimization: \item Once at the beginning of {\tt opt}: \begin{itemize} \item {\tt opt\_expr} -\item {\tt opt\_share -nomux} +\item {\tt opt\_merge -nomux} \end{itemize} \item Repeat until result is stable: \begin{itemize} \item {\tt opt\_muxtree} \item {\tt opt\_reduce} -\item {\tt opt\_share} +\item {\tt opt\_merge} \item {\tt opt\_rmdff} \item {\tt opt\_clean} \item {\tt opt\_expr} @@ -130,7 +130,7 @@ This pass identifies unused signals and cells and removes them from the design. creates an \B{unused\_bits} attribute on wires with unused bits. This attribute can be used for debugging or by other optimization passes. -\subsection{The opt\_share pass} +\subsection{The opt\_merge pass} This pass performs trivial resource sharing. This means that this pass identifies cells with identical inputs and replaces them with a single instance of the cell. diff --git a/manual/CHAPTER_Overview.tex b/manual/CHAPTER_Overview.tex index 4ce314825..964875d57 100644 --- a/manual/CHAPTER_Overview.tex +++ b/manual/CHAPTER_Overview.tex @@ -489,7 +489,7 @@ select.cc}, {\tt show.cc}, \dots) and a couple of other small utility libraries. This directory contains a subdirectory for each pass or group of passes. For example as of this writing the directory {\tt passes/opt/} contains the code for seven passes: {\tt opt}, {\tt opt\_expr}, {\tt opt\_muxtree}, {\tt opt\_reduce}, -{\tt opt\_rmdff}, {\tt opt\_rmunused} and {\tt opt\_share}. +{\tt opt\_rmdff}, {\tt opt\_rmunused} and {\tt opt\_merge}. \item {\tt techlibs/} \\ This directory contains simulation models and standard implementations for the @@ -513,7 +513,7 @@ Yosys. So it is not needed to add additional commands to a central list of comma \end{sloppypar} Good starting points for reading example source code to learn how to write passes -are {\tt passes/opt/opt\_rmdff.cc} and {\tt passes/opt/opt\_share.cc}. +are {\tt passes/opt/opt\_rmdff.cc} and {\tt passes/opt/opt\_merge.cc}. See the top-level README file for a quick {\it Getting Started} guide and build instructions. The Yosys build is based solely on Makefiles. diff --git a/manual/PRESENTATION_ExSyn.tex b/manual/PRESENTATION_ExSyn.tex index b57063c9c..655720ebc 100644 --- a/manual/PRESENTATION_ExSyn.tex +++ b/manual/PRESENTATION_ExSyn.tex @@ -145,12 +145,12 @@ is a macro command that calls other commands: \begin{lstlisting}[xleftmargin=0.5cm, basicstyle=\ttfamily\fontsize{8pt}{10pt}\selectfont, language=ys] opt_expr # const folding and simple expression rewriting -opt_share -nomux # merging identical cells +opt_merge -nomux # merging identical cells do opt_muxtree # remove never-active branches from multiplexer tree opt_reduce # consolidate trees of boolean ops to reduce functions - opt_share # merging identical cells + opt_merge # merging identical cells opt_rmdff # remove/simplify registers with constant inputs opt_clean # remove unused objects (cells, wires) from design opt_expr # const folding and simple expression rewriting diff --git a/passes/memory/memory_share.cc b/passes/memory/memory_share.cc index 3a6fd0b44..ab9edb6e7 100644 --- a/passes/memory/memory_share.cc +++ b/passes/memory/memory_share.cc @@ -746,7 +746,7 @@ struct MemorySharePass : public Pass { log("\n"); log("Note that in addition to the algorithms implemented in this pass, the $memrd\n"); log("and $memwr cells are also subject to generic resource sharing passes (and other\n"); - log("optimizations) such as opt_share.\n"); + log("optimizations) such as \"share\" and \"opt_merge\".\n"); log("\n"); } virtual void execute(std::vector args, RTLIL::Design *design) { diff --git a/passes/opt/Makefile.inc b/passes/opt/Makefile.inc index dd9088a66..a8b1537bb 100644 --- a/passes/opt/Makefile.inc +++ b/passes/opt/Makefile.inc @@ -1,6 +1,6 @@ OBJS += passes/opt/opt.o -OBJS += passes/opt/opt_share.o +OBJS += passes/opt/opt_merge.o OBJS += passes/opt/opt_muxtree.o OBJS += passes/opt/opt_reduce.o OBJS += passes/opt/opt_rmdff.o diff --git a/passes/opt/opt.cc b/passes/opt/opt.cc index db35a1775..c25adac97 100644 --- a/passes/opt/opt.cc +++ b/passes/opt/opt.cc @@ -38,12 +38,12 @@ struct OptPass : public Pass { log("passes in the following order:\n"); log("\n"); log(" opt_expr [-mux_undef] [-mux_bool] [-undriven] [-clkinv] [-fine] [-full] [-keepdc]\n"); - log(" opt_share [-share_all] -nomux\n"); + log(" opt_merge [-share_all] -nomux\n"); log("\n"); log(" do\n"); log(" opt_muxtree\n"); log(" opt_reduce [-fine] [-full]\n"); - log(" opt_share [-share_all]\n"); + log(" opt_merge [-share_all]\n"); log(" opt_rmdff\n"); log(" opt_clean [-purge]\n"); log(" opt_expr [-mux_undef] [-mux_bool] [-undriven] [-clkinv] [-fine] [-full] [-keepdc]\n"); @@ -53,7 +53,7 @@ struct OptPass : public Pass { log("\n"); log(" do\n"); log(" opt_expr [-mux_undef] [-mux_bool] [-undriven] [-clkinv] [-fine] [-full] [-keepdc]\n"); - log(" opt_share [-share_all]\n"); + log(" opt_merge [-share_all]\n"); log(" opt_rmdff\n"); log(" opt_clean [-purge]\n"); log(" while \n"); @@ -68,7 +68,7 @@ struct OptPass : public Pass { std::string opt_clean_args; std::string opt_expr_args; std::string opt_reduce_args; - std::string opt_share_args; + std::string opt_merge_args; bool fast_mode = false; log_header("Executing OPT pass (performing simple optimizations).\n"); @@ -111,7 +111,7 @@ struct OptPass : public Pass { continue; } if (args[argidx] == "-share_all") { - opt_share_args += " -share_all"; + opt_merge_args += " -share_all"; continue; } if (args[argidx] == "-fast") { @@ -126,7 +126,7 @@ struct OptPass : public Pass { { while (1) { Pass::call(design, "opt_expr" + opt_expr_args); - Pass::call(design, "opt_share" + opt_share_args); + Pass::call(design, "opt_merge" + opt_merge_args); design->scratchpad_unset("opt.did_something"); Pass::call(design, "opt_rmdff"); if (design->scratchpad_get_bool("opt.did_something") == false) @@ -139,12 +139,12 @@ struct OptPass : public Pass { else { Pass::call(design, "opt_expr" + opt_expr_args); - Pass::call(design, "opt_share -nomux" + opt_share_args); + Pass::call(design, "opt_merge -nomux" + opt_merge_args); while (1) { design->scratchpad_unset("opt.did_something"); Pass::call(design, "opt_muxtree"); Pass::call(design, "opt_reduce" + opt_reduce_args); - Pass::call(design, "opt_share" + opt_share_args); + Pass::call(design, "opt_merge" + opt_merge_args); Pass::call(design, "opt_rmdff"); Pass::call(design, "opt_clean" + opt_clean_args); Pass::call(design, "opt_expr" + opt_expr_args); diff --git a/passes/opt/opt_share.cc b/passes/opt/opt_merge.cc similarity index 96% rename from passes/opt/opt_share.cc rename to passes/opt/opt_merge.cc index 46752e43b..fe1ad685a 100644 --- a/passes/opt/opt_share.cc +++ b/passes/opt/opt_merge.cc @@ -31,7 +31,7 @@ USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN -struct OptShareWorker +struct OptMergeWorker { RTLIL::Design *design; RTLIL::Module *module; @@ -212,14 +212,14 @@ struct OptShareWorker } struct CompareCells { - OptShareWorker *that; - CompareCells(OptShareWorker *that) : that(that) {} + OptMergeWorker *that; + CompareCells(OptMergeWorker *that) : that(that) {} bool operator()(const RTLIL::Cell *cell1, const RTLIL::Cell *cell2) const { return that->compare_cells(cell1, cell2); } }; - OptShareWorker(RTLIL::Design *design, RTLIL::Module *module, bool mode_nomux, bool mode_share_all) : + OptMergeWorker(RTLIL::Design *design, RTLIL::Module *module, bool mode_nomux, bool mode_share_all) : design(design), module(module), assign_map(module), mode_share_all(mode_share_all) { total_count = 0; @@ -286,13 +286,13 @@ struct OptShareWorker } }; -struct OptSharePass : public Pass { - OptSharePass() : Pass("opt_share", "consolidate identical cells") { } +struct OptMergePass : public Pass { + OptMergePass() : Pass("opt_merge", "consolidate identical cells") { } virtual void help() { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); - log(" opt_share [options] [selection]\n"); + log(" opt_merge [options] [selection]\n"); log("\n"); log("This pass identifies cells with identical type and input signals. Such cells\n"); log("are then merged to one cell.\n"); @@ -328,7 +328,7 @@ struct OptSharePass : public Pass { int total_count = 0; for (auto module : design->selected_modules()) { - OptShareWorker worker(design, module, mode_nomux, mode_share_all); + OptMergeWorker worker(design, module, mode_nomux, mode_share_all); total_count += worker.total_count; } @@ -336,6 +336,6 @@ struct OptSharePass : public Pass { design->scratchpad_set_bool("opt.did_something", true); log("Removed a total of %d cells.\n", total_count); } -} OptSharePass; +} OptMergePass; PRIVATE_NAMESPACE_END diff --git a/techlibs/ice40/ice40_opt.cc b/techlibs/ice40/ice40_opt.cc index 69c222808..5730847ce 100644 --- a/techlibs/ice40/ice40_opt.cc +++ b/techlibs/ice40/ice40_opt.cc @@ -128,7 +128,7 @@ struct Ice40OptPass : public Pass { log(" do\n"); log(" \n"); log(" opt_expr -mux_undef -undriven [-full]\n"); - log(" opt_share\n"); + log(" opt_merge\n"); log(" opt_rmdff\n"); log(" opt_clean\n"); log(" while \n"); @@ -159,7 +159,7 @@ struct Ice40OptPass : public Pass { run_ice40_opts(module); Pass::call(design, "opt_expr " + opt_expr_args); - Pass::call(design, "opt_share"); + Pass::call(design, "opt_merge"); Pass::call(design, "opt_rmdff"); Pass::call(design, "opt_clean"); -- 2.30.2