diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-09-30 20:27:01 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-09-30 20:27:01 +0200 |
commit | 128c4a0f7d52116b4377aa6218f91066f1b20109 (patch) | |
tree | 6c087a445bdeb55069b23b4d3cbf7f8269f0a83f /src/vhdl/evaluation.adb | |
parent | 0ecff214b82f61da149e51075254c3ecc4904d75 (diff) | |
download | ghdl-128c4a0f7d52116b4377aa6218f91066f1b20109.tar.gz ghdl-128c4a0f7d52116b4377aa6218f91066f1b20109.tar.bz2 ghdl-128c4a0f7d52116b4377aa6218f91066f1b20109.zip |
Rework range_expression and incomplete type for instantiation.
Diffstat (limited to 'src/vhdl/evaluation.adb')
-rw-r--r-- | src/vhdl/evaluation.adb | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/vhdl/evaluation.adb b/src/vhdl/evaluation.adb index 8bcc6ff9e..24a365ee9 100644 --- a/src/vhdl/evaluation.adb +++ b/src/vhdl/evaluation.adb @@ -273,7 +273,9 @@ package body Evaluation is Location_Copy (Res, Origin); Set_Type (Res, Get_Type (Range_Expr)); Set_Left_Limit (Res, Get_Left_Limit (Range_Expr)); + Set_Left_Limit_Expr (Res, Get_Left_Limit_Expr (Range_Expr)); Set_Right_Limit (Res, Get_Right_Limit (Range_Expr)); + Set_Right_Limit_Expr (Res, Get_Right_Limit_Expr (Range_Expr)); Set_Direction (Res, Get_Direction (Range_Expr)); Set_Range_Origin (Res, Origin); Set_Expr_Staticness (Res, Locally); @@ -302,16 +304,12 @@ package body Evaluation is -- Set the right limit of A_RANGE from LEN. procedure Set_Right_Limit_By_Length (A_Range : Iir; Len : Iir_Int64) is - Left, Right : Iir; + A_Type : constant Iir := Get_Type (A_Range); + Left : constant Iir := Get_Left_Limit (A_Range); + Right : Iir; Pos : Iir_Int64; - A_Type : Iir; begin - if Get_Expr_Staticness (A_Range) /= Locally then - raise Internal_Error; - end if; - A_Type := Get_Type (A_Range); - - Left := Get_Left_Limit (A_Range); + pragma Assert (Get_Expr_Staticness (A_Range) = Locally); Pos := Eval_Pos (Left); case Get_Direction (A_Range) is @@ -329,6 +327,7 @@ package body Evaluation is -- FIXME: what about nul range? Right := Build_Discrete (Pos, A_Range); Set_Literal_Origin (Right, Null_Iir); + Set_Right_Limit_Expr (A_Range, Right); end if; Set_Right_Limit (A_Range, Right); end Set_Right_Limit_By_Length; @@ -1846,13 +1845,18 @@ package body Evaluation is end Create_Bound; Res : Iir; + Lit : Iir; begin Res_Btype := Get_Base_Type (Res_Type); Res := Create_Iir (Iir_Kind_Range_Expression); Location_Copy (Res, Loc); Set_Type (Res, Res_Btype); - Set_Left_Limit (Res, Create_Bound (Get_Left_Limit (Rng))); - Set_Right_Limit (Res, Create_Bound (Get_Right_Limit (Rng))); + Lit := Create_Bound (Get_Left_Limit (Rng)); + Set_Left_Limit (Res, Lit); + Set_Left_Limit_Expr (Res, Lit); + Lit := Create_Bound (Get_Right_Limit (Rng)); + Set_Right_Limit (Res, Lit); + Set_Right_Limit_Expr (Res, Lit); Set_Direction (Res, Get_Direction (Rng)); Set_Expr_Staticness (Res, Locally); return Res; |