diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-02 18:38:06 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-02 18:38:06 +0200 |
commit | 8b212a75204bd4bc6cc7cca583377fdf86651f2a (patch) | |
tree | a7cf1b93fed4e08436a0fba9ac93ee557675263e /src/synth | |
parent | a462aa24936a64e32a79286b594490491f7c1dab (diff) | |
download | ghdl-8b212a75204bd4bc6cc7cca583377fdf86651f2a.tar.gz ghdl-8b212a75204bd4bc6cc7cca583377fdf86651f2a.tar.bz2 ghdl-8b212a75204bd4bc6cc7cca583377fdf86651f2a.zip |
synth: fix extract_merge_partial_assigns.
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/synth-environment.adb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/synth/synth-environment.adb b/src/synth/synth-environment.adb index 2f6043cf9..d769a959c 100644 --- a/src/synth/synth-environment.adb +++ b/src/synth/synth-environment.adb @@ -794,12 +794,22 @@ package body Synth.Environment is declare Pa : Partial_Assign_Record renames Partial_Assign_Table.Table (P (I)); + N_Wd : Width; + N_Off : Uns32; begin - if Pa.Offset <= Off then - Off := Uns32'Max (Pa.Offset, Min_Off); - -- FIXME: May increase the width. - Wd := Width'Min - (Wd, Get_Width (Pa.Value) - (Off - Pa.Offset)); + if Pa.Offset < Off and then Min_Off < Off then + -- There is an assignment for an offset before the + -- current one. Handle it. + pragma Assert (Off >= Min_Off); + N_Off := Uns32'Max (Pa.Offset, Min_Off); + N_Wd := Get_Width (Pa.Value) - (N_Off - Pa.Offset); + Wd := Width'Min (N_Wd, Off - N_Off); + Off := N_Off; + elsif Pa.Offset = Off + or else (Off = Min_Off and then Pa.Offset < Off) + then + -- Reduce the width if the assignment is shorter. + Wd := Width'Min (Wd, Get_Width (Pa.Value)); elsif Pa.Offset < Off + Wd then -- Reduce the width when there is an assignment after -- the current offset. |