diff --git a/ivtest/ivltests/sv_void_cast1.v b/ivtest/ivltests/sv_void_cast1.v new file mode 100644 index 000000000..ad271440a --- /dev/null +++ b/ivtest/ivltests/sv_void_cast1.v @@ -0,0 +1,37 @@ +// Check that void casts are supported + +module test; + + int a; + real b; + string c; + + function int f1(int x); + a = x; + return x; + endfunction + + function real f2(real x); + b = x; + return x; + endfunction + + function string f3(string x); + c = x; + return x; + endfunction + + + initial begin + void'(f1(10)); + void'(f2(1.0)); + void'(f3("10")); + + if (a === 10 && b == 1.0 && c == "10") begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/ivltests/sv_void_cast2.v b/ivtest/ivltests/sv_void_cast2.v new file mode 100644 index 000000000..141996218 --- /dev/null +++ b/ivtest/ivltests/sv_void_cast2.v @@ -0,0 +1,41 @@ +// Check that void casts on class methods are supported + +module test; + + int a; + real b; + string c; + + class C; + function int f1(int x); + a = x; + return x; + endfunction + + function real f2(real x); + b = x; + return x; + endfunction + + function string f3(string x); + c = x; + return x; + endfunction + endclass + + C d; + + initial begin + d = new; + void'(d.f1(10)); + void'(d.f2(1.0)); + void'(d.f3("10")); + + if (a === 10 && b == 1.0 && c == "10") begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/ivltests/sv_void_cast3.v b/ivtest/ivltests/sv_void_cast3.v new file mode 100644 index 000000000..44237780f --- /dev/null +++ b/ivtest/ivltests/sv_void_cast3.v @@ -0,0 +1,18 @@ +// Check that void casts on methods of built-in types is supported + +module test; + + int q[$]; + + initial begin + q.push_back(1); + void'(q.pop_back()); + + if (q.size() === 0) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/ivltests/sv_void_cast4.v b/ivtest/ivltests/sv_void_cast4.v new file mode 100644 index 000000000..db23012ff --- /dev/null +++ b/ivtest/ivltests/sv_void_cast4.v @@ -0,0 +1,11 @@ +// Check that void casts on SystemFunctions is supported + +module test; + + initial begin + void'($clog2(10)); + + $display("PASSED"); + end + +endmodule diff --git a/ivtest/ivltests/sv_void_cast_fail1.v b/ivtest/ivltests/sv_void_cast_fail1.v new file mode 100644 index 000000000..c0acd3e09 --- /dev/null +++ b/ivtest/ivltests/sv_void_cast_fail1.v @@ -0,0 +1,12 @@ +// Check that void casting a void function results in an error + +module test; + + function void f(int x); + endfunction + + initial begin + void'(f(10)); + end + +endmodule diff --git a/ivtest/ivltests/sv_void_cast_fail2.v b/ivtest/ivltests/sv_void_cast_fail2.v new file mode 100644 index 000000000..ea3132bda --- /dev/null +++ b/ivtest/ivltests/sv_void_cast_fail2.v @@ -0,0 +1,12 @@ +// Check that void casting a task results in an error + +module test; + + task t(int x); + endtask + + initial begin + void'(t(10)); + end + +endmodule diff --git a/ivtest/ivltests/sv_void_cast_fail3.v b/ivtest/ivltests/sv_void_cast_fail3.v new file mode 100644 index 000000000..814feae69 --- /dev/null +++ b/ivtest/ivltests/sv_void_cast_fail3.v @@ -0,0 +1,9 @@ +// Check that void casting an expression results in an error + +module test; + + initial begin + void'(1+2); + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index d002e84a3..c7dea8134 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -803,6 +803,13 @@ sv_var_module_output1 normal,-g2005-sv ivltests sv_var_module_output2 normal,-g2005-sv ivltests sv_var_package normal,-g2005-sv ivltests sv_var_task normal,-g2005-sv ivltests +sv_void_cast1 normal,-g2005-sv ivltests +sv_void_cast2 normal,-g2005-sv ivltests +sv_void_cast3 normal,-g2005-sv ivltests +sv_void_cast4 normal,-g2005-sv ivltests +sv_void_cast_fail1 CE,-g2005-sv ivltests +sv_void_cast_fail2 CE,-g2005-sv ivltests +sv_void_cast_fail3 CE,-g2005-sv ivltests sv_wildcard_import1 normal,-g2009 ivltests sv_wildcard_import2 normal,-g2009 ivltests sv_wildcard_import3 normal,-g2009 ivltests diff --git a/ivtest/regress-vlog95.list b/ivtest/regress-vlog95.list index acd4b9f86..323a0cb1a 100644 --- a/ivtest/regress-vlog95.list +++ b/ivtest/regress-vlog95.list @@ -515,6 +515,9 @@ sv_typedef_queue_base1 CE,-g2009 ivltests # queue sv_typedef_queue_base2 CE,-g2009 ivltests # queue sv_typedef_queue_base3 CE,-g2009 ivltests # queue sv_typedef_queue_base4 CE,-g2009 ivltests # queue +sv_void_cast1 CE,-g2009,-pallowsigned=1 ivltests # string +sv_void_cast2 CE,-g2009,-pallowsigned=1 ivltests # string, class +sv_void_cast3 CE,-g2009,-pallowsigned=1 ivltests # queue wait_fork CE,-g2009 ivltests # wait fork and join_* wild_cmp_err CE,-g2009 ivltests # ==?/!=? wild_cmp_err2 CE,-g2009 ivltests # ==?/!=? @@ -977,6 +980,7 @@ sv_var_module_output1 normal,-g2005-sv,-pallowsigned=1 ivltests sv_var_module_output2 normal,-g2005-sv,-pallowsigned=1 ivltests sv_var_package normal,-g2005-sv,-pallowsigned=1 ivltests sv_var_task normal,-g2005-sv,-pallowsigned=1 ivltests +sv_void_cast4 normal,-g2009,-pallowsigned=1 ivltests test_dispwided normal,-pallowsigned=1 ivltests gold=test_dispwided.gold test_inc_dec normal,-g2009,-pallowsigned=1 ivltests test_enumsystem normal,-g2009,-pallowsigned=1,ivltests/enumsystem.vhd ivltests