Hi, I am experiencing a weird behavior with LEA.
I am trying matrix multiplication with Q15 data type, using the library function msp_matrix_mpy_q15
My code works correctly with (2x2 maxtrix) * (2x2 matrix).
However, it does not for (2x2 matrix) * (2x1 matrix).
Also, if I turn off LEA the result is correct.
DSPLIB_DATA(lea_src1, 4) _q15 lea_src1[2][2] = {{_Q15(0.1), _Q15(0.2)}, {_Q15(0.3), _Q15(0.4)}}; DSPLIB_DATA(lea_src2, 4) _q15 lea_src2[2][1] = {{_Q15(0.1)}, {_Q15(0.3)}}; DSPLIB_DATA(lea_dest, 4) _q15 lea_dest[2][1]; __nv _q15 expected[2][1] = {{_Q15(0.07)}, {_Q15(0.15)}}; int main() { msp_status status; msp_matrix_mpy_q15_params mpyParams; WDTCTL = WDTPW + WDTHOLD; mpyParams.srcARows = 2; mpyParams.srcACols = 2; mpyParams.srcBRows = 2; mpyParams.srcBCols = 1; status = msp_matrix_mpy_q15(&mpyParams, *lea_src1, *lea_src2, *lea_dest); return 0; }
Above is my code. Very simple, and works fine without lea, but with lea, the result is wrong.
Specifically, the output should be {0x8F5, 0x1333}, but the value in lea_dest is {0x8F5, 0x1ae0}.
Again, if I do square matrix multiplication I don't have this problem.
Why is this happening? Am I doing something wrong?
Thank you.
Best Regards,
Kiwan Maeng