Other Parts Discussed in Thread: TMS320F28075
Hi Guys,
MCU : TMS320F28075
Is there a dedicated CLA function to perform the saturation functionality similar to __fsat ?
If not, please give me a workaraound.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other Parts Discussed in Thread: TMS320F28075
Hi Guys,
MCU : TMS320F28075
Is there a dedicated CLA function to perform the saturation functionality similar to __fsat ?
If not, please give me a workaraound.
Hi Prakash,
There isnt an fsat for the CLA but you can use the __mmaxf32() followed by __mminf32() intrinsics. I think this should work, and with optimization it will register allocate everything instead of writing intermediate results to the scratchpad.
static inline float __cla_fsat(float val, float max, float min)
{
float temp;
// (val < min)? temp = min : temp = val
temp = __mmaxf32(val, min);
// (temp > max)? temp = max : temp = temp
temp = __mminf32(temp, max);
return(temp);
}
Yes you can or you can put in a header file too. If its a shared header file i suggest you wrap the define in a guard macro that only comes into scope when the CLA compiler is invoked
#ifdef __TMS320C28XX_CLA__
static inline....