Skip to content

Commit bb5d763

Browse files
committed
Check for typedefs before calculating width
Signed-off-by: Wojciech Sipak <[email protected]>
1 parent d852e75 commit bb5d763

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

systemverilog-plugin/third_party/yosys/simplify.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,6 +3127,12 @@ skip_dynamic_range_lvalue_expansion:;
31273127

31283128
// Is this needed?
31293129
//while (simplify(buf, true, false, false, stage, width_hint, sign_hint, false)) { }
3130+
3131+
if (buf->type == Yosys::AST::AST_IDENTIFIER && buf->id2ast && buf->id2ast->type == Yosys::AST::AST_TYPEDEF) {
3132+
// If the identifier points to a typedef, use the type that is stored inside the typedef (children[0]).
3133+
log_assert(buf->id2ast->children.size());
3134+
buf->id2ast = buf->id2ast->children[0];
3135+
}
31303136
buf->detectSignWidth(width_hint, sign_hint);
31313137

31323138
if (buf->type == Yosys::AST::AST_IDENTIFIER) {

0 commit comments

Comments
 (0)