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.
23 #include "kernel/rtlil.h"
29 #ifdef YOSYS_ENABLE_TCL
31 extern Tcl_Interp
*yosys_tcl
;
32 extern RTLIL::Design
*yosys_tcl_design
;
37 std::string pass_name
, short_help
;
38 Pass(std::string name
, std::string short_help
= "** document me **");
39 virtual void run_register();
42 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
44 void cmd_log_args(const std::vector
<std::string
> &args
);
45 void cmd_error(const std::vector
<std::string
> &args
, size_t argidx
, std::string msg
);
46 void extra_args(std::vector
<std::string
> args
, size_t argidx
, RTLIL::Design
*design
, bool select
= true);
48 static void call(RTLIL::Design
*design
, std::string command
);
49 static void call(RTLIL::Design
*design
, std::vector
<std::string
> args
);
51 static void init_register();
52 static void done_register();
56 struct Frontend
: Pass
58 std::string frontend_name
;
59 Frontend(std::string name
, std::string short_help
= "** document me **");
60 virtual void run_register();
62 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
);
63 virtual void execute(FILE *&f
, std::string filename
, std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
65 static std::vector
<std::string
> next_args
;
66 void extra_args(FILE *&f
, std::string
&filename
, std::vector
<std::string
> args
, size_t argidx
);
68 static void frontend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::string command
);
69 static void frontend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::vector
<std::string
> args
);
74 std::string backend_name
;
75 Backend(std::string name
, std::string short_help
= "** document me **");
76 virtual void run_register();
78 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
);
79 virtual void execute(FILE *&f
, std::string filename
, std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
81 void extra_args(FILE *&f
, std::string
&filename
, std::vector
<std::string
> args
, size_t argidx
);
83 static void backend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::string command
);
84 static void backend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::vector
<std::string
> args
);
87 namespace REGISTER_INTERN
{
88 extern int raw_register_count
;
89 extern bool raw_register_done
;
90 extern Pass
*raw_register_array
[];
91 extern std::map
<std::string
, Pass
*> pass_register
;
92 extern std::map
<std::string
, Frontend
*> frontend_register
;
93 extern std::map
<std::string
, Backend
*> backend_register
;