mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-13 03:00:21 +00:00
Add support for "yosys -E"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
446ccf1f05
commit
a96c775a73
13 changed files with 53 additions and 4 deletions
|
@ -835,6 +835,7 @@ struct QwpPass : public Pass {
|
|||
}
|
||||
if (args[argidx] == "-dump" && argidx+1 < args.size()) {
|
||||
config.dump_file.open(args[++argidx], std::ofstream::trunc);
|
||||
yosys_output_files.insert(args[argidx]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1263,6 +1263,7 @@ struct SelectPass : public Pass {
|
|||
log_cmd_error("Option -read can not be combined with a selection expression.\n");
|
||||
|
||||
std::ifstream f(read_file);
|
||||
yosys_input_files.insert(read_file);
|
||||
if (f.fail())
|
||||
log_error("Can't open '%s' for reading: %s\n", read_file.c_str(), strerror(errno));
|
||||
|
||||
|
@ -1331,6 +1332,7 @@ struct SelectPass : public Pass {
|
|||
FILE *f = NULL;
|
||||
if (!write_file.empty()) {
|
||||
f = fopen(write_file.c_str(), "w");
|
||||
yosys_output_files.insert(write_file);
|
||||
if (f == NULL)
|
||||
log_error("Can't open '%s' for writing: %s\n", write_file.c_str(), strerror(errno));
|
||||
}
|
||||
|
|
|
@ -681,6 +681,7 @@ struct ShowPass : public Pass {
|
|||
bool flag_enum = false;
|
||||
bool flag_abbreviate = true;
|
||||
bool flag_notitle = false;
|
||||
bool custom_prefix = false;
|
||||
RTLIL::IdString colorattr;
|
||||
|
||||
size_t argidx;
|
||||
|
@ -697,6 +698,7 @@ struct ShowPass : public Pass {
|
|||
}
|
||||
if (arg == "-prefix" && argidx+1 < args.size()) {
|
||||
prefix = args[++argidx];
|
||||
custom_prefix = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-color" && argidx+2 < args.size()) {
|
||||
|
@ -782,6 +784,7 @@ struct ShowPass : public Pass {
|
|||
for (auto filename : libfiles) {
|
||||
std::ifstream f;
|
||||
f.open(filename.c_str());
|
||||
yosys_input_files.insert(filename);
|
||||
if (f.fail())
|
||||
log_error("Can't open lib file `%s'.\n", filename.c_str());
|
||||
RTLIL::Design *lib = new RTLIL::Design;
|
||||
|
@ -797,6 +800,8 @@ struct ShowPass : public Pass {
|
|||
|
||||
log("Writing dot description to `%s'.\n", dot_file.c_str());
|
||||
FILE *f = fopen(dot_file.c_str(), "w");
|
||||
if (custom_prefix)
|
||||
yosys_output_files.insert(dot_file);
|
||||
if (f == NULL) {
|
||||
for (auto lib : libs)
|
||||
delete lib;
|
||||
|
|
|
@ -190,6 +190,7 @@ void read_liberty_cellarea(dict<IdString, double> &cell_area, string liberty_fil
|
|||
{
|
||||
std::ifstream f;
|
||||
f.open(liberty_file.c_str());
|
||||
yosys_input_files.insert(liberty_file);
|
||||
if (f.fail())
|
||||
log_cmd_error("Can't open liberty file `%s': %s\n", liberty_file.c_str(), strerror(errno));
|
||||
LibertyParser libparser(f);
|
||||
|
|
|
@ -65,6 +65,7 @@ struct TeePass : public Pass {
|
|||
if ((args[argidx] == "-o" || args[argidx] == "-a") && argidx+1 < args.size()) {
|
||||
const char *open_mode = args[argidx] == "-o" ? "w" : "a+";
|
||||
FILE *f = fopen(args[++argidx].c_str(), open_mode);
|
||||
yosys_input_files.insert(args[argidx]);
|
||||
if (f == NULL) {
|
||||
for (auto cf : files_to_close)
|
||||
fclose(cf);
|
||||
|
|
|
@ -67,6 +67,7 @@ struct WriteFileFrontend : public Frontend {
|
|||
extra_args(f, filename, args, argidx);
|
||||
|
||||
FILE *of = fopen(output_filename.c_str(), append_mode ? "a" : "w");
|
||||
yosys_output_files.insert(output_filename);
|
||||
char buffer[64 * 1024];
|
||||
int bytes;
|
||||
|
||||
|
|
|
@ -1095,6 +1095,7 @@ struct TechmapPass : public Pass {
|
|||
std::ifstream f;
|
||||
rewrite_filename(fn);
|
||||
f.open(fn.c_str());
|
||||
yosys_input_files.insert(fn);
|
||||
if (f.fail())
|
||||
log_cmd_error("Can't open map file `%s'\n", fn.c_str());
|
||||
Frontend::frontend_call(map, &f, fn, (fn.size() > 3 && fn.substr(fn.size()-3) == ".il") ? "ilang" : verilog_frontend);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue