Modified the new search for files of $readmem[hb] to be backward compatible

Signed-off-by: Rodrigo Alejandro Melo <rodrigomelo9@gmail.com>
This commit is contained in:
Rodrigo Alejandro Melo 2020-01-31 22:10:51 -03:00
parent 7b3fe404ab
commit d74b9604e3
1 changed files with 7 additions and 3 deletions

View File

@ -2887,9 +2887,13 @@ AstNode *AstNode::readmem(bool is_readmemh, std::string mem_filename, AstNode *m
std::ifstream f;
std::string path = filename.substr(0, filename.find_last_of("\\/")+1);
f.open(mem_filename.c_str());
if (f.fail()) {
f.open(path + mem_filename.c_str());
yosys_input_files.insert(path + mem_filename);
} else {
yosys_input_files.insert(mem_filename);
}
if (f.fail())
log_file_error(filename, linenum, "Can not open file `%s` for %s.\n", mem_filename.c_str(), str.c_str());