Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top