b742a0951ed8bacd04aeecbe06c42557aa911505
2 * yosys -- Yosys Open SYnthesis Suite
4 * Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #include "opt_status.h"
21 #include "kernel/register.h"
22 #include "kernel/log.h"
26 bool OPT_DID_SOMETHING
;
28 struct OptPass
: public Pass
{
29 OptPass() : Pass("opt", "perform simple optimizations") { }
32 // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
34 log(" opt [selection]\n");
36 log("This pass calls all the other opt_* passes in a useful manner. This performs\n");
37 log("a series of trivial optimizations and cleanups. This pass executes the other\n");
38 log("passes in the following order:\n");
41 log(" opt_share -nomux\n");
44 log(" opt_muxtree\n");
48 log(" opt_rmunused\n");
50 log(" while [changed design]\n");
53 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
)
55 log_header("Executing OPT pass (performing simple optimizations).\n");
58 extra_args(args
, 1, design
);
60 log_header("Optimizing in-memory representation of design.\n");
63 Pass::call(design
, "opt_const");
64 Pass::call(design
, "opt_share -nomux");
66 OPT_DID_SOMETHING
= false;
67 Pass::call(design
, "opt_muxtree");
68 Pass::call(design
, "opt_reduce");
69 Pass::call(design
, "opt_share");
70 Pass::call(design
, "opt_rmdff");
71 Pass::call(design
, "opt_rmunused");
72 Pass::call(design
, "opt_const");
73 if (OPT_DID_SOMETHING
== false)
75 log_header("Rerunning OPT passes. (Maybe there is more to do..)\n");
78 log_header("Optimizing in-memory representation of design.\n");
81 log_header("Finished OPT passes. (There is nothing left to do.)\n");