graphman65 / linter-vhdl

Atom vhdl linter
https://atom.io/packages/linter-vhdl
MIT License
6 stars 2 forks source link

Error checking syntax: package not found in library #11

Open douglasrossi opened 6 years ago

douglasrossi commented 6 years ago

Hi, If a file (eg my_vhdl.vhd) uses a package (eg my_package.vhd) in the work library, the following error is reported: : error: unit "my_package" not found in library "work"

One solution to fix this problem is to check the syntax of the package(s) before the main file, such as: ghdl -s my_package.vhd my_vhdl.vhd

It would be great to have an option to pass the package(s) as parameters before checking syntax. Thanks!

graphman65 commented 6 years ago

Hi, Could something like a comment at the top of the file (eg "-- requires my_package.vhd") work for you ?

douglasrossi commented 6 years ago

I think your proposal works, and the only drawback is to insert the comment at the top of the files.

I'm not sure if this is feasible, but another solution could be using the original library declaration, for example:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.my_package.all;

As the default ghdl execution uses work as the main library, one solution could be to check previously the syntax of all files between the string "work." and ".all" plus ".vhd*". The constraint would be the presence of the package in the same directory as the main file.