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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
2,739 Views
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?

Tags (4)
0 Kudos
1 Solution
2,445 Views
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

View solution in original post

0 Kudos
5 Replies
2,446 Views
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 Kudos
2,445 Views
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 Kudos
2,445 Views
iulianbulancea
NXP Employee
NXP Employee

Hi Andreas,

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

Best regards,

Iulian

0 Kudos
2,445 Views
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 Kudos
2,445 Views
dumitru-daniel_
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 Kudos