I want to know the error in this code:
class a1;
int q;
task set(int i);
q = i;
endtask
function int get();
return q;
endfunction
endclass
`include "a1.sv"
module top;
a1 class_1;
a1 class_2;
int a,b;
initial
begin
class_1 = new();
a1 class_2 = new();
class_1.set(10);
class_2.set(20);
a = class_1.get();
b = class_2.get();
$display("The first value is %0d",a);
$display("The second value is %0d",b);
end
endmodule
I see that if I use program in stead of module the file top.sv executes properly
Can anyone look into this and tell me the reason