完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
.def _Reset
.ref _c_int00 .sect "vectors" _Reset: .ivec _c_int00, USE_RETA .sect "indata" x0: .copy .dualsine.dat ; allocate label definitions and/or references here ; allocate uninitialized data sections here samps_fir .set 200 taps_fir .set 16 a0: .usect "coeffs" , taps_fir y0: .usect "results", (samps_fir-taps_fir + 2) & 0xFFFE samps_iir .set 200 taps_iir .set 8 a1: .usect "coeffs" , taps_iir y1: .usect "results", samps_iir & 0xFFFE z1: .usect "results", 2 ; allocate memory for stack and system stack STKLEN .set 100 BOS: .usect "STK", STKLEN .even BOSS: .usect "SSTK", STKLEN ; allocate initialized data section here ;only the first 8 values are used in lab2 and lab3 .sect "init" table_fir: .int 7FCh, 7FDh, 7FEh, 7FFh .int 800h, 801h, 802h, 803h .int 803h, 802h, 801h, 800h .int 7FFh, 7FEh, 7FDh, 7FCh table_iir: .int 0001h, 0002h, 0029h, 872Eh .int 3978h, 2000h, 4000h, 2000h ;allocate initialized code section here .def _c_int00 .sect "code" _c_int00: ; gv - CPU configuration must match assembler BCLR C54CM .c54cm_off ; when off, work in C55 mode , other wise in C54 mode. BCLR CPL .cpl_off ; when off, working in assemble mode, other wise in C mode. ; when assemble mode, "move @a, XAR " will get value from XDP+ a ; when C mode, "mov @a, XAR" will get value from SP + a. BCLR ARMS ; syntax checking directives .arms_off ; when off, work in the DSP mode, other wise in CPU mode. BSET M40 ; use 40 bits extenion. BSET FRCT ; redundant sign bit eliminated automatically. BSET SXMD ; sign extension ; initialized the pointer to SP and SSP. AMOV #(BOS + STKLEN), XSP AMOV #(BOSS + STKLEN), XSSP CALL copy_fir CALL fir CALL copy_iir CALL iir NOP here: B here copy_fir: .asmfunc AMOV #table_fir,XAR2 AMOV #a0, XAR3 RPT #7 ; repeat 8 times MOV dbl(*AR2+), dbl(*AR3+) ; indirect addressing .endasmfunc RET ; return for the subrounte _copy call fir:.asmfunc AMOV #x0, XAR2 AMOV #a0, XCDP AMOV #(x0+1),XAR3 AMOV #y0, XAR4 MOV mmap(CDP), BSAC MOV #0, CDP MOV #taps_fir,BKC MOV #(taps_fir-3),T0 MOV #(taps_fir-3),CSR BSET CDPLC MOV #((samps_fir-taps_fir)/2), BRC0 ; 92 RPTBLOCAL e1 MPY *AR2+, *CDP+, AC0 :: MPY *AR3+, *CDP+, AC1 || RPT CSR MAC *AR2+, *CDP+, AC0 :: MAC *AR3+, *CDP+, AC1 MAC *(AR2-T0), *CDP+, AC0 :: MAC *(AR3-T0), *CDP+, AC1 e1: MOV pair(hi(AC0)), dbl(*AR4+) .endasmfunc RET copy_iir: .asmfunc AMOV #table_iir,XAR2 AMOV #a1, XAR3 RPT #3 ; repeat 4 times MOV dbl(*AR2+), dbl(*AR3+) ; indirect addressing AMOV #z1, XAR1 ; initialized the two taps mov #0, *AR1+ mov #0, *AR1+ .endasmfunc RET ; return for the subrounte _copy call iir:.asmfunc AMOV #x0, XAR0 AMOV #z1, XAR1 AMOV #a1, XAR2 AMOV #y1, XAR3 MOV mmap(AR2), BSA23 MOV #0, AR2 MOV #taps_iir,BK03 BSET AR2LC MOV #(samps_iir-1), BRC0 RPTBLOCAL e2 MOV *AR0+<<#16, AC1 ;get input sample ; Start of Biguad section loop MOV dbl(*AR2+), pair(T0) ; get scaling factors ; denominator calculations - result in AC0 mpym *AR2+, AC1, AC0 ; a0 * x masm *AR2+, *AR1+, AC0 ; -a1 * z1 masm *AR2+, *AR1-, AC0 ; -a2 * z2 sfts AC0, T0 ; scale z0 ; numerator calculations - result in AC1 mpym *AR2+, AC0, AC1 ; z0 * b0 macm *AR2+, *AR1+, AC1 ; +z1 * b1 macm *AR2+, *AR1-, AC1 ; +z1 * b2 sfts AC1, T1 ; scale output ; update taps mov *AR1, T0 ; save Z1 mov rnd(hi(AC0)), *AR1+ ; new Z1 = Z0 mov T0, *AR1- ; new z2 = z1 ;End of Biquad section loop e2: mov rnd(hi(AC1)), *AR3+ ; save the output value .endasmfunc RET MEMORY { DARAM2 : o = 0x004000 l = 0x002000 DARAM3 : o = 0x006000 l = 0x002000 SARAM16 : o = 0x020000 l = 0x002000 CE0 : o = 0x050000 l = 0x004000 FLASH : o = 0xFF8000 l = 0x007F00 VECS : o = 0xFFFF00 l = 0x000100 } SECTIONS { indata > DARAM2 coeffs > SARAM16 results > CE0 init > FLASH ALIGN = 4 code > FLASH vectors > VECS STK > DARAM3 ALIGN = 4 SSTK > DARAM3 ALIGN = 4 } |
|
相关推荐
|
|
基于 DSP5509 进行数字图像处理中 Sobel 算子边缘检测的硬件连接电路图
2465 浏览 0 评论
696 浏览 0 评论
普中科技F28335开发板中,如何使用aic23播放由代码生成的正弦波
2900 浏览 0 评论
3666 浏览 1 评论
1209 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 19:41 , Processed in 0.473228 second(s), Total 66, Slave 48 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号