MAXS instruction in S32R274 SPT

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

MAXS instruction in S32R274 SPT

1,331 Views
Mikael_Eliasson
Contributor I

I cannot find any information in the S32R274 reference manual about what output the MAXS instruction will give when in global mode. I have tried running the instruction and it does not seem to give either the expected maximum value or the index of it in the vector I am running the instruction over.

What I want to do is find both the maximum value and bin number in the output of an FFT. If MAXS is not the right instruction for this, do you have another suggestion for accomplishing what I want to do? 

0 Kudos
10 Replies

1,299 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

I cannot find any information in the S32R274 reference manual about what output the MAXS instruction will give when in global mode.

To find the global maximum, the result of the current maximum operation is also compared with the result of the previous
maximum operation and overwrites this result, if it is larger. To find the local maximum (peak), each value is compared with its nearest neighboring values.

If MAXS is not the right instruction for this, do you have another suggestion for accomplishing what I want to do?

The MAX-S is the instruction you will use to find maxima.

What I want to do is find both the maximum value and bin number in the output of an FFT

Please refer to below section in reference manual:

petervlna_0-1640078145610.png

 

Best regards,

Peter

 

0 Kudos

1,240 Views
Mikael_Eliasson
Contributor I

Hi,

Sorry for the late reply.

The only thing that instruction seems to output is the maximum value, not its location in the vector.

This is the input:

Mikael_Eliasson_0-1641919569647.png

This is the MAXS instruction:

0x9C000400, 0x8000A000, 0x00000101, 0x00000000,

I do some PDMA instructions before and after to load from/to SPT memory.

 

And this is the output:

Mikael_Eliasson_1-1641919690722.png

The only thing I can see in memory is the maximum value. No bitfield indicating the location.

 

0 Kudos

1,199 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Looking at your MAXs instruction I am quite confused:

0x9C000400, 0x8000A000, 0x00000101, 0x00000000

petervlna_0-1642500803365.png

So your source address is 0x8000 and destination address is 0xA000. But you are sharing to me RAM memory screenshots. Also your INC step is 0 for both src and dest.

I am also confused about your complain about not seeing maxima bitfield. Are you not seeing it in TRAM? What is the issue?

petervlna_1-1642501933942.png

Best regards,

Peter

 

0 Kudos

1,180 Views
Mikael_Eliasson
Contributor I

Hi,

Thanks to the help from Reinhard I was able to inspect the operand RAM. Still nothing where in the vector the maximum value is. Just the maximum value.

/Regards

Mikael

Mikael_Eliasson_0-1642519312209.png

 

0 Kudos

1,161 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

I cannot speak for your case, but here is the example of max location.

petervlna_0-1642754957673.png

Best regards,

Peter

 

0 Kudos

1,156 Views
Mikael_Eliasson
Contributor I

Hi,

It seems like it works differently in global and local mode. You seem to run it in local mode and then it seems to give a bit vector as output. But in global mode it does not. Am I correct?

If I am correct I cannot see that I would be able to get a global maxima in local mode. Or do you have a workaround?

 

/Regards

Mikael

0 Kudos

1,115 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

To find the global maximum, the result of the current maximum operation is also compared with the result of the previous maximum operation and overwrites the previous result, if it is larger.

petervlna_0-1643187695324.png

Best regards,

Peter

 

 

0 Kudos

1,103 Views
Mikael_Eliasson
Contributor I

Hi,

So there is no way for MAX-S to report the location of the global maximum value. Just the value itself.

/Regards

Mikael

0 Kudos

1,194 Views
Mikael_Eliasson
Contributor I

Hi,

I am using a Lauterbach debugger. As far as I know it cannot directly inspect TRAM. If you know a way to directly inspect TRAM I am very interested. So therefor I load and unload from RAM using PDMA instructions. This is the whole program. 0xDEADDEAD is replace with the RAM adresses:

uint32_t maxtest[] __attribute__ ((aligned (8))) = {
//PDMA into SPT
0xA1050400, 0xDEADDEAD, 0x80000000, 0x01000001, // [1] = input_start

//MAXS
0x9C000400, 0x8000A000, 0x00000101, 0x00000000,

// PDMA transfer of output to SRAM
// Sign extension, direct address, 24-bit complex
// PDMA OPRAM (0x9000) -> SRAM (output_start), synchronous,
// Vec len = 128 units, SKIP = 127 to overwrite range FFT
0xA1070400, 0xDEADDEAD, 0xA0000000, 0x01000001, // [9] = output_start

// Stop Cmd
0x10000000, 0x00000000, 0x00000000, 0x00000000
};

SRC_ADD_INC and DEST_ADD_INC are both 1. I have made my own dissasembler to verify.

OPCODE : 100111

IN_DATTYP : 00

PREPROC : 00

THLD_CMP : 0

IN_TAG : 0

LOC_N_ABS : 0

TAG_N_BITFLD : 0

CYC_EXTN : 0

MAXSN_EN : 0

IN_PACK : 00

IMA : 0

VEC_SZ : 0x400

SRC_ADD : 0x8000

DEST_ADD : 0xA000

SRC_ADD_INC : 0x1

DEST_ADD_INC : 0x1

MAXSN_SEL : 00

THLD_ADD : 0x0

/Regards

Mikael

0 Kudos

1,186 Views
rweiss
Contributor V

Mikael,

select in menu:
  SPT -> Twiddle RAM Dump

or enter this in the command line:

Data.DUMP D:0x4000 /QUAD

 

Regards,
Reinhard