aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-09-15 05:40:44 +0200
committerTristan Gingold <tgingold@free.fr>2021-09-15 05:40:44 +0200
commitf75191ef6e013c4efaa8b68eee93e4de47254db9 (patch)
tree156936782a82c210abc916b4b254d75ee2edb6b6 /src/synth
parentefcf7034d651a59c7698b30cf20c1cea6458bb17 (diff)
downloadghdl-f75191ef6e013c4efaa8b68eee93e4de47254db9.tar.gz
ghdl-f75191ef6e013c4efaa8b68eee93e4de47254db9.tar.bz2
ghdl-f75191ef6e013c4efaa8b68eee93e4de47254db9.zip
synth/netlists-disp_verilog: fix output of parameter values. For #1866
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/netlists-disp_verilog.adb14
-rw-r--r--src/synth/netlists-dump.adb29
-rw-r--r--src/synth/netlists-dump.ads6
3 files changed, 37 insertions, 12 deletions
diff --git a/src/synth/netlists-disp_verilog.adb b/src/synth/netlists-disp_verilog.adb
index 55f64d68c..83fdc30ca 100644
--- a/src/synth/netlists-disp_verilog.adb
+++ b/src/synth/netlists-disp_verilog.adb
@@ -186,7 +186,19 @@ package body Netlists.Disp_Verilog is
when Param_Uns32 =>
Put_Uns32 (Get_Param_Uns32 (Inst, P - 1));
when Param_Types_Pval =>
- Disp_Pval_Binary (Get_Param_Pval (Inst, P - 1));
+ declare
+ Pv : constant Pval := Get_Param_Pval (Inst, P - 1);
+ Pvlen : constant Uns32 := Get_Pval_Length (Pv);
+ begin
+ if Pvlen = 0 then
+ Put ('"');
+ Put ('"');
+ else
+ Put_Uns32 (Pvlen);
+ Put ("'b");
+ Disp_Pval_Binary_Digits (Pv);
+ end if;
+ end;
when Param_Invalid =>
Put ("*invalid*");
end case;
diff --git a/src/synth/netlists-dump.adb b/src/synth/netlists-dump.adb
index d105df37e..4007e0e24 100644
--- a/src/synth/netlists-dump.adb
+++ b/src/synth/netlists-dump.adb
@@ -49,23 +49,30 @@ package body Netlists.Dump is
end loop;
end Disp_Binary_Digits;
- procedure Disp_Pval_Binary (Pv : Pval)
+ procedure Disp_Pval_Binary_Digits (Pv : Pval)
is
Len : constant Uns32 := Get_Pval_Length (Pv);
V : Logic_32;
Off : Uns32;
begin
- Put ('"');
- if Len > 0 then
- V := Read_Pval (Pv, (Len - 1) / 32);
- for I in reverse 0 .. Len - 1 loop
- Off := I mod 32;
- if Off = 31 then
- V := Read_Pval (Pv, I / 32);
- end if;
- Disp_Binary_Digit (V.Val, V.Zx, Natural (Off));
- end loop;
+ if Len = 0 then
+ return;
end if;
+
+ V := Read_Pval (Pv, (Len - 1) / 32);
+ for I in reverse 0 .. Len - 1 loop
+ Off := I mod 32;
+ if Off = 31 then
+ V := Read_Pval (Pv, I / 32);
+ end if;
+ Disp_Binary_Digit (V.Val, V.Zx, Natural (Off));
+ end loop;
+ end Disp_Pval_Binary_Digits;
+
+ procedure Disp_Pval_Binary (Pv : Pval) is
+ begin
+ Put ('"');
+ Disp_Pval_Binary_Digits (Pv);
Put ('"');
end Disp_Pval_Binary;
diff --git a/src/synth/netlists-dump.ads b/src/synth/netlists-dump.ads
index 2fcb429be..48e8a384f 100644
--- a/src/synth/netlists-dump.ads
+++ b/src/synth/netlists-dump.ads
@@ -27,7 +27,13 @@ package Netlists.Dump is
procedure Put_Id (N : Name_Id);
procedure Disp_Binary_Digits (Va : Uns32; Zx : Uns32; W : Natural);
+
+ -- Display the digits of binary value PV.
+ procedure Disp_Pval_Binary_Digits (Pv : Pval);
+
+ -- Display PV within double quotes.
procedure Disp_Pval_Binary (Pv : Pval);
+
procedure Disp_Pval_String (Pv : Pval);
procedure Dump_Name (N : Sname);