#1268 Fix using array elements in expressions with an array element lval

closed-accepted
nobody
None
5
2014-12-13
2013-08-09
Jared Casper
No

When you have an expression like this (extreme example):

a[idx[1]][idx[2]*4 +: 4] <= #(idx[3]) 4'ha;

where a is a reg array and idx is a reg or net array. The retrieval of idx[2] was clobbering index register 3, which was set before evaluating the part offset expression, then used in the %set/av of the array value. (likewise for idx[1] and idx[3]])

To avoid this issue, this patch adds and uses a new instruction %ix/mov which simply copies one indexed register to another. When necessary, expressions are first evaluated into temporary registers to avoid clobbering, then moved in to place before the %*/av instruction.

1 Attachments

Discussion

    • status: open --> closed-accepted
     
  • This patch was applied at some point, so I'm going to close this ticket. I have written a regression test to verify that the vec4-stack implementation still works with this example.