File tree Expand file tree Collapse file tree 5 files changed +38
-5
lines changed
regression/verilog/data-types Expand file tree Collapse file tree 5 files changed +38
-5
lines changed Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
associative_array1.sv
3
3
4
- ^EXIT=0$
4
+ ^no properties$
5
+ ^EXIT=10$
5
6
^SIGNAL=0$
6
7
--
7
8
--
8
- Parsing fails.
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 @@ -2055,6 +2055,24 @@ packed_dimension:
2055
2055
| unsized_dimension
2056
2056
;
2057
2057
2058
+ associative_dimension:
2059
+ ' [' data_type ' ]'
2060
+ { init ($$, ID_verilog_associative_array);
2061
+ // for the element type
2062
+ stack_type ($$).add_subtype ().make_nil ();
2063
+ }
2064
+ | ' [' ' *' ' ]'
2065
+ { init ($$, ID_verilog_associative_array);
2066
+ // for the element type
2067
+ stack_type ($$).add_subtype ().make_nil ();
2068
+ }
2069
+ | " [*" ' ]'
2070
+ { init ($$, ID_verilog_associative_array);
2071
+ // for the element type
2072
+ stack_type ($$).add_subtype ().make_nil ();
2073
+ }
2074
+ ;
2075
+
2058
2076
unpacked_dimension:
2059
2077
' [' const_expression TOK_COLON const_expression ' ]'
2060
2078
{ init ($$, ID_verilog_unpacked_array);
@@ -2073,6 +2091,7 @@ unpacked_dimension:
2073
2091
variable_dimension:
2074
2092
unsized_dimension
2075
2093
| unpacked_dimension
2094
+ | associative_dimension
2076
2095
;
2077
2096
2078
2097
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