Merge branch 'YosysHQ:main' into main

This commit is contained in:
Akash Levy 2025-05-01 08:40:31 -07:00 committed by GitHub
commit d2aa569d8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 14 additions and 13 deletions

View File

@ -176,7 +176,7 @@ ifeq ($(OS), Haiku)
CXXFLAGS += -D_DEFAULT_SOURCE
endif
YOSYS_VER := 0.52+117
YOSYS_VER := 0.52+137
YOSYS_MAJOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f1)
YOSYS_MINOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f2)
YOSYS_COMMIT := $(shell echo $(YOSYS_VER) | cut -d'.' -f3)
@ -847,7 +847,7 @@ $(PROGRAM_PREFIX)yosys-config: misc/yosys-config.in $(YOSYS_SRC)/Makefile
.PHONY: check-git-abc
check-git-abc:
@if [ ! -d "$(YOSYS_SRC)/abc" ]; then \
@if [ ! -d "$(YOSYS_SRC)/abc" ] && git -C "$(YOSYS_SRC)" status >/dev/null 2>&1; then \
echo "Error: The 'abc' directory does not exist."; \
echo "Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \
exit 1; \
@ -873,6 +873,12 @@ check-git-abc:
echo "3. Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \
echo "4. Reapply your changes: Move your saved changes back to the 'abc' directory, if necessary."; \
exit 1; \
elif ! git -C "$(YOSYS_SRC)" status >/dev/null 2>&1; then \
echo "$(realpath $(YOSYS_SRC)) is not configured as a git repository, and 'abc' folder is missing."; \
echo "If you already have ABC, set 'ABCEXTERNAL' make variable to point to ABC executable."; \
echo "Otherwise, download release archive 'yosys.tar.gz' from https://github.com/YosysHQ/yosys/releases."; \
echo " ('Source code' archive does not contain submodules.)"; \
exit 1; \
else \
echo "Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \
exit 1; \

View File

@ -100,11 +100,12 @@ gzip_istream::ibuf::~ibuf() {
// Takes a successfully opened ifstream. If it's gzipped, returns an istream. Otherwise,
// returns the original ifstream, rewound to the start.
// Never returns nullptr or failed state istream*
std::istream* uncompressed(const std::string filename, std::ios_base::openmode mode) {
std::ifstream* f = new std::ifstream();
f->open(filename, mode);
if (f->fail())
return f;
log_cmd_error("Can't open input file `%s' for reading: %s\n", filename.c_str(), strerror(errno));
// Check for gzip magic
unsigned char magic[3];
int n = 0;
@ -124,7 +125,7 @@ std::istream* uncompressed(const std::string filename, std::ios_base::openmode m
filename.c_str(), unsigned(magic[2]));
gzip_istream* s = new gzip_istream();
delete f;
s->open(filename.c_str());
log_assert(s->open(filename.c_str()));
return s;
#else
log_cmd_error("File `%s' is a gzip file, but Yosys is compiled without zlib.\n", filename.c_str());

View File

@ -472,8 +472,6 @@ void Frontend::extra_args(std::istream *&f, std::string &filename, std::vector<s
yosys_input_files.insert(filename);
f = uncompressed(filename, bin_input ? std::ifstream::binary : std::ifstream::in);
}
if (f == NULL)
log_cmd_error("Can't open input file `%s' for reading: %s\n", filename.c_str(), strerror(errno));
for (size_t i = argidx+1; i < args.size(); i++)
if (args[i].compare(0, 1, "-") == 0)

View File

@ -349,8 +349,6 @@ void read_liberty_cellarea(dict<IdString, cell_area_t> &cell_area, string libert
{
std::istream* f = uncompressed(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, liberty_file);
delete f;

View File

@ -72,7 +72,9 @@ 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);
auto path = args[++argidx];
rewrite_filename(path);
FILE *f = fopen(path.c_str(), open_mode);
yosys_input_files.insert(args[argidx]);
if (f == NULL) {
for (auto cf : files_to_close)

View File

@ -310,8 +310,6 @@ struct ClockgatePass : public Pass {
LibertyMergedCells merged;
for (auto path : liberty_files) {
std::istream* f = uncompressed(path);
if (f->fail())
log_cmd_error("Can't open liberty file `%s': %s\n", path.c_str(), strerror(errno));
LibertyParser p(*f, path);
merged.merge(p);
delete f;

View File

@ -635,8 +635,6 @@ struct DfflibmapPass : public Pass {
LibertyMergedCells merged;
for (auto path : liberty_files) {
std::istream* f = uncompressed(path);
if (f->fail())
log_cmd_error("Can't open liberty file `%s': %s\n", path.c_str(), strerror(errno));
LibertyParser p(*f, path);
merged.merge(p);
delete f;