summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold2015-01-12 05:03:42 +0100
committerTristan Gingold2015-01-12 05:03:42 +0100
commit4d24c422cc4a3f84bf0aa81fa26e777355b7265c (patch)
tree0f2e2a5fced7f615184e5eeb6aff9badcb489ed7
parentbf34db9bc6351e0a89c2faa208ac12add92363ec (diff)
downloadghdl-4d24c422cc4a3f84bf0aa81fa26e777355b7265c.tar.gz
ghdl-4d24c422cc4a3f84bf0aa81fa26e777355b7265c.tar.bz2
ghdl-4d24c422cc4a3f84bf0aa81fa26e777355b7265c.zip
vhdl2008: expanded names in for-generate statements.
-rw-r--r--src/vhdl/iirs.ads2
-rw-r--r--src/vhdl/nodes_meta.adb132
-rw-r--r--src/vhdl/sem_names.adb19
-rw-r--r--src/vhdl/sem_stmts.adb2
4 files changed, 81 insertions, 74 deletions
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index 8c53961..90e8045 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -2565,6 +2565,8 @@ package Iirs is
--
-- Get/Set_Visible_Flag (Flag4)
--
+ -- Get/Set_Is_Within_Flag (Flag5)
+ --
-- Get/Set_End_Has_Reserved_Id (Flag8)
--
-- Get/Set_End_Has_Identifier (Flag9)
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index f510db8..4795441 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -3395,6 +3395,7 @@ package body Nodes_Meta is
-- Iir_Kind_For_Generate_Statement
Field_Label,
Field_Visible_Flag,
+ Field_Is_Within_Flag,
Field_End_Has_Reserved_Id,
Field_End_Has_Identifier,
Field_Parameter_Specification,
@@ -4026,71 +4027,71 @@ package body Nodes_Meta is
Iir_Kind_Concurrent_Procedure_Call_Statement => 1212,
Iir_Kind_Block_Statement => 1225,
Iir_Kind_If_Generate_Statement => 1235,
- Iir_Kind_For_Generate_Statement => 1243,
- Iir_Kind_Component_Instantiation_Statement => 1253,
- Iir_Kind_Simple_Simultaneous_Statement => 1260,
- Iir_Kind_Generate_Statement_Body => 1271,
- Iir_Kind_If_Generate_Else_Clause => 1276,
- Iir_Kind_Signal_Assignment_Statement => 1285,
- Iir_Kind_Null_Statement => 1289,
- Iir_Kind_Assertion_Statement => 1296,
- Iir_Kind_Report_Statement => 1302,
- Iir_Kind_Wait_Statement => 1309,
- Iir_Kind_Variable_Assignment_Statement => 1315,
- Iir_Kind_Return_Statement => 1321,
- Iir_Kind_For_Loop_Statement => 1329,
- Iir_Kind_While_Loop_Statement => 1336,
- Iir_Kind_Next_Statement => 1342,
- Iir_Kind_Exit_Statement => 1348,
- Iir_Kind_Case_Statement => 1355,
- Iir_Kind_Procedure_Call_Statement => 1360,
- Iir_Kind_If_Statement => 1368,
- Iir_Kind_Elsif => 1373,
- Iir_Kind_Character_Literal => 1380,
- Iir_Kind_Simple_Name => 1387,
- Iir_Kind_Selected_Name => 1395,
- Iir_Kind_Operator_Symbol => 1400,
- Iir_Kind_Selected_By_All_Name => 1405,
- Iir_Kind_Parenthesis_Name => 1409,
- Iir_Kind_Base_Attribute => 1411,
- Iir_Kind_Left_Type_Attribute => 1416,
- Iir_Kind_Right_Type_Attribute => 1421,
- Iir_Kind_High_Type_Attribute => 1426,
- Iir_Kind_Low_Type_Attribute => 1431,
- Iir_Kind_Ascending_Type_Attribute => 1436,
- Iir_Kind_Image_Attribute => 1442,
- Iir_Kind_Value_Attribute => 1448,
- Iir_Kind_Pos_Attribute => 1454,
- Iir_Kind_Val_Attribute => 1460,
- Iir_Kind_Succ_Attribute => 1466,
- Iir_Kind_Pred_Attribute => 1472,
- Iir_Kind_Leftof_Attribute => 1478,
- Iir_Kind_Rightof_Attribute => 1484,
- Iir_Kind_Delayed_Attribute => 1492,
- Iir_Kind_Stable_Attribute => 1500,
- Iir_Kind_Quiet_Attribute => 1508,
- Iir_Kind_Transaction_Attribute => 1516,
- Iir_Kind_Event_Attribute => 1520,
- Iir_Kind_Active_Attribute => 1524,
- Iir_Kind_Last_Event_Attribute => 1528,
- Iir_Kind_Last_Active_Attribute => 1532,
- Iir_Kind_Last_Value_Attribute => 1536,
- Iir_Kind_Driving_Attribute => 1540,
- Iir_Kind_Driving_Value_Attribute => 1544,
- Iir_Kind_Behavior_Attribute => 1544,
- Iir_Kind_Structure_Attribute => 1544,
- Iir_Kind_Simple_Name_Attribute => 1551,
- Iir_Kind_Instance_Name_Attribute => 1556,
- Iir_Kind_Path_Name_Attribute => 1561,
- Iir_Kind_Left_Array_Attribute => 1568,
- Iir_Kind_Right_Array_Attribute => 1575,
- Iir_Kind_High_Array_Attribute => 1582,
- Iir_Kind_Low_Array_Attribute => 1589,
- Iir_Kind_Length_Array_Attribute => 1596,
- Iir_Kind_Ascending_Array_Attribute => 1603,
- Iir_Kind_Range_Array_Attribute => 1610,
- Iir_Kind_Reverse_Range_Array_Attribute => 1617,
- Iir_Kind_Attribute_Name => 1625
+ Iir_Kind_For_Generate_Statement => 1244,
+ Iir_Kind_Component_Instantiation_Statement => 1254,
+ Iir_Kind_Simple_Simultaneous_Statement => 1261,
+ Iir_Kind_Generate_Statement_Body => 1272,
+ Iir_Kind_If_Generate_Else_Clause => 1277,
+ Iir_Kind_Signal_Assignment_Statement => 1286,
+ Iir_Kind_Null_Statement => 1290,
+ Iir_Kind_Assertion_Statement => 1297,
+ Iir_Kind_Report_Statement => 1303,
+ Iir_Kind_Wait_Statement => 1310,
+ Iir_Kind_Variable_Assignment_Statement => 1316,
+ Iir_Kind_Return_Statement => 1322,
+ Iir_Kind_For_Loop_Statement => 1330,
+ Iir_Kind_While_Loop_Statement => 1337,
+ Iir_Kind_Next_Statement => 1343,
+ Iir_Kind_Exit_Statement => 1349,
+ Iir_Kind_Case_Statement => 1356,
+ Iir_Kind_Procedure_Call_Statement => 1361,
+ Iir_Kind_If_Statement => 1369,
+ Iir_Kind_Elsif => 1374,
+ Iir_Kind_Character_Literal => 1381,
+ Iir_Kind_Simple_Name => 1388,
+ Iir_Kind_Selected_Name => 1396,
+ Iir_Kind_Operator_Symbol => 1401,
+ Iir_Kind_Selected_By_All_Name => 1406,
+ Iir_Kind_Parenthesis_Name => 1410,
+ Iir_Kind_Base_Attribute => 1412,
+ Iir_Kind_Left_Type_Attribute => 1417,
+ Iir_Kind_Right_Type_Attribute => 1422,
+ Iir_Kind_High_Type_Attribute => 1427,
+ Iir_Kind_Low_Type_Attribute => 1432,
+ Iir_Kind_Ascending_Type_Attribute => 1437,
+ Iir_Kind_Image_Attribute => 1443,
+ Iir_Kind_Value_Attribute => 1449,
+ Iir_Kind_Pos_Attribute => 1455,
+ Iir_Kind_Val_Attribute => 1461,
+ Iir_Kind_Succ_Attribute => 1467,
+ Iir_Kind_Pred_Attribute => 1473,
+ Iir_Kind_Leftof_Attribute => 1479,
+ Iir_Kind_Rightof_Attribute => 1485,
+ Iir_Kind_Delayed_Attribute => 1493,
+ Iir_Kind_Stable_Attribute => 1501,
+ Iir_Kind_Quiet_Attribute => 1509,
+ Iir_Kind_Transaction_Attribute => 1517,
+ Iir_Kind_Event_Attribute => 1521,
+ Iir_Kind_Active_Attribute => 1525,
+ Iir_Kind_Last_Event_Attribute => 1529,
+ Iir_Kind_Last_Active_Attribute => 1533,
+ Iir_Kind_Last_Value_Attribute => 1537,
+ Iir_Kind_Driving_Attribute => 1541,
+ Iir_Kind_Driving_Value_Attribute => 1545,
+ Iir_Kind_Behavior_Attribute => 1545,
+ Iir_Kind_Structure_Attribute => 1545,
+ Iir_Kind_Simple_Name_Attribute => 1552,
+ Iir_Kind_Instance_Name_Attribute => 1557,
+ Iir_Kind_Path_Name_Attribute => 1562,
+ Iir_Kind_Left_Array_Attribute => 1569,
+ Iir_Kind_Right_Array_Attribute => 1576,
+ Iir_Kind_High_Array_Attribute => 1583,
+ Iir_Kind_Low_Array_Attribute => 1590,
+ Iir_Kind_Length_Array_Attribute => 1597,
+ Iir_Kind_Ascending_Array_Attribute => 1604,
+ Iir_Kind_Range_Array_Attribute => 1611,
+ Iir_Kind_Reverse_Range_Array_Attribute => 1618,
+ Iir_Kind_Attribute_Name => 1626
);
function Get_Fields (K : Iir_Kind) return Fields_Array
@@ -9044,6 +9045,7 @@ package body Nodes_Meta is
| Iir_Kind_Process_Statement
| Iir_Kind_Block_Statement
| Iir_Kind_If_Generate_Statement
+ | Iir_Kind_For_Generate_Statement
| Iir_Kind_Generate_Statement_Body
| Iir_Kind_For_Loop_Statement =>
return True;
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index 7edad15..756066c 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -311,10 +311,8 @@ package body Sem_Names is
procedure Iterator_Decl_Chain is new Sem_Scopes.Iterator_Decl_Chain
(Arg_Type => Name_Id, Handle_Decl => Iterator_Decl);
- Id : Name_Id;
- Decl_Body : Iir;
+ Id : constant Name_Id := Get_Identifier (Name);
begin
- Id := Get_Identifier (Name);
case Get_Kind (Decl) is
when Iir_Kind_Function_Declaration
| Iir_Kind_Procedure_Declaration =>
@@ -352,11 +350,14 @@ package body Sem_Names is
case Get_Kind (Decl) is
when Iir_Kind_Function_Declaration
| Iir_Kind_Procedure_Declaration =>
- Decl_Body := Get_Subprogram_Body (Decl);
- Iterator_Decl_Chain
- (Get_Declaration_Chain (Decl_Body), Id);
- Iterator_Decl_Chain
- (Get_Sequential_Statement_Chain (Decl_Body), Id);
+ declare
+ Decl_Body : constant Iir := Get_Subprogram_Body (Decl);
+ begin
+ Iterator_Decl_Chain
+ (Get_Declaration_Chain (Decl_Body), Id);
+ Iterator_Decl_Chain
+ (Get_Sequential_Statement_Chain (Decl_Body), Id);
+ end;
when Iir_Kind_Architecture_Body
| Iir_Kind_Entity_Declaration
| Iir_Kind_Block_Statement =>
@@ -364,7 +365,7 @@ package body Sem_Names is
Iterator_Decl_Chain (Get_Concurrent_Statement_Chain (Decl), Id);
when Iir_Kind_For_Generate_Statement =>
declare
- Bod : constant Iir := Get_Generate_Block_Configuration (Decl);
+ Bod : constant Iir := Get_Generate_Statement_Body (Decl);
begin
Iterator_Decl_Chain (Get_Declaration_Chain (Bod), Id);
Iterator_Decl_Chain (Get_Concurrent_Statement_Chain (Bod), Id);
diff --git a/src/vhdl/sem_stmts.adb b/src/vhdl/sem_stmts.adb
index a99ccde..6707624 100644
--- a/src/vhdl/sem_stmts.adb
+++ b/src/vhdl/sem_stmts.adb
@@ -1525,6 +1525,7 @@ package body Sem_Stmts is
-- LRM93 10.1 Declarative region.
-- 12. A generate statement.
Open_Declarative_Region;
+ Set_Is_Within_Flag (Stmt, True);
Param := Get_Parameter_Specification (Stmt);
Sem_Scopes.Add_Name (Param);
@@ -1544,6 +1545,7 @@ package body Sem_Stmts is
-- In the same declarative region.
Sem_Generate_Statement_Body (Get_Generate_Statement_Body (Stmt));
+ Set_Is_Within_Flag (Stmt, True);
Close_Declarative_Region;
end Sem_For_Generate_Statement;