[SOLVED] Error in Questasim simulation

Status
Not open for further replies.

dharag

Newbie level 5
Joined
Mar 24, 2014
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
66
Hello,

I am using Questasim for verification of VHDL and SV files. In generator class run task I am giving the input from a .DAT file and I am facing an error for the same. Error is

"Error: (vsim PLI-3084) : $fscanf: Argument 1 is not a valid file descriptor"

Code is:
int i;
int D;
i = $fscanf(fp,"%d",D);

file pointer fp is passed through environment class run task.

Please help me to come out of this error :thinker:
Thanks in advance
 

Hello,

fp is the file pointer in the environment class run task

int fp;
fp = $fopen("file_for_input.dat","r");

this fp is passed to genereator run task and when I am displaying value of fp in generator block it displays 0.
 

So either $fopen failed, or you are not passing fp correctly to the generator run task.
Did you check the value of fp right after you opened the file?
 

Thanks Dave Rich for your response, I have solved the same and you were right my file was not being opened due to some directory issues. Now its working fine...

- - - Updated - - -

Also Thanks Rahul for your suggestion, my code is now running perfectly
 

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