aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-concats.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-08 18:49:57 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-08 18:49:57 +0200
commit561b15d8066fcaa2147b7e95d9e2bcc7044c7f36 (patch)
treee92acc7eb394ed98bef1f5058726216b9ecc2280 /src/synth/netlists-concats.adb
parent7119ed0eee11707dcfc6ab023fdf1f72783b35bd (diff)
downloadghdl-561b15d8066fcaa2147b7e95d9e2bcc7044c7f36.tar.gz
ghdl-561b15d8066fcaa2147b7e95d9e2bcc7044c7f36.tar.bz2
ghdl-561b15d8066fcaa2147b7e95d9e2bcc7044c7f36.zip
synth: fix incorrect order for concat.
Diffstat (limited to 'src/synth/netlists-concats.adb')
-rw-r--r--src/synth/netlists-concats.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/synth/netlists-concats.adb b/src/synth/netlists-concats.adb
index c833531b5..4c94fa6ac 100644
--- a/src/synth/netlists-concats.adb
+++ b/src/synth/netlists-concats.adb
@@ -56,6 +56,7 @@ package body Netlists.Concats is
N := Build_Concat4
(Ctxt, C.Sarr (4), C.Sarr (3), C.Sarr (2), C.Sarr (1));
when 5 .. Static_Last =>
+ -- Compute length.
Wd := 0;
for I in 1 .. C.Len loop
Wd := Wd + Get_Width (C.Sarr (I));
@@ -64,9 +65,10 @@ package body Netlists.Concats is
N := Build_Concatn (Ctxt, Wd, Uns32 (C.Len));
Inst := Get_Net_Parent (N);
for I in 1 .. C.Len loop
- Connect (Get_Input (Inst, Port_Idx (I - 1)), C.Sarr (I));
+ Connect (Get_Input (Inst, Port_Idx (C.Len - I)), C.Sarr (I));
end loop;
when Static_Last + 1 .. Int32'Last =>
+ -- Compute length.
pragma Assert (C.Len = Net_Tables.Last (C.Darr));
Wd := 0;
for I in 1 .. C.Len loop
@@ -76,7 +78,8 @@ package body Netlists.Concats is
N := Build_Concatn (Ctxt, Wd, Uns32 (C.Len));
Inst := Get_Net_Parent (N);
for I in Net_Tables.First .. C.Len loop
- Connect (Get_Input (Inst, Port_Idx (I - 1)), C.Darr.Table (I));
+ Connect (Get_Input (Inst, Port_Idx (C.Len - I)),
+ C.Darr.Table (I));
end loop;
-- Free the vector.
Net_Tables.Free (C.Darr);