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 @@ -1979,6 +1979,24 @@ packed_dimension:
1979
1979
| unsized_dimension
1980
1980
;
1981
1981
1982
+ associative_dimension:
1983
+ ' [' data_type ' ]'
1984
+ { init ($$, ID_verilog_associative_array);
1985
+ // for the element type
1986
+ stack_type ($$).add_subtype ().make_nil ();
1987
+ }
1988
+ | ' [' ' *' ' ]'
1989
+ { init ($$, ID_verilog_associative_array);
1990
+ // for the element type
1991
+ stack_type ($$).add_subtype ().make_nil ();
1992
+ }
1993
+ | " [*" ' ]'
1994
+ { init ($$, ID_verilog_associative_array);
1995
+ // for the element type
1996
+ stack_type ($$).add_subtype ().make_nil ();
1997
+ }
1998
+ ;
1999
+
1982
2000
unpacked_dimension:
1983
2001
' [' const_expression TOK_COLON const_expression ' ]'
1984
2002
{ init ($$, ID_verilog_unpacked_array);
@@ -1997,6 +2015,7 @@ unpacked_dimension:
1997
2015
variable_dimension:
1998
2016
unsized_dimension
1999
2017
| unpacked_dimension
2018
+ | associative_dimension
2000
2019
;
2001
2020
2002
2021
variable_dimension_brace:
Original file line number Diff line number Diff line change @@ -177,6 +177,13 @@ typet verilog_typecheck_exprt::elaborate_type(const typet &src)
177
177
// one bit, unsigned
178
178
return unsignedbv_typet{1 }.with_source_location (source_location);
179
179
}
180
+ else if (src.id () == ID_verilog_associative_array)
181
+ {
182
+ // The subtype is the element type.
183
+ auto tmp = to_type_with_subtype (src);
184
+ tmp.subtype () = elaborate_type (tmp.subtype ());
185
+ return std::move (tmp);
186
+ }
180
187
else if (src.id () == ID_verilog_byte)
181
188
{
182
189
return signedbv_typet{8 }.with_source_location (source_location);
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