danmc
Community Member
![* *](https://designers-guide.org/forum/Templates/Forum/default/stargold.gif) ![* *](https://designers-guide.org/forum/Templates/Forum/default/stargold.gif)
Offline
Posts: 35
Boston
|
simulator is spectre 7.1.1.221.isr13
The exact warnings/errors are:
Warning from spectre during DC analysis `dcOp1'. WARNING (VLOGA-5090): "/home/dan/myLib/myvacell/veriloga/veriloga.va" 58: ITEST: Overwriting file /tmp/statefile.txt. Saving old contents of file in /tmp/myfile.txt~.
^^^ line 58 is in my @(final_step) block and says fp = $fopen("/tmp/myfile.txt", "w");
Fatal error found by spectre during DC analysis `dcOp1'. FATAL (VLOGA-5103): "/home/dan/myLib/myvacell/veriloga/veriloga.va" 36: ITEST: File '/tmp/myfile.txt' is already open for writing. The software is trying to open this file for reading. Close the file and try again.
^^^^ line 36 is in my @(initial_step) block and says fp = $fopen("/tmp/myfile.txt", "r");
both my @(initial_step) and @(final_step) blocks end with $fclose(fp). What doesn't make sense to me is that it looks like opening for writing happened before opening for reading even though I thought everything in @(initial_step) should have run to completion before anything in @(final_step) began.
FATAL (VLOGA-5078): "/home/dan/myLib/myvacell/veriloga/veriloga.va" 45: ITEST: Invalid file descriptor. Correct the problem and try again.
^^^^ This is inside my @(initial_step) block shortly after opening the file. It fails because of the preceeding error (not being able to open the file). line 45 is:
$fscanf(fp, "%d", myint);
At first I suspected that I do not fully understand @(initial_step) and @(final_step) in the context of a 'dc' simulation but now I think I do not understand some fine details of file I/O because the following code shows the same problem:
Note, all I am doing is opening a file, reading some variables, closing it, then re-opening for writing and putting out some new values and closing. Is it perhaps the case that the $fopen()'s do not execute in order? That seems to go against how Verilog-A is supposed to work.
@(initial_step) begin $display("starting initial_step"); fd = $fopen("/tmp/myfile.txt", "r"); $display("read fd = %d", fd); $fscanf(fd, "%d", val1); $fscanf(fd, "%d", val2); $fscanf(fd, "%d", val3); $display("Read val1 = %d", val1); $display(" val2 = %d", val2); $display(" val3 = %d", val3); $fclose(fd); fd = $fopen("/tmp/myfile.txt", "w"); $display("write fd = %d", fd); $fdisplay(fd, "%d", val1+1); $fdisplay(fd, "%d", val2+1); $fdisplay(fd, "%d", val3+1); $fclose(fd); $display("finished initial_step"); end
|