?? hilb16.asm
字號:
;***********************************************************
; Version 2.20.01
;***********************************************************
;****************************************************************
; Function: hilb16
; Description: hilbert transformer using FIR filter
;
; Copyright Texas instruments Inc, 1998
;----------------------------------------------------------------
; Revision History:
; 1.00 J. Kusuma, Original Beta Release 5/26/98
; 1.01 Li Yuan, fixed the db pointer bug.
;****************************************************************
; registers used: ;
; Acc A - for the MAC operation results ;
; AR0 - step size for the circular array ;
; AR1 - repeat count for how many FIR iterations we'll need ;
; according to the input buffer length used ;
; AR2 - coefficient buffer pointer ;
; AR3 - input data buffer pointer ;
; AR4 - output buffer pointer ;
; AR5 - delay buffer pointer ;
; BRC - loop counter for the number of samples ;
; BK - sets the length of the buffer ;
;---------------------------------------------------------------;
.def _hilb16
.mmregs
;---------------------------------;
; check to see if it's a FAR call ;
;---------------------------------;
.if __far_mode
OFFSET .set 2
.else
OFFSET .set 1
.endif
REG_SAVE_SIZE .set 3 ; this is because we're saving AR1
; it's a C compiler thing...
PARAM_OFFSET .set REG_SAVE_SIZE + OFFSET
;-------------------------------------------------------------------;
; now assign variable names to the appropriate items in the stack ;
;-------------------------------------------------------------------;
; variable names: ;
; ns - number of input samples ;
; nh - number of taps in the FIR filter ;
; x - ptr to input buffer (already in AL) ;
; h - ptr to coefficient buffer ;
; y - ptr to output buffer ;
;-------------------------------------------------------------------;
.asg *sp(0 + PARAM_OFFSET), h
.asg *sp(1 + PARAM_OFFSET), y
.asg *sp(2 + PARAM_OFFSET), db
.asg *sp(3 + PARAM_OFFSET), nh
.asg *sp(4 + PARAM_OFFSET), ns
.asg AR1, counter
.asg AR2, x_ptr
.asg AR3, h_ptr
.asg AR4, y_ptr
.asg AR5, db_ptr
.text
_hilb16:
;----------------------------;
; initialization routine ;
;----------------------------;
; AR0 is increment step size ;
; AR2 is coef line ;
; AR5 is delay buff line ;
;----------------------------;
PSHM AR1 ; save AR1 to the stack, it's a C thing
PSHM ST0 ; 1 cycle
PSHM ST1 ; 1 cycle
RSBX OVA ; 1 cycle
RSBX OVB ; 1 cycle
SSBX FRCT ; go into fraction mode
SSBX SXM ; set sign extend mode
STLM A, x_ptr ; now all the arguments have been
; recovered from caller
MVDK h, h_ptr
MVDK y, y_ptr
MVDK db, db_ptr
MVDK nh, BK
;-------------------------------------;
; set up BRC for the outer loop count ;
; and pointer to delay buffer ;
;-------------------------------------;
LD ns, A
SUB #1, A ; need to subtract one from ns
STLM A, BRC ; and save to BRC
LD nh, A ; calculate nh
SFTA A, -1,B ; for inner loop
SUB #2, b
STL B, nh
;---------------------------------------------------------;
; outer loop begin, the number of iterations is from ns-1 ;
;---------------------------------------------------------;
RPTBD end_hil - 1
STM #2, AR0 ; increment size because of decimation
loop:
MVDD *x_ptr+, *db_ptr ; read data from input buffer into delay slot
MPY *h_ptr+0%, *db_ptr+0%, A
RPT nh
MAC *h_ptr+0%, *db_ptr+0%, A
STH A, *y_ptr+ ; save output to output buffer
MAR *db_ptr-% ; adjust the db pointer
end_hil:
return:
LDM db_ptr, B ; need this to use AR5
MVDK db, db_ptr
LD #0, A ; check overflow flag
XC 1, AOV ; and pass it in acc. A
LD #1, A
STL B, *db_ptr ; save new position of pointer
POPM ST1 ; 1 cycle
POPM ST0 ; 1 cycle
POPM AR1
.if __far_mode
FRETD
.else
RETD
.endif
nop
nop
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -