| 5 | 1/1 | 返回列表 |
| 查看: 1195 | 回復: 4 | |||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | |||
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ā)表 | |
|---|---|---|---|---|
|
[考研] 085600,320分求調(diào)劑 +5 | 大饞小子 2026-04-02 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 材料專碩322分 +7 | 哈哈哈吼吼吼哈 2026-04-02 | 7/350 |
|
|
[考研] 265求調(diào)劑 +9 | 林深溫瀾 2026-04-01 | 11/550 |
|
|
[考研] 材料專業(yè)求調(diào)劑 +10 | 月月鳥木 2026-04-01 | 10/500 |
|
|
[考研] 化學工程專碩324分,一志愿中國礦業(yè)大學求調(diào)劑 +7 | 耿耿1314 2026-04-01 | 7/350 |
|
|
[考研] 英一數(shù)一408,總分284,二戰(zhàn)真誠求調(diào)劑 +12 | 12.27 2026-03-30 | 14/700 |
|
|
[考研] 310分求調(diào)劑 +4 | 成功上岸wang 2026-04-01 | 4/200 |
|
|
[考研] 288資源與環(huán)境專碩求調(diào)劑,不限專業(yè),有學上就行 +25 | lllllos 2026-03-30 | 26/1300 |
|
|
[考研] 土木304求調(diào)劑 +3 | 兔突突突, 2026-03-31 | 3/150 |
|
|
[考研] 085701環(huán)境工程,267求調(diào)劑 +17 | minht 2026-03-26 | 17/850 |
|
|
[考研] 【調(diào)劑】一志愿廈大生物與醫(yī)藥調(diào)劑 +3 | Echo蝦米 2026-03-31 | 3/150 |
|
|
[考研] 一志愿華東師范大學有機化學專業(yè),初試351分,復試被刷求調(diào)劑! +9 | 真名有冰 2026-03-29 | 10/500 |
|
|
[考研] 315求調(diào)劑 +6 | akie... 2026-03-28 | 7/350 |
|
|
[考研] 286求調(diào)劑 +6 | Faune 2026-03-30 | 6/300 |
|
|
[考研] 一志愿西電085401數(shù)一英一299求調(diào)劑 六級521 +4 | 愛吃大鴨梨 2026-03-31 | 4/200 |
|
|
[考研] 266分,求材料相關(guān)專業(yè)調(diào)劑 +10 | 哇呼哼呼哼 2026-03-30 | 12/600 |
|
|
[有機交流]
10+3
|
kaobao456 2026-03-29 | 4/200 |
|
|
[考研] 304求調(diào)劑 +6 | 曼殊2266 2026-03-27 | 6/300 |
|
|
[考研] 330一志愿中國海洋大學 化學工程 085602 有讀博意愿 求調(diào)劑 +3 | wywy.. 2026-03-27 | 4/200 |
|
|
[考研] 324求調(diào)劑 +5 | hanamiko 2026-03-26 | 5/250 |
|