diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-02-10 07:00:31 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-02-10 07:00:31 +0100 |
commit | 8f4dda3ded16f2604c070736cbde8849774755a8 (patch) | |
tree | f4f59e0760faf79d9d9f7a625991df655599c8bc /src/synth/netlists.adb | |
parent | 0f7aa39d2c423b27519b541ae04648d5b3277ffd (diff) | |
download | ghdl-8f4dda3ded16f2604c070736cbde8849774755a8.tar.gz ghdl-8f4dda3ded16f2604c070736cbde8849774755a8.tar.bz2 ghdl-8f4dda3ded16f2604c070736cbde8849774755a8.zip |
synth: rework (again) memory inference.
Preliminary work to support multi-clock memories.
Strengthen and fix fallout of Check_Connected.
Rename synth.inference to netlists.inference.
Diffstat (limited to 'src/synth/netlists.adb')
-rw-r--r-- | src/synth/netlists.adb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/synth/netlists.adb b/src/synth/netlists.adb index c7c9edb96..7207d6ac0 100644 --- a/src/synth/netlists.adb +++ b/src/synth/netlists.adb @@ -357,7 +357,7 @@ package body Netlists is Nbr_Inputs : constant Port_Idx := Get_Nbr_Inputs (Inst); begin -- Check that all outputs are unused. - if Nbr_Outputs > 1 then + if Nbr_Outputs > 0 then for K in 0 .. Nbr_Outputs - 1 loop if Is_Connected (Get_Output (Inst, K)) then return True; @@ -861,15 +861,16 @@ package body Netlists is procedure Redirect_Inputs (Old : Net; N : Net) is First_I, I : Input; - Prev_I : Input; + Last_I : Input; begin First_I := Get_First_Sink (Old); if First_I = No_Input then + -- Nothing to do if no input. return; end if; I := First_I; - Prev_I := No_Input; + Last_I := No_Input; while I /= No_Input loop declare I_Rec : Input_Record renames Inputs_Table.Table (I); @@ -877,18 +878,16 @@ package body Netlists is pragma Assert (I_Rec.Driver = Old); I_Rec.Driver := N; - if Prev_I /= No_Input then - Inputs_Table.Table (Prev_I).Next_Sink := I; - end if; - Prev_I := I; + Last_I := I; I := I_Rec.Next_Sink; end; end loop; - if Prev_I /= No_Input then - Inputs_Table.Table (Prev_I).Next_Sink := Get_First_Sink (N); - Nets_Table.Table (N).First_Sink := First_I; - end if; + Inputs_Table.Table (Last_I).Next_Sink := Get_First_Sink (N); + Nets_Table.Table (N).First_Sink := First_I; + + -- Also disconnect OLD + Nets_Table.Table (Old).First_Sink := No_Input; end Redirect_Inputs; begin |