ericew
Newbie level 4
Hi,
I would like to pass a parameter to the `include file. The following is my codes
`define HIER testbench.module_1.shift_register.register_bank
parameter TOTAL_ADDR_WIDTH = 43;
`include "../tb/self_check.v"
`undef HIER
`define HIER testbench.module_2.shift_register.register_bank
parameter TOTAL_ADDR_WIDTH = 59;
`include "../tb/self_check.v"
`undef HIER
`define HIER testbench.module_3.shift_register.register_bank
parameter TOTAL_ADDR_WIDTH = 67;
`include "../tb/self_check.v"
`undef HIER
This looks definitely ok but only when i do it once. But if I do it more than once, how do I pass the parameter to the `include file? Defining same parameter for several times will give compilation error.
Btw, I need to stick to the parameter name as TOTAL_ADDR_WIDTH as I would like to reuse the self_check.v.
Question:
1. Is this the correct way of doing it? (reusing the self_check.v in such way)
2. What is the proper way of passing the parameter to the `include file in the case showing above? What exactly syntax I should use?
Thanks!
I would like to pass a parameter to the `include file. The following is my codes
`define HIER testbench.module_1.shift_register.register_bank
parameter TOTAL_ADDR_WIDTH = 43;
`include "../tb/self_check.v"
`undef HIER
`define HIER testbench.module_2.shift_register.register_bank
parameter TOTAL_ADDR_WIDTH = 59;
`include "../tb/self_check.v"
`undef HIER
`define HIER testbench.module_3.shift_register.register_bank
parameter TOTAL_ADDR_WIDTH = 67;
`include "../tb/self_check.v"
`undef HIER
This looks definitely ok but only when i do it once. But if I do it more than once, how do I pass the parameter to the `include file? Defining same parameter for several times will give compilation error.
Btw, I need to stick to the parameter name as TOTAL_ADDR_WIDTH as I would like to reuse the self_check.v.
Question:
1. Is this the correct way of doing it? (reusing the self_check.v in such way)
2. What is the proper way of passing the parameter to the `include file in the case showing above? What exactly syntax I should use?
Thanks!