aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-02 04:34:01 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-02 04:34:01 +0200
commit82bb81caf07783f3b7d11276f971a7acb2e86fc3 (patch)
treed37d866d09ad188d3acb2c66a68ea2159a809f84 /src
parent8cd28ef3318a735820aeac438e21f66bc3784694 (diff)
downloadghdl-82bb81caf07783f3b7d11276f971a7acb2e86fc3.tar.gz
ghdl-82bb81caf07783f3b7d11276f971a7acb2e86fc3.tar.bz2
ghdl-82bb81caf07783f3b7d11276f971a7acb2e86fc3.zip
netlists-disp_vhdl: handle Const_Log, add comments, fix assertion.
Diffstat (limited to 'src')
-rw-r--r--src/synth/netlists-disp_vhdl.adb23
-rw-r--r--src/synth/netlists-gates.ads3
-rw-r--r--src/synth/netlists-utils.adb3
3 files changed, 28 insertions, 1 deletions
diff --git a/src/synth/netlists-disp_vhdl.adb b/src/synth/netlists-disp_vhdl.adb
index 3a5ca960c..d83edfeec 100644
--- a/src/synth/netlists-disp_vhdl.adb
+++ b/src/synth/netlists-disp_vhdl.adb
@@ -317,6 +317,27 @@ package body Netlists.Disp_Vhdl is
Put ('"');
end Disp_Const_Bit;
+ procedure Disp_Const_Log (Inst : Instance)
+ is
+ W : constant Width := Get_Width (Get_Output (Inst, 0));
+ Nd : constant Width := W / 32;
+ Ld : constant Natural := Natural (W mod 32);
+ begin
+ Put ('"');
+ if Ld > 0 then
+ Disp_Binary_Digits (Get_Param_Uns32 (Inst, Param_Idx (2 * Nd)),
+ Get_Param_Uns32 (Inst, Param_Idx (2 * Nd + 1)),
+ Ld);
+ end if;
+ for I in reverse 1 .. Nd loop
+ Disp_Binary_Digits
+ (Get_Param_Uns32 (Inst, Param_Idx (2 * (I - 1))),
+ Get_Param_Uns32 (Inst, Param_Idx (2 * (I - 1)) + 1),
+ 32);
+ end loop;
+ Put ('"');
+ end Disp_Const_Log;
+
procedure Disp_X_Lit (W : Width)
is
Q : constant Character := Get_Lit_Quote (W);
@@ -357,7 +378,7 @@ package body Netlists.Disp_Vhdl is
when Id_Const_Bit =>
Disp_Const_Bit (Inst);
when Id_Const_Log =>
- raise Internal_Error;
+ Disp_Const_Log (Inst);
when Id_Extract =>
Disp_Extract (Inst);
when others =>
diff --git a/src/synth/netlists-gates.ads b/src/synth/netlists-gates.ads
index 9e9260808..1379c038d 100644
--- a/src/synth/netlists-gates.ads
+++ b/src/synth/netlists-gates.ads
@@ -179,6 +179,9 @@ package Netlists.Gates is
pragma Unreferenced (Id_Const_UB64, Id_Const_UL64);
-- Large width.
+ -- For Const_Bit: param N is for bits 32*N .. 32*N+31
+ -- For Const_Log: param 2*N is for 0/1 of bits 32*N .. 32*N+31
+ -- param 2*N+1 is for Z/X of bits 32*N .. 32*N+31
Id_Const_Bit : constant Module_Id := 104;
Id_Const_Log : constant Module_Id := 105;
diff --git a/src/synth/netlists-utils.adb b/src/synth/netlists-utils.adb
index ab7c1824a..02e1ea24a 100644
--- a/src/synth/netlists-utils.adb
+++ b/src/synth/netlists-utils.adb
@@ -55,6 +55,9 @@ package body Netlists.Utils is
case Get_Id (M) is
when Id_Const_Bit =>
return Param_Nbr ((Get_Width (Get_Output (Inst, 0)) + 31) / 32);
+ when Id_Const_Log =>
+ return Param_Nbr
+ (2 * ((Get_Width (Get_Output (Inst, 0)) + 31) / 32));
when others =>
return Get_Nbr_Params (M);
end case;