File tree Expand file tree Collapse file tree 5 files changed +20
-11
lines changed Expand file tree Collapse file tree 5 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,11 @@ IREP_ID_ONE(wire)
106
106
IREP_ID_ONE (uwire )
107
107
IREP_ID_ONE (wand )
108
108
IREP_ID_ONE (automatic )
109
- IREP_ID_ONE (verilog_enum )
110
109
IREP_ID_TWO (C_verilog_type , #verilog_type )
110
+ IREP_ID_ONE (verilog_enum )
111
+ IREP_ID_ONE (verilog_packed_array )
111
112
IREP_ID_ONE (verilog_type_reference )
113
+ IREP_ID_ONE (verilog_unpacked_array )
112
114
IREP_ID_ONE (enum_names )
113
115
IREP_ID_ONE (var )
114
116
IREP_ID_ONE (trireg )
Original file line number Diff line number Diff line change @@ -1202,7 +1202,7 @@ list_of_net_names:
1202
1202
{ $$ =$1 ; mto($$ , $3 ); }
1203
1203
;
1204
1204
1205
- net_name : net_identifier packed_dimension_brace
1205
+ net_name : net_identifier unpacked_dimension_brace
1206
1206
{
1207
1207
$$ =$1 ;
1208
1208
stack_expr ($$).id(ID_declarator);
@@ -1707,7 +1707,7 @@ packed_dimension_opt:
1707
1707
1708
1708
packed_dimension :
1709
1709
' [' const_expression TOK_COLON const_expression ' ]'
1710
- { init($$ , ID_array );
1710
+ { init($$ , ID_verilog_packed_array );
1711
1711
stack_type ($$).add_subtype().make_nil();
1712
1712
exprt &range=static_cast <exprt &>(stack_type($$ ).add(ID_range));
1713
1713
range.add_to_operands(stack_expr($2 ));
@@ -1717,13 +1717,14 @@ packed_dimension:
1717
1717
1718
1718
unpacked_dimension :
1719
1719
' [' const_expression TOK_COLON const_expression ' ]'
1720
- { init($$ , ID_array );
1720
+ { init($$ , ID_verilog_unpacked_array );
1721
1721
stack_type ($$).add_subtype().make_nil();
1722
1722
exprt &range=static_cast <exprt &>(stack_type($$ ).add(ID_range));
1723
1723
range.add_to_operands(stack_expr($2 ));
1724
1724
range.add_to_operands(stack_expr($4 )); }
1725
1725
| ' [' expression ' ]'
1726
- { init($$ , ID_array);
1726
+ { // starts at index 0
1727
+ init ($$, ID_verilog_unpacked_array);
1727
1728
stack_type ($$).add_subtype().make_nil();
1728
1729
stack_type ($$).set(ID_size, std::move(stack_expr($2 )));
1729
1730
}
Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ void verilog_typecheckt::collect_symbols(const verilog_declt &decl)
222
222
223
223
if (declarator.type ().is_nil ())
224
224
symbol.type = type;
225
- else if (declarator.type ().id () == ID_array )
225
+ else if (declarator.type ().id () == ID_verilog_unpacked_array )
226
226
symbol.type = array_type (declarator.type (), type);
227
227
else
228
228
{
@@ -401,7 +401,7 @@ void verilog_typecheckt::collect_symbols(const verilog_declt &decl)
401
401
402
402
if (declarator.type ().is_nil ())
403
403
symbol.type = type;
404
- else if (declarator.type ().id () == ID_array )
404
+ else if (declarator.type ().id () == ID_verilog_unpacked_array )
405
405
symbol.type = array_type (declarator.type (), type);
406
406
else
407
407
{
@@ -468,7 +468,7 @@ void verilog_typecheckt::collect_symbols(const verilog_declt &decl)
468
468
469
469
if (declarator.type ().is_nil ())
470
470
symbol.type = type;
471
- else if (declarator.type ().id () == ID_array )
471
+ else if (declarator.type ().id () == ID_verilog_unpacked_array )
472
472
symbol.type = array_type (declarator.type (), type);
473
473
else
474
474
{
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ array_typet verilog_typecheckt::array_type(
44
44
{
45
45
// int whatnot[x:y];
46
46
// 'src' is yet to be converted, but 'element_type' is already converted.
47
- PRECONDITION (src.id () == ID_array );
47
+ PRECONDITION (src.id () == ID_verilog_unpacked_array );
48
48
49
49
// Unpacked arrays may have a range [x:y],
50
50
// or a size [s], equivalent to [0:s-1]
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ typet verilog_typecheck_exprt::convert_type(const typet &src)
115
115
result.set (ID_C_identifier, enum_type.identifier ());
116
116
return result.with_source_location (source_location);
117
117
}
118
- else if (src.id () == ID_array )
118
+ else if (src.id () == ID_verilog_packed_array )
119
119
{
120
120
const exprt &range=static_cast <const exprt &>(src.find (ID_range));
121
121
@@ -151,7 +151,8 @@ typet verilog_typecheck_exprt::convert_type(const typet &src)
151
151
}
152
152
else
153
153
{
154
- // we have a genuine array, and do a recursive call
154
+ // We have a multi-dimensional packed array,
155
+ // and do a recursive call.
155
156
const exprt size=from_integer (width, integer_typet ());
156
157
typet s=convert_type (subtype);
157
158
@@ -162,6 +163,11 @@ typet verilog_typecheck_exprt::convert_type(const typet &src)
162
163
return std::move (result).with_source_location (source_location);
163
164
}
164
165
}
166
+ else if (src.id () == ID_verilog_unpacked_array)
167
+ {
168
+ // not expected here -- these stick to the declarators
169
+ PRECONDITION (false );
170
+ }
165
171
else if (src.id () == ID_verilog_type_reference)
166
172
{
167
173
auto &type_reference = to_verilog_type_reference (src);
You can’t perform that action at this time.
0 commit comments