diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-06 21:22:35 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-06 21:22:35 +0200 |
commit | 28a691dc5ca293b1b9d6b02b2b76ce8d0b7231d0 (patch) | |
tree | 80c0a6f186e5804c84b7d8f2d650a7ce02ca49e6 /src/synth/synth-environment.adb | |
parent | cddbaa9cbaf33428bb2dc59de00f9f89f8bcd585 (diff) | |
download | ghdl-28a691dc5ca293b1b9d6b02b2b76ce8d0b7231d0.tar.gz ghdl-28a691dc5ca293b1b9d6b02b2b76ce8d0b7231d0.tar.bz2 ghdl-28a691dc5ca293b1b9d6b02b2b76ce8d0b7231d0.zip |
synth: propagate assignments out of subprograms. Fix #960
Diffstat (limited to 'src/synth/synth-environment.adb')
-rw-r--r-- | src/synth/synth-environment.adb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/synth/synth-environment.adb b/src/synth/synth-environment.adb index 2785d9b08..d082f3885 100644 --- a/src/synth/synth-environment.adb +++ b/src/synth/synth-environment.adb @@ -317,6 +317,33 @@ package body Synth.Environment is -- FIXME: free wires. end Pop_And_Merge_Phi; + procedure Propagate_Phi_Until_Mark (Ctxt : Builders.Context_Acc; + Phi : Phi_Type; + Mark : Wire_Id) + is + Asgn : Seq_Assign; + begin + Asgn := Phi.First; + while Asgn /= No_Seq_Assign loop + declare + Asgn_Rec : Seq_Assign_Record renames Assign_Table.Table (Asgn); + Wid : constant Wire_Id := Asgn_Rec.Id; + Pasgn, Next_Pasgn : Partial_Assign; + begin + if Wid <= Mark then + Pasgn := Asgn_Rec.Asgns; + while Pasgn /= No_Partial_Assign loop + Next_Pasgn := Get_Partial_Next (Pasgn); + Set_Partial_Next (Pasgn, No_Partial_Assign); + Phi_Assign (Ctxt, Wid, Pasgn); + Pasgn := Next_Pasgn; + end loop; + end if; + Asgn := Asgn_Rec.Chain; + end; + end loop; + end Propagate_Phi_Until_Mark; + -- Merge sort of conc_assign by offset. function Le_Conc_Assign (Left, Right : Conc_Assign) return Boolean is begin |