reading binary files in vhdl. Use of read in a function.

Discussion in 'VHDL' started by gfandango, Feb 3, 2009.

  1. gfandango

    gfandango

    Joined:
    Feb 3, 2009
    Messages:
    3
    Likes Received:
    0
    Hello,

    I wrote the following code (reading.txt in attachment) to read the header of a ppm file. Modelsim throws me an error during the compilation:
    reading.vhd(54): (vcom-1282) Cannot reference file "ppm_file" inside pure function "readheader".

    I don't know how to solve it and I don't want to put the code of the function ReadHeader in the process. It seems to be linked to the passing of the file parameter and MODELSIM (see below). A problem of type ?

    Thanks in advance for your help.

    I have made some additional tests to see where the problem comes from. I was surprised to see that my file could be compiled with GHDL and works fine with it. So my problem is clearly related to MODELSIM (6.5 PE).
     

    Attached Files:

    Last edited: Feb 4, 2009
    gfandango, Feb 3, 2009
    #1
    1. Advertisements

  2. gfandango

    gfandango

    Joined:
    Feb 3, 2009
    Messages:
    3
    Likes Received:
    0
    I found the solution: declaring my function as impure.
     
    gfandango, Feb 10, 2009
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.