aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-04-28 07:02:57 +0200
committerTristan Gingold <tgingold@free.fr>2022-04-28 07:02:57 +0200
commit1dd9c36d3bd138a9cfe37983514e32664e91a4d8 (patch)
tree5571b5b79b4412d6d83b8b8373e801fac9daf2e9 /src/synth
parenta2550cae21230060c3a5c5c210781a8c66938a3f (diff)
downloadghdl-1dd9c36d3bd138a9cfe37983514e32664e91a4d8.tar.gz
ghdl-1dd9c36d3bd138a9cfe37983514e32664e91a4d8.tar.bz2
ghdl-1dd9c36d3bd138a9cfe37983514e32664e91a4d8.zip
synth-ieee-numeric_std: factorize code
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/synth-ieee-numeric_std.adb19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/synth/synth-ieee-numeric_std.adb b/src/synth/synth-ieee-numeric_std.adb
index e35ac950c..f8b7bc960 100644
--- a/src/synth/synth-ieee-numeric_std.adb
+++ b/src/synth/synth-ieee-numeric_std.adb
@@ -776,7 +776,6 @@ package body Synth.Ieee.Numeric_Std is
is
Len : constant Uns32 := V.Typ.Vbound.Len;
Res : Memtyp;
- Vb, Carry : Sl_X01;
begin
Res.Typ := Create_Res_Type (V.Typ, Len);
Res := Create_Memory (Res.Typ);
@@ -785,19 +784,11 @@ package body Synth.Ieee.Numeric_Std is
return Res;
end if;
- Carry := '1';
- for I in 1 .. Len loop
- Vb := Sl_To_X01 (Read_Std_Logic (V.Mem, Len - I));
- if Vb = 'X' then
- Warning_Msg_Synth
- (+Loc, "NUMERIC_STD.""-"": non logical value detected");
- Fill (Res, 'X');
- exit;
- end if;
- Vb := Not_Table (Vb);
- Write_Std_Logic (Res.Mem, Len - I, Xor_Table (Carry, Vb));
- Carry := And_Table (Carry, Vb);
- end loop;
+ Neg_Vec (V.Mem, Res.Mem, V.Typ);
+ if Read_Std_Logic (Res.Mem, 0) = 'X' then
+ Warning_Msg_Synth
+ (+Loc, "NUMERIC_STD.""-"": non logical value detected");
+ end if;
return Res;
end Neg_Vec;