I wanna create the task that verifies the output is correct or not. If it is correct it shows correct +1 and if there would be an error it shows error +1. By writing this code, I couldn't get any value in expected123.
logic [31:0] expected123;
task checker123 (logic [31:0] expected, logic [31:0] actual, bit [3:0] command, logic[31:0] input1, input2);
$display("%h, %h, %h, %h, %h", expected, actual, command, input1, input2);
if(command == "0001")
expected123 = input1 + input2;
$display(expected, input1, input2);
if(command == "0010")
expected123 = input1 - input2;
$display(expected, input1, input2);
expected = expected123;
if (expected !== actual) begin
$display("%t: command %h is expected %h but got %h ", $time, command, expected, actual);
error = error + 1;
end
correct = correct + 1;
endtask
commandwith an 64-bit string"0001". this is not verilog. - Serge