<< Chapter < Page Chapter >> Page >

The flow diagram in summarizes the operation of the interrupt handling routine

main
interrupt handler
Overall program flow of the main function and the interrupt handling function.

Assembly fft routine

As the list of operations indicates, bit-reversal and FFT computation are to be done in both C and assembly. For theassembly version, make sure that the line defining C_FFT is commented in lab4main.c . We are providing you with a shell assembly file, available at v:\ece420\54x\dspclib\c_fft_given.asm and shown in Appendix B , containing many useful declarations and some code. The code for performingbit-reversal and other declarations needed for the FFT routine are also provided in this section. However, we would like you to enter this code manually, as you will be expected to understand itsoperation.

The assembly file c_fft_given.asm contains two main parts, the data section starting with .sect ".data" and the program section starting with .sect ".text" . Every function and variable accessed in C must be preceded by a single underscore _ in assembly and a .global _name must be placed in the assembly file for linking. In this example, bit_rev_fft is an assembly function called from the C program with a label _bit_rev_fft in the text portion of the assembly file and a .global _bit_rev_fft declaration. In each assembly function, the macro ENTER_ASM is called upon entering and LEAVE_ASM is called upon exiting. These macros are defined in v:\ece420\54x\dspclib\core.inc . The ENTER_ASM macro saves the status registers and AR1 , AR6 , and AR7 when entering a function as required by the register use conventions. The ENTER_ASM macro also sets the status registers to the assembly conventions we have been using (i.e, FRCT =1 for fractional arithmetic and CPL =0 for DP referenced addressing). The LEAVE_ASM macro just restores the saved registers.

Parameter passing

The parameter passing convention between assembly and C is simple for single input, single output assembly functions. Froma C program, the input to an assembly program is in the low part of accumulator A with the output returned in the same place. When morethan one parameter is passed to an assembly function, the parameters are passed on the stack (see the core filedescription for more information). We suggest that you avoid passing or returning more than one parameter. Instead, use globalmemory addresses to pass in or return more than one parameter. Another alternative is to pass a pointer to the start of a bufferintended for passing and returning parameters.

Registers modified

When entering and leaving an assembly function, the ENTER_ASM and LEAVE_ASM macros ensure that certain registers are saved and restored. Since the C program may use any and all registers, the state ofa register cannot be expected to remain the same between calls to assembly function(s). Therefore, any information that needs to be preserved across calls to an assembly function must besaved to memory!

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing laboratory (ece 420). OpenStax CNX. Sep 27, 2006 Download for free at http://cnx.org/content/col10236/1.14
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing laboratory (ece 420)' conversation and receive update notifications?

Ask