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
22associative_array1.sv
33
4- ^EXIT=0$
4+ ^no properties$
5+ ^EXIT=10$
56^SIGNAL=0$
67--
78--
8- Parsing fails.
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ IREP_ID_ONE(inst)
7878IREP_ID_ONE (Verilog )
7979IREP_ID_ONE (verilog_array_range )
8080IREP_ID_ONE (verilog_assignment_pattern )
81+ IREP_ID_ONE (verilog_associative_array )
8182IREP_ID_ONE (verilog_declarations )
8283IREP_ID_ONE (verilog_lifetime )
8384IREP_ID_ONE (verilog_logical_equality )
Original file line number Diff line number Diff line change @@ -2055,6 +2055,24 @@ packed_dimension:
20552055 | unsized_dimension
20562056 ;
20572057
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+
20582076unpacked_dimension:
20592077 ' [' const_expression TOK_COLON const_expression ' ]'
20602078 { init ($$, ID_verilog_unpacked_array);
@@ -2073,6 +2091,7 @@ unpacked_dimension:
20732091variable_dimension:
20742092 unsized_dimension
20752093 | unpacked_dimension
2094+ | associative_dimension
20762095 ;
20772096
20782097variable_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)
210210 return rec;
211211 }
212212 }
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+ }
213220 else if (src.id () == ID_verilog_byte)
214221 {
215222 // 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
3333 typet result = type ();
3434 typet *p = &result;
3535
36- while (p->id () == ID_verilog_unpacked_array)
36+ while (p->id () == ID_verilog_unpacked_array ||
37+ p->id () == ID_verilog_associative_array)
38+ {
3739 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" );
3845
39- DATA_INVARIANT (p->is_nil (), " merged_type only works on unpacked arrays" );
4046 *p = declaration_type;
4147
4248 return result;
You can’t perform that action at this time.
0 commit comments