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 "kernel/yosys.h"
22 #ifdef YOSYS_ENABLE_READLINE
23 # include <readline/readline.h>
24 # include <readline/history.h>
27 #ifdef YOSYS_ENABLE_PLUGINS
34 #elif defined(__APPLE__)
35 # include <mach-o/dyld.h>
38 # include <sys/stat.h>
42 # include <sys/types.h>
43 # include <sys/stat.h>
51 #if defined(_WIN32) && !defined(__MINGW32__)
52 const char *yosys_version_str
= "Yosys for Windows (Version Information Unavailable)";
56 RTLIL::Design
*yosys_design
= NULL
;
58 #ifdef YOSYS_ENABLE_TCL
59 Tcl_Interp
*yosys_tcl_interp
= NULL
;
62 std::string
stringf(const char *fmt
, ...)
68 string
= vstringf(fmt
, ap
);
74 std::string
vstringf(const char *fmt
, va_list ap
)
84 str
= (char*)realloc(str
, sz
);
85 rc
= vsnprintf(str
, sz
, fmt
, apc
);
87 if (rc
>= 0 && rc
< sz
)
92 if (vasprintf(&str
, fmt
, ap
) < 0)
104 std::string
next_token(std::string
&text
, const char *sep
)
106 size_t pos_begin
= text
.find_first_not_of(sep
);
108 if (pos_begin
== std::string::npos
)
109 pos_begin
= text
.size();
111 size_t pos_end
= text
.find_first_of(sep
, pos_begin
);
113 if (pos_end
== std::string::npos
)
114 pos_end
= text
.size();
116 std::string token
= text
.substr(pos_begin
, pos_end
-pos_begin
);
117 text
= text
.substr(pos_end
);
121 // this is very similar to fnmatch(). the exact rules used by this
124 // ? matches any character except
125 // * matches any sequence of characters
126 // [...] matches any of the characters in the list
127 // [!..] matches any of the characters not in the list
129 // a backslash may be used to escape the next characters in the
130 // pattern. each special character can also simply match itself.
132 bool patmatch(const char *pattern
, const char *string
)
137 if (*pattern
== '\\') {
138 if (pattern
[1] == string
[0] && patmatch(pattern
+2, string
+1))
142 if (*pattern
== '?') {
145 return patmatch(pattern
+1, string
+1);
148 if (*pattern
== '*') {
150 if (patmatch(pattern
+1, string
++))
153 return pattern
[1] == 0;
156 if (*pattern
== '[') {
157 bool found_match
= false;
158 bool inverted_list
= pattern
[1] == '!';
159 const char *p
= pattern
+ (inverted_list
? 1 : 0);
163 if (found_match
!= inverted_list
&& patmatch(p
+1, string
+1))
177 if (*pattern
== *string
)
178 return patmatch(pattern
+1, string
+1);
183 int run_command(const std::string
&command
, std::function
<void(const std::string
&)> process_line
)
186 return system(command
.c_str());
188 FILE *f
= popen(command
.c_str(), "r");
194 while (fgets(logbuf
, 128, f
) != NULL
) {
196 if (!line
.empty() && line
.back() == '\n')
197 process_line(line
), line
.clear();
208 return WEXITSTATUS(ret
);
212 std::string
make_temp_file(std::string template_str
)
215 if (template_str
.rfind("/tmp/", 0) == 0) {
217 char longpath
[MAX_PATH
+ 1];
218 char shortpath
[MAX_PATH
+ 1];
220 WCHAR longpath
[MAX_PATH
+ 1];
221 TCHAR shortpath
[MAX_PATH
+ 1];
223 if (!GetTempPath(MAX_PATH
+1, longpath
))
224 log_error("GetTempPath() failed.\n");
225 if (!GetShortPathName(longpath
, shortpath
, MAX_PATH
+ 1))
226 log_error("GetShortPathName() failed.\n");
227 log_assert(sizeof(TCHAR
) == sizeof(char));
228 template_str
= stringf("%s\\%s", shortpath
, template_str
.c_str() + 5);
231 size_t pos
= template_str
.rfind("XXXXXX");
232 log_assert(pos
!= std::string::npos
);
235 for (int i
= 0; i
< 6; i
++) {
236 static std::string y
= "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
237 static uint32_t x
= 314159265 ^ uint32_t(time(NULL
));
238 x
^= x
<< 13, x
^= x
>> 17, x
^= x
<< 5;
239 template_str
[pos
+i
] = y
[x
% y
.size()];
241 if (_access(template_str
.c_str(), 0) != 0)
245 size_t pos
= template_str
.rfind("XXXXXX");
246 log_assert(pos
!= std::string::npos
);
248 int suffixlen
= GetSize(template_str
) - pos
- 6;
250 char *p
= strdup(template_str
.c_str());
251 close(mkstemps(p
, suffixlen
));
259 std::string
make_temp_dir(std::string template_str
)
262 template_str
= make_temp_file(template_str
);
263 mkdir(template_str
.c_str());
266 size_t pos
= template_str
.rfind("XXXXXX");
267 log_assert(pos
!= std::string::npos
);
269 int suffixlen
= GetSize(template_str
) - pos
- 6;
270 log_assert(suffixlen
== 0);
272 char *p
= strdup(template_str
.c_str());
274 log_assert(p
!= NULL
);
283 bool check_file_exists(std::string filename
, bool)
285 return _access(filename
.c_str(), 0) == 0;
288 bool check_file_exists(std::string filename
, bool is_exec
)
290 return access(filename
.c_str(), is_exec
? X_OK
: F_OK
) == 0;
294 void remove_directory(std::string dirname
)
297 run_command(stringf("rmdir /s /q \"%s\"", dirname
.c_str()));
300 struct dirent
**namelist
;
301 int n
= scandir(dirname
.c_str(), &namelist
, nullptr, alphasort
);
303 for (int i
= 0; i
< n
; i
++) {
304 if (strcmp(namelist
[i
]->d_name
, ".") && strcmp(namelist
[i
]->d_name
, "..")) {
305 std::string buffer
= stringf("%s/%s", dirname
.c_str(), namelist
[i
]->d_name
);
306 if (!stat(buffer
.c_str(), &stbuf
) && S_ISREG(stbuf
.st_mode
)) {
307 log("Removing `%s'.\n", buffer
.c_str());
308 remove(buffer
.c_str());
310 remove_directory(buffer
);
315 log("Removing `%s'.\n", dirname
.c_str());
316 rmdir(dirname
.c_str());
320 int GetSize(RTLIL::Wire
*wire
)
327 Pass::init_register();
328 yosys_design
= new RTLIL::Design
;
332 void yosys_shutdown()
339 for (auto f
: log_files
)
345 Pass::done_register();
347 #ifdef YOSYS_ENABLE_TCL
348 if (yosys_tcl_interp
!= NULL
) {
349 Tcl_DeleteInterp(yosys_tcl_interp
);
351 yosys_tcl_interp
= NULL
;
355 #ifdef YOSYS_ENABLE_PLUGINS
356 for (auto &it
: loaded_plugins
)
359 loaded_plugins
.clear();
360 loaded_plugin_aliases
.clear();
364 RTLIL::IdString
new_id(std::string file
, int line
, std::string func
)
366 std::string str
= "$auto$";
367 size_t pos
= file
.find_last_of('/');
368 str
+= pos
!= std::string::npos
? file
.substr(pos
+1) : file
;
369 str
+= stringf(":%d:%s$%d", line
, func
.c_str(), autoidx
++);
373 RTLIL::Design
*yosys_get_design()
378 const char *create_prompt(RTLIL::Design
*design
, int recursion_counter
)
380 static char buffer
[100];
381 std::string str
= "\n";
382 if (recursion_counter
> 1)
383 str
+= stringf("(%d) ", recursion_counter
);
385 if (!design
->selected_active_module
.empty())
386 str
+= stringf(" [%s]", RTLIL::unescape_id(design
->selected_active_module
).c_str());
387 if (!design
->selection_stack
.empty() && !design
->selection_stack
.back().full_selection
) {
388 if (design
->selected_active_module
.empty())
390 else if (design
->selection_stack
.back().selected_modules
.size() != 1 || design
->selection_stack
.back().selected_members
.size() != 0 ||
391 design
->selection_stack
.back().selected_modules
.count(design
->selected_active_module
) == 0)
394 snprintf(buffer
, 100, "%s> ", str
.c_str());
398 #ifdef YOSYS_ENABLE_TCL
399 static int tcl_yosys_cmd(ClientData
, Tcl_Interp
*interp
, int argc
, const char *argv
[])
401 std::vector
<std::string
> args
;
402 for (int i
= 1; i
< argc
; i
++)
403 args
.push_back(argv
[i
]);
405 if (args
.size() >= 1 && args
[0] == "-import") {
406 for (auto &it
: pass_register
) {
407 std::string tcl_command_name
= it
.first
;
408 if (tcl_command_name
== "proc")
409 tcl_command_name
= "procs";
411 if (Tcl_GetCommandInfo(interp
, tcl_command_name
.c_str(), &info
) != 0) {
412 log("[TCL: yosys -import] Command name collision: found pre-existing command `%s' -> skip.\n", it
.first
.c_str());
414 std::string tcl_script
= stringf("proc %s args { yosys %s {*}$args }", tcl_command_name
.c_str(), it
.first
.c_str());
415 Tcl_Eval(interp
, tcl_script
.c_str());
421 if (args
.size() == 1) {
422 Pass::call(yosys_get_design(), args
[0]);
426 Pass::call(yosys_get_design(), args
);
430 extern Tcl_Interp
*yosys_get_tcl_interp()
432 if (yosys_tcl_interp
== NULL
) {
433 yosys_tcl_interp
= Tcl_CreateInterp();
434 Tcl_CreateCommand(yosys_tcl_interp
, "yosys", tcl_yosys_cmd
, NULL
, NULL
);
436 return yosys_tcl_interp
;
439 struct TclPass
: public Pass
{
440 TclPass() : Pass("tcl", "execute a TCL script file") { }
441 virtual void help() {
443 log(" tcl <filename>\n");
445 log("This command executes the tcl commands in the specified file.\n");
446 log("Use 'yosys cmd' to run the yosys command 'cmd' from tcl.\n");
448 log("The tcl command 'yosys -import' can be used to import all yosys\n");
449 log("commands directly as tcl commands to the tcl shell. The yosys\n");
450 log("command 'proc' is wrapped using the tcl command 'procs' in order\n");
451 log("to avoid a name collision with the tcl builting command 'proc'.\n");
454 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
) {
456 log_cmd_error("Missing script file.\n");
458 extra_args(args
, 1, design
, false);
459 if (Tcl_EvalFile(yosys_get_tcl_interp(), args
[1].c_str()) != TCL_OK
)
460 log_cmd_error("TCL interpreter returned an error: %s\n", Tcl_GetStringResult(yosys_get_tcl_interp()));
465 #if defined(__linux__)
466 std::string
proc_self_dirname()
469 ssize_t buflen
= readlink("/proc/self/exe", path
, sizeof(path
));
471 log_error("readlink(\"/proc/self/exe\") failed: %s\n", strerror(errno
));
473 while (buflen
> 0 && path
[buflen
-1] != '/')
475 return std::string(path
, buflen
);
477 #elif defined(__APPLE__)
478 std::string
proc_self_dirname()
482 while (_NSGetExecutablePath(path
, &buflen
) != 0)
483 path
= (char *) realloc((void *) path
, buflen
);
484 while (buflen
> 0 && path
[buflen
-1] != '/')
486 return std::string(path
, buflen
);
488 #elif defined(_WIN32)
489 std::string
proc_self_dirname()
493 char longpath
[MAX_PATH
+ 1];
494 char shortpath
[MAX_PATH
+ 1];
496 WCHAR longpath
[MAX_PATH
+ 1];
497 TCHAR shortpath
[MAX_PATH
+ 1];
499 if (!GetModuleFileName(0, longpath
, MAX_PATH
+1))
500 log_error("GetModuleFileName() failed.\n");
501 if (!GetShortPathName(longpath
, shortpath
, MAX_PATH
+1))
502 log_error("GetShortPathName() failed.\n");
503 while (shortpath
[i
] != 0)
505 while (i
> 0 && shortpath
[i
-1] != '/' && shortpath
[i
-1] != '\\')
507 log_assert(sizeof(TCHAR
) == sizeof(char));
508 return std::string((char*)shortpath
);
510 #elif defined(EMSCRIPTEN)
511 std::string
proc_self_dirname()
516 #error Dont know how to determine process executable base path!
519 std::string
proc_share_dirname()
521 std::string proc_self_path
= proc_self_dirname();
522 std::string proc_share_path
= proc_self_path
+ "share/";
523 if (check_file_exists(proc_share_path
, true))
524 return proc_share_path
;
525 proc_share_path
= proc_self_path
+ "../share/yosys/";
526 if (check_file_exists(proc_share_path
, true))
527 return proc_share_path
;
528 log_error("proc_share_dirname: unable to determine share/ directory!\n");
531 bool fgetline(FILE *f
, std::string
&buffer
)
536 if (fgets(block
, 4096, f
) == NULL
)
539 if (buffer
.size() > 0 && (buffer
[buffer
.size()-1] == '\n' || buffer
[buffer
.size()-1] == '\r')) {
540 while (buffer
.size() > 0 && (buffer
[buffer
.size()-1] == '\n' || buffer
[buffer
.size()-1] == '\r'))
541 buffer
.resize(buffer
.size()-1);
547 static void handle_label(std::string
&command
, bool &from_to_active
, const std::string
&run_from
, const std::string
&run_to
)
552 while (pos
< GetSize(command
) && (command
[pos
] == ' ' || command
[pos
] == '\t'))
555 while (pos
< GetSize(command
) && command
[pos
] != ' ' && command
[pos
] != '\t' && command
[pos
] != '\r' && command
[pos
] != '\n')
556 label
+= command
[pos
++];
558 if (label
.back() == ':' && GetSize(label
) > 1)
560 label
= label
.substr(0, GetSize(label
)-1);
561 command
= command
.substr(pos
);
563 if (label
== run_from
)
564 from_to_active
= true;
565 else if (label
== run_to
|| (run_from
== run_to
&& !run_from
.empty()))
566 from_to_active
= false;
570 void run_frontend(std::string filename
, std::string command
, RTLIL::Design
*design
, std::string
*backend_command
, std::string
*from_to_label
)
572 if (command
== "auto") {
573 if (filename
.size() > 2 && filename
.substr(filename
.size()-2) == ".v")
575 else if (filename
.size() > 2 && filename
.substr(filename
.size()-3) == ".sv")
576 command
= "verilog -sv";
577 else if (filename
.size() > 3 && filename
.substr(filename
.size()-3) == ".il")
579 else if (filename
.size() > 3 && filename
.substr(filename
.size()-3) == ".ys")
581 else if (filename
== "-")
584 log_error("Can't guess frontend for input file `%s' (missing -f option)!\n", filename
.c_str());
587 if (command
== "script")
589 std::string run_from
, run_to
;
590 bool from_to_active
= true;
592 if (from_to_label
!= NULL
) {
593 size_t pos
= from_to_label
->find(':');
594 if (pos
== std::string::npos
) {
595 run_from
= *from_to_label
;
596 run_to
= *from_to_label
;
598 run_from
= from_to_label
->substr(0, pos
);
599 run_to
= from_to_label
->substr(pos
+1);
601 from_to_active
= run_from
.empty();
604 log("\n-- Executing script file `%s' --\n", filename
.c_str());
609 f
= fopen(filename
.c_str(), "r");
612 log_error("Can't open script file `%s' for reading: %s\n", filename
.c_str(), strerror(errno
));
614 FILE *backup_script_file
= Frontend::current_script_file
;
615 Frontend::current_script_file
= f
;
619 while (fgetline(f
, command
)) {
620 while (!command
.empty() && command
[command
.size()-1] == '\\') {
621 std::string next_line
;
622 if (!fgetline(f
, next_line
))
624 command
.resize(command
.size()-1);
625 command
+= next_line
;
627 handle_label(command
, from_to_active
, run_from
, run_to
);
629 Pass::call(design
, command
);
632 if (!command
.empty()) {
633 handle_label(command
, from_to_active
, run_from
, run_to
);
635 Pass::call(design
, command
);
638 catch (log_cmd_error_expection
) {
639 Frontend::current_script_file
= backup_script_file
;
640 throw log_cmd_error_expection();
643 Frontend::current_script_file
= backup_script_file
;
648 if (backend_command
!= NULL
&& *backend_command
== "auto")
649 *backend_command
= "";
654 if (filename
== "-") {
655 log("\n-- Parsing stdin using frontend `%s' --\n", command
.c_str());
657 log("\n-- Parsing `%s' using frontend `%s' --\n", filename
.c_str(), command
.c_str());
660 Frontend::frontend_call(design
, NULL
, filename
, command
);
663 void run_pass(std::string command
, RTLIL::Design
*design
)
665 log("\n-- Running pass `%s' --\n", command
.c_str());
667 Pass::call(design
, command
);
670 void run_backend(std::string filename
, std::string command
, RTLIL::Design
*design
)
672 if (command
== "auto") {
673 if (filename
.size() > 2 && filename
.substr(filename
.size()-2) == ".v")
675 else if (filename
.size() > 3 && filename
.substr(filename
.size()-3) == ".il")
677 else if (filename
.size() > 5 && filename
.substr(filename
.size()-5) == ".blif")
679 else if (filename
== "-")
681 else if (filename
.empty())
684 log_error("Can't guess backend for output file `%s' (missing -b option)!\n", filename
.c_str());
687 if (filename
.empty())
690 if (filename
== "-") {
691 log("\n-- Writing to stdout using backend `%s' --\n", command
.c_str());
693 log("\n-- Writing to `%s' using backend `%s' --\n", filename
.c_str(), command
.c_str());
696 Backend::backend_call(design
, NULL
, filename
, command
);
699 #ifdef YOSYS_ENABLE_READLINE
700 static char *readline_cmd_generator(const char *text
, int state
)
702 static std::map
<std::string
, Pass
*>::iterator it
;
706 it
= pass_register
.begin();
710 for (; it
!= pass_register
.end(); it
++) {
711 if (it
->first
.substr(0, len
) == text
)
712 return strdup((it
++)->first
.c_str());
717 static char *readline_obj_generator(const char *text
, int state
)
719 static std::vector
<char*> obj_names
;
727 RTLIL::Design
*design
= yosys_get_design();
728 int len
= strlen(text
);
730 if (design
->selected_active_module
.empty())
732 for (auto &it
: design
->modules_
)
733 if (RTLIL::unescape_id(it
.first
).substr(0, len
) == text
)
734 obj_names
.push_back(strdup(RTLIL::id2cstr(it
.first
)));
737 if (design
->modules_
.count(design
->selected_active_module
) > 0)
739 RTLIL::Module
*module
= design
->modules_
.at(design
->selected_active_module
);
741 for (auto &it
: module
->wires_
)
742 if (RTLIL::unescape_id(it
.first
).substr(0, len
) == text
)
743 obj_names
.push_back(strdup(RTLIL::id2cstr(it
.first
)));
745 for (auto &it
: module
->memories
)
746 if (RTLIL::unescape_id(it
.first
).substr(0, len
) == text
)
747 obj_names
.push_back(strdup(RTLIL::id2cstr(it
.first
)));
749 for (auto &it
: module
->cells_
)
750 if (RTLIL::unescape_id(it
.first
).substr(0, len
) == text
)
751 obj_names
.push_back(strdup(RTLIL::id2cstr(it
.first
)));
753 for (auto &it
: module
->processes
)
754 if (RTLIL::unescape_id(it
.first
).substr(0, len
) == text
)
755 obj_names
.push_back(strdup(RTLIL::id2cstr(it
.first
)));
758 std::sort(obj_names
.begin(), obj_names
.end());
761 if (idx
< obj_names
.size())
762 return strdup(obj_names
[idx
++]);
769 static char **readline_completion(const char *text
, int start
, int)
772 return rl_completion_matches(text
, readline_cmd_generator
);
773 if (strncmp(rl_line_buffer
, "read_", 5) && strncmp(rl_line_buffer
, "write_", 6))
774 return rl_completion_matches(text
, readline_obj_generator
);
779 void shell(RTLIL::Design
*design
)
781 static int recursion_counter
= 0;
784 log_cmd_error_throw
= true;
786 #ifdef YOSYS_ENABLE_READLINE
787 rl_readline_name
= "yosys";
788 rl_attempted_completion_function
= readline_completion
;
789 rl_basic_word_break_characters
= " \t\n";
792 char *command
= NULL
;
793 #ifdef YOSYS_ENABLE_READLINE
794 while ((command
= readline(create_prompt(design
, recursion_counter
))) != NULL
)
796 char command_buffer
[4096];
797 while ((command
= fgets(command_buffer
, 4096, stdin
)) != NULL
)
800 if (command
[strspn(command
, " \t\r\n")] == 0)
802 #ifdef YOSYS_ENABLE_READLINE
803 add_history(command
);
806 char *p
= command
+ strspn(command
, " \t\r\n");
807 if (!strncmp(p
, "exit", 4)) {
809 p
+= strspn(p
, " \t\r\n");
815 log_assert(design
->selection_stack
.size() == 1);
816 Pass::call(design
, command
);
817 } catch (log_cmd_error_expection
) {
818 while (design
->selection_stack
.size() > 1)
819 design
->selection_stack
.pop_back();
827 log_cmd_error_throw
= false;
830 struct ShellPass
: public Pass
{
831 ShellPass() : Pass("shell", "enter interactive command mode") { }
832 virtual void help() {
836 log("This command enters the interactive command mode. This can be useful\n");
837 log("in a script to interrupt the script at a certain point and allow for\n");
838 log("interactive inspection or manual synthesis of the design at this point.\n");
840 log("The command prompt of the interactive shell indicates the current\n");
841 log("selection (see 'help select'):\n");
844 log(" the entire design is selected\n");
847 log(" only part of the design is selected\n");
849 log(" yosys [modname]>\n");
850 log(" the entire module 'modname' is selected using 'select -module modname'\n");
852 log(" yosys [modname]*>\n");
853 log(" only part of current module 'modname' is selected\n");
855 log("When in interactive shell, some errors (e.g. invalid command arguments)\n");
856 log("do not terminate yosys but return to the command prompt.\n");
858 log("This command is the default action if nothing else has been specified\n");
859 log("on the command line.\n");
861 log("Press Ctrl-D or type 'exit' to leave the interactive shell.\n");
864 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
) {
865 extra_args(args
, 1, design
, false);
870 #ifdef YOSYS_ENABLE_READLINE
871 struct HistoryPass
: public Pass
{
872 HistoryPass() : Pass("history", "show last interactive commands") { }
873 virtual void help() {
877 log("This command prints all commands in the shell history buffer. This are\n");
878 log("all commands executed in an interactive session, but not the commands\n");
879 log("from executed scripts.\n");
882 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
) {
883 extra_args(args
, 1, design
, false);
884 for(HIST_ENTRY
**list
= history_list(); *list
!= NULL
; list
++)
885 log("%s\n", (*list
)->line
);
890 struct ScriptPass
: public Pass
{
891 ScriptPass() : Pass("script", "execute commands from script file") { }
892 virtual void help() {
894 log(" script <filename> [<from_label>:<to_label>]\n");
896 log("This command executes the yosys commands in the specified file.\n");
898 log("The 2nd argument can be used to only execute the section of the\n");
899 log("file between the specified labels. An empty from label is synonymous\n");
900 log("for the beginning of the file and an empty to label is synonymous\n");
901 log("for the end of the file.\n");
903 log("If only one label is specified (without ':') then only the block\n");
904 log("marked with that label (until the next label) is executed.\n");
907 virtual void execute(std::vector
<std::string
> args
, RTLIL::Design
*design
) {
909 log_cmd_error("Missing script file.\n");
910 else if (args
.size() == 2)
911 run_frontend(args
[1], "script", design
, NULL
, NULL
);
912 else if (args
.size() == 3)
913 run_frontend(args
[1], "script", design
, NULL
, &args
[2]);
915 extra_args(args
, 2, design
, false);