Search code examples
filevhdlvivado

VHDL - Vivado - Vivado Simulator retrieve old file instead of the newly generated one


I am building a vhdl project within vivado 2020.2

My working directory is located at the local Desktop of my O.S. and it has the following structure:

script\
    datasets\
        gentestdata.py
        testdata\
            test_data.txt
src\
  <<source files here>>
tst\
  <<testbenches here>>
vivado\
  <<project directory here>>

I have the following impure function to load the data from a script-generated file test_data.txt :

impure function gen_datain(dataset_path: in string) return datain_type is

file text_header: text is in dataset_path;
variable text_line: line;
variable line_i: bit_vector(0 to neuron_rom_width-1);
variable dataset_content: datain_type;

begin
for i in dataset_content'range loop
    if i = 101 then
        readline(text_header, text_line);
        read(text_line, line_i);
    else
        readline(text_header, text_line);
        read(text_line, line_i);
    end if;
    dataset_content(i) := makesfixed(line_i);
end loop;
file_close(text_header);
return dataset_content;
end function;

The file test_data.txt is generated automatically by the Python script gentestdata.py. Every time I run this script the content of test_data.txt changes and so should the data which is loaded within the vivado environment, but somehow even if the old version of test_data.txt has been replaced by the newer one, the simulator still loads the old data. How can I fix this behaviour. I tried to close vivado and reboot the O.S.

My questions is, do you know the reason of such behavior, and how it can be corrected?

Thanks everyone


Solution

  • When adding files to the GUI project, Vivado allows the user to 'Copy file to project'; say no to the copy. There is a check box or radio button involved. Vivado will try to have its own local copy buried somewhere it its hierarchy. Vivado is free to remove and re-add its own folders and if your file is part of this it can become confusing.

    You may need to start over with a fresh Gui project in order to have the project in a state where it is not modifying your files.

    The ultimate solution is to use Vivado in non-project mode without the GUI. This works better in a Linux based script driven environment than in Windows. In non-project Vivado does not mess with your files.
    See:
    https://docs.xilinx.com/r/en-US/ug892-vivado-design-flows-overview
    For more on the trade-offs between project and non-project build work flows.