diff --git a/test_regress/t/t_type_comparison.v b/test_regress/t/t_type_comparison.v index ce957dd8c..80bc98306 100644 --- a/test_regress/t/t_type_comparison.v +++ b/test_regress/t/t_type_comparison.v @@ -46,4 +46,46 @@ module t(); .a_type (logic[7:0]), .b_type (real)) the_foo (); + // From 6.22.1 (mostly) + typedef bit node; // 'bit' and 'node' are matching types + typedef node type1; + typedef type1 type2; // 'type1' and 'type2' are matching types + + struct packed {int A; int B;} AB1, AB2; // AB1, AB2 have matching types + struct packed {int A; int B;} AB3; // the type of AB3 does not match + // the type of AB1 + + typedef struct packed {int A; int B;} AB_t; + AB_t AB4; AB_t AB5; // AB4 and AB5 have matching types + typedef struct packed {int A; int B;} otherAB_t; + otherAB_t AB6; // the type of AB6 does not match the type of AB4 or AB5 + + typedef bit signed [7:0] BYTE; // matches the byte type + /* verilator lint_off LITENDIAN */ + typedef bit signed [0:7] ETYB; // does not match the byte type + /* verilator lint_on LITENDIAN */ + + typedef byte MEM_BYTES [256]; + typedef bit signed [7:0] MY_MEM_BYTES [256]; // MY_MEM_BYTES matches + // MEM_BYTES + typedef logic [1:0] [3:0] NIBBLES; + typedef logic [7:0] MY_BYTE; // MY_BYTE and NIBBLES are not matching types + typedef logic MD_ARY [][2:0]; + typedef logic MD_ARY_TOO [][0:2]; // Does not match MD_ARY + + typedef byte signed MY_CHAR; // MY_CHAR matches the byte type + + // TODO -- this (6.22.1 h) + //import the_pkg::*; + + initial begin + if (type(bit) != type(node)) $stop(); + if (type(type1) != type(type2)) $stop(); + if (type(AB1) != type(AB2)) $stop(); + if (type(AB3) == type(AB1)) $stop(); + // TODO -- the rest + // TODO -- case equal/not equal, ===, !=== + end + + endmodule