3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-21 13:23:40 +00:00

sv: fix two struct access bugs

- preserve signedness of struct members
- fix initial width detection of struct members (e.g., in case expressions)
This commit is contained in:
Zachary Snow 2021-06-22 10:39:57 -04:00 committed by Zachary Snow
parent 1aab608cff
commit a9c8ca21d5
5 changed files with 102 additions and 1 deletions

View file

@ -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) {