diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/netlists-gates.ads | 2 | ||||
-rw-r--r-- | src/synth/netlists-memories.adb | 18 | ||||
-rw-r--r-- | src/synth/netlists-utils.adb | 6 | ||||
-rw-r--r-- | src/synth/netlists-utils.ads | 5 |
4 files changed, 21 insertions, 10 deletions
diff --git a/src/synth/netlists-gates.ads b/src/synth/netlists-gates.ads index 506fae353..4a2a7ca33 100644 --- a/src/synth/netlists-gates.ads +++ b/src/synth/netlists-gates.ads @@ -157,6 +157,8 @@ package Netlists.Gates is Id_Extract : constant Module_Id := 68; -- OUT := IN0[IN1+OFF+WD-1:IN1+OFF] + -- Input0: the memory + -- Input1: then index Id_Dyn_Extract : constant Module_Id := 69; -- Like Insert but for dynamic values. diff --git a/src/synth/netlists-memories.adb b/src/synth/netlists-memories.adb index 401f1b20c..27887c8a9 100644 --- a/src/synth/netlists-memories.adb +++ b/src/synth/netlists-memories.adb @@ -347,9 +347,7 @@ package body Netlists.Memories is when Id_Memidx => return Res + 1; when Id_Addidx => - if Get_Id (Get_Net_Parent (Get_Input_Net (Inst, 1))) - /= Id_Memidx - then + if Get_Id (Get_Input_Instance (Inst, 1)) /= Id_Memidx then raise Internal_Error; end if; Res := Res + 1; @@ -403,7 +401,7 @@ package body Netlists.Memories is Indexes (P) := (Inst => Inst, Addr => No_Net); exit; when Id_Addidx => - Inst2 := Get_Net_Parent (Get_Input_Net (Inst, 0)); + Inst2 := Get_Input_Instance (Inst, 0); if Get_Id (Inst2) /= Id_Memidx then raise Internal_Error; end if; @@ -494,7 +492,7 @@ package body Netlists.Memories is Remove_Instance (Inst); exit; when Id_Addidx => - Inst2 := Get_Net_Parent (Get_Input_Net (Inst, 0)); + Inst2 := Get_Input_Instance (Inst, 0); if Get_Id (Inst2) /= Id_Memidx then raise Internal_Error; end if; @@ -916,7 +914,7 @@ package body Netlists.Memories is end if; Set_Mark_Flag (Inst, True); Last := Inst; - Inst := Get_Net_Parent (Get_Input_Net (Inst, 0)); + Inst := Get_Input_Instance (Inst, 0); when Id_Isignal | Id_Signal | Id_Const_Bit => @@ -1393,7 +1391,7 @@ package body Netlists.Memories is is Inst : Instance; begin - Inst := Get_Net_Parent (Get_Input_Net (Sig, 0)); + Inst := Get_Input_Instance (Sig, 0); -- Skip dff/idff. -- FIXME: that should be considered as an implicit mux. @@ -1401,7 +1399,7 @@ package body Netlists.Memories is case Get_Id (Inst) is when Id_Dff | Id_Idff => - Inst := Get_Net_Parent (Get_Input_Net (Inst, 1)); + Inst := Get_Input_Instance (Inst, 1); when others => null; end case; @@ -1415,7 +1413,7 @@ package body Netlists.Memories is when Id_Dyn_Insert | Id_Dyn_Insert_En => -- Skip the dyn_insert. - Inst := Get_Net_Parent (Get_Input_Net (Inst, 0)); + Inst := Get_Input_Instance (Inst, 0); when Id_Signal | Id_Isignal => -- Should be done. @@ -1436,7 +1434,7 @@ package body Netlists.Memories is return True; when Id_Signal | Id_Isignal => - return Is_Const_Input (Get_Net_Parent (Get_Input_Net (Inst, 0))); + return Is_Const_Input (Get_Input_Instance (Inst, 0)); when others => -- FIXME: handle other consts ? return False; diff --git a/src/synth/netlists-utils.adb b/src/synth/netlists-utils.adb index d3861215e..722cafc1a 100644 --- a/src/synth/netlists-utils.adb +++ b/src/synth/netlists-utils.adb @@ -103,6 +103,12 @@ package body Netlists.Utils is return Get_Driver (Get_Input (Inst, Idx)); end Get_Input_Net; + function Get_Input_Instance (Inst : Instance; Idx : Port_Idx) + return Instance is + begin + return Get_Net_Parent (Get_Input_Net (Inst, Idx)); + end Get_Input_Instance; + function Is_Const_Module (Id : Module_Id) return Boolean is begin case Id is diff --git a/src/synth/netlists-utils.ads b/src/synth/netlists-utils.ads index b8ccb3e93..f8749749f 100644 --- a/src/synth/netlists-utils.ads +++ b/src/synth/netlists-utils.ads @@ -42,8 +42,13 @@ package Netlists.Utils is function Get_Input_Width (M : Module; I : Port_Idx) return Width; function Get_Output_Width (M : Module; I : Port_Idx) return Width; + -- Return the net (driver) connected to input IDX of INSTANCE. function Get_Input_Net (Inst : Instance; Idx : Port_Idx) return Net; + -- Return the instance that drives input IDX of INST. + function Get_Input_Instance (Inst : Instance; Idx : Port_Idx) + return Instance; + -- Return True iff ID describe a constant. function Is_Const_Module (Id : Module_Id) return Boolean; function Is_Const_Net (N : Net) return Boolean; |