diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-02-12 18:12:04 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-02-12 18:12:55 +0100 |
commit | 7cf780c73be8429720195ddeaeb3682b106f4c38 (patch) | |
tree | 606288cd3781746e82e1640fb995896dac2a767e /src/synth/synth-expr.adb | |
parent | a2664544dc58caaedf84cd235aa3ee17b164f1f3 (diff) | |
download | ghdl-7cf780c73be8429720195ddeaeb3682b106f4c38.tar.gz ghdl-7cf780c73be8429720195ddeaeb3682b106f4c38.tar.bz2 ghdl-7cf780c73be8429720195ddeaeb3682b106f4c38.zip |
synth-expr: compute signess for range array attributes. Fix #1645
Diffstat (limited to 'src/synth/synth-expr.adb')
-rw-r--r-- | src/synth/synth-expr.adb | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 0e3849149..ad5d2f50b 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -425,14 +425,14 @@ package body Synth.Expr is N := Arr (Arr'First); end Concat_Array; - function Synth_Discrete_Range_Expression + function Build_Discrete_Range_Type (L : Int64; R : Int64; Dir : Direction_Type) return Discrete_Range_Type is begin return (Dir => Dir, Left => L, Right => R, Is_Signed => L < 0 or R < 0); - end Synth_Discrete_Range_Expression; + end Build_Discrete_Range_Type; function Synth_Discrete_Range_Expression (Syn_Inst : Synth_Instance_Acc; Rng : Node) return Discrete_Range_Type @@ -457,10 +457,7 @@ package body Synth.Expr is Lval := Read_Discrete (L); Rval := Read_Discrete (R); - return (Dir => Get_Direction (Rng), - Left => Lval, - Right => Rval, - Is_Signed => Lval < 0 or Rval < 0); + return Build_Discrete_Range_Type (Lval, Rval, Get_Direction (Rng)); end Synth_Discrete_Range_Expression; function Synth_Float_Range_Expression @@ -595,10 +592,8 @@ package body Synth.Expr is B : Bound_Type; begin B := Synth_Array_Attribute (Syn_Inst, Bound); - Rng := Discrete_Range_Type'(Dir => B.Dir, - Is_Signed => True, - Left => Int64 (B.Left), - Right => Int64 (B.Right)); + Rng := Build_Discrete_Range_Type + (Int64 (B.Left), Int64 (B.Right), B.Dir); end; when Iir_Kind_Reverse_Range_Array_Attribute => declare @@ -617,10 +612,8 @@ package body Synth.Expr is B.Right := B.Left; B.Left := T; - Rng := Discrete_Range_Type'(Dir => B.Dir, - Is_Signed => True, - Left => Int64 (B.Left), - Right => Int64 (B.Right)); + Rng := Build_Discrete_Range_Type + (Int64 (B.Left), Int64 (B.Right), B.Dir); end; when Iir_Kinds_Denoting_Name => -- A discrete subtype name. |