UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
834 Views
Registered: ‎01-30-2018

WARNING: File descriptor (-19999) passed to $fwrite is not valid

Jump to solution

Hi all,

 

I'm running a simulation where I write some values to a .txt using $fwrite, and I'm getting this WARNING:

 

WARNING: File descriptor (-19999) passed to $fwrite is not valid

 

I've checked this solution with no luck: https://www.xilinx.com/support/answers/47891.html

 

This is my $fopen line:  file = $fopen ("a.txt", "w");

And this is my $fwrite line: $fwrite (file, "HELLO");

 

It does not matter what I put in those two functions, it always gives me that warning.

 

I think the problem is that I'm closing the file ( $fclose(file); )  before the simulation ends, so that ISIM is trying to write in a closed file.

 

So, how can I place $fclose(file); just at the end of the simulation?

 

The path where the project is has no blank spaces nor strange characters ...

 

Can you please help me with this?

Please find attached the testbench I'm running.

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
1,009 Views
Registered: ‎05-31-2017

Re: WARNING: File descriptor (-19999) passed to $fwrite is not valid

Jump to solution

Hi @kardec,

 

Yes the main reason of this warning is the statement  $fclose(file);  Because as per your TB you are closing the file after 950 ns. If you are simulating more than 950 ns then this warning occurs as there is no file open to write. So, simulate the design for 950 ns then this warning will not occur.

 

Thanks & Regards,
A.Shameer.

1 Reply
Moderator
Moderator
1,010 Views
Registered: ‎05-31-2017

Re: WARNING: File descriptor (-19999) passed to $fwrite is not valid

Jump to solution

Hi @kardec,

 

Yes the main reason of this warning is the statement  $fclose(file);  Because as per your TB you are closing the file after 950 ns. If you are simulating more than 950 ns then this warning occurs as there is no file open to write. So, simulate the design for 950 ns then this warning will not occur.

 

Thanks & Regards,
A.Shameer.