improved test
This commit is contained in:
parent
44badf50de
commit
de2f506644
|
|
@ -2,23 +2,50 @@
|
||||||
module test;
|
module test;
|
||||||
|
|
||||||
function automatic [7:0] test_func;
|
function automatic [7:0] test_func;
|
||||||
input _unused;
|
test_func = 8'h1;
|
||||||
test_func = _unused;
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
logic [7:0] test_assign;
|
logic [7:0] test_alwayscomb;
|
||||||
assign test_assign = test_func(0);
|
always_comb test_alwayscomb = test_func();
|
||||||
|
|
||||||
wire [7:0] test_wire = test_func(0);
|
logic [7:0] test_alwaysff;
|
||||||
|
logic clk;
|
||||||
|
always_ff @(posedge clk) test_alwaysff <= test_func();
|
||||||
|
|
||||||
|
logic [7:0] test_assign;
|
||||||
|
assign test_assign = test_func();
|
||||||
|
|
||||||
|
wire [7:0] test_wire = test_func();
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
if (test_assign !== test_func(0)) begin
|
#1;
|
||||||
$display("FAILED -- test_assign=%h, expect %h", test_assign, test_func(0));
|
|
||||||
|
if (test_func() !== 8'h1) begin
|
||||||
|
$display("FAILED -- test_func()=%h, expect %h", test_func(), 8'h1);
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (test_wire !== test_func(0)) begin
|
if (test_alwayscomb !== test_func()) begin
|
||||||
$display("FAILED -- test_wire=%h, expect %h", test_wire, test_func(0));
|
$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());
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
|
||||||
|
clk = 0;
|
||||||
|
#1;
|
||||||
|
clk = 1;
|
||||||
|
#1;
|
||||||
|
if (test_alwaysff !== test_func()) begin
|
||||||
|
$display("FAILED -- test_alwaysff=%h, expect %h", test_alwaysff, test_func());
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue