aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-expands.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-26 19:42:43 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-26 20:07:53 +0200
commite0090ffc06862b69915fca6e53234eb747f5abd9 (patch)
treee6af1abe87925b1dbfa15059a69a140ef92edfe3 /src/synth/netlists-expands.adb
parent2bdc1cdc3afc8350fb5bb1ba7a438055704a6ed9 (diff)
downloadghdl-e0090ffc06862b69915fca6e53234eb747f5abd9.tar.gz
ghdl-e0090ffc06862b69915fca6e53234eb747f5abd9.tar.bz2
ghdl-e0090ffc06862b69915fca6e53234eb747f5abd9.zip
synth: add many calls to set_location
Diffstat (limited to 'src/synth/netlists-expands.adb')
-rw-r--r--src/synth/netlists-expands.adb29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/synth/netlists-expands.adb b/src/synth/netlists-expands.adb
index 571b17620..fe7687014 100644
--- a/src/synth/netlists-expands.adb
+++ b/src/synth/netlists-expands.adb
@@ -170,13 +170,16 @@ package body Netlists.Expands is
procedure Truncate_Address
(Ctxt : Context_Acc; Addr : in out Net; Nbr_Els : Natural)
is
+ Loc : Location_Type;
Addr_Len : Width;
begin
Addr_Len := Uns32 (Clog2 (Uns64 (Nbr_Els)));
if Get_Width (Addr) > Addr_Len then
-- Truncate the address. This is requied so that synth_case doesn't
-- use default value.
+ Loc := Get_Location (Get_Net_Parent (Addr));
Addr := Build_Trunc (Ctxt, Id_Utrunc, Addr, Addr_Len);
+ Set_Location (Addr, Loc);
end if;
end Truncate_Address;
@@ -229,8 +232,10 @@ package body Netlists.Expands is
Free_Case_Element_Array (Els);
end Expand_Dyn_Extract;
- procedure Generate_Decoder
- (Ctxt : Context_Acc; Addr : Net; Net_Arr : out Net_Array)
+ procedure Generate_Decoder (Ctxt : Context_Acc;
+ Addr : Net;
+ Net_Arr : out Net_Array;
+ Loc : Location_Type)
is
W : constant Width := Get_Width (Addr);
V0, V1 : Net;
@@ -245,7 +250,9 @@ package body Netlists.Expands is
for I in reverse 0 .. W - 1 loop
V1 := Build_Extract_Bit (Ctxt, Addr, I);
+ Set_Location (V1, Loc);
V0 := Build_Monadic (Ctxt, Id_Not, V1);
+ Set_Location (V0, Loc);
Step := 2**Natural (I);
if I = W - 1 then
Net_Arr (0) := V0;
@@ -255,9 +262,11 @@ package body Netlists.Expands is
loop
V := Net_Arr (J);
Net_Arr (J) := Build_Dyadic (Ctxt, Id_And, V, V0);
+ Set_Location (Net_Arr (J), Loc);
J := J + Step;
exit when J > Net_Arr'Last;
Net_Arr (J) := Build_Dyadic (Ctxt, Id_And, V, V1);
+ Set_Location (Net_Arr (J), Loc);
J := J + Step;
exit when J > Net_Arr'Last;
end loop;
@@ -272,6 +281,7 @@ package body Netlists.Expands is
Dat : Net;
Memidx_Arr : Memidx_Array_Type;
Net_Arr : Net_Array;
+ Loc : Location_Type;
En : Net := No_Net)
is
Dat_W : constant Width := Get_Width (Dat);
@@ -352,9 +362,11 @@ package body Netlists.Expands is
S := Net_Arr (Sel);
if En /= No_Net then
S := Build_Dyadic (Ctxt, Id_And, S, En);
+ Set_Location (S, Loc);
end if;
V := Build_Mux2 (Ctxt, S, V, Dat);
+ Set_Location (V, Loc);
Prev_Net := V;
Next_Off := Off + Dat_W;
@@ -384,10 +396,10 @@ package body Netlists.Expands is
procedure Expand_Dyn_Insert
(Ctxt : Context_Acc; Inst : Instance; En : Net)
is
+ Loc : constant Location_Type := Get_Location (Inst);
Mem : constant Net := Get_Input_Net (Inst, 0);
Dat : constant Net := Get_Input_Net (Inst, 1);
Addr_Net : constant Net := Get_Input_Net (Inst, 2);
- -- Loc : constant Location_Type := Get_Location (Inst);
O : constant Net := Get_Output (Inst, 0);
O_W : constant Width := Get_Width (O);
-- 1. compute number of dims, check order.
@@ -410,7 +422,7 @@ package body Netlists.Expands is
Disconnect (Get_Input (Inst, 2));
Extract_Address (Ctxt, Addr_Net, Ndims, Addr);
Truncate_Address (Ctxt, Addr, Nbr_Els);
- Generate_Decoder (Ctxt, Addr, Net_Arr.all);
+ Generate_Decoder (Ctxt, Addr, Net_Arr.all, Loc);
-- Build muxes
declare
@@ -418,7 +430,7 @@ package body Netlists.Expands is
begin
Off := Get_Param_Uns32 (Inst, 0);
Generate_Muxes
- (Ctxt, Concat, Mem, Off, Dat, Memidx_Arr, Net_Arr.all, En);
+ (Ctxt, Concat, Mem, Off, Dat, Memidx_Arr, Net_Arr.all, Loc, En);
if Off < O_W then
Append (Concat, Build_Extract (Ctxt, Mem, Off, O_W - Off));
end if;
@@ -438,12 +450,13 @@ package body Netlists.Expands is
Remove_Instance (Inst);
end Expand_Dyn_Insert;
- -- Replase instance INST a ROT b by: S (a, b) | C (a, l - b)
+ -- Replace instance INST a ROT b by: S (a, b) | C (a, l - b)
-- (S for shifted, C for counter-shifted)
procedure Expand_Rot (Ctxt : Context_Acc;
Inst : Instance;
Id_S, Id_C : Shift_Module_Id)
is
+ Loc : constant Location_Type := Get_Location (Inst);
Val : constant Input := Get_Input (Inst, 0);
Amt : constant Input := Get_Input (Inst, 1);
Val_N : constant Net := Get_Driver (Val);
@@ -456,11 +469,15 @@ package body Netlists.Expands is
Res : Net;
begin
Sh_S := Build_Shift_Rotate (Ctxt, Id_S, Val_N, Amt_N);
+ Set_Location (Sh_S, Loc);
R_Amt := Build_Dyadic (Ctxt, Id_Sub,
Build_Const_UB32 (Ctxt, W_Val, W_Amt),
Build2_Uresize (Ctxt, Amt_N, W_Amt));
+ Set_Location (R_Amt, Loc);
Sh_C := Build_Shift_Rotate (Ctxt, Id_C, Val_N, R_Amt);
+ Set_Location (Sh_C, Loc);
Res := Build_Dyadic (Ctxt, Id_Or, Sh_S, Sh_C);
+ Set_Location (Res, Loc);
Redirect_Inputs (Get_Output (Inst, 0), Res);
Disconnect (Val);