How to use the scalar product command scp_mex() in Matlab (Radar SPT core)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to use the scalar product command scp_mex() in Matlab (Radar SPT core)

跳至解决方案
3,094 次查看
andreas_schibil
Contributor I

I’m trying to get familiar with the SPT core and like to use the scalar product command.

The goal is to perform 8 multiply operations and compute the sum (don’t care about the Im() parts, set to 0).

 

In Matlab R2018b, I installed the “NXP_radar_Toolbox_for_S32R” toolkit, and tried the following:

 

a = [0,1,2,3,4,5,6,7];

c = [1,1,1,1,1,1,1,1];

M_Op = complex (a, 0)

M_Coeff = complex(c, 0)

no_of_taps = 8;

shft_val = 0;

M_Out = scp_mex(M_Coeff, M_Op, no_of_taps, shft_val)

 

Which gives me the result:

M_Out =   0.0000 + 0.0000i

 

But I would expect 0*1 + 1*1 + 2*1 + 3*1 + 4*1 + 5*1 + 6*1 + 7*1 = 28

 

What am I missing?

标记 (4)
0 项奖励
回复
1 解答
2,800 次查看
iulianbulancea
NXP Employee
NXP Employee

Hi Andreas,

The instruction has a scale after the multiplication is done of 13 bits, and another after the adding is done of 4 bits.

So if you run

a = [0,1,2,3,4,5,6,7]*2^17;

c = [1,1,1,1,1,1,1,1];

M_Op = complex(a, 0)

M_Coeff = complex(c, 0)

no_of_taps = 8;

shft_val = 0;

M_Out = scp_mex(M_Coeff, M_Op, no_of_taps, shft_val)

you will get

M_Out = 28.0000 + 0.0000i

Best regards,

Iulian

在原帖中查看解决方案

0 项奖励
回复
5 回复数
2,801 次查看
iulianbulancea
NXP Employee
NXP Employee

Hi Andreas,

The instruction has a scale after the multiplication is done of 13 bits, and another after the adding is done of 4 bits.

So if you run

a = [0,1,2,3,4,5,6,7]*2^17;

c = [1,1,1,1,1,1,1,1];

M_Op = complex(a, 0)

M_Coeff = complex(c, 0)

no_of_taps = 8;

shft_val = 0;

M_Out = scp_mex(M_Coeff, M_Op, no_of_taps, shft_val)

you will get

M_Out = 28.0000 + 0.0000i

Best regards,

Iulian

0 项奖励
回复
2,800 次查看
andreas_schibil
Contributor I

Perfect. Many thanks for your fast answer. I wonder where I can find more information about this shifting and the exact bit width used for the MUL and ADD operations?

0 项奖励
回复
2,800 次查看
iulianbulancea
NXP Employee
NXP Employee

Hi Andreas,

You should open a ticket here https://www.nxp.com/support/support:SUPPORTHOME.

Best regards,

Iulian

0 项奖励
回复
2,800 次查看
andreas_schibil
Contributor I

Hello Iulian,

I created such a ticket. Unfortunately, I didn't get any answers yet. Could you provide me more details about it?

Best regards,
Andreas

0 项奖励
回复
2,800 次查看
Daniel_Popa
NXP Employee
NXP Employee

Hi andreas.schibilla@aptiv.com‌,

Sorry to hear that. Please escalate on the ticket support since we are not allowed to share documents that are marked as "confidential information"

florianebert‌,

Can you have a look at this issue. Thank you!

Daniel

0 项奖励
回复