Not applicable
May 06, 2016
01:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 06, 2016
01:49 AM
Hi,
Is there any example for MATH linear rotation mode?
I tried to implement the following code for multiplication, however it is not clear how to interpret arguments and the result.
The arguments and the results are two's complement but in which format? (0Q23, 1Q22, etc..)
Is there any example for MATH linear rotation mode?
I tried to implement the following code for multiplication, however it is not clear how to interpret arguments and the result.
The arguments and the results are two's complement but in which format? (0Q23, 1Q22, etc..)
#include
#include "XMC1300.h"
#define XMC_MATH_Q8_15(x) ((XMC_MATH_Q8_15_t)(((x) >= 0) ? ((x) * (1 << 15) + 0.5) : ((x) * (1 << 15) - 0.5)))
int32_t XMC_MATH_Linear_XMulY(int32_t x, int32_t y)
{
uint32_t result;
MATH->STATC = 0U; /* Clear register */
MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_LINEAR + \
(uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION;
MATH->CORDY = 0U; /* Clear register */
MATH->CORDZ = ((uint32_t) y) << MATH_CORDZ_DATA_Pos;
MATH->CORDX = ((uint32_t) x) << MATH_CORDX_DATA_Pos;
result = ((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos;
return ((int32_t) result);
}
int main(void)
{
int a;
uint32_t result;
uint32_t x;
uint32_t y;
x = XMC_MATH_Q8_15(0.5);
y = XMC_MATH_Q8_15(0.5);
result = XMC_MATH_Linear_XMulY(x, y);
a = 1;
while(1);
}
- Tags:
- IFX
3 Replies
May 08, 2016
05:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 08, 2016
05:30 AM
Hi jsmith65
There is some description of the XMC MATH functions in the help file of the the XMC_Peripheral_Library_v2.1.6
I am not sure if you have already checked that. I hope it helps.
Regards.
Paul.
There is some description of the XMC MATH functions in the help file of the the XMC_Peripheral_Library_v2.1.6
I am not sure if you have already checked that. I hope it helps.
Regards.
Paul.
Not applicable
May 08, 2016
05:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 08, 2016
05:49 AM
I think no description for this mode.
May 12, 2016
01:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 12, 2016
01:03 AM
Hello,
The CORDIC's linear rotation mode is probably not useful since the CPU core can easily calculate Y+X*Z.
From the XMC1300 reference manual, section 7.3.4 on CORDIC Co-processor data format:
- X and Y are in two's complement and can be in any format as long as they are the same.
- Z must be in 4Q19 format.
Regards,
Min Wei
The CORDIC's linear rotation mode is probably not useful since the CPU core can easily calculate Y+X*Z.
From the XMC1300 reference manual, section 7.3.4 on CORDIC Co-processor data format:
- X and Y are in two's complement and can be in any format as long as they are the same.
- Z must be in 4Q19 format.
Regards,
Min Wei