From c8daebef48c7ddae5f51fba0b815b9d7f51ccba3 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 23 Apr 2022 21:11:29 +0200 Subject: [PATCH] Add regression tests for invalid task port declarations Check that all kinds of invalid repeated task port declarations are detected as errors. They should not crash the application nor should they result in successful elaboration. The tests are created for corner cases that previously resulted in incorrect behavior. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/task_nonansi_fail1.v | 15 +++++++++++++++ ivtest/ivltests/task_nonansi_fail10.v | 17 +++++++++++++++++ ivtest/ivltests/task_nonansi_fail11.v | 15 +++++++++++++++ ivtest/ivltests/task_nonansi_fail2.v | 16 ++++++++++++++++ ivtest/ivltests/task_nonansi_fail3.v | 16 ++++++++++++++++ ivtest/ivltests/task_nonansi_fail4.v | 16 ++++++++++++++++ ivtest/ivltests/task_nonansi_fail5.v | 15 +++++++++++++++ ivtest/ivltests/task_nonansi_fail6.v | 16 ++++++++++++++++ ivtest/ivltests/task_nonansi_fail7.v | 16 ++++++++++++++++ ivtest/ivltests/task_nonansi_fail8.v | 14 ++++++++++++++ ivtest/ivltests/task_nonansi_fail9.v | 15 +++++++++++++++ ivtest/regress-vlg.list | 11 +++++++++++ 12 files changed, 182 insertions(+) create mode 100644 ivtest/ivltests/task_nonansi_fail1.v create mode 100644 ivtest/ivltests/task_nonansi_fail10.v create mode 100644 ivtest/ivltests/task_nonansi_fail11.v create mode 100644 ivtest/ivltests/task_nonansi_fail2.v create mode 100644 ivtest/ivltests/task_nonansi_fail3.v create mode 100644 ivtest/ivltests/task_nonansi_fail4.v create mode 100644 ivtest/ivltests/task_nonansi_fail5.v create mode 100644 ivtest/ivltests/task_nonansi_fail6.v create mode 100644 ivtest/ivltests/task_nonansi_fail7.v create mode 100644 ivtest/ivltests/task_nonansi_fail8.v create mode 100644 ivtest/ivltests/task_nonansi_fail9.v diff --git a/ivtest/ivltests/task_nonansi_fail1.v b/ivtest/ivltests/task_nonansi_fail1.v new file mode 100644 index 000000000..f81ee6e92 --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail1.v @@ -0,0 +1,15 @@ +// Check that declaring multiple task non-ANSI ports with the same name is an +// error. Even if they both have an implicit type. + +module test; + + task t; + input x; + input x; + $display("FAILED"); + endtask + + reg y; + initial t(y, y); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail10.v b/ivtest/ivltests/task_nonansi_fail10.v new file mode 100644 index 000000000..10705a602 --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail10.v @@ -0,0 +1,17 @@ +// Check that declaring two non-ANSI task ports with an implicit type and the +// same name is an error. Even if the signal was previously declared as an +// variable. + +module test; + + task t; + integer x; + input x; + input x; + $display("FAILED"); + endtask + + integer y; + initial t(y, y); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail11.v b/ivtest/ivltests/task_nonansi_fail11.v new file mode 100644 index 000000000..82d4b2285 --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail11.v @@ -0,0 +1,15 @@ +// Check that declaring two non-ANSI output task ports with an explicit type is +// an error. Even if the types are the same. + +module test; + + task t; + input integer x; + input integer x; + $display("FAILED"); + endtask + + integer y; + initial t(y, y); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail2.v b/ivtest/ivltests/task_nonansi_fail2.v new file mode 100644 index 000000000..9e4f07537 --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail2.v @@ -0,0 +1,16 @@ +// Check that declaring a variable multiple times for a signal that was +// previously declared as a non-ANSI task input port is an error. + +module test; + + task t; + input x; + reg x; + reg x; + $display("FAILED"); + endtask + + reg y; + initial t(y); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail3.v b/ivtest/ivltests/task_nonansi_fail3.v new file mode 100644 index 000000000..584b2dfd3 --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail3.v @@ -0,0 +1,16 @@ +// Check that declaring a variable multiple times for a signal that was +// previously declared as a non-ANSI task output port is an error. + +module test; + + task t; + output x; + reg x; + reg x; + $display("FAILED"); + endtask + + reg y; + initial t(y); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail4.v b/ivtest/ivltests/task_nonansi_fail4.v new file mode 100644 index 000000000..c5d3249c8 --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail4.v @@ -0,0 +1,16 @@ +// Check that declaring an integer typed non-ANSI task port for signal that was +// previously declared as a variable is an error. Even if the types for both +// declarations are the same. + +module test; + + task t; + integer x; + input integer x; + $display("FAILED"); + endtask + + integer y; + initial t(y); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail5.v b/ivtest/ivltests/task_nonansi_fail5.v new file mode 100644 index 000000000..e1b3f2d8e --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail5.v @@ -0,0 +1,15 @@ +// Check that declaring an integer typed variabe for a signal that was +// previously declared as a non-ANSI task port is an error. Even if the types +// for both declarations are the same. + +module test; + + task t; + input integer x; + integer x; + $display("FAILED"); + endtask + + initial t(); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail6.v b/ivtest/ivltests/task_nonansi_fail6.v new file mode 100644 index 000000000..7b0c09ada --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail6.v @@ -0,0 +1,16 @@ +// Check that declaring a real typed variable for a signal that was previously +// declared as a non-ANSI task port is an error. Even if the types for both +// declarations are the same. + +module test; + + task t; + output real x; + real x; + $display("FAILED"); + endtask + + real y; + initial t(y); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail7.v b/ivtest/ivltests/task_nonansi_fail7.v new file mode 100644 index 000000000..5d994273d --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail7.v @@ -0,0 +1,16 @@ +// Check that declaring a real typed non-ANSI task port for signal that was +// previously declared as a variable is an error. Even if the types for both +// declarations are the same. + +module test; + + task t; + real x; + output real x; + $display("FAILED"); + endtask + + real y; + initial t(y); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail8.v b/ivtest/ivltests/task_nonansi_fail8.v new file mode 100644 index 000000000..6adf2e2cd --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail8.v @@ -0,0 +1,14 @@ +// Check that declaring an integer typed variable for a signal that was previously +// declared as a real typed non-ANSI task port is an error. + +module test; + + task t; + output real x; + integer x; + $display("FAILED"); + endtask + + initial t(); + +endmodule diff --git a/ivtest/ivltests/task_nonansi_fail9.v b/ivtest/ivltests/task_nonansi_fail9.v new file mode 100644 index 000000000..17ad486d1 --- /dev/null +++ b/ivtest/ivltests/task_nonansi_fail9.v @@ -0,0 +1,15 @@ +// Check that declaring a non-ANSI task port with an explicit type for a signal +// that was previously declared real variable is an error. + +module test; + + task t; + real x; + output integer x; + $display("FAILED"); + endtask + + real y; + initial t(y); + +endmodule diff --git a/ivtest/regress-vlg.list b/ivtest/regress-vlg.list index 15c51ccb0..2b8274d21 100644 --- a/ivtest/regress-vlg.list +++ b/ivtest/regress-vlg.list @@ -1652,6 +1652,17 @@ task_inpad normal ivltests # Validates input of task should pad w/ 0 task_iotypes normal ivltests # task ports with types. task_iotypes2 normal ivltests # task ports with types. task_mem normal ivltests +task_nonansi_fail1 CE ivltests +task_nonansi_fail2 CE ivltests +task_nonansi_fail3 CE ivltests +task_nonansi_fail4 CE ivltests +task_nonansi_fail5 CE ivltests +task_nonansi_fail6 CE ivltests +task_nonansi_fail7 CE ivltests +task_nonansi_fail8 CE ivltests +task_nonansi_fail9 CE ivltests +task_nonansi_fail10 CE ivltests +task_nonansi_fail11 CE ivltests task_nonansi_integer1 normal ivltests task_nonansi_integer2 normal ivltests task_nonansi_integer_fail CE ivltests