mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-28 16:53:45 +02:00
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]>
36 lines
727 B
Verilog
36 lines
727 B
Verilog
// Check that the signedness of methods on the built-in enum type is handled
|
|
// correctly when calling the function with parenthesis and passing the result
|
|
// to a system function.
|
|
|
|
module test;
|
|
|
|
enum shortint {
|
|
A = -1,
|
|
B = -2,
|
|
C = -3
|
|
} es;
|
|
|
|
enum bit [15:0] {
|
|
X = 65535,
|
|
Y = 65534,
|
|
Z = 65533
|
|
} eu;
|
|
|
|
string s;
|
|
|
|
initial begin
|
|
es = B;
|
|
eu = Y;
|
|
|
|
s = $sformatf("%0d %0d %0d %0d %0d %0d %0d %0d",
|
|
es.first(), es.last(), es.prev(), es.next(),
|
|
eu.first(), eu.last(), eu.prev(), eu.next());
|
|
if (s == "-1 -3 -1 -3 65535 65533 65535 65533") begin
|
|
$display("PASSED");
|
|
end else begin
|
|
$display("FAILED s=%s", s);
|
|
end
|
|
end
|
|
|
|
endmodule
|