mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-22 13:53:40 +00:00
Added support for dump -append
This commit is contained in:
parent
1fb8ba73bd
commit
968ae31cac
1 changed files with 12 additions and 3 deletions
|
@ -409,13 +409,16 @@ struct DumpPass : public Pass {
|
||||||
log(" only dump the module headers if the entire module is selected\n");
|
log(" only dump the module headers if the entire module is selected\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" -outfile <filename>\n");
|
log(" -outfile <filename>\n");
|
||||||
log(" Write to the specified file.\n");
|
log(" write to the specified file.\n");
|
||||||
|
log("\n");
|
||||||
|
log(" -append <filename>\n");
|
||||||
|
log(" like -outfile but append instead of overwrite\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
}
|
}
|
||||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
bool flag_m = false, flag_n = false;
|
bool flag_m = false, flag_n = false, append = false;
|
||||||
|
|
||||||
size_t argidx;
|
size_t argidx;
|
||||||
for (argidx = 1; argidx < args.size(); argidx++)
|
for (argidx = 1; argidx < args.size(); argidx++)
|
||||||
|
@ -423,6 +426,12 @@ struct DumpPass : public Pass {
|
||||||
std::string arg = args[argidx];
|
std::string arg = args[argidx];
|
||||||
if (arg == "-outfile" && argidx+1 < args.size()) {
|
if (arg == "-outfile" && argidx+1 < args.size()) {
|
||||||
filename = args[++argidx];
|
filename = args[++argidx];
|
||||||
|
append = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (arg == "-append" && argidx+1 < args.size()) {
|
||||||
|
filename = args[++argidx];
|
||||||
|
append = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg == "-m") {
|
if (arg == "-m") {
|
||||||
|
@ -442,7 +451,7 @@ struct DumpPass : public Pass {
|
||||||
size_t buf_size;
|
size_t buf_size;
|
||||||
|
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
f = fopen(filename.c_str(), "w");
|
f = fopen(filename.c_str(), append ? "a" : "w");
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
log_error("Can't open file `%s' for writing: %s\n", filename.c_str(), strerror(errno));
|
log_error("Can't open file `%s' for writing: %s\n", filename.c_str(), strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue