📄 rbrev32b.s
字号:
;*********************************************************************
; *
; Software License Agreement *
; *
; The software supplied herewith by Microchip Technology *
; Incorporated (the "Company") for its dsPIC controller *
; is intended and supplied to you, the Company's customer, *
; for use solely and exclusively on Microchip dsPIC *
; products. The software is owned by the Company and/or its *
; supplier, and is protected under applicable copyright laws. All *
; rights are reserved. Any use in violation of the foregoing *
; restrictions may subject the user to criminal sanctions under *
; applicable laws, as well as to civil liability for the breach of *
; the terms and conditions of this license. *
; *
; THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO *
; WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, *
; BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND *
; FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE *
; COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, *
; INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. *
; *
; (c) Copyright 2007 Microchip Technology, All rights reserved. *
;*********************************************************************
; Local inclusions.
.nolist
.include "dspcommon.inc" ; MODCON, XBREV
.list
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.section .libdsp, code
.global _BitReverseReal32bIP
.text
;............................................................................
_BitReverseReal32bIP:
;............................................................................
; Context Save
PUSH MODCON
PUSH XBREV
;............................................................................
; MODCONbits.BWM=0b0111 ; W2 for Bit reverse
; XBREVbits.BREN=1
; XBREVbits.XB= N
; N-----> Size of the real FFT, for 1024 point real FFT "N" should be 1024
MOV #0x0700,w7 ; Uses w7 for bit reverse
MOV w7,MODCON
MOV #0x8000,w7 ; Enable bit reverse addresing
IOR w0,w7,w7
MOV w7,XBREV ; Element N (equivalent to a
; sample N/2 for complex data)
LSR w0,#1,w0
DEC w0,w0 ; w6=(N/2)-1
MOV w1,w7
DO w0,BREV_END
CP w7,w1 ; w1-w7 ?
BRA le,BREV_SKIP ; w1 <= w7 => skip to next
; Swap 32-bit Complex pairs
MOV [w1+0],w2
MOV [w1+2],w3
MOV [w1+4],w4
MOV [w1+6],w5
MOV [w7++],[w1++]
MOV [w7++],[w1++]
MOV [w7++],[w1++]
MOV [w7++],[w1++]
MOV w5,[--w7] ; Swap Real Data
MOV w4,[--w7]
MOV w3,[--w7] ; Swap Real Data
MOV w2,[--w7]
SUB w1,#8,w1
BREV_SKIP:
ADD w1,#8,w1
BREV_END: MOV [w7],[w7++] ; bit reverse update
; (only on data writes!!!)
;............................................................................
; Context Restore
POP XBREV
POP MODCON
;............................................................................
RETURN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -