aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/GHDL_implementation_of_VHDL.rst14
-rw-r--r--doc/Invoking_GHDL.rst4
-rw-r--r--src/ghdldrv/ghdlcomp.adb5
-rw-r--r--src/libraries.adb74
4 files changed, 68 insertions, 29 deletions
diff --git a/doc/GHDL_implementation_of_VHDL.rst b/doc/GHDL_implementation_of_VHDL.rst
index 808c39140..5df2ec5d1 100644
--- a/doc/GHDL_implementation_of_VHDL.rst
+++ b/doc/GHDL_implementation_of_VHDL.rst
@@ -29,6 +29,8 @@ VHDL standards
.. index:: v02
+.. index:: v08
+
This is very unfortunate, but there are many versions of the VHDL
language, and they aren't backward compatible.
@@ -64,6 +66,9 @@ Minors corrections were added by the 2002 revision of the VHDL standard. This
revision is not fully backward compatible with VHDL-00 since, for example,
the value of the `'instance_name` attribute has slightly changed.
+The latest version is 2008. Many features have been added, and GHDL
+doesn't implement all of them.
+
You can select the VHDL standard expected by GHDL with the
:samp:`--std=VER` option, where :samp:`VER` is one of the left column of the
table below:
@@ -94,8 +99,9 @@ table below:
08
Select VHDL-2008 standard (partially implemented).
-You cannot mix VHDL-87 and VHDL-93 units. A design hierarchy must have been
-completely analyzed using either the 87 or the 93 version of the VHDL standard.
+The 93, 93c, 00 and 02 standards are considered as compatible: you can
+elaborate a design mixing these standards. However, 87, 93 and 08 are
+not compatible.
.. _psl_implementation:
@@ -173,8 +179,8 @@ changed with the :option:`--work=NAME` option of GHDL.
To keep the list of design units in a design library, GHDL creates
library files. The name of these files is :file:`NAME-objVER.cf`, where
-`NAME` is the name of the library, and `VER` the VHDL version (87
-or 93) used to analyze the design units.
+`NAME` is the name of the library, and `VER` the VHDL version (87,
+93 or 08) used to analyze the design units.
You don't have to know how to read a library file. You can display it
using the *-d* of `ghdl`. The file contains the name of the
diff --git a/doc/Invoking_GHDL.rst b/doc/Invoking_GHDL.rst
index e8f17debe..8dcb76b5e 100644
--- a/doc/Invoking_GHDL.rst
+++ b/doc/Invoking_GHDL.rst
@@ -361,7 +361,9 @@ manual for details.
.. option:: -P<DIRECTORY>
Add `DIRECTORY` to the end of the list of directories to be searched for
- library files.
+ library files. A library is searched in `DIRECTORY` and also in
+ `DIRECTORY/LIB/vVV` (where `LIB` is the name of the library and `VV`
+ the vhdl standard).
The `WORK` library is always searched in the path specified by the
:option:`--workdir=` option, or in the current directory if the latter
diff --git a/src/ghdldrv/ghdlcomp.adb b/src/ghdldrv/ghdlcomp.adb
index 1dfc5111b..180240710 100644
--- a/src/ghdldrv/ghdlcomp.adb
+++ b/src/ghdldrv/ghdlcomp.adb
@@ -234,11 +234,6 @@ package body Ghdlcomp is
Run_Arg : Natural;
begin
begin
- Hooks.Compile_Init.all (False);
-
- Flags.Flag_Elaborate_With_Outdated := True;
- Flags.Flag_Only_Elab_Warnings := False;
-
if Args'Length > 1 and then
(Args (Args'First).all = "-r" or else Args (Args'First).all = "-e")
then
diff --git a/src/libraries.adb b/src/libraries.adb
index d6de2b51c..d3d19c860 100644
--- a/src/libraries.adb
+++ b/src/libraries.adb
@@ -64,8 +64,10 @@ package body Libraries is
procedure Init_Pathes
is
begin
+ -- Always look in current directory first.
Name_Nil := Get_Identifier ("");
Pathes.Append (Name_Nil);
+
Local_Directory := Name_Nil;
Work_Directory := Name_Nil;
end Init_Pathes;
@@ -100,12 +102,62 @@ package body Libraries is
function Get_Path (N : Natural) return Name_Id is
begin
- if N > Pathes.Last or N < Pathes.First then
+ if N not in Pathes.First .. Pathes.Last then
raise Constraint_Error;
end if;
+
return Pathes.Table (N);
end Get_Path;
+ -- Search LIBRARY in the library path.
+ procedure Search_Library_In_Path (Library : Iir)
+ is
+ use Flags;
+ File_Name : constant String := Back_End.Library_To_File_Name (Library);
+ Library_Id : constant Name_Id := Get_Identifier (Library);
+ Id_Len : constant Natural := Get_Name_Length (Library_Id);
+ L : Natural;
+ Path_Len : Natural;
+ begin
+ for I in Pathes.First .. Pathes.Last loop
+ Image (Pathes.Table (I));
+ Path_Len := Nam_Length;
+
+ -- Try PATH/LIBxxx.cf
+ L := Path_Len + File_Name'Length;
+ Nam_Buffer (Path_Len + 1 .. L) := File_Name;
+ Nam_Buffer (L + 1) := Character'Val (0);
+ if GNAT.OS_Lib.Is_Regular_File (Nam_Buffer'Address) then
+ Set_Library_Directory (Library, Pathes.Table (I));
+ exit;
+ end if;
+
+ -- Try PATH/LIB/vNN/LIBxxx.cf
+ L := Path_Len + Id_Len;
+ Nam_Buffer (Path_Len + 1 .. L) := Image (Library_Id);
+ Nam_Buffer (L + 1) := GNAT.OS_Lib.Directory_Separator;
+ case Vhdl_Std is
+ when Vhdl_87 =>
+ Nam_Buffer (L + 2 .. L + 4) := "v87";
+ when Vhdl_93c | Vhdl_93 | Vhdl_00 | Vhdl_02 =>
+ Nam_Buffer (L + 2 .. L + 4) := "v93";
+ when Vhdl_08 =>
+ Nam_Buffer (L + 2 .. L + 4) := "v08";
+ end case;
+ L := L + 5;
+ Nam_Buffer (L) := GNAT.OS_Lib.Directory_Separator;
+ Nam_Buffer (L + 1 .. L + File_Name'Length) := File_Name;
+ Nam_Buffer (L + File_Name'Length + 1) := Character'Val (0);
+ if GNAT.OS_Lib.Is_Regular_File (Nam_Buffer'Address) then
+ -- For Get_Identifier: keep only the path part (including the
+ -- trailing path separator).
+ Nam_Length := L;
+ Set_Library_Directory (Library, Get_Identifier);
+ exit;
+ end if;
+ end loop;
+ end Search_Library_In_Path;
+
-- Set PATH as the path of the work library.
procedure Set_Work_Library_Path (Path : String) is
begin
@@ -368,24 +420,8 @@ package body Libraries is
-- Try to open the library file map.
Dir := Get_Library_Directory (Library);
if Dir = Null_Identifier then
- -- Search in the library path.
- declare
- File_Name : constant String :=
- Back_End.Library_To_File_Name (Library);
- L : Natural;
- begin
- for I in Pathes.First .. Pathes.Last loop
- Image (Pathes.Table (I));
- L := Nam_Length + File_Name'Length;
- Nam_Buffer (Nam_Length + 1 .. L) := File_Name;
- Nam_Buffer (L + 1) := Character'Val (0);
- if GNAT.OS_Lib.Is_Regular_File (Nam_Buffer'Address) then
- Dir := Pathes.Table (I);
- Set_Library_Directory (Library, Dir);
- exit;
- end if;
- end loop;
- end;
+ Search_Library_In_Path (Library);
+ Dir := Get_Library_Directory (Library);
end if;
if Dir = Null_Identifier
or else not Set_Library_File_Name (Dir, Library)