aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate/trans-chap1.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-01-07 08:07:42 +0100
committerTristan Gingold <tgingold@free.fr>2015-01-07 08:07:42 +0100
commit99443212bf78a5d36b693abab225a160a92d097a (patch)
tree9191d2419b376bd45737e3b23e9b95967c017560 /src/vhdl/translate/trans-chap1.adb
parent3aaf2679a61b4d8bd61c7cccd5ca0ec1f1606de5 (diff)
downloadghdl-99443212bf78a5d36b693abab225a160a92d097a.tar.gz
ghdl-99443212bf78a5d36b693abab225a160a92d097a.tar.bz2
ghdl-99443212bf78a5d36b693abab225a160a92d097a.zip
Handle vhdl08 if generate statements
Diffstat (limited to 'src/vhdl/translate/trans-chap1.adb')
-rw-r--r--src/vhdl/translate/trans-chap1.adb40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/vhdl/translate/trans-chap1.adb b/src/vhdl/translate/trans-chap1.adb
index ae2b10699..1f0e7d3e7 100644
--- a/src/vhdl/translate/trans-chap1.adb
+++ b/src/vhdl/translate/trans-chap1.adb
@@ -727,31 +727,39 @@ package body Trans.Chap1 is
Parent_Info : Block_Info_Acc)
is
Spec : constant Iir := Get_Block_Specification (Block_Config);
- Block : constant Iir := Get_Block_From_Block_Specification (Spec);
- Info : constant Block_Info_Acc := Get_Info (Block);
+ Bod : constant Iir := Get_Block_From_Block_Specification (Spec);
+ Gen : constant Iir := Get_Parent (Bod);
+ Gen_Info : constant Generate_Info_Acc := Get_Info (Gen);
+ Bod_Info : constant Block_Info_Acc := Get_Info (Bod);
Var : O_Dnode;
If_Blk : O_If_Block;
begin
- -- Configure the block only if it was created.
- Open_Temp;
- Var := Create_Temp_Init
- (Info.Block_Decls_Ptr_Type,
- New_Value (New_Selected_Element
- (Get_Instance_Ref (Parent_Info.Block_Scope),
- Info.Block_Parent_Field)));
+ -- Configure the block only if block id matches.
Start_If_Stmt
(If_Blk,
New_Compare_Op
- (ON_Neq,
- New_Obj_Value (Var),
- New_Lit (New_Null_Access (Info.Block_Decls_Ptr_Type)),
+ (ON_Eq,
+ New_Value (New_Selected_Element
+ (Get_Instance_Ref (Parent_Info.Block_Scope),
+ Gen_Info.Generate_Body_Id)),
+ New_Lit (New_Index_Lit (Unsigned_64 (Bod_Info.Block_Id))),
Ghdl_Bool_Type));
- Set_Scope_Via_Param_Ptr (Info.Block_Scope, Var);
- Translate_Block_Configuration_Calls (Block_Config, Block, Info);
- Clear_Scope (Info.Block_Scope);
- Finish_If_Stmt (If_Blk);
+
+ Open_Temp;
+ Var := Create_Temp_Init
+ (Bod_Info.Block_Decls_Ptr_Type,
+ New_Convert_Ov
+ (New_Value (New_Selected_Element
+ (Get_Instance_Ref (Parent_Info.Block_Scope),
+ Gen_Info.Generate_Parent_Field)),
+ Bod_Info.Block_Decls_Ptr_Type));
+ Set_Scope_Via_Param_Ptr (Bod_Info.Block_Scope, Var);
+ Translate_Block_Configuration_Calls (Block_Config, Bod, Bod_Info);
+ Clear_Scope (Bod_Info.Block_Scope);
Close_Temp;
+
+ Finish_If_Stmt (If_Blk);
end Translate_If_Generate_Block_Configuration_Calls;
procedure Translate_Block_Configuration_Calls