aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-06-19 06:40:48 +0200
committerTristan Gingold <tgingold@free.fr>2018-06-19 06:40:48 +0200
commit3a9ebc277637dcfc029038caf6b37fb7580d409d (patch)
tree95a9a578e65558b6421909e423db3c381248bf26 /src/vhdl
parenta3524ea3265ab4c135d1fa3461466ba0a7d8dfac (diff)
downloadghdl-3a9ebc277637dcfc029038caf6b37fb7580d409d.tar.gz
ghdl-3a9ebc277637dcfc029038caf6b37fb7580d409d.tar.bz2
ghdl-3a9ebc277637dcfc029038caf6b37fb7580d409d.zip
Delay translation of default configuration.
Fix #606
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/translate/trans-chap12.adb22
-rw-r--r--src/vhdl/translate/translation.adb1
2 files changed, 19 insertions, 4 deletions
diff --git a/src/vhdl/translate/trans-chap12.adb b/src/vhdl/translate/trans-chap12.adb
index 9522b5cd2..b0e096565 100644
--- a/src/vhdl/translate/trans-chap12.adb
+++ b/src/vhdl/translate/trans-chap12.adb
@@ -675,10 +675,12 @@ package body Trans.Chap12 is
case Get_Kind (Lib_Unit) is
when Iir_Kind_Configuration_Declaration =>
- -- Always generate code for configuration.
- -- Because default binding may be changed between analysis
- -- and elaboration.
- Translate (Unit, True);
+ if Get_Identifier (Lib_Unit) /= Null_Identifier then
+ -- Always generate code for configuration.
+ -- Because default binding may be changed between analysis
+ -- and elaboration.
+ Translate (Unit, True);
+ end if;
when Iir_Kind_Entity_Declaration
| Iir_Kind_Architecture_Body
| Iir_Kind_Package_Declaration
@@ -698,6 +700,18 @@ package body Trans.Chap12 is
end case;
end loop;
+ for I in Design_Units.First .. Design_Units.Last loop
+ Unit := Design_Units.Table (I);
+ Lib_Unit := Get_Library_Unit (Unit);
+ if Get_Kind (Lib_Unit) = Iir_Kind_Configuration_Declaration
+ and then Get_Identifier (Lib_Unit) = Null_Identifier
+ then
+ -- Because of possible indirect recursion, translate default
+ -- configuration at the end.
+ Translate (Unit, True);
+ end if;
+ end loop;
+
-- Generate code to elaboration body-less package.
--
-- When a package is analyzed, we don't know wether there is body
diff --git a/src/vhdl/translate/translation.adb b/src/vhdl/translate/translation.adb
index 69b63abee..5c39283e3 100644
--- a/src/vhdl/translate/translation.adb
+++ b/src/vhdl/translate/translation.adb
@@ -332,6 +332,7 @@ package body Translation is
Push_Identifier_Prefix (Mark_Arch, Get_Identifier (Arch));
Push_Identifier_Prefix
(Mark, Name_Table.Get_Identifier ("DEFAULT_CONFIG"));
+ -- Spec is built during translation of architecture.
Chap1.Translate_Configuration_Declaration_Body (Lib_Unit);
Pop_Identifier_Prefix (Mark);
Pop_Identifier_Prefix (Mark_Arch);