Menu

#48 Disable error complaining that file has changed.

1.0
closed
None
2015-05-13
2015-05-10
No

bug.vhd:

entity ent is
end entity;

architecture a of ent is
begin
end architecture;

command line output:

> ghdl -a bug.vhd
> ghdl -e ent
> touch bug.vhd
> ghdl -e ent
file bug.vhd has changed and must be reanalysed
ghdl: compilation error

I suspect GHDL only checks the timestamp of the file and not the contents. Im not suggesting you should also check the contents but rather that you add a flag to disable the check completely without even a warning since such a check can cause problems in specific circumstances. Let me explain:
In VUnit we do not reanalyze files if the sha1 hash of the contents has not changed rather than relying on the timestamp. When doing git checkout or git rebase it changes the timestamp of all files but the content might not change and they do not have to be reanalyzed. Our dependency scanner will not reanalyze such files and cause GHDL to complain. In large VHDL code-bases it can take minutes to reanalyze every file and it would be annoying to do just because the timestamp changed to due for instance a git operation like rebase or checkout.

Also philosophically having a check of the timestamp of the source file and halting on error by the simulator is malplaced and too interfering in my opinion. It should be the choice of the user if he/she wants to reanalyze the file or not. Maybe the content has changed but the user does not want to re-analyze it anyway. Anyway having a flag to disable it works for me. I recently made the same complaint to the maintainer of the NVC simulator that had a similar check and he added an --ignore-time flag.

Discussion

  • Tristan Gingold

    Tristan Gingold - 2015-05-10

    I am not against adding --ignore-time although the situation is different from NVC.
    GHDL is source based: it doesn't write internal trees, so if the source has changed the units that depend on must really be reanalysed. The nice outcome is that analysis is very very fast when no code is generated.

     
  • Olof Kraigher

    Olof Kraigher - 2015-05-11

    If I understood correctly then GHDL must reread a previously analyzed source file when operating on dependent files and design units to rebuild the AST and the contents must then match to avoid inconsistencies.

    Adding the --ignore-time flag will work for me but after learning the above I think you should actually consider checking the sha1 hash of the contents instead of the timestamp. GHDL is reading the file anyway so the IO cost is already paid and computing the hash is orders of magnitude faster than reanalyzing. You could avoid computing the hash if the timestamp is identical as well as a further optimization.

    Without any of the above fixes GHDL will force excessive reanalysis of files in the presence of DVCS like git and Mercurial which change the timestamp of every file when moving between commits/changesets even though no content was changed.

     
  • Tristan Gingold

    Tristan Gingold - 2015-05-13
    • status: open --> closed
    • assigned_to: Tristan Gingold
     
  • Tristan Gingold

    Tristan Gingold - 2015-05-13

    Now implemented: ghdl doesn't use time stamp anymore to detect file change, but sha1. Note that the library format version has been updated, so you need to reanalyse all your units.

    Thank you for the idea!
    Tristan.

     
  • Olof Kraigher

    Olof Kraigher - 2015-05-13

    Works great, thank you!

     

Log in to post a comment.