mardi 30 juin 2015

VHDL textio, reading image from file

I am trying to learn how to implement image processing algorithms in an FPGA and to do this I am working with a txt file that contains a bmp image (converted using MATLAB).

I am havin problems using the textio package, so by now I am only able to read the first column of data (but not the entire row of data).

The txt file have this aspect:

    1,1,0,0,0
    0,1,1,1,1
    1,0,0,0,0
    0,0,1,1,0
    1,1,1,1,1

a 5x5 matrix separated by commas. The output of the entity I have now in my simulations is

    1 0 1 0 1 

that corresponds to the first column. I don't understand why the code doesn't read all the line and when it ends jump to the next line.

Here is the process for read the file (I have add a variable named comma so I could detect the comma and skip it but still doesn't work ):

reading : process 

    constant filename : string := "C:\DOCUMENTACION\PROYECTOS\Envio_salida_VGA_atraves_FPGA\MatLab\Procesado de imagen con Toolbox\prueba.txt";
    file f : text open read_mode is filename;
    variable L : line;
    variable data_read : integer;
    variable comma : character;
begin
    while not endfile(f) loop
        wait until rising_edge(clk); 
            readline(f, L);
            read(L, data_read);

            while L = ',' loop
                read(L, comma);
            end loop;

            d_out <= data_read;
    end loop;

what is wrong with my code?

Aucun commentaire:

Enregistrer un commentaire