aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-concats.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-27 21:04:18 +0100
committerTristan Gingold <tgingold@free.fr>2019-10-27 21:04:18 +0100
commit51f90bb57b068d7ed44ad0439bb710f8857abdb5 (patch)
tree501870e2bc153a20d650febfb8092ee13dafa2b7 /src/synth/netlists-concats.adb
parent57d57e71330851d700f68be97661efc0dc9c00bb (diff)
downloadghdl-51f90bb57b068d7ed44ad0439bb710f8857abdb5.tar.gz
ghdl-51f90bb57b068d7ed44ad0439bb710f8857abdb5.tar.bz2
ghdl-51f90bb57b068d7ed44ad0439bb710f8857abdb5.zip
synth: create build2_concat from netlists-concat.
Diffstat (limited to 'src/synth/netlists-concats.adb')
-rw-r--r--src/synth/netlists-concats.adb40
1 files changed, 4 insertions, 36 deletions
diff --git a/src/synth/netlists-concats.adb b/src/synth/netlists-concats.adb
index 4c94fa6ac..0aacd9ec6 100644
--- a/src/synth/netlists-concats.adb
+++ b/src/synth/netlists-concats.adb
@@ -38,49 +38,17 @@ package body Netlists.Concats is
end Append;
-- Get the concatenation of all nets in C. Reset C.
- procedure Build (Ctxt : Context_Acc; C : in out Concat_Type; N : out Net)
- is
- Inst : Instance;
- Wd : Width;
+ procedure Build (Ctxt : Context_Acc; C : in out Concat_Type; N : out Net) is
begin
case C.Len is
when Int32'First .. 0 =>
raise Internal_Error;
- when 1 =>
- N := C.Sarr (1);
- when 2 =>
- N := Build_Concat2 (Ctxt, C.Sarr (2), C.Sarr (1));
- when 3 =>
- N := Build_Concat3 (Ctxt, C.Sarr (3), C.Sarr (2), C.Sarr (1));
- when 4 =>
- 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));
- end loop;
-
- 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 (C.Len - I)), C.Sarr (I));
- end loop;
+ when 1 .. Static_Last =>
+ N := Build2_Concat (Ctxt, Net_Array (C.Sarr (1 .. C.Len)));
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
- Wd := Wd + Get_Width (C.Darr.Table (I));
- end loop;
-
- 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 (C.Len - I)),
- C.Darr.Table (I));
- end loop;
+ N := Build2_Concat (Ctxt, Net_Array (C.Darr.Table (1 .. C.Len)));
-- Free the vector.
Net_Tables.Free (C.Darr);
end case;