need help in verilog

Status
Not open for further replies.

malikkhaled

Junior Member level 1
Joined
Jan 14, 2010
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
sweden
Visit site
Activity points
1,447
In my design i have a lot of constants, i want to save these constant in a file and use this file where ever i need it in different modules, but i am getting errors by doing so. anyone could help me here i just post my code.
file name: inc.v

Code Verilog - [expand]
1
2
3
4
5
6
7
`default_nettype none
 
`define k 8
`define k1 32
`define k1 64
`define k1 128
`define k1 256



in my module i just add it like


Code Verilog - [expand]
1
`include inc.v

 

try adding "" around the inc.v and path information on where it's located. i.e. `include "../../some_path/inc.v"
for modelsim this path will be relative to the current directory modelsim is running from.

Unless all your files are co-located in the simulation directory it probably won't find the inc.v file otherwise.

Also, you should place the `include inc.v line in your other files outside the module-endmodule structure.

You should also know that including the same inc.v file in a bunch of other files will result in many warnings about redefinition of a define.

I typically use a top level include file which includes all the files (except the top level) including the define file and then the `defines only get defined once.
 

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