3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-10-11 02:08:08 +00:00
This commit is contained in:
Emil J 2025-10-08 13:37:04 +13:00 committed by GitHub
commit cf766acb23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 28 additions and 30 deletions

View file

@ -30,6 +30,7 @@
#include "libs/sha1/sha1.h"
#include "frontends/verilog/verilog_frontend.h"
#include "ast.h"
#include "kernel/io.h"
#include <sstream>
#include <stdarg.h>
@ -4474,12 +4475,7 @@ std::unique_ptr<AstNode> AstNode::readmem(bool is_readmemh, std::string mem_file
std::ifstream f;
f.open(mem_filename.c_str());
if (f.fail()) {
#ifdef _WIN32
char slash = '\\';
#else
char slash = '/';
#endif
std::string path = location.begin.filename->substr(0, location.begin.filename->find_last_of(slash)+1);
std::string path = parent_from_file_path(*location.begin.filename);
f.open(path + mem_filename.c_str());
yosys_input_files.insert(path + mem_filename);
} else {

View file

@ -895,11 +895,7 @@ frontend_verilog_preproc(std::istream &f,
// if the include file was not found, it is not given with an absolute path, and the
// currently read file is given with a path, then try again relative to its directory
ff.clear();
#ifdef _WIN32
fixed_fn = filename.substr(0, filename.find_last_of("/\\")+1) + fn;
#else
fixed_fn = filename.substr(0, filename.rfind('/')+1) + fn;
#endif
fixed_fn = parent_from_file_path(filename) + fn;
ff.open(fixed_fn);
}
if (ff.fail() && fn.size() > 0 && fn_relative) {