⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pow10fxp.asm

📁 C50_melp.tar.gz为美军2400bps语音压缩编码算法
💻 ASM
字号:
* 
* 
* 2.4 kbps MELP Federal Standard speech coder
* 
* version 1.2
* 
* Copyright (c) 1996, Texas Instruments, Inc.  
* 
* This Mixed Excitation Linear Prediction (MELP) speech coding algorithm
* including the C source code software, the pre-existing MELP software and any
* enhancements thereto, is delivered to the Government in accordance with the
* requirement of Contract MDA904-94-C-6101.  It is delivered with Government
* Purpose License Rights in the field of secure voice communications only.  No
* other use is authorized or granted by Texas Instruments Incorporated. The
* Government Purpose license rights shall be effective until 30 September 2001;
* thereafter, the Government purpose license rights will expire and the
* Government shall have unlimited rights in the software.  The restrictions
* governing use of the software marked with this legend are set forth in the
* definition of "Government Purpose License Rights" in paragraph (a)(14) of the
* clause at 252.227-7013 of the contract listed above.   This legend, together
* with the indications of the portions of this software which are subject to
* Government purpose license rights shall be included on any reproduction
* hereof which includes any part of the portions subject to such limitations.
* 
* 

*
*************************************************************************
*
* The following code was hand optimized for the Texas Instuments
* TMS320C5x DSP by DSPCon, Inc.  For information, please contact DSPCon
* at:
* 
*                       DSPCon, Inc.
*                       380 Foothill Road
*                       Bridgewater, New Jersey 08807
*                       (908) 722-5656
*                       info@dspcon.com
*                       www.dspcon.com
*
*************************************************************************
	.if 0
/***************************************************************************
 *
 *   FUNCTION NAME: pow10_fxp
 *
 *   PURPOSE:
 *
 *     Compute 10 raised to the power x.
 *
 *
 *   INPUTS:
 *
 *     x
 *		       16 bit short signed integer (Shortword) in Q12.
 *     Q
 *		       16 bit short signed integer (Shortword) represents
 *		       required Q value of returned result.
 *
 *   OUTPUTS:
 *
 *     none
 *
 *   RETURN VALUE:
 *
 *     y
 *		       16 bit short signed integer (Shortword).
 *
 *************************************************************************/
	.endif
;  Code to compute the pow10(x)

    .mmregs

    .def    _pow10_fxp


FP	.set	AR0
SP	.set	AR1
count	.set	BRCR
loopcnt .set	AR3
realptr .set	AR4

; Page 6 storage
PAGE6	.set	300h
Q	.set	0
X	.set	1
y	.set	2
interp_factor	    .set    3
interp_component    .set    4
index1	.set	5
index2	.set	6
ten_multiple	.set	7
temp1	.set	8
temp2	.set	9
temp	.set	10
tabval1 .set	11
tabval2 .set	12
tabadr	.set	13
tenadr	.set	14

SW_MAX  .set    7fffh


; Constants
	.bss	tens_table, 9
	.bss	Q_table, 4
	.sect	".cinit"
	.word	9, tens_table
	.word	26844, 16777, 20972, 26214, 1, 10, 100, 1000, 10000
	.word	4, Q_table
	.word	28, 24, 21, 18


    .text

; Save C context so that we may restore it upon exit
_pow10_fxp  .equ    $
    LDP     #6		; Change the page pointer to on chip (fast ram)

; Setup the C50 modes
    SSXM		; enable sign extension

; Take stack passed arguments and place them in fast direct RAM
    SBRK    2		; Point SP to first argument
    RPT     #(2-1)
	BLDD	*+, #(PAGE6 + Q)

    LAC     X		; load X >> 12
    BSAR    12
    SACL    ten_multiple
    ADD     #4
    RETCD   LT
	ZAC
	NOP

    SETC    OVM 	; enable saturation mode
    SPM     1		; Set product mode to auto multiply by 2

; Compute index values
    SPLK    #table, tabadr
    SPLK    #tens_table, tenadr
    LAC     X
    AND     #0ff0h
    BSAR    4
    ADDS    tabadr
    TBLR    tabval1
    ADD     #1
    TBLR    tabval2

; Compute interpolation factor
    LAC     X,4
    AND     #0f0h
    SACL    interp_factor,7

    LAC     tabval2
    SUB     tabval1
    SAMM    TREG0
    MPY     interp_factor
    SPH     interp_component
    LAC     interp_component
    ADD     tabval1
;   SACL    temp1		    ; may not be needed !!!!
    SAMM    TREG0

    LAC     #(tens_table +4)
    ADD     ten_multiple
    SAMM    AR2
    LARP    AR2
    NOP 			    ; needed for pipe race
    MPY     *
    PAC
    SACB			    ; save L_y in ACCB

    LAC     ten_multiple
    BCNDD   else, LT		    ; ten_multiple >= 0
        LACL    #12
	SUB	Q

    BCNDD   neg, LT
    SAMM    TREG1
    NOP
    LACB			; recall L_y
    SATH			; may not be needed !!!
    SATL
    SACL    y
    SACH    temp                ; Check if MSW of y != 0
    LAC     temp
    BCNDD   exit, EQ
        LACC    #SW_MAX
    BD      exit
        NOP
	SACL	y

neg:
    ABS
    SUB     #1
    SACL    temp
    LACB
    RPT     temp
	SFL
    SACL    y
    SACH    temp
    LAC     temp
    BCNDD   exit, EQ
        LACC    #SW_MAX
    BD      exit
        NOP
	SACL	y

else:
    LAC     #(Q_table +4)
    ADD     ten_multiple
    SAMM    AR2
    LACL    #12
    NOP
    ADD     *
    SUB     Q
    BCNDD   neg1, LT
	SAMM	TREG1
	NOP
    LACB
    SATH			; may not be needed !!!
    BD	    exit
	SATL
	SACL	y

neg1:
    ABS
    SUB #1
    SACL    temp
    LACB
    RPT     temp
	SFL
    SACL    y

; Prepare to return to caller
exit:
    LARP    SP		; Select ARP for "C" context re-entry
    LAC     y
    RETD		; return to caller with delay
       SPM     0	; reset the product shift mode
       CLRC    OVM	; disable saturation mode
			; return occurs here

table:
   .word  2048, 2066, 2085, 2104, 2123, 2142, 2161, 2181, 2200, 2220
   .word  2240, 2260, 2281, 2302, 2322, 2343, 2364, 2386, 2407, 2429
   .word  2451, 2473, 2496, 2518, 2541, 2564, 2587, 2610, 2634, 2658
   .word  2682, 2706, 2731, 2755, 2780, 2805, 2831, 2856, 2882, 2908
   .word  2934, 2961, 2988, 3015, 3042, 3069, 3097, 3125, 3153, 3182
   .word  3211, 3240, 3269, 3298, 3328, 3358, 3389, 3419, 3450, 3481
   .word  3513, 3544, 3576, 3609, 3641, 3674, 3708, 3741, 3775, 3809
   .word  3843, 3878, 3913, 3948, 3984, 4020, 4056, 4093, 4130, 4167
   .word  4205, 4243, 4281, 4320, 4359, 4399, 4438, 4478, 4519, 4560
   .word  4601, 4643, 4684, 4727, 4769, 4813, 4856, 4900, 4944, 4989
   .word  5034, 5079, 5125, 5172, 5218, 5266, 5313, 5361, 5410, 5458
   .word  5508, 5558, 5608, 5658, 5710, 5761, 5813, 5866, 5919, 5972
   .word  6026, 6081, 6136, 6191, 6247, 6303, 6360, 6418, 6476, 6534
   .word  6593, 6653, 6713, 6774, 6835, 6897, 6959, 7022, 7085, 7149
   .word  7214, 7279, 7345, 7411, 7478, 7546, 7614, 7683, 7752, 7822
   .word  7893, 7964, 8036, 8109, 8182, 8256, 8331, 8406, 8482, 8559
   .word  8636, 8714, 8793, 8872, 8952, 9033, 9115, 9197, 9280, 9364
   .word  9449, 9534, 9620, 9707, 9795, 9883, 9973, 10063, 10154, 10245
   .word  10338, 10431, 10526, 10621, 10717, 10813, 10911, 11010, 11109, 11210
   .word  11311, 11413, 11516, 11620, 11725, 11831, 11938, 12046, 12155, 12265
   .word  12375, 12487, 12600, 12714, 12829, 12945, 13062, 13180, 13299, 13419
   .word  13540, 13663, 13786, 13911, 14036, 14163, 14291, 14420, 14550, 14682
   .word  14815, 14948, 15084, 15220, 15357, 15496, 15636, 15777, 15920, 16064
   .word  16209, 16355, 16503, 16652, 16803, 16955, 17108, 17262, 17418, 17576
   .word  17734, 17895, 18056, 18220, 18384, 18550, 18718, 18887, 19058, 19230
   .word  19404, 19579, 19756, 19934, 20114, 20296, 20480


    .end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -