aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-disp_vhdl.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-08-07 06:22:59 +0200
committerTristan Gingold <tgingold@free.fr>2019-08-08 04:33:32 +0200
commitafafa2c3f856df075db309d553988ff5407c56ff (patch)
treeaf74fe1f2cc750d742f3e3b61f0288726454fc96 /src/synth/synth-disp_vhdl.adb
parent97d3a89195c8aeb981a7f4171b939c48ec4bdfaa (diff)
downloadghdl-afafa2c3f856df075db309d553988ff5407c56ff.tar.gz
ghdl-afafa2c3f856df075db309d553988ff5407c56ff.tar.bz2
ghdl-afafa2c3f856df075db309d553988ff5407c56ff.zip
synth: handle 1 bit integer in disp_vhdl, fix range in synth-expr.
Diffstat (limited to 'src/synth/synth-disp_vhdl.adb')
-rw-r--r--src/synth/synth-disp_vhdl.adb15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/synth/synth-disp_vhdl.adb b/src/synth/synth-disp_vhdl.adb
index 07e9fc94e..e7d61b11c 100644
--- a/src/synth/synth-disp_vhdl.adb
+++ b/src/synth/synth-disp_vhdl.adb
@@ -77,9 +77,18 @@ package body Synth.Disp_Vhdl is
end if;
when Iir_Kind_Integer_Type_Definition =>
-- FIXME: signed or unsigned ?
- Put (" wrap_" & Pfx & " <= std_logic_vector(to_unsigned(");
- Put (Pfx & "," & Width'Image (Desc.W) & "));");
- New_Line;
+ Put (" wrap_" & Pfx & " <= ");
+ if Desc.W > 1 then
+ Put ("std_logic_vector(");
+ end if;
+ Put ("to_unsigned(");
+ Put (Pfx & "," & Width'Image (Desc.W) & ")");
+ if Desc.W > 1 then
+ Put (")");
+ elsif Desc.W = 1 then
+ Put ("(0)");
+ end if;
+ Put_Line (";");
Idx := Idx + 1;
when Iir_Kind_Array_Type_Definition =>
if Btype = Vhdl.Ieee.Std_Logic_1164.Std_Logic_Vector_Type then