aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/driver.cc
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2022-11-25 16:18:02 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2022-11-25 16:18:02 +0100
commit2450e6be2223b4895bfa239364996c882c0229af (patch)
treec2a62ef34cee2b7eabe906a2ef4c4fe8982ec9c7 /kernel/driver.cc
parentc55c514cdbd5a7968c17689876f2ced282071f9c (diff)
downloadyosys-2450e6be2223b4895bfa239364996c882c0229af.tar.gz
yosys-2450e6be2223b4895bfa239364996c882c0229af.tar.bz2
yosys-2450e6be2223b4895bfa239364996c882c0229af.zip
Add TCL interactive shell mode
Diffstat (limited to 'kernel/driver.cc')
-rw-r--r--kernel/driver.cc30
1 files changed, 25 insertions, 5 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc
index 6d996783e..aa90802c9 100644
--- a/kernel/driver.cc
+++ b/kernel/driver.cc
@@ -202,6 +202,11 @@ extern char *yosys_argv0;
extern char yosys_path[PATH_MAX];
};
#endif
+#ifdef YOSYS_ENABLE_TCL
+namespace Yosys {
+ extern int yosys_tcl_iterp_init(Tcl_Interp *interp);
+};
+#endif
int main(int argc, char **argv)
{
@@ -221,6 +226,7 @@ int main(int argc, char **argv)
bool call_abort = false;
bool timing_details = false;
bool run_shell = true;
+ bool run_tcl_shell = false;
bool mode_v = false;
bool mode_q = false;
@@ -284,6 +290,9 @@ int main(int argc, char **argv)
printf("\n");
printf(" -c tcl_scriptfile\n");
printf(" execute the commands in the tcl script file (see 'help tcl' for details)\n");
+ printf("\n");
+ printf(" -C\n");
+ printf(" enters TCL interatcive shell mode\n");
#endif
printf("\n");
printf(" -p command\n");
@@ -358,7 +367,7 @@ int main(int argc, char **argv)
}
int opt;
- while ((opt = getopt(argc, argv, "MXAQTVSgm:f:Hh:b:o:p:l:L:qv:tds:c:W:w:e:r:D:P:E:x:B:")) != -1)
+ while ((opt = getopt(argc, argv, "MXAQTVCSgm:f:Hh:b:o:p:l:L:qv:tds:c:W:w:e:r:D:P:E:x:B:")) != -1)
{
switch (opt)
{
@@ -496,6 +505,9 @@ int main(int argc, char **argv)
case 'B':
perffile = optarg;
break;
+ case 'C':
+ run_tcl_shell = true;
+ break;
default:
fprintf(stderr, "Run '%s -h' for help.\n", argv[0]);
exit(1);
@@ -570,10 +582,18 @@ int main(int argc, char **argv)
for (auto it = passes_commands.begin(); it != passes_commands.end(); it++)
run_pass(*it);
- if (run_shell)
- shell(yosys_design);
- else
- run_backend(output_filename, backend_command);
+ if (run_tcl_shell) {
+#ifdef YOSYS_ENABLE_TCL
+ Tcl_Main(argc, argv, yosys_tcl_iterp_init);
+#else
+ log_error("Can't exectue TCL shell: this version of yosys is not built with TCL support enabled.\n");
+#endif
+ } else {
+ if (run_shell)
+ shell(yosys_design);
+ else
+ run_backend(output_filename, backend_command);
+ }
yosys_design->check();
for (auto it : saved_designs)