Group B

input2Offset

outputOffset;

LEACMD__POLYNOMIALSCALAR...N-1...N-1

on SCALEDMAC

outputOffset

u16
u16
u16
u16
u16

Bias
{-1...1}{-1...1}

MAX (XO)MAX (XE)MIN (XO)MIN (XE)

A0 {-1...1}

Xn {-1...1}

Q3[Q.15]

Q4[Q.15]

B1[Q1.14]
A1[Q1.14]
31

B2[Q.15]
B0[Q.15]
A2[Q.15]31
Q1[Q.15]0Q2[Q.15]

A2[Q.15]
A0[Q.15] A1[Q1.14]
B1[Q1.14] B0[Q.15]
B2[Q.15]

Z-1

A1 {-1...1}A2 {-1...1}+Z

n {-1...1}B1 {-1...1}Q1 {-1...1}S
C

0

Extended Functions

B0 {-1...1}Q0 {-1...1}+A1 {-1...1}Z-1 Q2{-1...1}ESEC

B1 {-1...1}B2 {-1...1}

31
0Q1[Q.15]
Q2[Q.15]
MIN1[Q.15] MIN0[Q.15]
MAX1[Q15] MAX0[Q15]
BIAS[Q.15]
A2[Q.15]
A0[Q.15]
B1[Q1.14]-

A1[Q1.14]
B0[Q.15]
B2[Q.15]

Nfor n=0...K-1
X
C

and

K

VS0*
=&X
Q.15

& of base parameters1.

command2.

Invoke Command Function

on SCALEDFIR

scaleFactor

Siz VS1* VD*=N =&Y =&Z SF
u16 Q.15 Q.31 rsvd.

1st argument

n=0..N-1 (for mask=0xff)

outputGroup 2LEACMD_#

input1

rsvd.
rsvd.
rsvd.
rsvd.
Q.15

n=1,3,5...N-1

vectorSize

u16
u16
u16
u16
u16

n=0,2,4...N-2

basic MAC vector

occu. reserved1SF

n=1,3,5...N-1

SF
IQ16.15
s16
rsvd.

N −1

Z =  ( xn y n )n =0n=0...N-1

LEA module
LEAPMS0LLEACNF0

LEAPMCTL

LEAPMS1LLEACNF1LEAIE

LEAPMCBLLEACNF2LEAIFG3.

#include <msp430.h>n=0..N-1

SF=> REGDSTon AUTOSCALING

n=0...N-1 with...

reserved2

n+=

VD *

index
rsvd.
rsvd.
rsvd.
rsvd.
rsvd.

0
Q2[Q.15]

0
1
2
3
4

n=0..N-1n-2
n-1//macros to simplify LEA code (usually put in a header file)#define LEA_EPRG(x) _Pragma(#x) //aux. def for NewLEA…
#define NewLEA_VAR(var) LEA_EPRG(RETAIN(var)) LEA_EPRG(DATA_SECTION(var,”.leaRAM”))#define Ladr(x) ((unsigned short)((unsigned long)(x) & 0xffff)>>2)#define Q15(x) (x)<1.0? ((x)>-1.0? (x)*0x8000:0x8000):0x7FFF#define LeaSP 0x3C00/4 //define Lea-Stack to top of LEA memory {32 bit oriented adr.}
NewLEA_VAR(Xi); NewLEA_VAR(Yi); NewLEA_VAR(Zo); NewLEA_VAR(P); //decl. variables in leaRAM
signed short Xi[]={Q15(-0.5), Q15(0.3), Q15(-0.4), Q15(0.5)}; //init with some input data
signed short Yi[]={Q15(-1) , Q15(-1) , Q15(-1) , Q15(-1) }; //init with some input data
signed long Zo[]={0x00000000};//init space for result output
short P[]={0,0,4,0,0,0};//here pre initialized parameters with N=4void main(void) {WDTCTL = WDTPW | WDTHOLD;// Stop watchdog timer
LEACNF0=0; LEACNF1=0; LEACNF2=LeaSP;//init LEA
LEAPMCTL|=LEACMDEN;//enable LEA
P[0]=Ladr(&Xi); //set Xi in parameters
P[3]=Ladr(&Yi); //ditto with Yi using macro;P[4]=Ladr(&Zo); //address of Zo to last element of parameters
LEAPMS0L=P[0];//put 1st parameter directly in register ~PMS0L; here adr of X[]
LEAPMS1L=Ladr(&P[2]); //put address of base parameter in ~PMS1L…
LEAPMCBL=LEACMD__MAC + 0; //start/invoke command with ~ITFLGS=0 for simple execution
for(;;);}//have a look yourself

poVS1
+=1
(next)

X
1st
2nd
3rd
4th
5th
6th
7th
8th

of Q.15

FFT, post operation
for real points

poVS2
+=1
(next)*+

Y

1. Declare a parameter block and variables usingZ
init=0NewLEA_VAR macros;poVD
of Q.31
2. Initialize parameters according to the desired
function (see this sheet)
3. Invoke command by writing to LEAPMS0L,
LEAPMS1L and LEAPMCBL with proper modeby setting ~ITFLGS (see Invoke Methods)
Siz
4.
Pick up results=N lb(N)

1st
2nd
3rd
4th
5th
6th
7th
8th

of Q.15VS0*LEACMD__FFT(FFTSPLIT)
LEACMD__FFTLONG (FFTLONGSPLIT)=&X
0x28 Q.15
0xA4 Q.31

Invoke a command

log2Size

u16
u16
u16
u16
u16

{-1...1}

input1mask

n=0,2,4...N-2

with...
bit reverse sorted input

=&Z
IQ16
IQ16
IQ16
IQ16
IQ32

0.5*A1{-1...1} -1
Z Q4
A2 {-1...1}

0.5*B1 {-1...1}B2 {-1...1}-1

input1; &X of Q.15
reserved 1
vectorSize; N of u16
tapSize; K of u16
0x130 coeffs; &C of Q.15

vectorSize=M

31
Q1[Q.15]{-1...1}

Q2 Z

input1; &X of Q.15
reserved 1
vectorSize; N ofu16

occu. reserved1

Siz
=N

Q3

C

output; &Z of Q.15
state; &ES of Q.150x90 coeffs; &EC of Q.15

log2Size
rsvd.
rsvd.
rsvd.
rsvd.
interleaveDepth

reserved2

Siz=N/2 lb(N)u16 u16
u16 u16
u16 u16

0.5*A1{-1...1} Z-1

0.5*B1 {-1...1}{-1...1}

output; &Z of Q.15
state; &S of Q.15
0x11C coeffs; &C of Q.15
LEACMD__IIRBQ2EXTENDED
Direct form II structure

Zn {-1...1}S

scaleFactor

scaleFactor

reserved2

order

coefs

outputvectorSize

circularBufferMask

filterLength

coefs

output

rsvd.
rsvd.
rsvd.
rsvd.

VC*
Siz VD *Ord=N =&Z +&C=M
u16 Q.15 Q.15
u16
u16 Q.31 Q.31
u16

Z-1

Q1

Q0 {-1...1}+

n=0...N-1

D*=&Z
VE,VO,PE,PO
VE,VO,PE,PO
VE,VO,PE,PO
VE,VO,PE,POVD *Siz VC*Len=N +&H =&Z=K
u16 Q.15 Q.15
u16
u16 Q.31 Q.31
u16
u16 cQ.15 cQ.15 u16
u16 cQ.31 cQ.31 u16
u16 Q.15 Q.15
u16+n=0...N-1

outputvectorSize
vectorSize

Siz VS0+=.
=N =Xiu16 s16
u16 s16
u16 s16
u16 s16

B0 {-1...1}

input1; &X of Q.15
reserved 1
vectorSize; N ofu16

LEACMD__IIRBQ2
Direct form II structurecode snippet (actually complete test program)reserved2

output

rsvd.
rsvd.
rsvd.
rsvd.

input1Offset

input1Offset

outputvectorSize

VS0+=..
=Xi
s16
s16
s16
s16

=

Nrow_of_s ubmatrixx M= Zrow_of_s ubmatrix

Xn {-1...1}

output; &Z of Q.15
state; &S of Q.15
coeffs; &C of Q.15
direction; S16
0x4C reserved

LEACMD__WINDOWSiz D*=N =&Z
u16 V,P
u16 V,P
u16 V,P
u16 V,P

u16
u16
u16
u16

input1; &X of Q.15
reserved 1
vectorSize; N of u16

LEACMD__IIRBQ1
Direct form I structure

n=0...N-1

X

coeffs ;&C of Q.31
order ;M
0xBC scaleFactor ; SF as signed;

on MAC3

input1Offset

output...N-1

input1scaleFactor

outputinput2

vectorSize

V,P
V,P
V,P
V,P

input1; &NROW of Q.15
reserved 1
rowSize; R as u16 (rows of M)
colSize; C u16(cols of M)
colVector; &MCOL of Q.15
0x34 output &ZOUT of Q.15
input1; X as Q.31

;

s16
s16
s16
s16
s16
s16
s16

input2Offset

outputinput1Offset

input2
input2

vectorSize

s16
s16
s16
s16
s16
s16
s16

...

=&X
0x58 IQ16
0x5C IQ160x60 IQ160x64 IQ16
0x12C IQ32

s16
s16
s16
s16
s16
s16
s16

Group 11

VS0*
LEACMD__DEINTERLEAVEEVENEVENLEACMD__DEINTERLEAVEEVENODD
LEACMD__DEINTERLEAVEODDEVENLEACMD__DEINTERLEAVEODDODD
LEACMD__DEINTERLEAVELONG

u16
u16
u16
u16

occu. reserved1

input1
input1
VS0*=&X
0x84 cQ.15
0x88 cQ.15
0xAC cQ.31
0xB4 cQ.31

input1

Vector/Matrix Deinterleave/Sort
FunctionsD*=&Z

reserved1

input1VS0*=&X
0xC0 cQ.15
0x10 cQ.15
0x9C cQ.31

occu. reserved1

Group 8Group 9Group 10VS0*=&X
0x20 Q.15
0x30 Q.31

bit reversed carrypropagated addressing
pre-sort for DIT-FFTs

LEACMD__BITREVERSECOMPLEXEVENLEACMD__BITREVERSECOMPLEXODD
LEACMD__BITREVERSECOMPLEXLONGEVENLEACMD__BITREVERSECOMPLEXLONGODD
Group 12=&X
0x18 Q.15
0xC8 Q.31
0xE0 cQ.15
0x124 cQ.31
0x13C Q.15

FFT, iFFT,
bank filtering(DIT_Type)LEACMD__FFTCOMPLEXAUTOSCALINGLEACMD__FFTCOMPLEXFIXEDSCALINGLEACMD__FFTCOMPLEXLONGSiz=NGroup ALEACMD__MPYMATRIXROW NxM

VS0+=.. VS1+=.. VD +=..
=Zi
=Xi
=Yi
Q.15 Q.31
s16
s16
s16
Q.31 Q.31
s16
s16
rsvd.
cQ.15 cQ.31 s16
s16
rsvd.
cQ.15 cQ.31 s16
s16
rsvd.

vectorSizeBy2

VS0*

occu. reserved1

input1
VS0*=&X
0x44 IQ16
0xE8 u16
0x48 IQ160xEC u16

block- FIR,
correlation,
convolution

LEASCCMD__POLYNOMIALLEASCCMD__POLYNOMIALLONG

VD *
=&Z

vectorSize

Group 7

input1

generic min/max
search operations on dual 16B
data /complex

input1

Group 5
Group 6LEACMD__MAXLONGMATRIXLEACMD__MAXUNSIGNEDLONGMATRIXLEACMD__MINLONGMATRIXLEACMD__MINUNSIGNEDLONGMATRIX

VS0*
=&X
0xD8 IQ32
0x114 u32
0xDC IQ32
0x118 u32

taylor functions
on pointwise
vectors/matrices

VS1*
=&Y

0x104 IQ16
0x10C u16
0x108 IQ160x110 u16

generic min/max
search operations on 32B
data

LEACMD__FIR
LEACMD__FIRLONGLEACMD__FIRCOMPLEXLEACMD__FIRCOMPLEXLONGLEACMD__SCALEDFIR

Siz=N

Specials for Math,
Matrix, DSP

VS0+=.. VS1+=.. VD +=..
=Xi
=Yi
=Zi

SF
Q.15 Q.31 rsvd.
Q.15 Q.31 rsvd.
Q.15 Q16.15 Q.15

sqryVectorSize

input1

occu. reserved1

input1

occu. reserved1

VS0*
=&X

LEACMD__MAXMATRIXLEACMD__MAXUNSIGNEDMATRIXLEACMD__MINMATRIXLEACMD__MINUNSIGNEDMATRIX

VD *
=&Z

u16
u16
u16
u16

occu. reserved1

Group 3
Group 40x100 Q.15
0xD0 Q.31
0x68 cQ.15
0x6C cQ.15

basic min/max vector
search operations on 16B data

LEACMD__MAX
LEACMD__MAXUNSIGNEDLEACMD__MIN
LEACMD__MINUNSIGNED

VS1*
=&Y

u16
u16
u16

VS0*
=&X
LEACMD__MACMATRIXLEACMD__MACLONGMATRIXLEACMD__MACCOMPLEXMATRIXLEACMD__MACCOMPLEXCONJUGATEMATRIX

=&Z

Siz
=N

0x54 Q.15
0x134 Q.15
0x138 Q.15

MAC, point- FIR,
correlation,
convolution

VD *

=&Y

vectorSize

input1
VS0*
=&X

VS1*

u16 IQ16 IQ16
u16 IQ32 IQ32
u16 Q.15 Q.15
u16 Q.31 Q.31
u16 cQ.15 cQ.15
u16 IQ16 IQ16
u16 IQ32 IQ32
occu. reserved1

basic MAC vector

LEACMD__MAC
LEACMD__MAC3
LEACMD__SCALEDMAC

Siz=N

0x40 IQ16
0x7C IQ32
0x3C Q.15
0x74 Q.31
0x78 cQ.15
0x70 IQ16
0xD4 IQ32

occu. reserved1

LEACMD__ADDMATRIXLEACMD__ADDLONGMATRIXLEACMD__MPYMATRIXLEACMD__MPYLONGMATRIXLEACMD__MPYCOMPLEXMATRIXLEACMD__SUBMATRIXLEACMD__SUBLONGMATRIX

occu.

Group 2=&X

outputVS0*vectorSize

input1

occu. reserved1

basic pointwise
vector/matrix
operations

occu. reserved1

Group 1

Low-Energy Accelerator (LEA) Common Parameter Blocks

u16 u16
u16 u16

LEA notifies completion using flags, events, and interrupts

vectorSize

Programming
Structure

inputGroup A

Low-Energy Accelerator (LEA) Common Parameter Blocks

LEACMD__MOVELONGLISTLEACMD_SUSPENDLEACMD_RESUME

L&SRC[0] {LeaAdr}&DST[0] {LeaAdr}&SRC[1] {LeaAdr}&DST[1] {LeaAdr}

LEACNF0N
u16

LEACNF1&SRC[N-1] {LeaAdr}&DST[N-1] {LeaAdr}

after
SUSPEND

high adr.

high adr.

31/15~TISEL~TEN

L~MEMFLTE

H

31/15
LEAWRSTAT

L

~TRST

~MEMFLTS~CFLTS~TIMFLTS

~ILB

~ILPM

~LPR

~TIMFLTELEARDSTAT~MEMFLTC

LEAASST~CFLTC~FREES~FLTHOLD ~SWRST~TIMFLTC

LEAPWST

16/0~DONES~FREECLEAMODE

16/0~DONEC
~BUSY

31/15

LEACNF2

beforeSUSPEND

H

N*2

...

VS0*
=&L
0x80 u32
0x00
0x08

LEA Hardware Registers (abridged list)

MOVELONGLIST Parameter Structure

beforeRESUME

after
RESUMEhigh adr.

high adr.

16/0

H
L

LEASPTR
31/15

16/0

H

LEACMALEACMDP (high word)L

LEACMDP (low word)
31/15

LEACNF2.
LEASPTRold data

old data

old data

freememoryregistercontent ofsuspendedcommandregistercontent ofsuspendedcommandLEACNF2.
LEASPTRLEACNF2.
LEASPTRfreememoryLEACNF2.
LEASPTRLEACMCTL

old data
registercontent ofsuspendedcommandfree’d up

freememory

16/0

H

LEAAP

L

LEACROFFLEACMDSTATLLEACMD (working command)

typical use
LEA_CONST_0
neutral element, dummy source
LEA_CONST_1
pos. epsilon
LEA_CONST_4
pos. amplitude margin 16B, + 0.5
LEA_CONST_7
neutral element, +1
LEA_CONST_8
substitutions, complementaryelement, conversion of ADC/DAC
formats, -1,…
LEA_CONST_C
neg. amplitude margin 16B, -.5
LEA_CONST_E
neg. double epsilon, inv. element
LEA_CONST_F
neg. epsilon
LEA_CONST_LONG_0
neutral element, dummy source
LEA_CONST_LONG_1
pos. epsilon
LEA_CONST_LONG_4
pos. amplitude margin 32B, +.5
LEA_CONST_LONG_7
neutral element
LEA_CONST_LONG_8
substitutions, complementaryelement, conversion of ADC/DAC
formats,…
LEA_CONST_LONG_C
neg. amplitude margin 32B, -.5
LEA_CONST_LONG_E
neg. double epsilon, inv. element
LEA_CONST_LONG_F
neg. epsilon

Value
0x0
0x1
0x40000x7FFF0x80000xA000..
0xA3FF
0xA400..
0xA7FF
0xA800..
0xABFF
0xAC00..
0xAFFF
0xB000..

16/0

LEAS0STAT H
LEAS1STAT L

LEAS0VAL / LEAS1VAL (high word ; working register)
LEAS0VAL / LEAS1VAL (low word ; working register)
31/15

16/0
LEADSTVAL / LEAPMDST (high word ; working result / result register)

0xB3FF

2048

16B(dual)

2048

16B(dual)

2048

16B(dual)

2048

16B(dual)

2048

0xB400..
0xB7FF
0xB800..
0xFFFE
0xBBFF
0xBC00..
0xFFFF
0xBFFF
0xC000..
0x0
0xC7FF
0xC800..
0x1
0xCFFF
0xD000..
0x4000:0000
0xD7FF
0xD800..
0x7FFF:FFFF
0xDFFF0xE000..

16B(dual)

2048

16B(dual)

2048

16B(dual)

2048

0x8000:0000

32B

0xC0000xC000:0000
0xFFFF:FFFE
0xFFFF:FFFF

0xE7FF
0xE800..
0xEFFF
0xF000..
0xF7FF
0xF800..
0xFFFF

32B
32B
32B
32B

LEAPMCTL

2048
2048
2048
2048

2048

32B

2048

32B

2048

16/0

H
L

LEA Stack Frame Structure
Memory Address

LEADSTVAL / LEAPMDST (low word ; working buffer / result register)
31/15

low adr.

Size

16B(dual)~TRG

Register Content Stored

16/0

LEAPMS0 H
LEAPMS1 L

LEASPTR + 100 LEADSTSTATLEAPMS0 / LEAPMS1 (high word ; source register)
LEAPMS0 / LEAPMS1 (low word ; source register)

LEASPTR + 96

LEACNF0LEASPTR + 92

LEACNF1

LEASPTR + 88

LEACMDSTATLEASPTR + 84

LEAS1STATLEASPTR + 80

LEAS0STATLEASPTR + 76

PC-Saved

LEASPTR + 72

LoopEnd1 : LoopEnd0

LEASPTR + 68

LoopStart1 : LoopStart0

LEASPTR + 64

LoopCount1 : LoopCount0

LEASPTR + 60

Loop Index

LEASPTR + 56

Address Registers [SCL:SOV]LEASPTR + 52

Address Registers [SR1:SR]

LEASPTR + 48

Address Registers [MR:PR]

LEASPTR + 44

Address Registers [PA3:PA2]

LEASPTR + 40

Address Registers [PA1:PA0]

LEASPTR + 36

Address Registers [MA:SA2]

LEASPTR + 32

Address Registers [SA1:SA0]

LEASPTR + 28

Data path register C7

LEASPTR + 24

Data path register C6

LEA Command Invoke Methods

LEASPTR + 20

Data path register C5

LEASPTR + 16

Data path register C4

LEASPTR + 12

Data path register C3

LEASPTR + 8

Data path register C2

LEASPTR + 4

Data path register C1

Invoke Method
LEAPMCBL=LEACMD_xxx ;LEAPMCBL= LEACMD_xxx +1;
LEAPMCBL= LEACMD_xxx +2;
LEAPMCBL= LEACMD_xxx +3;

LEASPTR + 0

Data path register C0

2048

31/15

16/0

H

LEAPMCBLEACTX (command context)

L

LEACMD (command buffer)

Name
LEA_CONST_LONG_SQRTLEA_CONST_LONG_EXP
LEA_CONST_LONG_2COS
LEA_CONST_LONG_SIN
LEA_CONST_LONG_COS
LEA_CONST_LONG_INV
LEA_CONST_LONG_2SECH
LEA_CONST_LONG_CBTF
LEA_CONST_SQRTW
LEA_CONST_SQRTLEA_CONST_SINWLEA_CONST_SIN
LEA_CONST_COS
LEA_CONST_INV
LEA_CONST_TAN
LEA_CONST_LONG_ASIN
LEA_CONST_LONG_ATN1
LEA_CONST_LONG_ATN2
LEA_CONST_LONG_ATN3
LEA_CONST_LONG_2EXP
LEA_CONST_LONG_LOG
LEA_CONST_LONG_4EXP
LEA_CONST_LONG_2SIN

function / purpose
coefficients for SQRT(X-1)
coefficients for EXP(X)
coefficients for COS(X^2)
coefficients for SIN(X)
coefficients for COS(X)
coefficients for 1/X
coefficients for SECH(X^2)
coefficients for CBRT(X) cubic root
coefficients for SQRT(X/PI) wide range
coefficients for SQRT(X-1)
coefficients for SIN(X/PI)
coefficients for SIN(X)
coefficients for COS(X)
coefficients for 1/X
coefficient for TAN(X)coefficient for ASIN(x)coefficient for ATN(x) segment 1
coefficient for ATN(x) segment 2
coefficient for ATN(x) segment 3
coefficient for EXP(X^2)
coefficient for LOG(X)
coefficient for EXP(X) auxiliarycoefficient for SIN(X^2)

Address{Lea} Width Size N
0x800032B
330x802132B
130x802E32B
70x803532B
120x804132B
130x804E
32B
33
0x806F
32B
25
0x808832B
33
0x80A116B
50x80A416B
130x80AB
16B
70x80AF
16B
80x80B316B
90x80B816B
170x80C132B
120x80CD
32B
24
0x80E532B
60x80EB
32B
90x80F432B
100x80FE32B
100x810832B
130x811532B
100x811F
32B
4~ITFLG

31/15

16/0

H

LEAIFGSETL~CMDIS~SDIIS~OORIS~TIS~OVLIS

31/15

16/0

H

LEAIE

L

~CMDIE~SDIIE~OORIE~TIE~OVLIE

31/15

16/0

H

LEAIFGL~CMDIFG ~SDIIFG ~OORIFG~TIFG~OVLIFG

31/15

16/0

H

LEAIV

L

LEAIV

Registers mainly for Programming Purposes

Registers mainly for Debug and Diagnostics Purposes

LEA's Command Response
LEA command without any further indication
LEA command with explicit result update
LEA command with interrupt upon completion
LEA command with interrupt and explicit result update

PUC
Off

LEA Operation Mode done & ~ITFLG=0
State Diagram

LEASCSWRST=0

LEASCSWRST=1
RESUME!
entering AM

NWait
LEA comon functions polynomial coefficients (ROM)~CMDEN

31/15

command

32B~ITFLG

31/15

freememorylow adr.

~MAE
16/0

LEAPMDST L

low adr.
AddressWidthrange{Lea}

~INC

H

LEADSTSTAT H
LEA auxiliary vectors (ROM)
low adr.
Name

~DEC

31/15

commanddone &~ITFLG=2&~ILPM=0

commanddone &~ITFLG=2&~ILPM=1

RunL

Ready
SUSPEND!

Notifycommanddone &~ITFLG=0

command done &~ITFLG=2

entering AM

RunA
entering LPMx
& ~LPR=1

regularcommandreceived !

SUSPEND!

RunS

entering LPMx
& ~LPR=0

entering AM

end ofSUSPEND

end of
RESUME

Sleep

RunR

LEA operation mode and behaviour

Useful macros for Code Composer#define Ladr(x) ((unsigned short)((unsigned long)(x) & 0xffff)>>2)#define Q15(x) (x)<1.0? ((x)>-1.0? (x)*0x8000:0x8000):0x7FFF//Mathematical correct#define Q15c(x) (((x)<1? ((x)>=-1 ? (x)*0x8000:0x8000):0x7FFF))//Ceiling rounded version#define Q15f(x) (x)>=0? ((x)>=1 ? 0x7FFF:(x)*0x7FFF):((x)<=-1? 0x8000:(x)*0x8000) //Floor rounded#define Q31(x) (x)<1.0? ((x)>=-1.0 ? (x)*0x80000000:0x80000000):0x7FFFFFFF //Mathematical correct#define Q31c(x) (((x)<1? ((x)>=-1 ? (x)*0x80000000:0x80000000):0x7FFFFFFF)) //Ceiling roundedother Restart#define Q31f(x) (x)>=0? ((x)>=1.0? 0x7FFFFFFF:(x)*0x7FFFFFFF):((x)<=-1.0? 0x80000000:(x)*0x80000000)#define IQ16_15(x) (x)<32768? ((x)>=-32768 ? (x)*0x8000:0x80000000):0x7FFFFFFF //Math. correct
sinks#define LEA_EPRG(x) _Pragma(#x) // auxiliary macro// constructor for new LEA global variable without alignment#define NewLEA_VAR(var) LEA_EPRG(RETAIN(var)) LEA_EPRG(DATA_SECTION(var,".leaRAM"))LEASWRST// constructor for new LEA variable with alignment#define NewLEA_aVAR(var,algn) LEA_EPRG(RETAIN(var)) LEA_EPRG(DATA_SECTION(var,".leaRAM"))
LEA_EPRG(DATA_ALIGN(var,(algn)))
LEATRST// constructor for new LEA scratch variable without alignment (API internal)#define NewLEA_xVAR(var) LEA_EPRG(RETAIN(var)) LEA_EPRG(DATA_SECTION(var,".leaSCRATCH"))// constructor for new global variable without alignment
Command Start#define NewLEA_dVAR(var) LEA_EPRG(RETAIN(var)) LEA_EPRG(DATA_SECTION(var,".data"))// constructor for new FRAM variable without alignment#define NewLEA_fVAR(var) LEA_EPRG(RETAIN(var)) LEA_EPRG(DATA_SECTION(var,".const"))LEATENLEA running
clock

Operation Mode
Notify (interims mode while setting interrupt)
Nwait (waiting for active mode)
Off (optional mode only available on ULP architectures)
Ready (LEA waits for commands to execute)
RunA (execution mode of invoked command)
RunL (execution mode during low power mode)
RunR (LEACMD_RESUME execution)
RunS (LEACMD_SUSPEND execution)
Sleep (operations are stopped )LEATISELx

Q23
Q22
Q21
Q20
Q19
CLR
Q17
Q16
Q15
Q14
Q13
Q12
Q11
EN
Q10
Q9
Q8
CLK Q7

1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
0000

accept CMD PWR req MCLK req
no
yes
yes
n.a
yes
no
no
no
no
yes
yes
no
SUSPEND only
yes
yes
n.a
yes
yes
no
yes
yes
no
yes
yes
no
yes
no

MODE
0x5
0x5
0x0
0x1
0x4
0x7
0x3
0x2
0x6

LEA Timer Block Diagram

LEATIMFLTELEATIMFLTSLEATIFLT
S (rw)R

to NMI logic

LEATIMFLTCLEATIS

SYS
moduleLEATIFGS (rw)LEATIEInterrupt logic

SLAU852

IMPORTANT NOTICE AND DISCLAIMER
TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATASHEETS), DESIGN RESOURCES (INCLUDING REFERENCEDESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS”
AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANYIMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRDPARTY INTELLECTUAL PROPERTY RIGHTS.
These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate
TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicablestandards, and any other safety, security, or other requirements. These resources are subject to change without notice. TI grants you
permission to use these resources only for development of an application that uses the TI products described in the resource. Other
reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third party
intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims, damages,
costs, losses, and liabilities arising out of your use of these resources.
TI’s products are provided subject to TI’s Terms of Sale (https:www.ti.com/legal/termsofsale.html) or other applicable terms available either
on ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s
applicable warranties or warranty disclaimers for TI products.IMPORTANT NOTICE
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2021, Texas Instruments Incorporated