yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
proc.cc
Go to the documentation of this file.
1 /*
2  * yosys -- Yosys Open SYnthesis Suite
3  *
4  * Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
5  *
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.
9  *
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.
17  *
18  */
19 
20 #include "kernel/register.h"
21 #include "kernel/log.h"
22 #include <stdlib.h>
23 #include <stdio.h>
24 
27 
28 struct ProcPass : public Pass {
29  ProcPass() : Pass("proc", "translate processes to netlists") { }
30  virtual void help()
31  {
32  // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
33  log("\n");
34  log(" proc [options] [selection]\n");
35  log("\n");
36  log("This pass calls all the other proc_* passes in the most common order.\n");
37  log("\n");
38  log(" proc_clean\n");
39  log(" proc_rmdead\n");
40  log(" proc_init\n");
41  log(" proc_arst\n");
42  log(" proc_mux\n");
43  log(" proc_dff\n");
44  log(" proc_clean\n");
45  log("\n");
46  log("This replaces the processes in the design with multiplexers and flip-flops.\n");
47  log("\n");
48  log("The following options are supported:\n");
49  log("\n");
50  log(" -global_arst [!]<netname>\n");
51  log(" This option is passed through to proc_arst.\n");
52  log("\n");
53  }
54  virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
55  {
56  std::string global_arst;
57 
58  log_header("Executing PROC pass (convert processes to netlists).\n");
59  log_push();
60 
61  size_t argidx;
62  for (argidx = 1; argidx < args.size(); argidx++)
63  {
64  if (args[argidx] == "-global_arst" && argidx+1 < args.size()) {
65  global_arst = args[++argidx];
66  continue;
67  }
68  break;
69  }
70  extra_args(args, argidx, design);
71 
72  Pass::call(design, "proc_clean");
73  Pass::call(design, "proc_rmdead");
74  Pass::call(design, "proc_init");
75  if (global_arst.empty())
76  Pass::call(design, "proc_arst");
77  else
78  Pass::call(design, "proc_arst -global_arst " + global_arst);
79  Pass::call(design, "proc_mux");
80  Pass::call(design, "proc_dff");
81  Pass::call(design, "proc_clean");
82 
83  log_pop();
84  }
85 } ProcPass;
86 
Definition: proc.cc:28
virtual void help()
Definition: proc.cc:30
void log_header(const char *format,...)
Definition: log.cc:188
void log_pop()
Definition: log.cc:237
#define PRIVATE_NAMESPACE_BEGIN
Definition: yosys.h:97
ProcPass ProcPass
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
Definition: proc.cc:54
#define PRIVATE_NAMESPACE_END
Definition: yosys.h:98
Definition: register.h:27
#define USING_YOSYS_NAMESPACE
Definition: yosys.h:102
void log(const char *format,...)
Definition: log.cc:180
ProcPass()
Definition: proc.cc:29
void log_push()
Definition: log.cc:232
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)
Definition: register.cc:128
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146