📄 real_dit_fft.lst
字号:
230 1 CoSTORE R12,MAS // (R12) = Re(Qn+1)
231 1
232 1 //------Calculation of image parts---------
233 1 //(R5) = Im(Pn+1) = Im(Pn) + Im(Qn) * cos(x) - Re(Qn) * sin(x)
234 1 MOV MAH,R6 // (ACC) = Im(Pn)
235 1 CoMAC R14,[x-] // (ACC) = Im(Pn) + (Im(Qn) * cos(x))
236 1 // (R8) = (R8)-2
237 1 CoMAC- R15,[x+] // (ACC) = (ACC) - (Re(Qn) * sin(x))
238 1 // (R8) = (R8)-2
239 1 CoSTORE R5,MAS // (R5) = Im(Pn+1)
240 1
241 1 //(R9) = Im(Qn+1) = Im(Pn) - Im(Qn) * cos(x) + Re(Qn) * sin(x)
C166 COMPILER V6.04, REAL_DIT_FFT 09/04/2007 16:24:44 PAGE 5
242 1 MOV MAH,R6 // (ACC) = Im(Pn)
243 1 CoMAC- R14,[x-] // (ACC) = Im(Pn) - (Im(Qn) * cos(x))
244 1 // (R8) = (R8)-2
245 1 CoMAC R15,[x+] // (ACC) = (ACC) + (Re(Qn) * sin(x))
246 1 // (R8) = (R8)+2
247 1 CoSTORE R13,MAS // (R13) = Im(Qn+1)
248 1
249 1 //------Output Pn+1 and Qn+1-----------
250 1 MOV [x],R13 // X[QR1+2] = R13 = Im(Qn+1)
251 1 MOV [-x],R12 // X[QR1] = R12 = Re(Qn+1)
252 1
253 1 CoNOP [x - QR1] // (R8) = (R8) - (QR1)
254 1 CoNOP [x + QR0] // (R8) = (R8) + (QR0)
255 1 ADD x,#2 // (R8) = (R8)+2
256 1 MOV [x],R5 // X[QR0+2] = R5 = Im(Pn+1)
257 1 MOV [-x],R7 // X[QR0] = R7 = Re(Pn+1)
258 1 CoNOP [x - QR0] // (R8) = (R8) - (QR0)
259 1
260 1
261 1
262 1 //------Incrementing FFT_in Index Counter--------
263 1 EXTR #2
264 1 ADD QR0,#4
265 1 ADD QR1,#4
266 1
267 1 //------Decrementing IN_LOOP Counter-------------
268 1 SUB R1,#1
269 1 JMPR cc_NZ,IN_LOOP
270 1
271 1 POP R12 // pop basic address of cos(x) out stack
272 1 POP R6
273 1 POP R5
274 1
275 1 MOV R13,#1 //(R13)=1
276 1 SHL R13,exp //(R13)=N
277 1 SHL R13,#1 //(R13)=2*N
278 1
279 1 //------Increment FFT_IN Index offset
280 1 ADD R3,R2
281 1 CMP R3,R13
282 1 POP R13
283 1
284 1 JMPR cc_ULT,MID_LOOP
285 1
286 1 //END_MID_LOOP:
287 1 MOV R2,R13 // (R2) = counter
288 1 SHR R13,#1h // (R13) = (R13)/2
289 1
290 1 SUB R4,#1h // R4 = R4 - 1
291 1 JMPR cc_NZ,OUT_LOOP
292 1
293 1 // ***** End Stage 1 - (exp-1) *****
294 1
295 1 // ********** Last Stage **********
296 1 // This stage performs the extraction of the real valued FFT
297 1 // out of the previously performed complex FFT. The
298 1 // output is sorted in linear-order. Because of symmetric property of
299 1 // FFT only the first N/2 points and the Nyquist point are calculated.
300 1
301 1 //------Extraction of the frequency values with indices [0, N/2]
302 1 MOV R2,#(-2) // init UN_LOOP counter
303 1
C166 COMPILER V6.04, REAL_DIT_FFT 09/04/2007 16:24:44 PAGE 6
304 1 MOV R13,#1h // (R13) = 1
305 1 SHL R13,exp // (R13) = 2^(exp) = N
306 1
307 1 UN_LOOP:
308 1 PUSH R5 // push cos(x) into stack
309 1 PUSH table
310 1
311 1 ADD R2,#2 // (R2)=(R2)+2
312 1
313 1 //------determine input index of R(k) and I(k) in FFT_in
314 1 MOV R3,R2 // (R3)=(R2)
315 1 ADD R3,index // (R3) = (R2) + index
316 1 MOV R14,[R3]
317 1 ADD R14,x
318 1
319 1 //------Input-------------------------------
320 1 MOV R3,[R14+] // R3 = FFT_in[R3] = R(k)
321 1 MOV R14,[R14] // R14 = FFT_in[R3+2] = I(k)
322 1
323 1 MOV R6,R3 // R6 = R(k)
324 1 MOV R7,R14 // R7 = I(k)
325 1
326 1 CMP R2,#0
327 1 JMPR cc_EQ, DC_output //jump to calculation of DC element
328 1
329 1 //------determine input index of R(N/2-k) and I(N/2-k) in FFT_in
330 1 MOV R7,R13 // (R7) = N
331 1 SUB R7,R2 // (R7) = N - R2
332 1
333 1 ADD R7,index // (R7) = (R7) + index
334 1 MOV R7,[R7] // (R7) = [N - index]
335 1 ADD R7,x // (R7) = (R7) + FFT_in
336 1
337 1 //------Input-------------------------------
338 1 MOV R6,[R7+] // (R6) = R(N/2-k)
339 1 MOV R7,[R7] // (R7) = I(N/2-k)
340 1
341 1 //------save register-----------------------
342 1 DC_output:
343 1 MOV R15,R6 // R15 = R6= R(N/2-k)
344 1 MOV R1,R14 // R1 = R14= I(k)
345 1
346 1 //------calculation of the spectra H(k) and G(k)
347 1 SUB R15,R3 // (R15) = (R15)-(R3) = -(R(k)-R(N/2-k))=Im{G}
348 1 ADD R1,R7 // (R1) = (R1)+(R7) = I(k)+I(N/2-k)=Re{G}
349 1 ADD R3,R6 // (R13) = (R13)+(R6) = R(k)+R(k+N/2)=Re{H}
350 1 SUB R14,R7 // (R14) = (R14)-(R7) = I(k)-I(N/2-k)=Im{H}
351 1
352 1 ASHR R15,#1
353 1 ASHR R1,#1
354 1 ASHR R3,#2 //to make sure same point position in calculation of Re{X(k)}
355 1 ASHR R14,#2 //and Im{X(k)}
356 1
357 1 //------assembly of the full spectrum spectra----
358 1 ADD table,R2
359 1 ADD R5,R2
360 1 MOV R5,[R5] // (R5) = cos(x)
361 1 MOV table,[table] // (table) = sin(x)
362 1
363 1 //------calculate Re{X(k)}=Re{H(k)}+cos(X)*Re{G(k)}+sin(X)*Im{G(k)}
364 1 MOV MAH,R3 //(ACC)=(R13)=Re{H(k)}
365 1 MOV [R12],R1 //((X))=Re{G}
C166 COMPILER V6.04, REAL_DIT_FFT 09/04/2007 16:24:44 PAGE 7
366 1 CoMAC R5,[R12] //(ACC)=(ACC)+cos(x)*Re{G(k)}
367 1
368 1 MOV [R12],R15 //(X)=(R1) =Im{G}
369 1 CoMAC table,[R12] //(ACC)=(ACC)+sin(X)*Im{G(k)}
370 1
371 1 //Write the real part Re{X(k)} into X
372 1 COSTORE [R12+],MAS //((R12))=limited(ACC) =Re{X(k)}
373 1 //(R12)=(R12)+2
374 1
375 1 //-------Calculate Im{X(k)}=Im{H(k)}+cos(x)*Im{G(k)}-sin(x)*Re{G(k)}
376 1 MOV MAH,R14 //(ACC)=(R6)=Im{H(k)}
377 1 MOV [R12],R15 //((R12))=(R15)=Im{G}
378 1 CoMAC R5,[R12] //(ACC)=(ACC)+cos(x)*Im{G(k)}
379 1 //(IDX0)=(IDX0)-(QX0)
380 1 MOV [R12],R1 //((R12))=Re{G}
381 1 CoMAC- table,[R12] //(ACC)=(ACC)-sin(X)*Re{G(k)}
382 1
383 1 //Write the image part Im{X(k)} into X
384 1 COSTORE [R12+],MAS //((R12))=limited(ACC)=Im{X(k)}
385 1 //(R12)=(R12)+2
386 1 CMP R2,#0
387 1 JMPR cc_NE, loop_counter //jump to loop counter
388 1
389 1 //The folowing instructions computer the FFT value in Nyquist point,
390 1 //that is, k=N/2
391 1 //------ FFT value in Nyquist popint N/2 ----------------
392 1
393 1 //------ Re{X(N/2)}=Re{H(0)}-cos(pi*n)*Re{G(0)}-sin(pi*n)*Im{G(0)}
394 1 MOV MAH,R3 //(ACC)=(R5)=Re{H(0)}
395 1 MOV [R12],R1 //((X))=Re{G}
396 1 CoMAC- R5,[R12] //(ACC)=(ACC)-cos(n*pi)*Re{G(0)}
397 1
398 1 MOV [R12],R15 //((X))=(R7) =Im{G}
399 1 CoMAC- table,[R12] //(ACC)=(ACC)-sin(n*pi)*Im{G(0)}
400 1
401 1 //Write the real part Re{X(N/2)} into X
402 1 MOV R6,R13 //(R6)=N
403 1 SHL R6,#1 //(R6)=2*N
404 1 ADD R6,R12
405 1 SUB R6,#4 //(R6)=(X)+2*N-4
406 1 COSTORE [R6+],MAS //((R6))=limited(ACC) =Re{X(N/2)}
407 1 //(R6)=(R6)+2
408 1
409 1 //------- Im{X(N/2)}=Im{H(0)}-cos(n*pi)*Im{G(0)}+sin(n*pi)*Re{G(0)}
410 1 MOV MAH,R14 //(ACC)=(R6)=Im{H(0)}
411 1 MOV [R12],R15 //((X))=(R7)=Im{G(0)}
412 1 CoMAC- R5,[R12] //(ACC)=(ACC)-cos(n*pi)*Im{G(0)}
413 1 //(IDX0)=(IDX0)-(QX0)
414 1 MOV [R12],R1 //((X))=Re{G(0)}
415 1 CoMAC table,[R12] //(ACC)=(ACC)+sin(n*pi)*Re{G(0)}
416 1
417 1 //Write the image part Im{X(k)} into X
418 1 COSTORE [R6],MAS //((R6))=limited(ACC)=Im{X(N/2)}
419 1
420 1
421 1 //------ loop counter-------------------------
422 1 loop_counter:
423 1 POP table
424 1 POP R5 // pop the basic address of cos(x)from stack
425 1 MOV R1,R13 // (R1)=N
426 1 SUB R1,#2 // (R1)=N-2
427 1 CMP R2,R1
C166 COMPILER V6.04, REAL_DIT_FFT 09/04/2007 16:24:44 PAGE 8
428 1 JMPR cc_ULT,UN_LOOP
429 1
430 1 //restore the system state
431 1 POP R15
432 1 POP R14
433 1 POP R13
434 1
435 1 RET
436 1
437 1 }
438 1 }
*** WARNING C47 IN LINE 124 OF REAL_DIT_FFT.C: 'X': unreferenced parameter
439
440 //------------------- END OF FILE ----------------------------------------------
441
MODULE INFORMATION: INITIALIZED UNINITIALIZED
CODE SIZE = 418 --------
NEAR-CONST SIZE = -------- --------
FAR-CONST SIZE = -------- --------
HUGE-CONST SIZE = -------- --------
XHUGE-CONST SIZE = -------- --------
NEAR-DATA SIZE = -------- --------
FAR-DATA SIZE = -------- --------
XHUGE-DATA SIZE = -------- --------
IDATA-DATA SIZE = -------- --------
SDATA-DATA SIZE = -------- --------
BDATA-DATA SIZE = -------- --------
HUGE-DATA SIZE = -------- --------
BIT SIZE = -------- --------
INIT'L SIZE = -------- --------
END OF MODULE INFORMATION.
C166 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -