aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-12-06 08:42:32 +0100
committerTristan Gingold <tgingold@free.fr>2020-12-06 08:42:32 +0100
commitee9b40b24ba2450e52c9661136963ec3e5cf9d80 (patch)
tree00f054e98c6fdbf4bfa9e355d1abfbf3061f0541 /src/synth
parent3bf136140b218a3f9191ba6cef319bede7bf6425 (diff)
downloadghdl-ee9b40b24ba2450e52c9661136963ec3e5cf9d80.tar.gz
ghdl-ee9b40b24ba2450e52c9661136963ec3e5cf9d80.tar.bz2
ghdl-ee9b40b24ba2450e52c9661136963ec3e5cf9d80.zip
synth: handle static resize from std_numeric. Fix #1531
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/synth-ieee-numeric_std.adb4
-rw-r--r--src/synth/synth-static_oper.adb3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/synth/synth-ieee-numeric_std.adb b/src/synth/synth-ieee-numeric_std.adb
index 2c0951f3b..4c7080f5a 100644
--- a/src/synth/synth-ieee-numeric_std.adb
+++ b/src/synth/synth-ieee-numeric_std.adb
@@ -873,11 +873,11 @@ package body Synth.Ieee.Numeric_Std is
for I in 1 .. Size loop
if I <= Old_Size then
- B := Read_Std_Logic (Val.Mem, I - 1);
+ B := Read_Std_Logic (Val.Mem, Old_Size - I);
else
B := Pad;
end if;
- Write_Std_Logic (Res.Mem, I - 1, B);
+ Write_Std_Logic (Res.Mem, Size - I, B);
end loop;
return Res;
diff --git a/src/synth/synth-static_oper.adb b/src/synth/synth-static_oper.adb
index 2da770ba1..b667ccdd5 100644
--- a/src/synth/synth-static_oper.adb
+++ b/src/synth/synth-static_oper.adb
@@ -861,6 +861,9 @@ package body Synth.Static_Oper is
when Iir_Predefined_Ieee_Numeric_Std_Resize_Sgn_Nat =>
return Resize_Vec
(Get_Memtyp (Param1), Uns32 (Read_Discrete (Param2)), True);
+ when Iir_Predefined_Ieee_Numeric_Std_Resize_Uns_Nat =>
+ return Resize_Vec
+ (Get_Memtyp (Param1), Uns32 (Read_Discrete (Param2)), False);
when Iir_Predefined_Ieee_1164_To_Stdlogicvector_Bv =>
declare