AnsweredAssumed Answered

MKV5x, bad performance when loading data from flash.

Question asked by Ari Mendes on Jun 7, 2016
Latest reply on Jun 28, 2016 by Iva Dorazinova

I did the following code in IAR Assembler to test the MKV5x:

...

SET_PIN_PB23                   ;MACRO

 

MOV32      R0,#FloatTable

VLDR.F32   S2,[R0,#0]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#4]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#8]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#12]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#16]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#20]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#24]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#28]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#32]

VMLA.F32   S0,S1,S2

VLDR.F32   S2,[R0,#36]

VMLA.F32   S0,S1,S2

 

CLEAR_PIN_PB23           ;MACRO

 

...

 

DATA

alignram 2

FloatTable

DF32          0.1

DF32          0.2

DF32          0.3

DF32          0.4

DF32          0.5

DF32          0.6

DF32          0.7

DF32          0.8

DF32          0.9

DF32          1.0

 

The addres of FloatTable is 0x100013A0.

 

This code takes 1.05 uS when CPU clock is 200MHZ or 210 cycles. (too much)

When FloatTable is replaced to another table in SRAM, the code only takes 0.275 uS or 55 cycles.

If the chip have 8 KB of Data cache, why the performance is so bad when loading from Flash?

How to solve it?

Outcomes