| 查看: 1127 | 回复: 4 | |||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | |||
[交流]
【求助】请帮忙看一个汇编函数
|
|||
|
/*********************************************************************** * _DFT_Fundamental: * calculate DFT transform for the fundamental waveform * this routine could be use to calculate the phase of fundamental waveform * which equals to atan(A(1)/B(1)) * * Operation: * F(1) = (1/N)* sum_n (f(n)*WN(n)), WN(n) = exp[-(j*2*pi*n)/N], * n in {0, 1,... , N-1}, * F(2) = (1/N)* sum_n (f(n)*WN(n)), WN(n) = exp[-(j*2*pi*n)/N], * n in {N, 1,... , 2*N-1}, * * calculate: * cycle 1 's DFT transform * and cycle 2 's DFT transform * Input: * w0 = number of source data per cycle * w1 = ptr to source vector (srcCV) ----- data should be stored in Y-DATA memory * w2 = ptr to output value * w3 = ptr to cos_sin table * w4 = COEFFS_IN_DATA, or memory program page with cos_sin table * w5 = calculate cycle number * Return: * null * result store in (w2) array, where * (w2 ) = F(1).real * (w2+1) = F(1).imag * (w2+2) = F(2).real * (w2+3) = F(2).imag * * System resources usage: * {w0..w7} used, not restored * {w8..w13} saved, used, restored * AccuA used, not restored * AccuB used, not restored * CORCON saved, used, restored * PSVPAG saved, used, restored (if factors in P memory) * * one loop stage usage. * instruction cycle: * w0 * 4 + * execution time under 30MIPS: * Design By: Jemmey Huang CADC * Last modification: Oct 8 / 2006 ***********************************************************************/ _DFT_Fundamental: push.d w8 ; {w8,w9} to TOS push.d w10 ; {w10,w11} to TOS push.d w12 ; {w12,w13} to TOS ;............................................................................ ; Prepare CORCON for fractional computation. push CORCON bset CORCON, #4 ;ACCSAT = 1, Set 9.31 mode bset CORCON, #6 ;ACCSAT = 1, Set 9.31 mode bset CORCON, #7 ;ACCSAT = 1, Set 9.31 mode ;............................................................................ ; Prepare CORCON and PSVPAG for possible access of data ; located in program memory, using the PSV. push PSVPAG; mov #COEFFS_IN_DATA,w7 ; w7 = COEFFS_IN_DATA psvaccess w7 ; enable PSV bit in CORCON mov w4,PSVPAG ; load PSVPAG with program ; space page offset ; from here w4 can be used for other job mov w5, w9 ; cycle number store to w9 mov w0, w7 ; data length = N dec w7, w7 ; N-1 ; from here, ; w0 data length N ; w1 source data start address ; w2 return data start address ; w3 table start address for cosx ; w4 not use ; w5, w6 use by MAC ; w7 loop counter = N-1 ; w8 X data pointer to the sin_cos table ; w9 cycle number ; w10 Y data pointer to the f(i) ; w11 not use ; w12 not use ; w13 not use mov w1, w11 _loop_cycls: mov w11, w10 ; source data begining address mov w3, w8 ; cos table begining address clr A mov [w10++], w6 ; pre-fetch source data mov [w8++], w5 ; pre-fetch cos table repeat w7 mac w5*w6, a, [w8]+=2, w5, [w10]+=2, w6 sac.r a, #5, [w2++] ; stored real value of cycle 1 mov w11, w10 ; retrive source data begining address mov [w10++], w6 ; pre-fetch data f(1) clr A repeat w7 ; repeat N time mac w5*w6, a, [w8]+=2, w5, [w10]+=2, w6 sac.r a, #5, [w2++] ; stored image value of cycle 1 >>20 add w11, w0, w11 add w11, w0, w11 dec w9, w9 ; w9-- bra gt,_loop_cycls ; if w0 > 0, do next stage ; Restore PSVPAG and CORCON. pop PSVPAG pop CORCON pop.d w12 ; {w12,w13} to TOS pop.d w10 ; {w10,w11} to TOS pop.d w8 ; {w8,w9} to TOS return 其中这部分: ; Prepare CORCON and PSVPAG for possible access of data ; located in program memory, using the PSV. push PSVPAG; mov #COEFFS_IN_DATA,w7 ; w7 = COEFFS_IN_DATA psvaccess w7 ; enable PSV bit in CORCON mov w4,PSVPAG ; load PSVPAG with program ; space page offset ; from here w4 can be used for other job 是什么意思?急求帮助!!! |
» 猜你喜欢
不自信的我
已经有11人回复
北核录用
已经有3人回复
要不要辞职读博?
已经有6人回复
实验室接单子
已经有3人回复
磺酰氟产物,毕不了业了!
已经有8人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有10人回复
26申博(荧光探针方向,有机合成)
已经有4人回复
论文终于录用啦!满足毕业条件了
已经有26人回复
2026年机械制造与材料应用国际会议 (ICMMMA 2026)
已经有4人回复
Cas 72-43-5需要30g,定制合成,能接单的留言
已经有8人回复
» 本主题相关价值贴推荐,对您同样有帮助:
跪求1stOpt2.5以上版本,或者请高人帮忙拟合包含复数的函数的参数
已经有8人回复
请教下:如何求一个函数在一定范围内的全部解
已经有10人回复
满足一定条件(极小值)的函数的构造,请高手帮忙!谢谢
已经有11人回复
恒熵恒容只做体积功的封闭体系里,体系达平衡,看哪个状态函数
已经有12人回复
帮忙看看图中功函数怎么读取
已经有8人回复
求助:能不能帮忙写一个用matlab求一个函数的傅里叶变换的程序
已经有16人回复
求帮忙,关于含有bessel函数的方程的编程求解问题
已经有11人回复
【求助】哪位大侠能帮我看看一个不等式的问题,求函数的界
已经有10人回复
【求助】求助一个周期排列数据的 函数形式,请虫友指点!
已经有5人回复
【求助】一个指数函数的积分!
已经有3人回复
【求助】请问怎么化简?想把这个化成一个相对简单的函数形式,求各位大侠帮忙!谢谢!
已经有6人回复
【求助】请教一个隐函数的求导问题
已经有10人回复
【交流】VC++, C#, VB答疑专贴
已经有145人回复
★
微尘、梦想(金币+1): 谢谢回复…… 2011-04-14 21:07:39
微尘、梦想(金币+1): 谢谢回复…… 2011-04-14 21:07:39
|
; Prepare CORCON and PSVPAG for possible access of data ;这里就说明了CORCON和PSVPAG是两个状态寄存器 ; located in program memory, using the PSV. ;设置程序状态,启用PSV位 push PSVPAG; ;备份寄存器 mov #COEFFS_IN_DATA,w7 ; 赋值,COEFFS_IN_DATA是常量值 psvaccess w7 ; 打开CORCON寄存器中的PSV位 mov w4,PSVPAG ; 为程序设置PSVPAG ============================================================================ 上面是大体意思,具体而言,应该翻阅单片机手册以查看CORCON和PSVPAG这两个寄存器干嘛用的,因单片机的不同,功能也不尽相同 |

5楼2011-04-13 23:25:30
fengyu027
木虫 (正式写手)
- 应助: 0 (幼儿园)
- 金币: 2687.4
- 散金: 84
- 红花: 1
- 帖子: 684
- 在线: 155.5小时
- 虫号: 705479
- 注册: 2009-02-21
- 专业: 无机合成和制备化学

2楼2010-08-23 16:01:11
3楼2010-09-10 14:59:31

4楼2011-01-14 21:05:21












回复此楼