@@ -1060,20 +1060,24 @@ void verilog_synthesist::assignment_rec(
1060
1060
const exprt &lhs_index = part_select.index ();
1061
1061
const exprt &lhs_width = part_select.width ();
1062
1062
1063
- mp_integer index , width ;
1063
+ auto index_opt = synthesis_constant (lhs_index) ;
1064
1064
1065
- if (to_integer_non_constant (lhs_index, index ))
1065
+ if (!index_opt. has_value ( ))
1066
1066
{
1067
1067
throw errort ().with_location (lhs_index.source_location ())
1068
1068
<< " failed to convert part select index" ;
1069
1069
}
1070
1070
1071
- if (to_integer_non_constant (lhs_width, width))
1071
+ auto width_opt = synthesis_constant (lhs_width);
1072
+
1073
+ if (!width_opt.has_value ())
1072
1074
{
1073
1075
throw errort ().with_location (lhs_width.source_location ())
1074
1076
<< " failed to convert part select width" ;
1075
1077
}
1076
1078
1079
+ mp_integer index = *index_opt, width = *width_opt;
1080
+
1077
1081
// turn
1078
1082
// a[i]=e
1079
1083
// into
@@ -1325,14 +1329,16 @@ void verilog_synthesist::assignment_member_rec(
1325
1329
const exprt &lhs_index = part_select.index ();
1326
1330
const exprt &lhs_width = part_select.width ();
1327
1331
1328
- mp_integer index , width ;
1332
+ auto index_opt = synthesis_constant (lhs_index) ;
1329
1333
1330
- if (to_integer_non_constant (lhs_index, index ))
1334
+ if (!index_opt. has_value ( ))
1331
1335
{
1332
1336
throw errort ().with_location (lhs_index.source_location ())
1333
1337
<< " failed to convert part select index" ;
1334
1338
}
1335
1339
1340
+ mp_integer index = index_opt.value (), width;
1341
+
1336
1342
if (to_integer_non_constant (lhs_width, width))
1337
1343
{
1338
1344
throw errort ().with_location (lhs_width.source_location ())
0 commit comments