On 8/02/11 12:01 PM, Tristan Gingold wrote:

> David,
> 
> feel free to post a patch.  You seem to be able to track down this issue 
> completely.
> 
> Tristan.
> 

With a ghdl-0.29 source distribution

cd ghdl/vhdl   (or 'cd ghdl' for svn distribution)

patch -c < PATH_TO_EVALUATION_DIFF/evaluation.diff

The diff/patch file was produced by:

diff -c evaluation.adb ~/Desktop/ghdl/evaluation.adb

Note the patch target file name is evaluation.adb in the immediate context.

Three lines plus a comment.

A shorter description:

The patch basically short circuits further processing when rol and ror
rotation is zero after modulo reduction.  At this point in the code Dir_Left
is the actual rotation direction, True for left. For actual right rotations
where Cnt is 0, Cnt will be assigned Len - Cnt which is Len (array length)
and Cnt becomes an offset index.  Cnt won't point to a valid element of
Array_List in the later Get_Nth_Element function calls if it is equal to Len.

I don't currently have a build environment handy to try it in.



*** evaluation.adb      2010-02-28 10:37:11.000000000 +1300
--- /Users/david_koontz/Desktop/ghdl/evaluation.adb     2011-02-08 
14:02:31.000000000 +1300
***************
*** 677,682 ****
--- 677,687 ----
           when Iir_Predefined_Array_Rol
             | Iir_Predefined_Array_Ror =>
              Cnt := Cnt mod Len;
+             -- if Cnt modulo Len = 0, return original Left array
+             if Cnt = 0 then
+                 return Build_Simple_Aggregate 
+                             (Arr_List, Origin, Get_Type (Left));
+             end if;
              if not Dir_Left then
                 Cnt := Len - Cnt;
              end if;
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to