Fix unpacked array passing to logic task arg error (#8148)

Signed-off-by: Pawel Klopotek <pklopotek@internships.antmicro.com>
This commit is contained in:
Pawel Klopotek 2026-08-19 08:04:28 +02:00 committed by GitHub
parent 86b7cfb05c
commit f5ae58ddab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 62 additions and 11 deletions

View File

@ -7545,9 +7545,11 @@ class WidthVisitor final : public VNVisitor {
relinkHandle.relink(newp); relinkHandle.relink(newp);
} }
if (portp->isWritable()) V3LinkLValue::linkLValueSet(pinp); if (portp->isWritable()) V3LinkLValue::linkLValueSet(pinp);
if (VN_IS(pinDTypep, BasicDType) && portp->direction() != VDirection::REF if (portp->direction() != VDirection::REF
&& (VN_IS(portDTypep, UnpackArrayDType) || VN_IS(portDTypep, DynArrayDType) && !(portp->basicp()
|| VN_IS(portDTypep, QueueDType) || VN_IS(portDTypep, AssocArrayDType))) { && portp->basicp()->untyped()) // for properties, handled in V3AssertPre
&& ((VN_IS(portDTypep, BasicDType) && pinDTypep->isNonPackedArray())
|| (VN_IS(pinDTypep, BasicDType) && portDTypep->isNonPackedArray()))) {
pinp->v3error("Function Argument expects " << portDTypep->prettyDTypeNameQ() pinp->v3error("Function Argument expects " << portDTypep->prettyDTypeNameQ()
<< ", got " << ", got "
<< pinDTypep->prettyDTypeNameQ()); << pinDTypep->prettyDTypeNameQ());

View File

@ -1,18 +1,42 @@
%Error: t/t_invalid_task_arguments_bad.v:25:20: Function Argument expects 'logic[30:0]$[]', got 'IData' %Error: t/t_invalid_task_arguments_bad.v:44:20: Function Argument expects 'logic[30:0]$[]', got 'IData'
: ... note: In instance 't' : ... note: In instance 't'
25 | dyn_task(.data($urandom)); 44 | dyn_task(.data($urandom));
| ^~~~~~~~ | ^~~~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: t/t_invalid_task_arguments_bad.v:26:25: Function Argument expects 'logic[30:0]$[3:0]', got 'IData' %Error: t/t_invalid_task_arguments_bad.v:45:25: Function Argument expects 'logic[30:0]$[3:0]', got 'IData'
: ... note: In instance 't' : ... note: In instance 't'
26 | unpacked_task(.data($urandom)); 45 | unpacked_task(.data($urandom));
| ^~~~~~~~ | ^~~~~~~~
%Error: t/t_invalid_task_arguments_bad.v:27:22: Function Argument expects 'logic[30:0]$[$]', got 'IData' %Error: t/t_invalid_task_arguments_bad.v:46:22: Function Argument expects 'logic[30:0]$[$]', got 'IData'
: ... note: In instance 't' : ... note: In instance 't'
27 | queue_task(.data($urandom)); 46 | queue_task(.data($urandom));
| ^~~~~~~~ | ^~~~~~~~
%Error: t/t_invalid_task_arguments_bad.v:28:22: Function Argument expects 'logic[30:0]$[int]', got 'IData' %Error: t/t_invalid_task_arguments_bad.v:47:22: Function Argument expects 'logic[30:0]$[int]', got 'IData'
: ... note: In instance 't' : ... note: In instance 't'
28 | assoc_task(.data($urandom)); 47 | assoc_task(.data($urandom));
| ^~~~~~~~ | ^~~~~~~~
%Error: t/t_invalid_task_arguments_bad.v:48:23: Function Argument expects 'logic', got 'logic$[3:0]'
: ... note: In instance 't'
48 | scalar_task(.data(unpacked_data));
| ^~~~~~~~~~~~~
%Error: t/t_invalid_task_arguments_bad.v:49:23: Function Argument expects 'logic', got 'logic$[]'
: ... note: In instance 't'
49 | scalar_task(.data(dyn_data));
| ^~~~~~~~
%Error: t/t_invalid_task_arguments_bad.v:50:23: Function Argument expects 'logic', got 'logic$[$]'
: ... note: In instance 't'
50 | scalar_task(.data(queue_data));
| ^~~~~~~~~~
%Error: t/t_invalid_task_arguments_bad.v:51:23: Function Argument expects 'logic', got 'logic$[int]'
: ... note: In instance 't'
51 | scalar_task(.data(assoc_data));
| ^~~~~~~~~~
%Error: t/t_invalid_task_arguments_bad.v:52:27: Function Argument expects 'logic[30:0]', got 'logic$[3:0]'
: ... note: In instance 't'
52 | scalar_vec_task(.data(vec_data));
| ^~~~~~~~
%Error: t/t_invalid_task_arguments_bad.v:53:32: Function Argument expects 'logic', got 'logic$[0:9]'
: ... note: In instance 't'
53 | logical_or(my_signal_a[0], my_signal_b);
| ^~~~~~~~~~~
%Error: Exiting due to %Error: Exiting due to

View File

@ -20,12 +20,37 @@ task assoc_task(input logic [30:0] data[int]);
$display("%p", data); $display("%p", data);
endtask endtask
task scalar_task(input logic data);
$display("%b", data);
endtask
task scalar_vec_task(input logic [30:0] data);
$display("%b", data);
endtask
function logic logical_or(input logic a, b);
return a | b;
endfunction
module t; module t;
logic unpacked_data[3:0];
logic dyn_data[];
logic queue_data[$];
logic assoc_data[int];
logic vec_data[3:0];
logic my_signal_a[10];
logic my_signal_b[10];
initial begin initial begin
dyn_task(.data($urandom)); dyn_task(.data($urandom));
unpacked_task(.data($urandom)); unpacked_task(.data($urandom));
queue_task(.data($urandom)); queue_task(.data($urandom));
assoc_task(.data($urandom)); assoc_task(.data($urandom));
scalar_task(.data(unpacked_data));
scalar_task(.data(dyn_data));
scalar_task(.data(queue_data));
scalar_task(.data(assoc_data));
scalar_vec_task(.data(vec_data));
logical_or(my_signal_a[0], my_signal_b);
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
$finish; $finish;
end end