File tree Expand file tree Collapse file tree 4 files changed +35
-2
lines changed Expand file tree Collapse file tree 4 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ IREP_ID_ONE(inst)
78
78
IREP_ID_ONE (Verilog )
79
79
IREP_ID_ONE (verilog_array_range )
80
80
IREP_ID_ONE (verilog_assignment_pattern )
81
+ IREP_ID_ONE (verilog_associative_array )
81
82
IREP_ID_ONE (verilog_declarations )
82
83
IREP_ID_ONE (verilog_lifetime )
83
84
IREP_ID_ONE (verilog_logical_equality )
Original file line number Diff line number Diff line change @@ -2000,6 +2000,24 @@ packed_dimension:
2000
2000
| unsized_dimension
2001
2001
;
2002
2002
2003
+ associative_dimension:
2004
+ ' [' data_type ' ]'
2005
+ { init ($$, ID_verilog_associative_array);
2006
+ // for the element type
2007
+ stack_type ($$).add_subtype ().make_nil ();
2008
+ }
2009
+ | ' [' ' *' ' ]'
2010
+ { init ($$, ID_verilog_associative_array);
2011
+ // for the element type
2012
+ stack_type ($$).add_subtype ().make_nil ();
2013
+ }
2014
+ | " [*" ' ]'
2015
+ { init ($$, ID_verilog_associative_array);
2016
+ // for the element type
2017
+ stack_type ($$).add_subtype ().make_nil ();
2018
+ }
2019
+ ;
2020
+
2003
2021
unpacked_dimension:
2004
2022
' [' const_expression TOK_COLON const_expression ' ]'
2005
2023
{ init ($$, ID_verilog_unpacked_array);
@@ -2018,6 +2036,7 @@ unpacked_dimension:
2018
2036
variable_dimension:
2019
2037
unsized_dimension
2020
2038
| unpacked_dimension
2039
+ | associative_dimension
2021
2040
;
2022
2041
2023
2042
variable_dimension_brace:
Original file line number Diff line number Diff line change @@ -210,6 +210,13 @@ typet verilog_typecheck_exprt::elaborate_type(const typet &src)
210
210
return rec;
211
211
}
212
212
}
213
+ else if (src.id () == ID_verilog_associative_array)
214
+ {
215
+ // The subtype is the element type.
216
+ auto tmp = to_type_with_subtype (src);
217
+ tmp.subtype () = elaborate_type (tmp.subtype ());
218
+ return std::move (tmp);
219
+ }
213
220
else if (src.id () == ID_verilog_byte)
214
221
{
215
222
// two-valued type, signed
Original file line number Diff line number Diff line change @@ -33,10 +33,16 @@ typet verilog_declaratort::merged_type(const typet &declaration_type) const
33
33
typet result = type ();
34
34
typet *p = &result;
35
35
36
- while (p->id () == ID_verilog_unpacked_array)
36
+ while (p->id () == ID_verilog_unpacked_array ||
37
+ p->id () == ID_verilog_associative_array)
38
+ {
37
39
p = &to_type_with_subtype (*p).subtype ();
40
+ }
41
+
42
+ DATA_INVARIANT (
43
+ p->is_nil (),
44
+ " merged_type only works on unpacked arrays and associative arrays" );
38
45
39
- DATA_INVARIANT (p->is_nil (), " merged_type only works on unpacked arrays" );
40
46
*p = declaration_type;
41
47
42
48
return result;
You can’t perform that action at this time.
0 commit comments