AN2094 Freescale Semiconductor / Motorola, AN2094 Datasheet - Page 41

no-image

AN2094

Manufacturer Part Number
AN2094
Description
ITU-T G.729 Implementation on StarCore SC140
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Code Example 13 illustrates how this formula can be applied to the multiplication of two 32-bit DPF numbers in
StarCore. In this example, d0 and d1 contain the 32-bit DPF values, d4 contains -2, and the result is stored in d2.
B.2 Lag_max() ASM code
Freescale Semiconductor
;* ******************************************* PURPOSE **************************************** *;
;*
;* PURPOSE:
;*
;*
;* ***************************************** INPUT AND OUTPUT ********************************* *;
;*
;* INPUT:
;*
;*
;*
;*
;*
;* OUTPUT:
;*
;*
;* CALLED BY:
;*
;* ******************************************** RESOURCES ************************************* *;
;*
;* REGISTERS USED:
;*
;*
;*
;* CYCLE COUNT:
;*
;*
;* CODE SIZE:
;*
;* ASSEMBLER SYNTAX:
;* Star*Core 100 Assembler
;* asmsc100 -q -l nul -s all -o elf -b Lag_max.eln Lag_max.asm
;*
;* ******************************************************************************************** *;
TextStart_lag_max
_Lag_max
;* function is ABI compliant so r6,r7 and d6,d7 must be saved *;
RWH
move.w (sp-10),d1
[
]
sp-10 - input : maximum lag (Word16 pit_max)
sp-12 - input : minimum (Word16 pit_min)
push r6
sub d2,d1,d1
sp-12 - output : normalized correlation of selected lag
Typical=
Maximum=
mpysu d0,d1,d2
asrw d2
and d4,d2
add d2,d3,d2
mac d0,d1,d2
UurÃyrh†‡Ã†vtvsvph‡Ãiv‡Ã‚sÃhÃ9QAÉhyˆrÃv†Ãhyh’†Ã“r…‚ÃU‚Ãr†ˆ…rÇuh‡Ã‡urÃ…r†ˆy‡Ã‚sÇurƒr…h‡v‚Ã
qr†p…virqÃur…rÃp‚s‚…€†Ã‡‚Ã9QAÃs‚…€h‡ÇurÃyrh†‡Ã†vtvsvph‡Ãiv‡Ã†u‚ˆyqÃirÓr…‚rqÃi’ȆvtÃhÃiv‡Ã
v†rÃ
section .text local
global _Lag_max
align
r0 - input : signal used to compute the open loop pitch (Word16 * signal)
d1 - input : length of frame to compute pitch (Word16 L_frame)
d0 - output : lag found(Word16)
d1-d15;
r0-r3;
n3;
type
ITU-T G.729 Implementation on the StarCore™ SC140/SC1400 Cores, Rev. 1
This is the open-loop pitch estimation
QG
pitch_ol() function
670
16
Example 13. StarCore Multiplication of Two 32-Bit DPF Values
1115
1835
Â…Ã
func
EPFOU
signal[-pit_max] to signal[-1] should be known
Ãv†‡…ˆp‡v‚Ã‡uh‡Ãˆ†r†Ã‡urÃiv‡Ã€h†xÃ!
Version 6.3.58 spec 0.63
move.w (sp-12),d2
push r7
asl d1,d2
Example 14. Lag_max() ASM Code
mpyus d0,d1,d3
asrw d3
and d4,d3

ñà Ã2ñÃ!
References
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;
41

Related parts for AN2094