iverilog/ivtest/ivltests/sv_argumentless_func.v

57 lines
1.2 KiB
Coq
Raw Normal View History

2023-07-29 08:51:02 +02:00
module test;
function automatic [7:0] test_func;
2023-07-29 09:21:31 +02:00
test_func = 8'h1;
2023-07-29 08:51:02 +02:00
endfunction
2023-07-29 09:21:31 +02:00
logic [7:0] test_alwayscomb;
always_comb test_alwayscomb = test_func();
logic [7:0] test_alwaysff;
logic clk;
always_ff @(posedge clk) test_alwaysff <= test_func();
2023-07-29 08:51:02 +02:00
logic [7:0] test_assign;
2023-07-29 09:21:31 +02:00
assign test_assign = test_func();
2023-07-29 08:51:02 +02:00
2023-07-29 09:21:31 +02:00
wire [7:0] test_wire = test_func();
2023-07-29 08:51:02 +02:00
initial begin
2023-07-29 09:21:31 +02:00
#1;
if (test_func() !== 8'h1) begin
$display("FAILED -- test_func()=%h, expect %h", test_func(), 8'h1);
$finish;
end
if (test_alwayscomb !== test_func()) begin
$display("FAILED -- test_alwayscomb=%h, expect %h", test_alwayscomb, test_func());
$finish;
end
if (test_assign !== test_func()) begin
$display("FAILED -- test_assign=%h, expect %h", test_assign, test_func());
$finish;
end
if (test_wire !== test_func()) begin
$display("FAILED -- test_wire=%h, expect %h", test_wire, test_func());
2023-07-29 08:51:02 +02:00
$finish;
end
2023-07-29 09:21:31 +02:00
clk = 0;
#1;
clk = 1;
#1;
if (test_alwaysff !== test_func()) begin
$display("FAILED -- test_alwaysff=%h, expect %h", test_alwaysff, test_func());
2023-07-29 08:51:02 +02:00
$finish;
end
$display("PASSED");
$finish;
end
endmodule