dfflibmap: allow gzipped liberty files

This commit is contained in:
Emil J. Tywoniak 2025-01-03 17:51:38 +01:00
parent 6c55df3467
commit 094ab8c017
1 changed files with 5 additions and 3 deletions

View File

@ -19,6 +19,7 @@
#include "kernel/yosys.h" #include "kernel/yosys.h"
#include "kernel/sigtools.h" #include "kernel/sigtools.h"
#include "kernel/gzip.h"
#include "libparse.h" #include "libparse.h"
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -632,11 +633,12 @@ struct DfflibmapPass : public Pass {
for (auto path : liberty_files) { for (auto path : liberty_files) {
std::ifstream f; std::ifstream f;
f.open(path.c_str()); f.open(path.c_str());
if (f.fail()) std::istream* ff = uncompressed(&f, path);
if (ff->fail())
log_cmd_error("Can't open liberty file `%s': %s\n", path.c_str(), strerror(errno)); log_cmd_error("Can't open liberty file `%s': %s\n", path.c_str(), strerror(errno));
LibertyParser p(f); LibertyParser p(*ff);
merged.merge(p); merged.merge(p);
f.close(); delete ff;
} }
find_cell(merged.cells, ID($_DFF_N_), false, false, false, false, false, false, dont_use_cells); find_cell(merged.cells, ID($_DFF_N_), false, false, false, false, false, false, dont_use_cells);