[SOLVED] Problem with `include in verilog

Status
Not open for further replies.

kjm

Junior Member level 1
Joined
May 22, 2012
Messages
16
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,283
Location
India
Activity points
1,389
Hi,
I am trying to include "tasks.v" file in my testbench file "tb_data.v" . after reg,wire and parameter declarations, I have include this file ('include "tasks.v"). But it is giving error (expecting the keyword 'module', 'macromodule' or 'primitive'[A.1].).

the tasks.v file looks like this:
task prep_req;
begin
request <= 1'b1;
@(posedge i_SymbolClk)
request <= 1'b0;
end

endtask // prep_req

There are other similar tasks like this in "tasks.v" file. Both the files (testbench + tasks) are in same folder. Please help.
Thanks
 

Maybe, you need include this task between the module / endmodule (not outside of it).
module a ();

input
output
wire
reg

`include "task.v"

endmodule

And when you compile your RTL codes, you can't include task.v in the file list (the compile tool will merge it into "module a" automatic).
 
Reactions: kjm

    kjm

    Points: 2
    Helpful Answer Positive Rating


I included the task between module/endmodule. But I was including it in the file list during compilation. That's why I was getting error...
SOLVED.

Thanks a lot
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…