$readmem and file not found 
Author Message
 $readmem and file not found

Hi,

Anyone care to describe the behaviour of the following code with
their simulator of choice/convenience:

module test;
reg [7:0] mem[0:7];
initial $readmemh("file_not_found", mem);
endmodule

Here's VCS's (4.1.2) response:

Warning: Can't open file_not_found: No such file or directory
Warning: $readmem: cannot open file 'file_not_found'

Personally I think it should be an error and the simulation should abort.
1364-1995 is silent on the matter.

Thanks,
/Ed
Lucent Technologies
--



Sat, 12 May 2001 03:00:00 GMT  
 $readmem and file not found
It is debatable if this should be treated as a fatal error. It is not
uncommon for simulation environment to have many memories, not all of
which may be initialized for each run.

Anyway, verilog does not have a system of run-time errors resulting in
simulation being aborted, unlike VHDL, where things like out of bound
array indexes are fatal errors.

Only way to end simulation is to do a finish or when the event queue is
empty.

--
Ashutosh Varma                                           Axis Systems
Senior Application Specialist                          209 Java Drive

Phone: (408)588-2000 x143                          Fax: (408)588-1662



Sat, 12 May 2001 03:00:00 GMT  
 $readmem and file not found
I've proposed to the 1364 committee an extra parameter to $readmemX.
If not present or 0 it defaults to the current behaviour.  If 1 the memory
file not found is a fatal error.

/Ed

Quote:

> It is debatable if this should be treated as a fatal error. It is not
> uncommon for simulation environment to have many memories, not all of
> which may be initialized for each run.

> Anyway, verilog does not have a system of run-time errors resulting in
> simulation being aborted, unlike VHDL, where things like out of bound
> array indexes are fatal errors.

> Only way to end simulation is to do a finish or when the event queue is
> empty.

--



Sat, 12 May 2001 03:00:00 GMT  
 $readmem and file not found
I'm a great fan of Giving The User The Choice, so I approve of the principle
of Edward's suggestion, however it would seem more consistent with
existing conventions for the $readmem function to return some completion
code which flags either success or the nature of the failure ("file not
found" or "permission denied" etc) which could be tested by subsequent code,
leaving the designer to choose the appropriate action, eg

integer errcode;
initial
   begin      
      errcode = $readmemh("my_file",my_memory);
      if (errcode == OHMYGOD)
         begin
            $display("Oops!");
            $finish;
         end
       $display("my_file data read into my_memory successfully");
   end

Regards, Robert.

Quote:

> I've proposed to the 1364 committee an extra parameter to $readmemX.
> If not present or 0 it defaults to the current behaviour.  If 1 the memory
> file not found is a fatal error.

--
=====================================================================
Robert R Fairlie - IC Design, Motorola, Scotland
Tel.  - +44 1355 566039
======================================================================


Sun, 13 May 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. ITS NOT A VIRUS, ITS A 404 ERROR, FILE NOT FOUND

2. ITS NOT A VIRUS, ITS A 404 ERROR, FILE NOT FOUND

3. Topspeed - CW2003 File Convert gets File Not Found

4. Curious 'File Not Found' Error

5. file not found - cw55bp32.lib

6. File not found

7. File not found during convert

8. File Not Found Error(3) problem

9. NT not finding C5 files

10. file not found ini.clw

11. file not found error

12. GET(file,1) -> Record not found

 

 
Powered by phpBB® Forum Software