UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
804 Views
Registered: ‎05-07-2012

Vivado not reading MIF file

Hello,

 

I'm using the Xilinx HDL designs corresponding to xapp1122 and xapp1112.  The designs include RAM inference and uses MIF files.  When I try to synthesize things I'm getting the error [Synth 8-3302] unable to open file './../enc.mif'.  I did add the MIF files to the project and they are in the "Memory Initialization Files" category of the Project Hierarchy.  The relevant VHDL files are not in the default library but the MIF files are in the default library according to the properties box.  Vivado will not let me change the library that the MIF files are associated with.  I'm not sure if this is relevant.  So, the bottom line is that Vivado seems unable to read the MIF files.  

 

Some relevant lines from the Xilinx HDL code are,

 

C_ELABORATION_DIR : STRING := "./";

...

CONSTANT MIF_FILE_NAME : STRING := C_ELABORATION_DIR & "enc.mif";

...

-- Initialize inferred ROM from mif file
TYPE RomType IS ARRAY(0 TO 1023) OF BIT_VECTOR(11 DOWNTO 0);
IMPURE FUNCTION InitRomFromFile (RomFileName : STRING) RETURN RomType IS
FILE RomFile : TEXT OPEN READ_MODE IS RomFileName;
VARIABLE RomFileLine : LINE;
VARIABLE ROM : RomType;
BEGIN
FOR I IN RomType'range LOOP
READLINE (RomFile, RomFileLine);
READ (RomFileLine, ROM(I));
END LOOP;
RETURN ROM;
END FUNCTION;
SIGNAL ROM : RomType := InitRomFromFile(MIF_FILE_NAME);

 

How is this remedied?

 

Thank you.

0 Kudos
1 Reply
Scholar jmcclusk
Scholar
790 Views
Registered: ‎02-24-2014

Re: Vivado not reading MIF file

add this line of code:

 

VARIABLE ROM : RomType;
BEGIN

ASSERT FALSE

   report "Trying to open file " & string'image(RomFileName )

   severity warning;
FOR I IN RomType'range LOOP

 

and then compile again and look at the warning messages.   What file is it actually trying to open?    Chances are exceedingly high it's got the wrong location.   I've used this code before with LUT types instead of BRAM..  It worked well.    Beware of using the BRAM version if you are using a clock that can possibly glitch.   I've seen BRAM corrupted by clock glitches, even if the write enable is tied low.  It's just a consequence of the BRAM internal design.

 

Edit:  Alternatively,  just play around with the file name until it points to the right place on your system..   you haven't said if you are using Windows or Linux.  Filenames can differ substantially between the two.

Don't forget to close a thread when possible by accepting a post as a solution.
0 Kudos