3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-14 19:24:45 +00:00

libcache: add -quiet and -verbose

This commit is contained in:
Emil J. Tywoniak 2025-05-09 11:36:39 +02:00
parent f60bbe64ac
commit 0d621ecc11
3 changed files with 30 additions and 6 deletions

View file

@ -29,7 +29,7 @@
{
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n");
log(" libcache {-enable|-disable|-purge} { -all | [path]... }\n");
log(" libcache [-verbose] {-enable|-disable|-purge} { -all | [path]... }\n");
log("\n");
log("Controls the default and per path caching of liberty file data.\n");
log("\n");
@ -47,6 +47,13 @@
log("\n");
log("Displays the current cache settings and cached paths.\n");
log("\n");
log(" libcache {-verbose|-quiet}\n");
log("\n");
log("Controls cache use logging.\n");
log("\n");
log(" -verbose Enable printing info when cache is used\n");
log(" -quiet Disable printing info when cache is used (default)\n");
log("\n");
}
void execute(std::vector<std::string> args, RTLIL::Design *) override
{
@ -55,6 +62,8 @@
bool purge = false;
bool all = false;
bool list = false;
bool verbose = false;
bool quiet = false;
std::vector<std::string> paths;
size_t argidx;
@ -79,16 +88,24 @@
list = true;
continue;
}
if (args[argidx] == "-verbose") {
verbose = true;
continue;
}
if (args[argidx] == "-quiet") {
quiet = true;
continue;
}
std::string fname = args[argidx];
rewrite_filename(fname);
paths.push_back(fname);
break;
}
int modes = enable + disable + purge + list;
int modes = enable + disable + purge + list + verbose + quiet;
if (modes == 0)
log_cmd_error("At least one of -enable, -disable, -purge or -list is required.\n");
log_cmd_error("At least one of -enable, -disable, -purge, -list,\n-verbose, or -quiet is required.\n");
if (modes > 1)
log_cmd_error("Only one of -enable, -disable, -purge or -list may be present.\n");
log_cmd_error("Only one of -enable, -disable, -purge, -list,\n-verbose, or -quiet may be present.\n");
if (all && !paths.empty())
log_cmd_error("The -all option cannot be combined with a list of paths.\n");
@ -121,6 +138,10 @@
LibertyAstCache::instance.cache_path.erase(path);
}
}
} else if (verbose) {
LibertyAstCache::instance.verbose = true;
} else if (quiet) {
LibertyAstCache::instance.verbose = false;
} else {
log_assert(false);
}