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_get_tcl_interp();
34 // from kernel/version_*.o (cc source generated from Makefile)
35 extern const char *yosys_version_str
;
37 // implemented in driver.cc
38 extern RTLIL::Design
*yosys_get_design();
39 std::string
rewrite_yosys_exe(std::string exe
);
40 std::string
get_share_file_name(std::string file
);
41 const char *create_prompt(RTLIL::Design
*design
, int recursion_counter
);
45 std::string pass_name
, short_help
;
46 Pass(std::string name
, std::string short_help
= "** document me **");
47 virtual void run_register();
50 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
52 void cmd_log_args(const std::vector
<std::string
> &args
);
53 void cmd_error(const std::vector
<std::string
> &args
, size_t argidx
, std::string msg
);
54 void extra_args(std::vector
<std::string
> args
, size_t argidx
, RTLIL::Design
*design
, bool select
= true);
56 static void call(RTLIL::Design
*design
, std::string command
);
57 static void call(RTLIL::Design
*design
, std::vector
<std::string
> args
);
59 static void call_newsel(RTLIL::Design
*design
, std::string command
);
60 static void call_newsel(RTLIL::Design
*design
, std::vector
<std::string
> args
);
62 static void init_register();
63 static void done_register();
66 struct Frontend
: Pass
68 std::string frontend_name
;
69 Frontend(std::string name
, std::string short_help
= "** document me **");
70 virtual void run_register();
72 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
);
73 virtual void execute(FILE *&f
, std::string filename
, std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
75 static std::vector
<std::string
> next_args
;
76 void extra_args(FILE *&f
, std::string
&filename
, std::vector
<std::string
> args
, size_t argidx
);
78 static void frontend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::string command
);
79 static void frontend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::vector
<std::string
> args
);
84 std::string backend_name
;
85 Backend(std::string name
, std::string short_help
= "** document me **");
86 virtual void run_register();
88 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
);
89 virtual void execute(FILE *&f
, std::string filename
, std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
91 void extra_args(FILE *&f
, std::string
&filename
, std::vector
<std::string
> args
, size_t argidx
);
93 static void backend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::string command
);
94 static void backend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::vector
<std::string
> args
);
97 // implemented in passes/cmds/select.cc
98 extern void handle_extra_select_args(Pass
*pass
, std::vector
<std::string
> args
, size_t argidx
, size_t args_size
, RTLIL::Design
*design
);
100 namespace REGISTER_INTERN
{
101 extern int raw_register_count
;
102 extern bool raw_register_done
;
103 extern Pass
*raw_register_array
[];
104 extern std::map
<std::string
, Pass
*> pass_register
;
105 extern std::map
<std::string
, Frontend
*> frontend_register
;
106 extern std::map
<std::string
, Backend
*> backend_register
;