Pass global integer to task?

D

Davy

Guest
Hi all,
I have a module 'test.v' call another 'test_task.v'.
But it seems the main module cannot call the task in another file? Is
it right?
Any suggestions will be appreciated!

//---test.v--------------
module test (clk, test_expr);
input clk, test_expr;

`include "test_task.v"

integer error_count;
initial error_count = 0;

always @(posedge clk)
begin
if (test_expr != 1'b1)
begin
ovl_error("");
end
end
endmodule
//-----------------------

//---test_task.v--------
module test_task();
task ovl_error;
input [8*63:0] err_msg;
begin
error_count = error_count + 1;
end
endtask
endmodule
//---------------------


Best regards,
Davy
 
You cannot declare a module (e.g. test_task) inside another module
(e.g. test). Module declarations cannot be nested.

You can declare module test_task outside any other module declarations
and make it another top-level module. Then task ovl_error could be
called from inside module test by using its hierarchical path name:
test_task.ovl_error.
 

Welcome to EDABoard.com

Sponsor

Back
Top