summaryrefslogtreecommitdiff
path: root/passes/cmds
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-11-28 13:35:28 +0100
committerClifford Wolf <clifford@clifford.at>2013-11-28 13:35:28 +0100
commit5af7f4db72586a8cc8c1e685eb5af8f635e91718 (patch)
tree7bcf265bd0ee8bc323b3e92793bdec65aa7968af /passes/cmds
parent143a58bccce1b8a4de9f80ce9402ac07c16471ce (diff)
Added support for "show -pause" and "show -format dot"
Diffstat (limited to 'passes/cmds')
-rw-r--r--passes/cmds/show.cc36
1 files changed, 30 insertions, 6 deletions
diff --git a/passes/cmds/show.cc b/passes/cmds/show.cc
index adb925cb..f5ebe774 100644
--- a/passes/cmds/show.cc
+++ b/passes/cmds/show.cc
@@ -22,6 +22,7 @@
#include "kernel/log.h"
#include <string.h>
#include <dirent.h>
+#include <readline/readline.h>
using RTLIL::id2cstr;
@@ -536,6 +537,9 @@ struct ShowPass : public Pass {
log(" stretch the graph so all inputs are on the left side and all outputs\n");
log(" (including inout ports) are on the right side.\n");
log("\n");
+ log(" -pause\n");
+ log(" wait for the use to press enter to before returning\n");
+ log("\n");
log("When no <format> is specified, SVG is used. When no <format> and <viewer> is\n");
log("specified, 'yosys-svgviewer' is used to display the schematic.\n");
log("\n");
@@ -559,6 +563,7 @@ struct ShowPass : public Pass {
uint32_t colorSeed = 0;
bool flag_width = false;
bool flag_stretch = false;
+ bool flag_pause = false;
size_t argidx;
for (argidx = 1; argidx < args.size(); argidx++)
@@ -610,6 +615,10 @@ struct ShowPass : public Pass {
flag_stretch= true;
continue;
}
+ if (arg == "-pause") {
+ flag_pause= true;
+ continue;
+ }
break;
}
extra_args(args, argidx, design);
@@ -660,24 +669,39 @@ struct ShowPass : public Pass {
if (worker.page_counter == 0)
log_cmd_error("Nothing there to show.\n");
- std::string cmd = stringf("dot -T%s -o '%s' '%s'", format.empty() ? "svg" : format.c_str(), out_file.c_str(), dot_file.c_str());
- log("Exec: %s\n", cmd.c_str());
- if (system(cmd.c_str()) != 0)
- log_cmd_error("Shell command failed!\n");
+ if (format != "dot") {
+ std::string cmd = stringf("dot -T%s -o '%s' '%s'", format.empty() ? "svg" : format.c_str(), out_file.c_str(), dot_file.c_str());
+ log("Exec: %s\n", cmd.c_str());
+ if (system(cmd.c_str()) != 0)
+ log_cmd_error("Shell command failed!\n");
+ }
if (!viewer_exe.empty()) {
- cmd = stringf("%s '%s' &", viewer_exe.c_str(), out_file.c_str());
+ std::string cmd = stringf("%s '%s' &", viewer_exe.c_str(), out_file.c_str());
log("Exec: %s\n", cmd.c_str());
if (system(cmd.c_str()) != 0)
log_cmd_error("Shell command failed!\n");
} else
if (format.empty()) {
- cmd = stringf("fuser -s '%s' || '%s' '%s' &", out_file.c_str(), rewrite_yosys_exe("yosys-svgviewer").c_str(), out_file.c_str());
+ std::string cmd = stringf("fuser -s '%s' || '%s' '%s' &", out_file.c_str(), rewrite_yosys_exe("yosys-svgviewer").c_str(), out_file.c_str());
log("Exec: %s\n", cmd.c_str());
if (system(cmd.c_str()) != 0)
log_cmd_error("Shell command failed!\n");
}
+ if (flag_pause) {
+ char *input = NULL;
+ while ((input = readline("Press ENTER to continue (or type 'shell' to open a shell)> ")) != NULL) {
+ if (input[strspn(input, " \t\r\n")] == 0)
+ break;
+ char *p = input + strspn(input, " \t\r\n");
+ if (!strcmp(p, "shell")) {
+ Pass::call(design, "shell");
+ break;
+ }
+ }
+ }
+
log_pop();
}
} ShowPass;