Verilog file handling

verilog

I tried to open a file ff.txt and write into it some random numbers say seven times. I used EDA playground website for it. Below is the link for that code as well as that code.

http://www.edaplayground.com/x/TCC

When I try to run I get error as

** Warning: (vsim-3533) [FOFIW] – Failed to open file "ff.txt" for writing.

Permission denied. (errno = EACCES) : design.sv(6)

My question is why don't I have access to the file ff.txt?

     module fopenclose();
       integer mcd,number;
       initial begin
         mcd=$fopen("ff.txt");
         repeat(7) begin
         number=$random;
         $fdisplay(mcd,"Number is",number);
       end
         $fclose(mcd);
       end
       initial #2 $display("%d",mcd);
     endmodule

Best Answer

EDA playground most likely does not provide filesystem access. You will probably need to run this in a simulator on your local computer.