aboutsummaryrefslogtreecommitdiffstats
path: root/frontends
diff options
context:
space:
mode:
authorRodrigo Alejandro Melo <rodrigomelo9@gmail.com>2020-01-31 22:10:51 -0300
committerRodrigo Alejandro Melo <rodrigomelo9@gmail.com>2020-01-31 22:10:51 -0300
commitd74b9604e332fc89bd314f6df0d909f91f0db04a (patch)
treeb71819d6d8b525cd3c22ff9c32a250469c3ff22c /frontends
parent7b3fe404ab30767a8b65f61fa2a6eebbe9019641 (diff)
downloadyosys-d74b9604e332fc89bd314f6df0d909f91f0db04a.tar.gz
yosys-d74b9604e332fc89bd314f6df0d909f91f0db04a.tar.bz2
yosys-d74b9604e332fc89bd314f6df0d909f91f0db04a.zip
Modified the new search for files of $readmem[hb] to be backward compatible
Signed-off-by: Rodrigo Alejandro Melo <rodrigomelo9@gmail.com>
Diffstat (limited to 'frontends')
-rw-r--r--frontends/ast/simplify.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index f7364b9a8..4f105eed6 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -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(path + mem_filename.c_str());
- yosys_input_files.insert(mem_filename);
-
+ 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());