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"
31 std::string pass_name
;
32 Pass(std::string name
);
33 virtual void run_register();
36 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
38 void cmd_log_args(const std::vector
<std::string
> &args
);
39 void cmd_error(const std::vector
<std::string
> &args
, size_t argidx
, std::string msg
);
40 void extra_args(std::vector
<std::string
> args
, size_t argidx
, RTLIL::Design
*design
);
42 static void call(RTLIL::Design
*design
, std::string command
);
43 static void call(RTLIL::Design
*design
, std::vector
<std::string
> args
);
45 static void init_register();
46 static void done_register();
49 struct Frontend
: Pass
51 std::string frontend_name
;
52 Frontend(std::string name
);
53 virtual void run_register();
55 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
);
56 virtual void execute(FILE *&f
, std::string filename
, std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
58 static std::vector
<std::string
> next_args
;
59 void extra_args(FILE *&f
, std::string
&filename
, std::vector
<std::string
> args
, size_t argidx
);
61 static void frontend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::string command
);
62 static void frontend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::vector
<std::string
> args
);
67 std::string backend_name
;
68 Backend(std::string name
);
69 virtual void run_register();
71 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
);
72 virtual void execute(FILE *&f
, std::string filename
, std::vector
<std::string
> args
, RTLIL::Design
*design
) = 0;
74 void extra_args(FILE *&f
, std::string
&filename
, std::vector
<std::string
> args
, size_t argidx
);
76 static void backend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::string command
);
77 static void backend_call(RTLIL::Design
*design
, FILE *f
, std::string filename
, std::vector
<std::string
> args
);
80 namespace REGISTER_INTERN
{
81 extern int raw_register_count
;
82 extern bool raw_register_done
;
83 extern Pass
*raw_register_array
[];
84 extern std::map
<std::string
, Pass
*> pass_register
;
85 extern std::map
<std::string
, Frontend
*> frontend_register
;
86 extern std::map
<std::string
, Backend
*> backend_register
;