systemverilog-plugin: only convert custom ranges when they exist This prevents overriding previously correctly set ranges Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
diff --git a/systemverilog-plugin/UhdmAst.cc b/systemverilog-plugin/UhdmAst.cc index 1d9689e..4292cfc 100644 --- a/systemverilog-plugin/UhdmAst.cc +++ b/systemverilog-plugin/UhdmAst.cc
@@ -1199,7 +1199,9 @@ break; case AST::AST_STRUCT_ITEM: AST_INTERNAL::current_scope[current_node->str] = current_node; - convert_packed_unpacked_range(current_node); + if (current_node->attributes.count(UhdmAst::packed_ranges()) || current_node->attributes.count(UhdmAst::unpacked_ranges())) { + convert_packed_unpacked_range(current_node); + } while (simplify(current_node, true, false, false, 1, -1, false, false)) { }; break;