cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Observer
Observer
5,241 Views
Registered: ‎06-30-2011

how to declare a variable to present a text string ?

Jump to solution

I use statement below to load data for running simulation. I would like to know if there is a way can do to declare some variable or what, so that I can simply use it to represent  ../Sim/test_TB/CMD_packages/move_L2R.

 

#2000
file1 = $fopen("../Sim/test_TB/CMD_packages/move_L2R/cmds_10_reg_80.bin","rb");

#2000
file1 = $fopen("../Sim/test_TB/CMD_packages/move_L2R/cmds_10_reg_84.bin","rb");

#2000
file1 = $fopen("../Sim/test_TB/CMD_packages/move_L2R/cmds_10_reg_A0.bin","rb");

 

======================================

 

For example : 

declare PATH_1 as ../Sim/test_TB/CMD_packages/move_L2R

 

#2000
file1 = $fopen("PATH_1/cmds_10_reg_80.bin","rb");

#2000
file1 = $fopen("PATH_1/cmds_10_reg_84.bin","rb");

#2000
file1 = $fopen("PATH_1/cmds_10_reg_A0.bin","rb");

0 Kudos
Reply
1 Solution

Accepted Solutions
Adventurer
Adventurer
9,172 Views
Registered: ‎02-24-2012

@chienpingwong

 

parameter PATH = "../Sim/test_TB/CMD_packages/move_L2R";
...
file1 = $fopen({PATH, "/cmds_10_reg_80.bin"}, "rb");
...

Best Regards,

 

Stephan

View solution in original post

8 Replies
Adventurer
Adventurer
9,173 Views
Registered: ‎02-24-2012

@chienpingwong

 

parameter PATH = "../Sim/test_TB/CMD_packages/move_L2R";
...
file1 = $fopen({PATH, "/cmds_10_reg_80.bin"}, "rb");
...

Best Regards,

 

Stephan

View solution in original post

Observer
Observer
5,226 Views
Registered: ‎06-30-2011

it works. Thanks a lot.

0 Kudos
Reply
Explorer
Explorer
5,188 Views
Registered: ‎11-25-2015

@chienpingwong

 

Please close this thread by marking appropriate post as "Accept as solution"

 

Regards,

Sravanthi

0 Kudos
Reply
Observer
Observer
5,090 Views
Registered: ‎06-30-2011

can I use similar way in including statement ?  or what is the right way to do it ? because what I put below isn't work

 

parameter TB_DataFile_Location = "../Sim/test_TB";

 

`include "{TB_DataFile_Location, "/TB_INI_CLK_nReset_2017_0109.v"}"

 

 

 

origianlly include statement is like

 

`include "../Sim/test_TB/TB_INI_CLK_nReset_2017_0109.v"

0 Kudos
Reply
Observer
Observer
5,027 Views
Registered: ‎06-30-2011

any suggestion on my problem above? 

 

 

 

Thanks a lot.

0 Kudos
Reply
Teacher
Teacher
5,014 Views
Registered: ‎03-31-2012

@chienpingwong try just `include PATH.

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Reply
Explorer
Explorer
5,004 Views
Registered: ‎11-25-2015

@chienpingwong

 

I don't think you can have predefined macro in include statement. 

 

Regards,

Sravanthi

Observer
Observer
4,983 Views
Registered: ‎06-30-2011

I try following statement, but it doesn't work. For your information. Anyway thanks for the help. It seems like macro cannot work on prodefine.

 

========================================================== 

parameter PATH_1 = "../Sim/test_TB/TB_INI_CLK_nReset_2017_0109.v";

 

`include PATH_1

==========================================================

 

 

0 Kudos
Reply