Files
iverilog/ivtest/ivltests/sv_queue_method_signed4.v
T
Lars-Peter Clausen 0c123b8498 Add regression tests for methods with signed return values
Check that the signedness of the return value of methods is handled
correctly.
  * When sign extending
  * When passing as a value to a system function

Check this for both methods on user defined class as well as built-in
methods on SystemVerilog types.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2022-04-14 12:01:23 +02:00

30 lines
736 B
Verilog

// Check that the signedness of the element type of a queue is correctly handled
// when passing the result of one of the pop methods as an argument to a system
// function.
module test;
shortint qs[$];
bit [15:0] qu[$];
string s;
initial begin
qs.push_back(-1);
qs.push_back(-2);
qu.push_back(-1);
qu.push_back(-2);
// Values popped from qs should be treated as signed, values popped from qu
// should be treated as unsigned
s = $sformatf("%0d %0d %0d %0d", qs.pop_front, qs.pop_back,
qu.pop_front, qu.pop_back);
if (s == "-1 -2 65535 65534") begin
$display("PASSED");
end else begin
$display("FAILED s=%s", s);
end
end
endmodule