I've got a verilog file which all I want to have in it is a task that does some maths which I am then include "maths.v"
in another file and calling the task by writing mathsfunction;
in a initial begin - end
block in the other file which should run the task at that point if I understand correctly, the code is below:
Maths.v
task mathsfunction;
reg [0:31] x;
reg [0:31] y;
reg [0:31] z;
begin
x = $urandom;
y = $urandom;
z = x + y
end
#200
endtask
I'm getting one compile error which is on the first line task mathsfunction;
which is Global declarations are illegal in Verilog 2001 syntax.
From what I've learnt so far, having a verilog file which is just a task (not a module, I dont want it to be a module) should be fine? So not sure why this doesn't work.
Any help would be great