<< Chapter < Page Chapter >> Page >

Appendix d: main routine, header files for psd estimator

lab4b.h

intrinsics.h

lab4bmain.c

1 #define N 1024 /* Length of output buffers */ 2 #define L N /* Length of input data */ 3 #define logL 10 /* log base 2 of L */ 4 #define M 31 /* Compute 2*M+1 autocorrelation points */ 5 6 /* #define M (L/2-1) */ /* Be sure to use ()'s in this case */ 7 /* or algebraic substitution bugs */ 8 /* can be introduced */ 1 /* Compiler intrinsics for the TI compiler */ 2 /* and the Very Portable Optimizer (VPO) port */ 3 /* to TMS320C54X series DSPs */ 4 /* */ 5 /* Use compile option -DVPO when using VPO */ 6 /* */ 7 /* Copyright September 2005 by Matt Kleffner */ 8 /* under the Creative Commons Attribution License */ 9 10 #ifndef INTRINSICS_H 11 12 #define INTRINSICS_H 13 14 #ifdef VPO 15 16 long int vpo_l_mul_ii(int w0, int w1); 17 18 /* fractional multiply without fractional mode (long result) */ 19 #define _l_mul_fract_fb0_ii(w0,w1) \ 20 (vpo_l_mul_ii(w0,w1) << 1) 21 22 /* fractional multiply with fractional mode already on (long result) */ 23 #define _l_mul_fract_fb1_ii(w0,w1) \ 24 (vpo_l_mul_ii(w0,w1)) 25 26 /* fractional multiply without fractional mode (int result) */ 27 #define _i_mul_fract_fb0_ii(w0,w1) \ 28 (vpo_l_mul_ii(w0,w1) >> 15) 29 30 /* fractional multiply with fractional mode already on (int result) */ 31 #define _i_mul_fract_fb1_ii(w0,w1) \ 32 (vpo_l_mul_ii(w0,w1) >> 16) 33 34 #define _set_fract_bit() vpo_set_fract() 35 #define _reset_fract_bit() vpo_reset_fract() 36 #define _set_ovm_bit() vpo_set_ovm() 37 #define _reset_ovm_bit() vpo_reset_ovm() 38 39 #define _l_add_shiftl_li(w0,w1) (((int32)(w0))+(((int32)(int16)(w1))<<16) ) 40 #define _l_sub_shiftl_li(w0,w1) (((int32)(w0))-(((int32)(int16)(w1))<<16) ) 41 42 #else 43 44 /* fractional multiply without fractional mode (long result) */ 45 #define _l_mul_fract_fb0_ii(w0,w1) \ 46 (((long int)w0 * (long int)w1) << 1) 47 48 /* fractional multiply with fractional mode already on (long result) */ 49 #define _l_mul_fract_fb1_ii(w0,w1) \ 50 (((long int)w0 * (long int)w1)) 51 52 /* fractional multiply without fractional mode (int result) */ 53 #define _i_mul_fract_fb0_ii(w0,w1) \ 54 (((long int)w0 * (long int)w1) >> 15) 55 56 /* fractional multiply with fractional mode already on (int result) */ 57 #define _i_mul_fract_fb1_ii(w0,w1) \ 58 (((long int)w0 * (long int)w1) >> 16) 59 60 #define _set_fract_bit() asm(" ssbx frct") 61 #define _reset_fract_bit() asm(" rsbx frct") 62 #define _set_ovm_bit() asm(" ssbx ovm") 63 #define _reset_ovm_bit() asm(" rsbx ovm") 64 65 #endif /* VPO */ 66 67 #endif /* INTRINSICS_H */

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