Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to check file existence in Verilog

Status
Not open for further replies.

vijay82

Member level 2
Joined
Jan 13, 2007
Messages
52
Helped
6
Reputation
12
Reaction score
7
Trophy points
1,288
Activity points
1,724
verilog check for file

In Verilog, how can one check the existence of a file, without using PLI?
My aim is:

if (<file exists>)
readmemh (<file name>) //Read it
else
other code

Although directly using readmemh on the file name does not give a compile/runtime error, it does give an ugly-looking warning on the simulation window(ModelSim) during simulation, which I'd rather avoid.
 

file exist in verilog

In my Verilog testbench code, I am using the following to attempt to open the file and get any errors associated with opening it.

---- Steve
******************************************

file = $fopen("code.vec", "r");
$ferror(file, error);
if (error != 0)
$display("\nFile Open Failed with Error Code = %x", error);
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top