From 4c9af1c47a55feff1c3f012eda28e2f23ab33148 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 16 Mar 2022 09:10:52 +0100 Subject: [PATCH] Add regression tests for non-ANSI integer module ports Check that it is possible to declare the type separately from the direction for non-ANSI integer, time and atom2 ports. Check that it is possible to both declare the type before and after the direction. For integer, time and atom2 types the range specification on the port direction declaration should be empty, rather than the implicit packed dimension of the integer type. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/module_nonansi_int1.v | 24 +++++++++++++++++++++++ ivtest/ivltests/module_nonansi_int2.v | 23 ++++++++++++++++++++++ ivtest/ivltests/module_nonansi_integer1.v | 17 ++++++++++++++++ ivtest/ivltests/module_nonansi_integer2.v | 16 +++++++++++++++ ivtest/ivltests/module_nonansi_time1.v | 17 ++++++++++++++++ ivtest/ivltests/module_nonansi_time2.v | 16 +++++++++++++++ ivtest/regress-sv.list | 2 ++ ivtest/regress-vlg.list | 4 ++++ ivtest/regress-vlog95.list | 2 ++ 9 files changed, 121 insertions(+) create mode 100644 ivtest/ivltests/module_nonansi_int1.v create mode 100644 ivtest/ivltests/module_nonansi_int2.v create mode 100644 ivtest/ivltests/module_nonansi_integer1.v create mode 100644 ivtest/ivltests/module_nonansi_integer2.v create mode 100644 ivtest/ivltests/module_nonansi_time1.v create mode 100644 ivtest/ivltests/module_nonansi_time2.v diff --git a/ivtest/ivltests/module_nonansi_int1.v b/ivtest/ivltests/module_nonansi_int1.v new file mode 100644 index 000000000..e501eff72 --- /dev/null +++ b/ivtest/ivltests/module_nonansi_int1.v @@ -0,0 +1,24 @@ +// Check that it is possible to declare the data type for an atom2 type module +// port separately from the direction for non-ANSI style port declarations. +// declarations. + +module test(x, y, z, w); + output x; + output y; + output z; + output w; + byte x; + shortint y; + int z; + longint w; + + initial begin + if ($bits(x) == 8 && $bits(y) == 16 && + $bits(z) == 32 && $bits(w) == 64) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/ivltests/module_nonansi_int2.v b/ivtest/ivltests/module_nonansi_int2.v new file mode 100644 index 000000000..fdabc8a08 --- /dev/null +++ b/ivtest/ivltests/module_nonansi_int2.v @@ -0,0 +1,23 @@ +// Check that it is possible to declare the data type for an atom2 type module +// port before the direction for non-ANSI style port declarations. + +module test(x, y, z, w); + byte x; + shortint y; + int z; + longint w; + output x; + output y; + output z; + output w; + + initial begin + if ($bits(x) == 8 && $bits(y) == 16 && + $bits(z) == 32 && $bits(w) == 64) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/ivltests/module_nonansi_integer1.v b/ivtest/ivltests/module_nonansi_integer1.v new file mode 100644 index 000000000..4ba0516ba --- /dev/null +++ b/ivtest/ivltests/module_nonansi_integer1.v @@ -0,0 +1,17 @@ +// Check that it is possible to declare the data type for an integer type module +// port separately from the direction for non-ANSI style port declarations. +// declarations. + +module test(x); + output x; + integer x; + + initial begin + if ($bits(x) == $bits(integer)) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/ivltests/module_nonansi_integer2.v b/ivtest/ivltests/module_nonansi_integer2.v new file mode 100644 index 000000000..5326e3020 --- /dev/null +++ b/ivtest/ivltests/module_nonansi_integer2.v @@ -0,0 +1,16 @@ +// Check that it is possible to declare the data type for an integer type module +// port before the direction for non-ANSI style port declarations. + +module test(x); + integer x; + output x; + + initial begin + if ($bits(x) == $bits(integer)) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/ivltests/module_nonansi_time1.v b/ivtest/ivltests/module_nonansi_time1.v new file mode 100644 index 000000000..628e73353 --- /dev/null +++ b/ivtest/ivltests/module_nonansi_time1.v @@ -0,0 +1,17 @@ +// Check that it is possible to declare the data type for a time type module +// port separately from the direction for non-ANSI style port declarations. +// declarations. + +module test(x); + output x; + time x; + + initial begin + if ($bits(x) == 64) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/ivltests/module_nonansi_time2.v b/ivtest/ivltests/module_nonansi_time2.v new file mode 100644 index 000000000..c897319f8 --- /dev/null +++ b/ivtest/ivltests/module_nonansi_time2.v @@ -0,0 +1,16 @@ +// Check that it is possible to declare the data type for a time type module +// port before the direction for non-ANSI style port declarations. + +module test(x); + time x; + output x; + + initial begin + if ($bits(x) == 64) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index 8312bd6b3..25d7a3cef 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -338,6 +338,8 @@ logp2 normal,-g2005-sv ivltests mod_inst_pkg normal,-g2009 ivltests module_nonansi_enum1 normal,-g2005-sv ivltests module_nonansi_enum2 normal,-g2005-sv ivltests +module_nonansi_int1 normal,-g2005-sv ivltests +module_nonansi_int2 normal,-g2005-sv ivltests module_nonansi_parray1 normal,-g2005-sv ivltests module_nonansi_parray2 normal,-g2005-sv ivltests module_nonansi_real1 normal,-g2005-sv ivltests diff --git a/ivtest/regress-vlg.list b/ivtest/regress-vlg.list index 539919c91..166463ba8 100644 --- a/ivtest/regress-vlg.list +++ b/ivtest/regress-vlg.list @@ -650,6 +650,10 @@ module3.12A normal ivltests main module3.12B normal ivltests module_inout_port_type CE ivltests module_input_port_type CE ivltests +module_nonansi_integer1 normal ivltests +module_nonansi_integer2 normal ivltests +module_nonansi_time1 normal ivltests +module_nonansi_time2 normal ivltests module_nonansi_vec1 normal ivltests module_nonansi_vec2 normal ivltests module_output_port_var1 normal ivltests diff --git a/ivtest/regress-vlog95.list b/ivtest/regress-vlog95.list index f5944b788..59207f27f 100644 --- a/ivtest/regress-vlog95.list +++ b/ivtest/regress-vlog95.list @@ -796,6 +796,8 @@ iuint1 normal,-g2009,-pallowsigned=1 ivltests logp2 normal,-g2009,-pallowsigned=1 ivltests mixed_width_case normal,-pallowsigned=1 ivltests mod_inst_pkg normal,-g2009,-pallowsigned=1 ivltests +module_nonansi_int1 normal,-g2005-sv,-pallowsigned=1 ivltests +module_nonansi_int2 normal,-g2005-sv,-pallowsigned=1 ivltests module_output_port_sv_var1 normal,-g2005-sv,-pallowsigned=1 ivltests module_output_port_sv_var2 normal,-g2005-sv,-pallowsigned=1 ivltests module_output_port_var1 normal,-pallowsigned=1 ivltests