| 5 | 1/1 | 返回列表 |
| 查看: 1194 | 回復(fù): 4 | |||
| 當(dāng)前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | |||
jianchaoyv金蟲 (小有名氣)
|
[交流]
【求助】請幫忙看一個匯編函數(shù)
|
||
|
/*********************************************************************** * _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 是什么意思?急求幫助。! |
金蟲 (小有名氣)
木蟲 (正式寫手)


|
; Prepare CORCON and PSVPAG for possible access of data ;這里就說明了CORCON和PSVPAG是兩個狀態(tài)寄存器 ; located in program memory, using the PSV. ;設(shè)置程序狀態(tài),啟用PSV位 push PSVPAG; ;備份寄存器 mov #COEFFS_IN_DATA,w7 ; 賦值,COEFFS_IN_DATA是常量值 psvaccess w7 ; 打開CORCON寄存器中的PSV位 mov w4,PSVPAG ; 為程序設(shè)置PSVPAG ============================================================================ 上面是大體意思,具體而言,應(yīng)該翻閱單片機手冊以查看CORCON和PSVPAG這兩個寄存器干嘛用的,因單片機的不同,功能也不盡相同 |

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 071000生物學(xué)調(diào)劑 +4 | 知昭蔓 2026-04-02 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 總分328生物與醫(yī)藥考數(shù)學(xué)求調(diào)劑 +3 | aaadim 2026-04-02 | 3/150 |
|
|
[考研] 求調(diào)劑!生物與醫(yī)藥專碩 +4 | 逆轉(zhuǎn)陸先生 2026-04-01 | 4/200 |
|
|
[考研] 一志愿北交大材料工程總分358 +3 | cs0106 2026-04-02 | 5/250 |
|
|
[考研] 計算機265跨調(diào)環(huán)境 +5 | Yumeng_6 2026-03-27 | 5/250 |
|
|
[考研] 324分 085600材料與化工 +20 | 呆鵝oor 2026-03-27 | 20/1000 |
|
|
[考研] 377求調(diào)劑 +3 | RASKIN 2026-04-02 | 3/150 |
|
|
[考研] 367求調(diào)劑 +8 | 芋泥啵! 2026-03-28 | 8/400 |
|
|
[考研] 一志愿南昌大學(xué)324求調(diào)劑 +12 | hanamiko 2026-03-27 | 12/600 |
|
|
[碩博家園] 考研調(diào)劑 +5 | 駱駝男人 2026-04-01 | 5/250 |
|
|
[考研] 一志愿華南師范361分,化學(xué)求調(diào)劑 +4 | Nicole88888 2026-04-01 | 4/200 |
|
|
[考研] 358求調(diào)劑 +3 | 王向陽花 2026-03-31 | 3/150 |
|
|
[考研] 0856材料化工調(diào)劑 總分330 +18 | zhubinhao 2026-03-27 | 18/900 |
|
|
[考研] 318求調(diào)劑 +10 | 陳晨79 2026-03-30 | 10/500 |
|
|
[考研] 一志愿浙江大學(xué)工科動力工程370,數(shù)一121,專業(yè)課135,現(xiàn)在能去哪里 +3 | 080700調(diào)劑 2026-03-30 | 4/200 |
|
|
[考研] 276求調(diào)劑 +3 | 趙久華 2026-03-29 | 3/150 |
|
|
[考研] 一志愿中海洋320化學(xué)工程與技術(shù)學(xué)碩求調(diào)劑 +8 | 披星河 2026-03-30 | 8/400 |
|
|
[考研] 279求調(diào)劑 +12 | j的立方 2026-03-29 | 12/600 |
|
|
[考研] 293求調(diào)劑 +3 | 末未mm 2026-03-30 | 5/250 |
|
|
[考研] 復(fù)試調(diào)劑,一志愿南農(nóng)083200食品科學(xué)與工程 +5 | XQTJZ 2026-03-26 | 5/250 |
|