aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in11
-rw-r--r--doc/using/InvokingGHDL.rst21
-rw-r--r--libraries/Makefile.inc81
-rw-r--r--src/flags.ads3
-rw-r--r--src/ghdldrv/ghdldrv.adb10
-rw-r--r--src/ghdldrv/ghdllocal.adb6
-rw-r--r--src/options.adb2
-rw-r--r--src/vhdl/vhdl-sem_names.adb48
-rw-r--r--testsuite/gna/bug047/repro_arith.vhdl1
-rwxr-xr-xtestsuite/gna/bug047/testsuite.sh2
10 files changed, 85 insertions, 100 deletions
diff --git a/Makefile.in b/Makefile.in
index 9a6b1731a..7bda9e52b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -524,14 +524,13 @@ LIBDST_DIR:=$(libdirsuffix)
VHDLLIB_SUBDIRS_COMMON= src/std src/std/v87 src/std/v93 src/std/v08 \
src/synopsys src/synopsys/v08 \
- std/v87 ieee/v87 synopsys/v87 \
- std/v93 ieee/v93 synopsys/v93 \
+ std/v87 ieee/v87 \
+ std/v93 ieee/v93 \
std/v08 ieee/v08 \
src/openieee
-VHDLLIB_SUBDIRS_FULL= src/ieee src/vital95 src/vital2000 src/mentor \
- src/ieee/v87 src/ieee/v93 src/ieee2008 \
- mentor/v93 synopsys/v08
+VHDLLIB_SUBDIRS_FULL= src/ieee src/vital95 src/vital2000 \
+ src/ieee/v87 src/ieee/v93 src/ieee2008
ifeq ($(enable_openieee),false)
VHDLLIB_SUBDIRS=$(VHDLLIB_SUBDIRS_COMMON) $(VHDLLIB_SUBDIRS_FULL)
@@ -603,8 +602,6 @@ clean-pure-gpl:
# IEEE 1164 or vital libraries aren't GPL compatible
$(RM) -rf libraries/ieee libraries/ieee2008
$(RM) -rf libraries/vital95 libraries/vital2000
-# Don't promote deprecated mentor libraries; synopsys one is ok
- $(RM) -rf libraries/mentor
# The GNA testsuite contains open-source reproducer that may not be GPL.
$(RM) -rf testsuite/gna
diff --git a/doc/using/InvokingGHDL.rst b/doc/using/InvokingGHDL.rst
index a2099152c..6846b1b3e 100644
--- a/doc/using/InvokingGHDL.rst
+++ b/doc/using/InvokingGHDL.rst
@@ -284,6 +284,18 @@ Options
Specify the standard to use. By default, the standard is ``93c``, which means VHDL-93 accepting VHDL-87 syntax. For details on ``STANDARD`` values see section :ref:`VHDL_standards`.
+.. option:: -fsynopsys
+
+ Allow the use of synopsys non-standard packages
+ (``std_logic_arith``, ``std_logic_signed``, ``std_logic_unsigned``,
+ ``std_logic_textio``). These packages are
+ present in the ieee library but without this option it's an error to
+ use them.
+
+ The synopsys packages were created by some companies, and are popular. However
+ they are not standard packages, and have been placed in the `IEEE`
+ library without the permission from the ``ieee``.
+
.. option:: --ieee=<IEEE_VAR>
.. index:: ieee library
@@ -307,13 +319,8 @@ Options
for more details.
synopsys
- Supply the former packages and the following additional packages:
- ``std_logic_arith``, ``std_logic_signed``,
- ``std_logic_unsigned``, ``std_logic_textio``.
-
- These packages were created by some companies, and are popular. However
- they are not standard packages, and have been placed in the `IEEE`
- library without the permission from the ``ieee``.
+ This option is now deprecated. It is equivalent to
+ ``--ieee=standard`` and ``-fsynopsys``.
To avoid errors, you must use the same `IEEE` library for all units of
your design, and during elaboration.
diff --git a/libraries/Makefile.inc b/libraries/Makefile.inc
index 2866daefd..0c71d9437 100644
--- a/libraries/Makefile.inc
+++ b/libraries/Makefile.inc
@@ -32,14 +32,13 @@ enable_openieee=false
ifeq ($(enable_openieee),false)
# Full libraries
-vhdl.libs.v87: std.v87 ieee.v87 synopsys.v87
-vhdl.libs.v93: std.v93 ieee.v93 synopsys.v93
-vhdl.libs.v08: std.v08 ieee.v08 synopsys.v08 \
- $(LIBDST_DIR)/src/ieee2008/LICENSE
+vhdl.libs.v87: std.v87 ieee.v87
+vhdl.libs.v93: std.v93 ieee.v93
+vhdl.libs.v08: std.v08 ieee.v08 $(LIBDST_DIR)/src/ieee2008/LICENSE
else
# GPL compatible
-vhdl.libs.v87: std.v87 ieee.v87 synopsys.v87
-vhdl.libs.v93: std.v93 ieee.v93 synopsys.v93
+vhdl.libs.v87: std.v87 ieee.v87
+vhdl.libs.v93: std.v93 ieee.v93
vhdl.libs.v08: std.v08 ieee.v08
endif
@@ -119,15 +118,12 @@ SED_V08:= sed -e '/--V87/s/^/ --/' -e '/--!V08/s/^/ --/' \
STD87_DIR:=$(LIBDST_DIR)/std/v87
IEEE87_DIR:=$(LIBDST_DIR)/ieee/v87
-SYN87_DIR:=$(LIBDST_DIR)/synopsys/v87
STD93_DIR:=$(LIBDST_DIR)/std/v93
IEEE93_DIR:=$(LIBDST_DIR)/ieee/v93
-SYN93_DIR:=$(LIBDST_DIR)/synopsys/v93
STD08_DIR:=$(LIBDST_DIR)/std/v08
IEEE08_DIR:=$(LIBDST_DIR)/ieee/v08
-SYN08_DIR:=$(LIBDST_DIR)/synopsys/v08
ANALYZE87:=$(ANALYZE) --std=87
ANALYZE93:=$(ANALYZE) --std=93
@@ -174,35 +170,22 @@ ANALYZE_IEEE87=$(ANALYZE87) -P../.. --work=ieee
ieee.v87: $(IEEE87_DIR)/ieee-obj87.cf
-$(IEEE87_DIR)/ieee-obj87.cf: $(ANALYZE_DEP) $(IEEE87_SRCS) $(VITAL95_SRCS) $(STD87_DIR)/std-obj87.cf
+$(IEEE87_DIR)/ieee-obj87.cf: $(ANALYZE_DEP) $(IEEE87_SRCS) $(VITAL95_SRCS) $(SYNOPSYS87_SRCS) $(STD87_DIR)/std-obj87.cf
+ echo dep: $(SYNOPSYS87_SRCS)
$(RM) -f $@
cd $(IEEE87_DIR); \
for i in $(IEEE87_BSRCS) $(VITAL95_BSRCS); do \
cmd="$(ANALYZE_IEEE87) ../../src/$$i";\
echo $$cmd; eval $$cmd || exit 1; \
- done
-
-$(LIBDST_DIR)/src/synopsys/%.vhdl: $(LIBSRC_DIR)/synopsys/%.vhdl
- $(CP) $< $@
-
-synopsys.v87: $(SYN87_DIR)/ieee-obj87.cf
-
-$(SYN87_DIR)/ieee-obj87.cf: $(ANALYZE_DEP) $(SYNOPSYS87_SRCS) $(IEEE87_DIR)/ieee-obj87.cf
- $(RM) -f $@
- cd $(SYN87_DIR); \
- $(CP) ../../ieee/v87/ieee-obj87.cf . ; \
- test x$(VHDLLIBS_COPY_OBJS) = "xno" || \
- for i in $(IEEE_SRCS) $(VITAL95_SRCS); do \
- b=`basename $$i .vhdl`; \
- if [ -f ../../ieee/v87/$$b.o ]; then \
- $(RM) -f $$b.o; $(LN) ../../ieee/v87/$$b.o $$b.o || exit 1; \
- fi; \
done; \
for i in $(SYNOPSYS87_BSRCS); do \
- cmd="$(ANALYZE_IEEE87) ../../src/$$i";\
+ cmd="$(ANALYZE_IEEE87) -fsynopsys ../../src/$$i";\
echo $$cmd; eval $$cmd || exit 1; \
done
+$(LIBDST_DIR)/src/synopsys/%.vhdl: $(LIBSRC_DIR)/synopsys/%.vhdl
+ $(CP) $< $@
+
### V93 ###############################################################
@@ -238,29 +221,15 @@ ANALYZE_IEEE93=$(ANALYZE93) -P../.. --work=ieee
ieee.v93: $(IEEE93_DIR)/ieee-obj93.cf
-$(IEEE93_DIR)/ieee-obj93.cf: $(ANALYZE_DEP) $(IEEE93_SRCS) $(VITAL2000_SRCS) $(STD93_DIR)/std-obj93.cf
+$(IEEE93_DIR)/ieee-obj93.cf: $(ANALYZE_DEP) $(IEEE93_SRCS) $(VITAL2000_SRCS) $(SYNOPSYS93_SRCS) $(STD93_DIR)/std-obj93.cf
$(RM) -f $@
cd $(IEEE93_DIR); \
for i in $(IEEE93_BSRCS) $(VITAL2000_BSRCS); do \
cmd="$(ANALYZE_IEEE93) ../../src/$$i"; \
echo $$cmd; eval $$cmd || exit 1; \
- done
-
-synopsys.v93: $(SYN93_DIR)/ieee-obj93.cf
-
-$(SYN93_DIR)/ieee-obj93.cf: $(ANALYZE_DEP) $(SYNOPSYS93_SRCS) $(IEEE93_DIR)/ieee-obj93.cf
- $(RM) -f $@
- cd $(SYN93_DIR); \
- $(CP) ../../ieee/v93/ieee-obj93.cf .; \
- test x$(VHDLLIBS_COPY_OBJS) = "xno" || \
- for i in $(IEEE_SRCS) $(MATH_SRCS) $(VITAL2000_SRCS); do \
- b=`basename $$i .vhdl`; \
- if [ -f ../../ieee/v93/$$b.o ]; then \
- $(RM) -f $$b.o; $(LN) ../../ieee/v93/$$b.o $$b.o || exit 1; \
- fi; \
done; \
for i in $(SYNOPSYS93_BSRCS); do \
- cmd="$(ANALYZE_IEEE93) ../../src/$$i"; \
+ cmd="$(ANALYZE_IEEE93) -fsynopsys ../../src/$$i"; \
echo $$cmd; eval $$cmd || exit 1; \
done
@@ -296,7 +265,7 @@ ANALYZE_VITAL08=$(ANALYZE08) -P../.. --work=ieee -frelaxed-rules
ieee.v08: $(IEEE08_DIR)/ieee-obj08.cf
-$(IEEE08_DIR)/ieee-obj08.cf: $(ANALYZE_DEP) $(IEEE08_SRCS) $(STD08_DIR)/std-obj08.cf
+$(IEEE08_DIR)/ieee-obj08.cf: $(ANALYZE_DEP) $(IEEE08_SRCS) $(SYNOPSYS08_SRCS) $(STD08_DIR)/std-obj08.cf
$(RM) -f $@
cd $(IEEE08_DIR); \
for i in $(IEEE08_BSRCS); do \
@@ -306,29 +275,15 @@ $(IEEE08_DIR)/ieee-obj08.cf: $(ANALYZE_DEP) $(IEEE08_SRCS) $(STD08_DIR)/std-obj0
for i in $(VITAL2000_BSRCS); do \
cmd="$(ANALYZE_VITAL08) ../../src/$$i"; \
echo $$cmd; eval $$cmd || exit 1; \
- done
-
-$(LIBDST_DIR)/src/synopsys/v08/%.vhdl: $(LIBSRC_DIR)/synopsys/%.vhdl
- $(SED_V08) < $< > $@
-
-synopsys.v08: $(SYN08_DIR)/ieee-obj08.cf
-
-$(SYN08_DIR)/ieee-obj08.cf: $(ANALYZE_DEP) $(SYNOPSYS08_SRCS) $(IEEE08_DIR)/ieee-obj08.cf
- $(RM) -f $@
- cd $(SYN08_DIR); \
- $(CP) ../../ieee/v08/ieee-obj08.cf .; \
- test x$(VHDLLIBS_COPY_OBJS) = "xno" || \
- for i in $(IEEE08_SRCS) $(VITAL2000_SRCS); do \
- b=`basename $$i .vhdl`; \
- if [ -f ../../ieee/v08/$$b.o ]; then \
- $(RM) -f $$b.o; $(LN) ../../ieee/v08/$$b.o $$b.o || exit 1; \
- fi; \
done; \
for i in $(SYNOPSYS08_BSRCS); do \
- cmd="$(ANALYZE_IEEE08) ../../src/$$i"; \
+ cmd="$(ANALYZE_IEEE08) -fsynopsys ../../src/$$i"; \
echo $$cmd; eval $$cmd || exit 1; \
done
+$(LIBDST_DIR)/src/synopsys/v08/%.vhdl: $(LIBSRC_DIR)/synopsys/%.vhdl
+ $(SED_V08) < $< > $@
+
##############################################################################
ANALYZE_STD=$(GHDL) --bootstrap-standard $(GHDL_FLAGS)
diff --git a/src/flags.ads b/src/flags.ads
index a90a4fea0..b05a830a3 100644
--- a/src/flags.ads
+++ b/src/flags.ads
@@ -148,6 +148,9 @@ package Flags is
-- constant x : xtype := x;
Flag_Relaxed_Rules : Boolean := False;
+ -- If true, allow to use synopsys packages (std_logic_arith & co).
+ Flag_Synopsys : Boolean := False;
+
-- --warn-undriven
--Warn_Undriven : Boolean := False;
diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb
index dd2320daf..4d4ebfa61 100644
--- a/src/ghdldrv/ghdldrv.adb
+++ b/src/ghdldrv/ghdldrv.adb
@@ -26,6 +26,7 @@ with Dyn_Tables;
with Files_Map;
with Libraries;
with Default_Paths;
+with Flags;
with Simple_IO; use Simple_IO;
with Name_Table; use Name_Table;
with Vhdl.Std_Package;
@@ -688,6 +689,15 @@ package body Ghdldrv is
Error ("option --time-resolution not supported by back-end");
Res := Option_Err;
return;
+ elsif Opt = "--ieee=synopsys" or else Opt = "--ieee=none" then
+ -- Automatically translate the option.
+ if Backend = Backend_Gcc then
+ Add_Argument (Compiler_Args, new String'("--ghdl-fsynopsys"));
+ else
+ Add_Argument (Compiler_Args, new String'("-fsynopsys"));
+ end if;
+ Flags.Flag_Synopsys := True;
+ Res := Option_Ok;
else
Res := Options.Parse_Option (Opt);
if Res = Option_Ok then
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index 5745b2b50..40f2eb984 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -444,9 +444,11 @@ package body Ghdllocal is
when Lib_Standard =>
Add_Library_Name ("ieee");
when Lib_Synopsys =>
- Add_Library_Name ("synopsys");
+ Add_Library_Name ("ieee");
+ Flag_Synopsys := True;
when Lib_None =>
- null;
+ -- Allow synopsys packages.
+ Flag_Synopsys := True;
end case;
-- For std: just add the library prefix.
diff --git a/src/options.adb b/src/options.adb
index 65521b411..f43ee7663 100644
--- a/src/options.adb
+++ b/src/options.adb
@@ -180,6 +180,8 @@ package body Options is
Flag_Explicit := True;
elsif Opt = "-frelaxed-rules" or else Opt = "-frelaxed" then
Flag_Relaxed_Rules := True;
+ elsif Opt = "-fsynopsys" then
+ Flag_Synopsys := True;
elsif Opt = "--syn-binding" then
Flag_Syn_Binding := True;
elsif Opt = "--no-vital-checks" then
diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb
index ebed95997..91c9475bd 100644
--- a/src/vhdl/vhdl-sem_names.adb
+++ b/src/vhdl/vhdl-sem_names.adb
@@ -2263,29 +2263,33 @@ package body Vhdl.Sem_Names is
Error_Msg_Sem (+Name, "no method %i in %n", (+Suffix, +Prot_Type));
end Error_Protected_Item;
- -- Emit an error message if unit is not found in library LIB.
- procedure Error_Unit_Not_Found (Lib : Iir)
+ -- Check if a synopsys package can be imported.
+ procedure Check_Synopsys_Package (Lib : Iir)
is
use Std_Names;
begin
- Error_Msg_Sem (+Name, "unit %i not found in %n", (+Suffix, +Lib));
-
- -- Give an advice for common synopsys packages.
- if Get_Identifier (Lib) = Name_Ieee then
- if Suffix = Name_Std_Logic_Arith
- or else Suffix = Name_Std_Logic_Signed
- or else Suffix = Name_Std_Logic_Unsigned
- then
- Error_Msg_Sem
- (+Name,
- " (use --ieee=synopsys for non-standard synopsys packages)");
- elsif Suffix = Name_Std_Logic_Textio then
- Error_Msg_Sem
- (+Name, " (use --ieee=synopsys or --std=08 for "
- & "this non-standard synopsys package)");
- end if;
+ if Get_Identifier (Lib) /= Name_Ieee then
+ return;
end if;
- end Error_Unit_Not_Found;
+
+ case Suffix is
+ when Name_Std_Logic_Arith
+ | Name_Std_Logic_Signed
+ | Name_Std_Logic_Unsigned =>
+ -- Synopsys package.
+ null;
+ when Name_Std_Logic_Textio =>
+ if Vhdl_Std >= Vhdl_08 then
+ -- Standard ieee package in vhdl-08
+ return;
+ end if;
+ when others =>
+ -- Not a synopsys package.
+ return;
+ end case;
+ Error_Msg_Sem
+ (+Name, "use of synopsys packages needs the -fsynopsys option");
+ end Check_Synopsys_Package;
begin
-- Analyze prefix.
if Soft then
@@ -2368,10 +2372,14 @@ package body Vhdl.Sem_Names is
-- GHDL: FIXME: error message more explicit
Res := Load_Primary_Unit (Prefix, Suffix, Name);
if Res /= Null_Iir then
+ if not Soft and then not Flag_Synopsys then
+ Check_Synopsys_Package (Prefix);
+ end if;
Sem.Add_Dependence (Res);
Res := Get_Library_Unit (Res);
elsif not Soft then
- Error_Unit_Not_Found (Prefix);
+ Error_Msg_Sem
+ (+Name, "unit %i not found in %n", (+Suffix, +Prefix));
end if;
when Iir_Kind_Process_Statement
| Iir_Kind_Procedure_Declaration
diff --git a/testsuite/gna/bug047/repro_arith.vhdl b/testsuite/gna/bug047/repro_arith.vhdl
index 4160c2f73..f951108bf 100644
--- a/testsuite/gna/bug047/repro_arith.vhdl
+++ b/testsuite/gna/bug047/repro_arith.vhdl
@@ -1,4 +1,5 @@
library ieee;
+use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity repro_arith is
diff --git a/testsuite/gna/bug047/testsuite.sh b/testsuite/gna/bug047/testsuite.sh
index 9ccf25f74..11838e49a 100755
--- a/testsuite/gna/bug047/testsuite.sh
+++ b/testsuite/gna/bug047/testsuite.sh
@@ -3,7 +3,7 @@
. ../../testenv.sh
#GHDL_FLAGS=--ieee=synopsys
-analyze_failure repro_arith.vhdl 2>&1 | grep "non-standard synopsys"
+analyze_failure repro_arith.vhdl
clean