• AVR Freaks

Hot!DSP_VectorAbs32 overflows!

Author
fbirot
New Member
  • Total Posts : 13
  • Reward points : 0
  • Joined: 2015/12/18 11:39:27
  • Location: 0
  • Status: offline
2018/08/15 08:48:02 (permalink)
0

DSP_VectorAbs32 overflows!

Hi,
we are using the DSP_VectorAbs32 function of harmony DSP fixed point math library and recently noticed that it overflows !
 
This function takes three parameters:
 
- the output buffer (where to write the result), which should be aligned 4
- the input (the value on which the absolute value should be computed), which should be aligned 4
- the number of absolute values to compute (N), which should be a multiple of 8
 
Yet, in reality, DSP_VectorAbs32 doesn't write N absolute values in the output but N+4 ! One could think that I could just set the third parameter to N-4, so that it computes N absolute values, but because N-4 is not a multiple of 8 so it doesn't do anything.
 
I've noticed this bug on different versions of Harmony (1.07.01 and 2.05) and both executing the code on a PIC32MZ2048EFG064 and with the simulator. In order to reproduce the bug, add the following lines in your main and click on "Use DSP fixed point Math library?" in the harmony configurator to link with the library:
 
static int32_t __attribute__((aligned(4))) out[8];
static int32_t __attribute__((aligned(4))) in[16] = {1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
int n = 8;

DSP_VectorAbs32(out, in, n);

 
The easiest in then to directly look at data memory (In MPLabX: Window > PIC Memory Views > Data Memory) and observe that DSP_VectorAbs32 has written 12*sizeof(int32_t) bytes instead of 8*sizeof(int32_t) bytes at the address of the out array.
 
Has anybody faced this issue ? This kind of bug is really annoying, since it creates erratic bugs and exceptions. What should I do to make sure that Microchip will fix this bug ?
 
Thank you
 
post edited by fbirot - 2018/08/15 09:02:58
#1
fbirot
New Member
  • Total Posts : 13
  • Reward points : 0
  • Joined: 2015/12/18 11:39:27
  • Location: 0
  • Status: offline
Re: DSP_VectorAbs32 overflows! 2018/08/15 09:59:54 (permalink)
0
Actually the overflow is much bigger when N is big (it is not always of 4*sizeof(int32_t) bytes)... I'll investigate this further tomorrow
 
UPDATE: My mistake, the overflow is actually always of 16 bytes (4 * sizeof(int32_t))
post edited by fbirot - 2018/08/16 04:58:24
#2
Jump to:
© 2019 APG vNext Commercial Version 4.5