0

I am running a test to compare output data of the system to a set of golden data generated on a text file, but when the test runs to around 2000 frames +, I start getting an error where is says:

warning-Cannot open file
 file could not be opened. Too many open files.

I tried to look for a system task in SystemVerilog to see if there is a task that can show all currently open files while the test is running, but I can't seem to find one. Is there a way for this to be done?

toolic
  • 57,801
  • 17
  • 75
  • 117
miner_kai
  • 29
  • 6
  • Most likely, you hit an operating system limit on opened file descriptors. It has nothing to do with verilog. – Serge Feb 20 '23 at 14:58
  • I know that there is a limit to how many opened file descriptors are available, but because I always use $fclose after I am done with the data file for each frame, I would assume that the test can just reuse the value for another file when I call for $fopen again, is this not the case? – miner_kai Feb 21 '23 at 03:41
  • Yes I did, and I have used the integer values returned to confirm that there is some code opening files in between every frame that is not mine because the integer identifier is jumping by 2 instead of 1. But since I am not the only one working on the project, its kind of hard to find out which bit of code is opening files, hence i was trying to figure if a function as described in the question exists, if not i guess I just have to do it the hard way to find out – miner_kai Feb 22 '23 at 11:11

1 Answers1

1

I don't think the IEEE Std 1800-2017 offers any way to directly know how many files are currently open.

However, you could look at the integer value returned by $fopen to see the value of the last file descriptor which was opened. When I open many files, the value increments by one every time a new file is opened. I tried this on 2 simulators.

Keep in mind that there are 2 ways to call $fopen: multichannel descriptor and file descriptor. They return different values.

Perhaps your simulator has a proprietary way to check for the number of open files. Look through your documentation, or contact the vendor for support.

toolic
  • 57,801
  • 17
  • 75
  • 117