diff options
author | Zachary Snow <zach@zachjs.com> | 2021-06-22 10:39:57 -0400 |
---|---|---|
committer | Zachary Snow <zachary.j.snow@gmail.com> | 2021-07-15 11:57:20 -0400 |
commit | a9c8ca21d583c58a38931389f90bbaae0caec0d6 (patch) | |
tree | eab021de70957cf08a44d296fbf63b29e3a3e9e7 /frontends/ast/genrtlil.cc | |
parent | 1aab608cffa19332dc5cf722def7413b16f5ee54 (diff) | |
download | yosys-a9c8ca21d583c58a38931389f90bbaae0caec0d6.tar.gz yosys-a9c8ca21d583c58a38931389f90bbaae0caec0d6.tar.bz2 yosys-a9c8ca21d583c58a38931389f90bbaae0caec0d6.zip |
sv: fix two struct access bugs
- preserve signedness of struct members
- fix initial width detection of struct members (e.g., in case expressions)
Diffstat (limited to 'frontends/ast/genrtlil.cc')
-rw-r--r-- | frontends/ast/genrtlil.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc index e6f7b30c1..29d0bddef 100644 --- a/frontends/ast/genrtlil.cc +++ b/frontends/ast/genrtlil.cc @@ -812,6 +812,10 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun this_width = id_ast->children[0]->range_left - id_ast->children[0]->range_right + 1; if (children.size() > 1) range = children[1]; + } else if (id_ast->type == AST_STRUCT_ITEM) { + AstNode *tmp_range = make_struct_member_range(this, id_ast); + this_width = tmp_range->range_left - tmp_range->range_right + 1; + delete tmp_range; } else log_file_error(filename, location.first_line, "Failed to detect width for identifier %s!\n", str.c_str()); if (range) { |