aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vhdl/translate/trans-chap1.adb2
-rw-r--r--src/vhdl/translate/trans-chap2.adb7
-rw-r--r--src/vhdl/translate/trans-chap4.adb19
-rw-r--r--src/vhdl/translate/trans-chap4.ads2
4 files changed, 21 insertions, 9 deletions
diff --git a/src/vhdl/translate/trans-chap1.adb b/src/vhdl/translate/trans-chap1.adb
index f48695d95..8533e5483 100644
--- a/src/vhdl/translate/trans-chap1.adb
+++ b/src/vhdl/translate/trans-chap1.adb
@@ -172,7 +172,7 @@ package body Trans.Chap1 is
-- Entity declaration subprograms as they can be called by the
-- architectures.
Chap4.Translate_Declaration_Chain_Subprograms
- (Entity, Subprg_Translate_Spec_And_Body);
+ (Entity, Subprg_Translate_Only_Spec);
else
-- Entity declaration and process subprograms.
Chap9.Translate_Block_Subprograms (Entity, Entity);
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb
index 04717cb91..cd84d4168 100644
--- a/src/vhdl/translate/trans-chap2.adb
+++ b/src/vhdl/translate/trans-chap2.adb
@@ -812,8 +812,7 @@ package body Trans.Chap2 is
-- For nested package, this will be translated when translating
-- subprograms.
- Chap4.Translate_Declaration_Chain_Subprograms
- (Decl, Subprg_Translate_Spec_And_Body);
+ Chap4.Translate_Declaration_Chain_Subprograms_Spec_Body (Decl);
Create_Package_Elaborator (Info);
@@ -948,9 +947,7 @@ package body Trans.Chap2 is
Subprgs.Pop_Subprg_Instance (Wki_Instance, Prev_Subprg_Instance);
- if What in Subprg_Translate_Body
- and then Global_Storage /= O_Storage_External
- then
+ if What in Subprg_Translate_Body then
-- For nested package, this will be translated when translating
-- subprograms.
Set_Scope_Via_Field (Info.Package_Spec_Scope,
diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb
index 0b82663a8..4e49b14dd 100644
--- a/src/vhdl/translate/trans-chap4.adb
+++ b/src/vhdl/translate/trans-chap4.adb
@@ -2598,6 +2598,19 @@ package body Trans.Chap4 is
Create_Union_Scope (State_Scope.all, Scope_Type);
end Translate_Statements_Chain_State_Declaration;
+ procedure Translate_Declaration_Chain_Subprograms_Spec_Body (Parent : Iir)
+ is
+ What : Subprg_Translate_Kind;
+ begin
+ if Global_Storage /= O_Storage_External then
+ What := Subprg_Translate_Spec_And_Body;
+ else
+ -- No need and incorrect to generate bodies when external storage.
+ What := Subprg_Translate_Only_Spec;
+ end if;
+ Translate_Declaration_Chain_Subprograms (Parent, What);
+ end Translate_Declaration_Chain_Subprograms_Spec_Body;
+
procedure Translate_Declaration_Chain_Subprograms
(Parent : Iir; What : Subprg_Translate_Kind)
is
@@ -2605,9 +2618,9 @@ package body Trans.Chap4 is
Do_Specs : constant Boolean := What in Subprg_Translate_Spec;
-- True iff bodies must be translated.
- Do_Bodies : constant Boolean :=
- (What in Subprg_Translate_Body
- and then Global_Storage /= O_Storage_External);
+ Do_Bodies : constant Boolean := What in Subprg_Translate_Body;
+ pragma Assert
+ (not (Do_Bodies and then Global_Storage = O_Storage_External));
El : Iir;
Infos : Chap7.Implicit_Subprogram_Infos;
diff --git a/src/vhdl/translate/trans-chap4.ads b/src/vhdl/translate/trans-chap4.ads
index 02ff9a70e..cf4a6624b 100644
--- a/src/vhdl/translate/trans-chap4.ads
+++ b/src/vhdl/translate/trans-chap4.ads
@@ -57,6 +57,8 @@ package Trans.Chap4 is
procedure Translate_Declaration_Chain_Subprograms
(Parent : Iir; What : Subprg_Translate_Kind);
+ procedure Translate_Declaration_Chain_Subprograms_Spec_Body (Parent : Iir);
+
-- Create subprograms for type/function conversion of signal
-- associations.
-- ENTITY is the entity instantiated, which can be either