3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-12 20:18:20 +00:00

show: add -viewer none option

This commit is contained in:
N. Engelhardt 2023-06-01 10:02:30 +02:00
parent 4b986c9c65
commit 0707b911c7

View file

@ -329,7 +329,7 @@ struct ShowWorker
} }
code += stringf("x%d [ shape=record, style=rounded, label=\"", dot_idx) \ code += stringf("x%d [ shape=record, style=rounded, label=\"", dot_idx) \
+ join_label_pieces(label_pieces) + "\" ];\n"; + join_label_pieces(label_pieces) + stringf("\", %s ];\n", nextColor(sig).c_str());
if (!port.empty()) { if (!port.empty()) {
currentColor = xorshift32(currentColor); currentColor = xorshift32(currentColor);
@ -655,6 +655,7 @@ struct ShowPass : public Pass {
log(" -viewer <viewer>\n"); log(" -viewer <viewer>\n");
log(" Run the specified command with the graphics file as parameter.\n"); log(" Run the specified command with the graphics file as parameter.\n");
log(" On Windows, this pauses yosys until the viewer exits.\n"); log(" On Windows, this pauses yosys until the viewer exits.\n");
log(" Use \"-viewer none\" to not run any command.\n");
log("\n"); log("\n");
log(" -format <format>\n"); log(" -format <format>\n");
log(" Generate a graphics file in the specified format. Use 'dot' to just\n"); log(" Generate a graphics file in the specified format. Use 'dot' to just\n");
@ -915,28 +916,30 @@ struct ShowPass : public Pass {
#if defined(YOSYS_DISABLE_SPAWN) #if defined(YOSYS_DISABLE_SPAWN)
log_assert(viewer_exe.empty() && !format.empty()); log_assert(viewer_exe.empty() && !format.empty());
#else #else
if (!viewer_exe.empty()) { if (viewer_exe != "none") {
#ifdef _WIN32 if (!viewer_exe.empty()) {
// system()/cmd.exe does not understand single quotes nor #ifdef _WIN32
// background tasks on Windows. So we have to pause yosys // system()/cmd.exe does not understand single quotes nor
// until the viewer exits. // background tasks on Windows. So we have to pause yosys
std::string cmd = stringf("%s \"%s\"", viewer_exe.c_str(), out_file.c_str()); // until the viewer exits.
#else std::string cmd = stringf("%s \"%s\"", viewer_exe.c_str(), out_file.c_str());
std::string cmd = stringf("%s '%s' %s", viewer_exe.c_str(), out_file.c_str(), background.c_str()); #else
#endif std::string cmd = stringf("%s '%s' %s", viewer_exe.c_str(), out_file.c_str(), background.c_str());
log("Exec: %s\n", cmd.c_str()); #endif
if (run_command(cmd) != 0) log("Exec: %s\n", cmd.c_str());
log_cmd_error("Shell command failed!\n"); if (run_command(cmd) != 0)
} else log_cmd_error("Shell command failed!\n");
if (format.empty()) { } else
#ifdef __APPLE__ if (format.empty()) {
std::string cmd = stringf("ps -fu %d | grep -q '[ ]%s' || xdot '%s' %s", getuid(), dot_file.c_str(), dot_file.c_str(), background.c_str()); #ifdef __APPLE__
#else std::string cmd = stringf("ps -fu %d | grep -q '[ ]%s' || xdot '%s' %s", getuid(), dot_file.c_str(), dot_file.c_str(), background.c_str());
std::string cmd = stringf("{ test -f '%s.pid' && fuser -s '%s.pid' 2> /dev/null; } || ( echo $$ >&3; exec xdot '%s'; ) 3> '%s.pid' %s", dot_file.c_str(), dot_file.c_str(), dot_file.c_str(), dot_file.c_str(), background.c_str()); #else
#endif std::string cmd = stringf("{ test -f '%s.pid' && fuser -s '%s.pid' 2> /dev/null; } || ( echo $$ >&3; exec xdot '%s'; ) 3> '%s.pid' %s", dot_file.c_str(), dot_file.c_str(), dot_file.c_str(), dot_file.c_str(), background.c_str());
log("Exec: %s\n", cmd.c_str()); #endif
if (run_command(cmd) != 0) log("Exec: %s\n", cmd.c_str());
log_cmd_error("Shell command failed!\n"); if (run_command(cmd) != 0)
log_cmd_error("Shell command failed!\n");
}
} }
#endif #endif