commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8377 - in gnuradio/branches/developers/ngoergen/gnura


From: ngoergen
Subject: [Commit-gnuradio] r8377 - in gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib: general/spu wrapper wrapper/spu
Date: Sun, 11 May 2008 00:22:59 -0600 (MDT)

Author: ngoergen
Date: 2008-05-11 00:22:59 -0600 (Sun, 11 May 2008)
New Revision: 8377

Added:
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_ccc_as.S
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_ccc_as.h
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_fff_as.S
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_fff_as.h
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/gcp_fir_ccc.cc
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/gcp_fir_ccc.h
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/qa_gcp_fir_ccc.cc
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/qa_gcp_fir_ccc.h
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_ccc.c
   
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_fff.c
Log:


Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_ccc_as.S
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_ccc_as.S
                           (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_ccc_as.S
   2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,280 @@
+/* -*- asm -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+// taps are guarenteed to be 16 byte aligned.
+// ntaps != 0
+
+//  void spu_fir_ccc ( 
+//     const float *input,
+//             const float *taps, 
+//     float *output,
+//     const float *delayline,
+//     const unsigned int offset,
+//     const unsigned int nsamples,
+//     const unsigned int ntaps
+//  )
+//  {
+//    unsigned int o_index = 0;
+//
+//    do {  
+//      float sum0 = 0;
+//      float sum1 = 0;
+//      float sum2 = 0;
+//      float sum3 = 0;
+//
+//        unsigned int n_2_complex_blocks = ntaps / 2;
+//
+//        unsigned int cur_tap = 0;
+//      unsigned int cur_input = input + offset + o_index;
+//
+//      do {
+//  
+//        sum0 += cur_input[0] * cur_tap[0] - cur_input[1] * cur_tap[1];
+//        sum1 += cur_input[0] * cur_tap[1] + cur_input[1] * cur_tap[0];
+//        sum2 += cur_input[2] * cur_tap[2] - cur_input[3] * cur_tap[3];
+//        sum3 += cur_input[2] * cur_tap[3] + cur_input[3] * cur_tap[2];
+//  
+//        cur_input += 4;
+//        cur_tap += 4;
+//  
+//      } while ((n_2_complex_blocks -= 2) != 0);
+//
+//             output[o_index] = sum0 + sum2;
+//             output[o_index+1] = sum1 + sum3;
+//
+//    } while ((o_index += 2) != nsamples * 2);
+//  
+//  }
+//     
+
+       .file   "spu_fir_ccc.S"
+.text
+       .align  3
+       .global spu_fir_ccc
+       .type   spu_fir_ccc, @function
+spu_fir_ccc:
+                               ori     $32,$5,0        // 0-2
+                               lqa $41, spu_fir_ccc_hightapmask        // 1-6 
expand masks for taps
+                               ori     $33,$7,0        // 0-2                  
        
+                               lqa $42, spu_fir_ccc_lowtapmask // 1-6 expand 
masks for taps
+                               ori     $31,$8,0        // 0-2                  
        
+                               lqa $43, spu_fir_ccc_xormask    // 1-6 mask for 
inverse of bd
+                               nop
+                               lqa $44, spu_fir_ccc_leftexpand // 1-6 mask to 
shift bd bc to prefered slot
+                       .spu_fir_ccc_start2: 
+                               xor $30,$30,$30         // 0-2 initilize the 
current output vector                              
+                               il  $34, 16             // 0-2 shift mask for 
output insertion
+                       
+                       .spu_fir_ccc_start1: 
+                               andi    $37,$33,0x0c     // 0-2 find index into 
masks [0-4]
+                               xor     $5,$5,$5         // 0-2 
+                               shlqbii $10,$37,2        // 1-4 mult by 4
+                               xor     $6,$6,$6         // 0-2
+                               ila     $37, spu_fir_ccc_highshiftmasks
+                               xor     $7,$7,$7         // 0-2
+                               ori     $36,$9,0         // 0-2
+                               lqx     $39,$37,$10      // 1-6 load the right 
shift mask                       
+                               xor     $8,$8,$8         // 0-2
+                       
+                               ila     $37, spu_fir_ccc_lowshiftmasks
+                               ori     $38,$4,0         // 0-2
+                               a       $35, $33, $3     // 0-2
+                               
+                               lqx     $40,$37,$10      // 1-6 load the right 
shift mask               
+               
+                               hbra    .spu_fir_ccc_inner_loop_branch, 
.spu_fir_ccc_inner_loop         // inner-loop hint
+                               
+                               lqd     $10,0($35)       // 1-6
+                               lqd     $11,16($35)      // 1-6
+                               nop
+                               lqd     $12,32($35)      // 1-6
+                               
+                       .spu_fir_ccc_inner_loop:                
+                               ai      $36,$36,-4       // 0-2
+                               lqd     $14,0($38)       // 1-6
+                               ai      $35,$35,32       // 0-2
+                               lqd     $15,16($38)      // 1-6
+                               shufb   $13,$10,$11,$40         // 1-4
+                               shufb   $16,$14,$14,$42         // 1-4
+                               ai      $38,$38,32       // 0-2
+
+
+                               shufb   $10,$10,$11,$39         // 1-4
+                               nop
+                               // expensive, but needed
+                               shufb   $14,$14,$14,$41         // 1-4
+                               fma     $6, $13, $16, $6        // 0-6
+                               shufb   $18,$11,$12,$40         // 1-4
+                               fma     $5, $10, $14, $5        // 0-6
+
+                               shufb   $17,$15,$15,$42         // 1-4
+                               lqd     $10,0($35)       // 1-6
+                               shufb   $15,$15,$15,$41         // 1-4
+                               nop
+                               shufb   $11,$11,$12,$39         // 1-4  
+                               fma     $8, $18, $17, $8        // 0-6
+                       
+                               lqd     $12,32($35)      // 1-6
+                               fma     $7, $11, $15, $7        // 0-6
+                               
+                               lqd     $11,16($35)      // 1-6
+
+
+                       .spu_fir_ccc_inner_loop_branch: 
+                               brnz    $36,.spu_fir_ccc_inner_loop
+                               
+                               fsmbi   $10,0xFF00       // 1-4
+                               fa      $18,$5,$6                // 0-6
+                               hbra    .outter_loop_branch, 
.spu_fir_ccc_start1         // 1-
+                               fa      $19,$7,$8                // 0-6
+                               hbra    .spu_fir_ccc_finish_branch, 
.spu_fir_ccc_finish_branch_targ      // 1-
+                               fa      $5,$18,$19               // 0-6         
                
+
+                               shufb   $6, $5, $5, $44 // 1-4 expand 5 to 6
+                               xor     $6,$6,$43        // 0-2
+                               fa      $11, $5, $6  // 0-6     
+
+                               and     $12,$10,$11      // 0-2
+
+                               rotqby  $11, $12, $34    // 1-4
+                               or      $30,$11,$30      // 0-2
+                               ai      $31,$31,-1       // 0-2
+
+                       .spu_fir_ccc_finish_branch:     
+                               brz     $31,.spu_fir_ccc_finish4         
+                       .spu_fir_ccc_finish_branch_targ:        
+
+                               
+                               ai      $33,$33,8        // 0-2
+                               ai      $34,$34,-8       // 0-2
+                       
+                       .outter_loop_branch:            
+                               brnz    $34, .spu_fir_ccc_start1
+                               hbra    .spu_fir_ccc_outter_outter_loop_branch, 
.spu_fir_ccc_start2     
+// Stores r5 in output
+                       .spu_fir_ccc_finish4:   
+                               stqd    $30,0($32)              
+                               ai      $32,$32,16                              
// increment output pointer by 1 new vector.
+
+                       .spu_fir_ccc_outter_outter_loop_branch: 
+                               brnz    $31,.spu_fir_ccc_start2                 
// start another output vector if needed
+
+                               bi      $lr
+       .size   spu_fir_ccc, .-spu_fir_ccc
+       
+.text
+        .global spu_fir_ccc_highshiftmasks
+        .p2align  4
+        .type   spu_fir_ccc_highshiftmasks, @object
+        .size   spu_fir_ccc_highshiftmasks, 64
+       
+spu_fir_ccc_highshiftmasks:
+       .long 0x00010203
+       .long 0x00010203
+       .long 0x04050607
+       .long 0x04050607
+
+       .long 0x04050607
+       .long 0x04050607
+       .long 0x08090a0b
+       .long 0x08090a0b
+
+       .long 0x08090a0b
+       .long 0x08090a0b
+       .long 0x0c0d0e0f
+       .long 0x0c0d0e0f
+
+       .long 0x0c0d0e0f
+       .long 0x0c0d0e0f
+       .long 0x10111213
+       .long 0x10111213
+
+        .global spu_fir_ccc_lowshiftmasks
+        .p2align  4
+        .type   spu_fir_ccc_lowshiftmasks, @object
+        .size   spu_fir_ccc_lowshiftmasks, 64
+        
+spu_fir_ccc_lowshiftmasks:
+       .long 0x08090a0b
+       .long 0x08090a0b
+       .long 0x0c0d0e0f
+       .long 0x0c0d0e0f
+
+       .long 0x0c0d0e0f
+       .long 0x0c0d0e0f
+       .long 0x10111213
+       .long 0x10111213
+
+       .long 0x10111213
+       .long 0x10111213
+       .long 0x14151617
+       .long 0x14151617
+
+       .long 0x14151617
+       .long 0x14151617
+       .long 0x18191a1b
+       .long 0x18191a1b
+
+        .global spu_fir_ccc_hightapmask
+        .align  4
+        .type   spu_fir_ccc_hightapmask, @object
+        .size   spu_fir_ccc_hightapmask, 16
+        
+spu_fir_ccc_hightapmask:
+       .long 0x00010203
+       .long 0x04050607
+       .long 0x04050607
+       .long 0x00010203
+
+        .global spu_fir_ccc_lowtapmask
+        .align  4
+        .type   spu_fir_ccc_lowtapmask, @object
+        .size   spu_fir_ccc_lowtapmask, 16
+        
+spu_fir_ccc_lowtapmask:
+       .long 0x08090a0b
+       .long 0x0c0d0e0f
+       .long 0x0c0d0e0f
+       .long 0x08090a0b
+
+        .global spu_fir_ccc_xormask
+        .align  4
+        .type   spu_fir_ccc_xormask, @object
+        .size   spu_fir_ccc_xormask, 16
+        
+spu_fir_ccc_xormask:
+       .long 0x80000000
+       .long 0x00000000
+       .long 0x00000000
+       .long 0x00000000
+       
+        .global spu_fir_ccc_leftexpand
+        .align  4
+        .type   spu_fir_ccc_leftexpand, @object
+        .size   spu_fir_ccc_leftexpand, 16
+        
+spu_fir_ccc_leftexpand:
+       .long 0x08090a0b
+       .long 0x0c0d0e0f
+       .long 0x80808080
+       .long 0x80808080                
+       
+       .ident  "Hand coded Cell SPU assembly"

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_ccc_as.h
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_ccc_as.h
                           (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_ccc_as.h
   2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SPU_FIR_CCC_AS_H_
+#define SPU_FIR_CCC_AS_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*!
+ * \brief compute an array of N interleaved complex output values from 
+ * interleaved complex inputs and taps.
+ *
+ * \param input must have (nsamples - 1 + ntaps()) valid entries.  input does 
+ * NOT need to be aligned. input[0] .. input[nsamples - 1 + ntaps() - 1] are 
+ * referenced to compute the output values.
+ * 
+ * \param taps a pointer to the pre-reversed and aligned set of taps.  Taps 
+ * must be a multiple of 4 and padded accordingly.
+ * 
+ * \param output a pointer to the filter output buffer
+ * 
+ * \param delayline NOTE: currently not used
+ * 
+ * \param offset the initial offset into input buffer to start the filter. If
+ * input is aligned, this should be zero.  If input is not aligned, this is
+ * the difference in allignment.
+ * 
+ * \param nsamples number of samples to produce for output
+ * 
+ * \param ntaps length of the tap vector.  Must be a multiple of 4. 
+ */
+
+extern void spu_fir_ccc(const vector float* input,
+    const vector float* taps, vector float* output,
+    const vector float* delayline, const unsigned int offset,
+    const unsigned int nsamples, const unsigned int ntaps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //SPU_FIR_CCC_AS_H_

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_fff_as.S
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_fff_as.S
                           (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_fff_as.S
   2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,197 @@
+#
+# Copyright 2008 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
+
+# taps are guarenteed to be 16 byte aligned.
+# ntaps != 0
+
+#  void spu_fir_fff (  
+#      const __vector float *input,
+#      const __vector float *taps, 
+#      __vector float *output,
+#      const __vector float *delayline,
+#      const unsigned int offset,
+#      const unsigned int nsamples,
+#      const unsigned int ntaps
+#  )
+#  {
+#    unsigned int o_index = 0;
+#
+#    do {  
+#      float sum0 = 0;
+#      float sum1 = 0;
+#      float sum2 = 0;
+#      float sum3 = 0;
+#
+#         unsigned int n_4_float_blocks = ntaps / 4;
+#
+#         unsigned int cur_tap = 0;
+#      unsigned int cur_input = input + offset + o_index;
+#
+#      do {
+#  
+#        sum0 += cur_input[0] * cur_tap[0];
+#        sum1 += cur_input[1] * cur_tap[1];
+#        sum2 += cur_input[2] * cur_tap[2];
+#        sum3 += cur_input[3] * cur_tap[3];
+#  
+#        cur_input += 4;
+#        cur_tap += 4;
+#  
+#      } while ((n_4_float_blocks -= 4) != 0);
+#
+#              output[o_index] = sum0 + sum1 + sum2 + sum3;
+#
+#    } while (o_index++ != nsamples);
+#  
+#  }
+#      
+
+       .file   "spu_fir_fff.S"
+.text
+       .align  3
+       .global spu_fir_fff
+       .type   spu_fir_fff, @function
+spu_fir_fff:
+                               ori     $32,$5,0        # 0-2
+                               ori     $33,$7,0        # 0-2
+                               ori     $31,$8,0        # 0-2
+                       .spu_fir_fff_start4: 
+                               xor $30,$30,$30         # 0-2 initilize the 
current output vector                               
+                               il  $34, 16             # 0-2 shift mask for 
output insertion
+                       
+                       .spu_fir_fff_start1: 
+                               andi    $37,$33,0x0c     # 0-2 find index into 
masks [0-4]
+                               xor     $5,$5,$5         # 0-2 
+                               xor     $6,$6,$6         # 0-2
+                                       shlqbii $38,$37,2        # 1-4 mult by 4
+                               xor     $7,$7,$7         # 0-2
+                               ori     $36,$9,0         # 0-2
+                       
+                               xor     $8,$8,$8         # 0-2
+                                       lqd     $39,spu_fir_fff_shiftmasks($38) 
 # 1-6 load the right shift mask
+                               a       $35, $33, $3     # 0-2
+                               ori     $38,$4,0         # 0-2
+               
+                               hbra    .spu_fir_fff_inner_loop_branch, 
.spu_fir_fff_inner_loop         # inner-loop hint       
+
+                                       lqd     $10,0($35)       # 1-6
+                                       lqd     $11,16($35)      # 1-6
+                                       lqd     $12,32($35)      # 1-6
+                       .spu_fir_fff_inner_loop:                
+
+                                       lqd     $13,48($35)      # 1-6          
                
+                                       lqd     $18,64($35)      # 1-6
+                                       lqd     $14,0($38)       # 1-6
+                               nop
+                                       lqd     $15,16($38)      # 1-6
+
+                               ai      $36,$36,-16      # 0-2
+                                       shufb   $10,$10,$11,$39         # 1-4 
+                                       lqd     $16,32($38)      # 1-6
+                               nop
+                               ai      $35,$35,64       # 0-2
+                                       shufb   $11,$11,$12,$39         # 1-4
+                                       lqd     $17,48($38)      # 1-6
+                                       shufb   $12,$12,$13,$39         # 1-4
+                               ai      $38,$38,64       # 0-2
+
+                                       shufb   $13,$13,$18,$39         # 1-4
+                               fma     $5, $10, $14, $5        # 0-6 
+                               nop                             
+                               fma     $6, $11, $15, $6        # 0-6
+                                       lqd     $10,0($35)       # 1-6
+                               fma     $7, $12, $16, $7        # 0-6           
        
+                                       lqd     $11,16($35)      # 1-6
+                               fma     $8, $13, $17, $8        # 0-6
+                                       lqd     $12,32($35)      # 1-6
+                               
+                               
+                               
+                       .spu_fir_fff_inner_loop_branch: 
+                               brnz    $36,.spu_fir_fff_inner_loop     
+                                       fsmbi   $10,0xF000       # 1-4
+                               fa      $18,$5,$6                # 0-6
+                                       hbra    
.spu_fir_fff_outter_loop_branch, .spu_fir_fff_start1     # 1-
+                               fa      $19,$7,$8                # 0-6
+                                       hbra    .spu_fir_fff_finish_branch, 
.spu_fir_fff_finish_branch_targ      # 1-
+                               fa      $5,$18,$19               # 0-6
+
+# accumulate word elements in r5 into first element in r5      
+                               ori     $6,$5,0          # 0-2          
+                                       shlqbyi $6,$6,4          # 1-4
+                               ai      $31,$31,-1       # 0-2
+                               fa      $5,$6,$5         # 0-2
+                                       shlqbyi $6,$6,4          # 1-4
+                               fa      $5,$6,$5         # 0-2
+                                       shlqbyi $6,$6,4          # 1-4
+                               fa      $5,$6,$5         # 0-2
+                               and     $11,$10,$5       # 0-2
+                                       rotqby  $12, $11, $34    # 1-4
+                               or      $30,$12,$30      # 0-2
+                       
+                               ai      $34,$34,-4       # 0-2
+                       .spu_fir_fff_finish_branch:     
+                               brz     $31,.spu_fir_fff_finish4         
+                       .spu_fir_fff_finish_branch_targ:        
+
+                               ai      $33,$33,4        # 0-2
+
+                       .spu_fir_fff_outter_loop_branch:                
+                               brnz    $34, .spu_fir_fff_start1        
+                               hbra    .spu_fir_fff_outter_outter_loop_branch, 
.spu_fir_fff_start4     
+# Stores r5 in output
+                       .spu_fir_fff_finish4:   
+                               stqd    $30,0($32)              
+                               ai      $32,$32,16                              
# increment output pointer by 1 new vector.
+
+                       .spu_fir_fff_outter_outter_loop_branch: 
+                               brnz    $31,.spu_fir_fff_start4                 
# start another output vector if needed
+
+       bi      $lr
+       .size   spu_fir_fff, .-spu_fir_fff
+.text
+        .global spu_fir_fff_shiftmasks
+        .align  4
+        .type   spu_fir_fff_shiftmasks, @object
+        .size   spu_fir_fff_shiftmasks, 64
+spu_fir_fff_shiftmasks:
+       .long 0x00010203
+       .long 0x04050607
+       .long 0x08090a0b
+       .long 0x0c0d0e0f
+
+       .long 0x04050607
+       .long 0x08090a0b
+       .long 0x0c0d0e0f
+       .long 0x10111213
+
+       .long 0x08090a0b
+       .long 0x0c0d0e0f
+       .long 0x10111213
+       .long 0x14151617
+
+       .long 0x0c0d0e0f
+       .long 0x10111213
+       .long 0x14151617
+       .long 0x18191a1b
+
+       .ident  "Hand coded Cell SPU assembly"

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_fff_as.h
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_fff_as.h
                           (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/general/spu/spu_fir_fff_as.h
   2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SPU_FIR_FFF_AS_H_
+#define SPU_FIR_FFF_AS_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*!
+ * \brief compute an array of N output values.
+ *
+ * \param input must have (nsamples - 1 + ntaps()) valid entries.  input does 
+ * NOT need to be aligned. input[0] .. input[nsamples - 1 + ntaps() - 1] are 
+ * referenced to compute the output values.
+ * 
+ * \param taps a pointer to the pre-reversed and aligned set of taps.  Taps 
+ * must be a multiple of 16 and padded accordingly.
+ * 
+ * \param output a pointer to the filter output buffer
+ * 
+ * \param delayline NOTE: currently not used
+ * 
+ * \param offset the initial offset into input buffer to start the filter. If
+ * input is aligned, this should be zero.  If input is not aligned, this is
+ * the difference in allignment.
+ * 
+ * \param nsamples number of samples to produce for output
+ * 
+ * \param ntaps length of the tap vector.  Must be a multiple of 16. 
+ */
+
+//extern void spu_fir_fff(const vector float* input,
+//    const vector float* taps, vector float* output,
+//    const vector float* delayline, const unsigned int offset,
+//    const unsigned int nsamples, const unsigned int ntaps);
+
+extern void spu_fir_fff(const qword input,
+    const qword taps, qword output,
+    const qword delayline, const unsigned int offset,
+    const unsigned int nsamples, const unsigned int ntaps, int awefawef);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //SPU_FIR_FFF_AS_H_

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/gcp_fir_ccc.cc
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/gcp_fir_ccc.cc
                         (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/gcp_fir_ccc.cc
 2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gcp_fir_ccc.h>
+#include <stdint.h>
+#include <stdexcept>
+#include <math.h>
+
+static void
+gcp_fir_ccc_init_jd(gc_job_desc *jd,
+       gc_proc_id_t proc_id,
+       unsigned n_samples,
+       unsigned n_taps,
+       std::complex<float> *out_vec,
+       const std::complex<float> *in_vec,
+       const std::complex<float> *taps_vec)
+{
+  jd->proc_id = proc_id;
+  jd->input.nargs = 2;
+  jd->output.nargs = 0;
+  jd->eaa.nargs = 3;
+
+  jd->input.arg[0].u32 = n_samples;
+  jd->input.arg[1].u32 = n_taps;
+
+  jd->eaa.arg[0].ea_addr = ptr_to_ea(out_vec);
+  jd->eaa.arg[0].direction = GCJD_DMA_PUT;
+  jd->eaa.arg[0].put_size = sizeof(std::complex<float>) * n_samples;
+
+  jd->eaa.arg[1].ea_addr = ptr_to_ea(const_cast<std::complex<float>*>(in_vec));
+  jd->eaa.arg[1].direction = GCJD_DMA_GET;
+  jd->eaa.arg[1].get_size = sizeof(std::complex<float>) * (n_samples + n_taps 
- 1);
+
+  jd->eaa.arg[2].ea_addr = 
ptr_to_ea(const_cast<std::complex<float>*>(taps_vec));
+  jd->eaa.arg[2].direction = GCJD_DMA_GET;
+  jd->eaa.arg[2].get_size = sizeof(std::complex<float>) * n_taps;
+}
+  
+gc_job_desc_sptr
+gcp_fir_ccc_submit(gc_job_manager_sptr mgr,
+                    unsigned int n_samples,
+                    unsigned int n_taps,
+                    std::complex<float> *out,
+                    const std::complex<float> *in,
+                    const std::complex<float> *taps)
+{
+  //TODO: if (n_samples > 4096)
+  //TODO:  throw std::invalid_argument("fft_length > 4096");
+
+  //if ((intptr_t)out & 0xf)
+  //  throw gc_bad_align("out");
+  if ((intptr_t)taps & 0xf)
+    throw gc_bad_align("taps");
+  
+  const char* proc_name("fir_ccc");
+
+  gc_proc_id_t fir_ccc_id = mgr->lookup_proc(proc_name);
+  gc_job_desc_sptr jd = gc_job_manager::alloc_job_desc(mgr);
+  gcp_fir_ccc_init_jd(jd.get(), fir_ccc_id, n_samples, n_taps, out, in, taps);
+
+  if (!mgr->submit_job(jd.get())){
+    gc_job_status_t s = jd->status;
+    throw gc_bad_submit(proc_name, s);
+  }
+  return jd;
+}

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/gcp_fir_ccc.h
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/gcp_fir_ccc.h
                          (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/gcp_fir_ccc.h
  2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GCP_FIR_FFF_H
+#define INCLUDED_GCP_FIR_FFF_H
+
+#include <gc_job_manager.h>
+#include <complex>
+
+/*!
+ * \brief Submit a job that computes the FFF FIR convolutional filter.
+ *
+ * \param mgr is the job manager instance
+ * \param n_samples is number of sample outputs requested from the conv. FIR 
filter.
+ * \param n_taps is the size of the (pre-reveresed) TAP vector.
+ * \param out is the n_samples output from FIR (must be 16-byte aligned).
+ * \param in is the (n_samples + n_taps - 1) input to FIR (must be 16-byte 
aligned).
+ * \param taps is n_taps input to FIR (must be 16-byte aligned).
+ * Returns a shared_ptr to a job descriptor which should be passed to 
wait_job*.
+ * Throws an exception in the event of a problem.
+ */
+gc_job_desc_sptr
+gcp_fir_ccc_submit(gc_job_manager_sptr mgr,
+         unsigned int n_samples,
+         unsigned int n_taps,
+         std::complex<float> *out,
+         const std::complex<float> *in,
+         const std::complex<float> *taps);
+
+#endif /* INCLUDED_GCP_FIR_FFF_H */

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/qa_gcp_fir_ccc.cc
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/qa_gcp_fir_ccc.cc
                              (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/qa_gcp_fir_ccc.cc
      2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,204 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "qa_gcp_fir_ccc.h"
+#include <cppunit/TestAssert.h>
+#include <gcp_fir_ccc.h>
+#include <stdio.h>
+
+typedef boost::shared_ptr<void> void_sptr;
+typedef std::complex<float> complex;
+
+// handle to embedded SPU executable
+extern spe_program_handle_t gcell_all;
+
+
+static const unsigned int in_vec_len(32);
+static const unsigned int taps_vec_len(16);
+static const unsigned int matlab_result_len(15);
+
+static complex in_vec[in_vec_len]__attribute__((aligned(128)))=
+ {complex(1,  2),      complex(3,  4), complex(-5,  6), complex(-7,  -8), 
complex(9,  -10), 
+  complex(-11.11,  -12.22), complex(13.33,  14.44), complex(15.55,  16.66),
+  complex(2.32,54.23), 
complex(1.534,-23.24),complex(12.4354,24.65),complex(43.432,25.453),
+  
complex(234.645,-123.23),complex(-23.23,12.65),complex(1.54,2.32),complex(-54.23,5.43),
+  complex(1,  2),  complex(3,  4), complex(-5,  6), complex(-7,  -8), 
complex(9,  -10), 
+  complex(-11.11,  -12.22), complex(13.33,  14.44), complex(15.55,  16.66),
+  complex(2.32,54.23), 
complex(1.534,-23.24),complex(12.4354,24.65),complex(43.432,25.453),
+  
complex(234.645,-123.23),complex(-23.23,12.65),complex(1.54,2.32),complex(-54.23,5.43)};
+
+static complex taps_vec[taps_vec_len]__attribute__((aligned(128))) = 
+ {complex(-12.32,13.2), complex(2.32, 12.3), complex(2.43,5.4),
+  complex(2.32, -23.6563), complex(-4.5434, -34.323), complex(0, 0), 
+  complex(0, 0), complex(0, 0), complex(0, 0),complex(0, 0), complex(0, 0),
+  complex(0, 0), complex(0, 0), complex(0, 0),complex(0, 0), complex(0, 0)};
+
+static complex matlab_result[matlab_result_len] =
+  {   complex(-715.122,-94.118), complex(-733.604,86.241), 
complex(260.634,-508.940),
+      complex(1248.406,-887.283), complex(2381.054,-471.156), 
complex(582.948,449.680),
+      complex(-567.533,-256.742), complex(344.364,-1737.180), 
complex(-5150.720,-9007.718),
+      complex(-1849.455,-4283.808), complex(862.728,1936.846), 
complex(1555.503, 4570.876),
+      complex(-1415.722,5625.155), complex(106.444,-857.966), 
complex(79.671,-569.760)};
+
+/*
+ * Return pointer to cache-aligned chunk of storage of size size bytes.
+ * Throw if can't allocate memory.  The storage should be freed
+ * with "free" when done.  The memory is initialized to zero.
+ */
+static void *
+aligned_alloc(size_t size, size_t alignment = 128)
+{
+  void *p = 0;
+  if (posix_memalign(&p, alignment, size) != 0){
+    perror("posix_memalign");
+    throw std::runtime_error("memory");
+  }
+  memset(p, 0, size);          // zero the memory
+  return p;
+}
+
+class free_deleter {
+public:
+  void operator()(void *p) {
+    free(p);
+  }
+};
+
+static boost::shared_ptr<void>
+aligned_alloc_sptr(size_t size, size_t alignment = 128)
+{
+  return boost::shared_ptr<void>(aligned_alloc(size, alignment), 
free_deleter());
+}
+
+// test ccc fir against matlab vectors 
+void
+qa_gcp_fir_ccc::test_matlab_vectors()
+{
+  gc_jm_options opts;
+  opts.program_handle = gc_program_handle_from_address(&gcell_all);
+  opts.nspes = 1;
+  gc_job_manager_sptr mgr = gc_make_job_manager(&opts);
+
+  test(mgr, in_vec, taps_vec, matlab_result, matlab_result_len);
+}
+
+// test ccc fir against generic fir filter 
+//void
+//qa_gcp_fir_ccc::test_fir_generic()
+//{
+//  gc_jm_options opts;
+//  opts.program_handle = gc_program_handle_from_address(&gcell_all);
+//  opts.nspes = 1;
+//  gc_job_manager_sptr mgr = gc_make_job_manager(&opts);
+//
+//  void_sptr cell_in_void = aligned_alloc_sptr(in_vec_len * 
sizeof(std::complex<float>), 128);
+//  void_sptr cell_taps_void = aligned_alloc_sptr(taps_vec_len * 
sizeof(std::complex<float>), 128);
+//  std::vector< std::complex<float> > ref_in(in_vec_len);
+//  std::vector< std::complex<float> > ref_taps(taps_vec_len);
+//  std::vector< std::complex<float> > ref_out(matlab_result_len);
+//  
+//  std::complex<float> *cell_in((std::complex<float> *) cell_in_void.get());
+//  std::complex<float> *cell_taps((std::complex<float> *) 
cell_taps_void.get());
+//  
+//  srandom(1);   // we want reproducibility
+//
+// // initialize the input buffers
+//  for (unsigned int i = 0; i < in_vec_len; i++){
+//    std::complex<float> t((float) (random() & 0xfffff), (float) (random() & 
0xfffff));
+//    ref_in[i] = t;
+//    cell_in[i] = t;
+//  }
+//  
+//  // initialize the tap buffers
+//   for (unsigned int i = 0; i < taps_vec_len; i++){
+//     std::complex<float> t((float) (random() & 0xfffff), (float) (random() & 
0xfffff));
+//     ref_taps[i] = t;
+//     cell_taps[i] = t;
+//   }
+//   
+//   gr_fir_ccc_generic ref_fir_ccc(gr_reverse(ref_taps));
+//   
+//   ref_fir_ccc.filterN(&ref_out.front(), &ref_in.front(), matlab_result_len);
+//  
+//  test(mgr, cell_in, cell_taps, &ref_out.front(), matlab_result_len);
+//}
+
+static inline float
+abs_diff(std::complex<float> x, std::complex<float> y)
+{
+  return std::max(std::abs(x.real()-y.real()),
+                 std::abs(x.imag()-y.imag()));
+}
+
+static float
+float_abs_rel_error(float ref, float actual)
+{
+  float delta = ref - actual;
+  if (std::abs(ref) < 1e-18)
+    ref = 1e-18;
+  return std::abs(delta/ref);
+}
+
+static float
+abs_rel_error(std::complex<float> ref, std::complex<float> actual)
+{
+  return std::max(float_abs_rel_error(ref.real(), actual.real()),
+                 float_abs_rel_error(ref.imag(), actual.imag()));
+}
+
+void 
+qa_gcp_fir_ccc::test(gc_job_manager_sptr mgr, 
+    std::complex<float>* cell_in, 
+    std::complex<float>* cell_taps,
+    std::complex<float>* ref_out, 
+    unsigned int n_samples)
+{
+  // allocate aligned buffers with boost shared_ptr's
+  void_sptr cell_out_void(aligned_alloc_sptr(n_samples * 
sizeof(std::complex<float>), 128));
+  std::complex<float> *cell_out((std::complex<float> *) cell_out_void.get());
+
+  // ------------------------------------------------------------------------
+  // compute the answer on the cell
+  gc_job_desc_sptr jd = gcp_fir_ccc_submit(mgr, n_samples, taps_vec_len,
+                                            cell_out, cell_in, cell_taps);
+  if (!mgr->wait_job(jd.get())){
+    fprintf(stderr, "wait_job failed: %s\n", 
gc_job_status_string(jd->status).c_str());
+    CPPUNIT_ASSERT(0);
+  }
+
+  // ------------------------------------------------------------------------
+  // compute the maximum of the relative error
+  float max_rel = 0.0;
+  for (unsigned int i = 0; i < n_samples; i++){
+    max_rel = std::max(max_rel, abs_rel_error(ref_out[i], cell_out[i]));
+    if (0)
+      fprintf(stdout,"(%16.3f, %16.3fj)  (%16.3f, %16.3fj)  (%16.3f, 
%16.3fj)\n",
+            ref_out[i].real(), ref_out[i].imag(),
+            cell_out[i].real(), cell_out[i].imag(),
+            ref_out[i].real() - cell_out[i].real(),
+            ref_out[i].imag() - cell_out[i].imag());
+  }
+
+  fprintf(stdout, "fir_ccc n_samples = %4d  max_rel_error = %e\n",
+         n_samples, max_rel);
+
+  CPPUNIT_ASSERT(max_rel <= 5e-3);
+}

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/qa_gcp_fir_ccc.h
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/qa_gcp_fir_ccc.h
                               (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/qa_gcp_fir_ccc.h
       2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_QA_GCP_FIR_CCC_H
+#define INCLUDED_QA_GCP_FIR_CCC_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <gc_job_manager.h>
+#include <complex>
+
+class qa_gcp_fir_ccc : public CppUnit::TestCase {
+
+  CPPUNIT_TEST_SUITE(qa_gcp_fir_ccc);
+  CPPUNIT_TEST(test_matlab_vectors);
+  CPPUNIT_TEST_SUITE_END();
+
+ private:
+  void test_matlab_vectors();
+  
+  void test(gc_job_manager_sptr mgr,
+      std::complex<float>* input, 
+      std::complex<float>* taps, 
+      std::complex<float>* ref_out, 
+      unsigned int n_samples);
+};
+
+
+
+#endif /* INCLUDED_QA_GCP_FIR_CCC_H */

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_ccc.c
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_ccc.c
                              (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_ccc.c
      2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gc_declare_proc.h>
+#include "spu_fir_ccc_as.h"
+//#include <stdio.h>
+//#include <spu_mfcio.h>
+
+static void
+gcs_fir_ccc(const gc_job_direct_args_t *input,
+      gc_job_direct_args_t *output __attribute__((unused)),
+      const gc_job_ea_args_t *eaa)
+{
+  vector float* out = (vector float *) eaa->arg[0].ls_addr; // complex
+  const vector float* in = (const vector float *) eaa->arg[1].ls_addr;  // 
complex
+  const vector float* taps = (const vector float *) eaa->arg[2].ls_addr; // 
complex
+  
+  unsigned int n_samples = input->arg[0].u32;
+  unsigned int n_taps = input->arg[1].u32;
+  
+  //spu_write_decrementer(~0);
+  //int start = spu_read_decrementer();
+  
+  spu_fir_ccc( in,
+      taps,
+      out, 
+      0, 
+      ((intptr_t) in & 0xf),
+      n_samples,
+      n_taps);
+  
+  // printf("time: %d taps: %d samples: %d\n", start - spu_read_decrementer(), 
n_taps, n_samples);
+}
+
+GC_DECLARE_PROC(gcs_fir_ccc, "fir_ccc");


Property changes on: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_ccc.c
___________________________________________________________________
Name: svn:executable
   + *

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_fff.c
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_fff.c
                              (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_fff.c
      2008-05-11 06:22:59 UTC (rev 8377)
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gc_declare_proc.h>
+#include <spu_intrinsics.h>
+#include <stdint.h>
+#include "spu_fir_fff_as.h"
+#include <stdio.h>
+#include <spu_mfcio.h>
+
+#define _UNUSED __attribute__((unused))
+
+static void
+fir_fff_spu(const gc_job_direct_args_t *input _UNUSED,
+  gc_job_direct_args_t *output _UNUSED,
+  const gc_job_ea_args_t *eaa)
+{
+
+  uintptr_t source_addr_u = (uintptr_t) eaa->arg[0].ls_addr;
+  const qword source_addr = si_from_uint(source_addr_u);
+
+  uintptr_t taps_addr_u = (uintptr_t) eaa->arg[1].ls_addr;
+  const qword taps_addr = si_from_uint(taps_addr_u);
+
+  uint32_t * n_taps_ptr = (uint32_t*)eaa->arg[2].ls_addr;
+  uint32_t n_taps = *n_taps_ptr;
+
+  uint32_t * n_samples_ptr = (uint32_t*)eaa->arg[3].ls_addr;
+  uint32_t n_samples = *n_samples_ptr;
+
+  uintptr_t target_addr_u = (uintptr_t) eaa->arg[4].ls_addr;
+  qword target_addr = si_from_uint(target_addr_u);
+  
+  printf("nsamples: %d ntaps: %d\n", n_samples, n_taps);
+  
+  spu_write_decrementer(~0);
+  int start = spu_read_decrementer();
+  
+  spu_fir_fff( source_addr,
+      taps_addr,
+      target_addr, 
+      (qword) {0,0,0,0} ,
+      0, 
+      n_samples,
+      n_taps);
+  
+  printf("time: %d\n", start - spu_read_decrementer());
+  
+  return;
+}
+
+GC_DECLARE_PROC(fir_fff_spu, "fir_fff_spu");


Property changes on: 
gnuradio/branches/developers/ngoergen/gnuradio-gcell/src/lib/wrapper/spu/gcs_fir_fff.c
___________________________________________________________________
Name: svn:executable
   + *





reply via email to

[Prev in Thread] Current Thread [Next in Thread]