From 6c6f7f8ae90a7520449b28d37e367220edf28edf Mon Sep 17 00:00:00 2001 From: Todd Strader Date: Wed, 1 Apr 2020 15:48:15 -0400 Subject: [PATCH] Tests for dynamic arrays, assosicative arrays and queues --- test_regress/t/t_type_comparison.v | 32 ++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/test_regress/t/t_type_comparison.v b/test_regress/t/t_type_comparison.v index 74e1b56fc..ba40f3574 100644 --- a/test_regress/t/t_type_comparison.v +++ b/test_regress/t/t_type_comparison.v @@ -67,6 +67,20 @@ module t(); const int int_c; + integer string_to_integer_1[string]; + integer string_to_integer_2[string]; + integer int_to_integer[int]; + + int dyn_1 []; + int dyn_2 []; + real dyn_3 []; + int dyn_4 [] []; + int dyn_5 [] []; + + int queue_1 [$]; + int queue_2 [$]; + real queue_3 [$]; + // From 6.22.1 (mostly) typedef bit node; // 'bit' and 'node' are matching types typedef node type1; @@ -108,6 +122,12 @@ module t(); bit should_be_true; initial begin + // size of non-fixed-length arrays does not matter for type matching + string_to_integer_2["foo"] = 5; + dyn_1 = new[100]; + dyn_2[3] = 7; + queue_1.push_front(8); + if (type(shortint) != type(shortint_v)) $stop(); if (type(int) != type(int_v)) $stop(); if (type(longint) != type(longint_v)) $stop(); @@ -117,6 +137,14 @@ module t(); if (type(reg) != type(reg_v)) $stop(); if (type(integer) != type(integer_v)) $stop(); if (type(time) != type(time_v)) $stop(); + if (type(string_to_integer_1) != type(string_to_integer_2)) $stop(); + if (type(string_to_integer_1) == type(int_to_integer)) $stop(); + if (type(dyn_1) != type(dyn_2)) $stop(); + if (type(dyn_1) == type(dyn_3)) $stop(); + if (type(dyn_1) == type(dyn_4)) $stop(); + if (type(dyn_4) != type(dyn_5)) $stop(); + if (type(queue_1) != type(queue_2)) $stop(); + if (type(queue_1) == type(queue_3)) $stop(); if (type(bit) != type(node)) $stop(); if (type(type1) != type(type2)) $stop(); if (type(AB1) != type(AB2)) $stop(); @@ -142,10 +170,6 @@ module t(); // TODO -- the rest // TODO -- case statement // TODO -- generate case - // TODO -- test associative arrays - // TODO -- test dynamic arrays - // TODO -- test unsized arrays - // TODO -- test queues if (type(shortint) !== type(shortint_v)) $stop(); if (type(int) === type(shortint_v)) $stop();