Using TCL relative path in Modelsim

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
Hello,

I have a VHD testbench file in this location:

Code:
C:/some_directory/hdl/tb.vhd

I also have a stimulus text file in this location:

Code:
C:/some_directory/text/stimulus.txt

In my VHDL testbench I use the absolute path of "stimulus.txt" as follows:
Code:
file text_file : text open read_mode is "C:\some_directory\text\stimulus.txt" ;

Question:
What's the syntax to use an absolute path for the same file?
 

do you mean relative path?
Its the same as the relative path in any OS: . is current folder, .. is up one folder:

".\stimulus.txt" or just "stimulus.txt"
 

do you mean relative path?
Yes. Sorry for the typo.

".\stimulus.txt" or just "stimulus.txt"

I tried that and it didn't work

Failed to open VHDL file "./stimulus.txt" in rb mode.
# No such file or directory. (errno = ENOENT)

Maybe "stimulus.txt" must be added to the project first when using a relative path ?
 

No it doesnt need adding. It just means that the simulation folder is not the folder where stimulus.txt is.
Where are you invoking vsim?
 

You mean the location I get when I type "pwd" in the console?
 

You mean the location I get when I type "pwd" in the console?

No
The folder that vsim is run in. Files in your source code are relative to where the simulation is running.
 
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…