diff options
author | Tom Rondeau | 2012-02-04 11:05:25 -0500 |
---|---|---|
committer | Tom Rondeau | 2012-02-13 14:56:39 -0500 |
commit | 47c390286d49e00498a3443a3dcb9f83d11c7ecc (patch) | |
tree | f5379c23b2ae1735bac9ea361ef202e01aba59da /gnuradio-core/src/lib | |
parent | f028a198cb47e0486ad41a29bd3b3dcf0663d766 (diff) | |
download | gnuradio-47c390286d49e00498a3443a3dcb9f83d11c7ecc.tar.gz gnuradio-47c390286d49e00498a3443a3dcb9f83d11c7ecc.tar.bz2 gnuradio-47c390286d49e00498a3443a3dcb9f83d11c7ecc.zip |
core: new multiply_const_ff and multiply_ff blocks done using Volk.
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r-- | gnuradio-core/src/lib/general/.gitignore | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/Makefile.am | 3 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/general.i | 2 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/general_generated.i | 3 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_multiply_ff.cc | 69 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_multiply_ff.h | 56 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_multiply_ff.i | 32 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/.gitignore | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | gnuradio-core/src/lib/gengen/generate_common.py | 2 |
11 files changed, 165 insertions, 17 deletions
diff --git a/gnuradio-core/src/lib/general/.gitignore b/gnuradio-core/src/lib/general/.gitignore index 349651e0c..b04ffe4ae 100644 --- a/gnuradio-core/src/lib/general/.gitignore +++ b/gnuradio-core/src/lib/general/.gitignore @@ -158,18 +158,12 @@ /gr_divide_ss.cc /gr_divide_ss.h /gr_divide_ss.i -/gr_multiply_const_ff.cc -/gr_multiply_const_ff.h -/gr_multiply_const_ff.i /gr_multiply_const_ii.cc /gr_multiply_const_ii.h /gr_multiply_const_ii.i /gr_multiply_const_ss.cc /gr_multiply_const_ss.h /gr_multiply_const_ss.i -/gr_multiply_ff.cc -/gr_multiply_ff.h -/gr_multiply_ff.i /gr_multiply_ii.cc /gr_multiply_ii.h /gr_multiply_ii.i diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 393f732b7..301465361 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -231,6 +231,7 @@ set(gr_core_general_triple_threats gr_lfsr_32k_source_s gr_map_bb gr_multiply_cc + gr_multiply_ff gr_multiply_const_cc gr_multiply_const_ff gr_nlog10_ff diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 5a6f5bf46..b452a5107 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -95,6 +95,7 @@ libgeneral_la_SOURCES = \ gr_map_bb.cc \ gr_misc.cc \ gr_multiply_cc.cc \ + gr_multiply_ff.cc \ gr_multiply_const_cc.cc \ gr_multiply_const_ff.cc \ gr_nlog10_ff.cc \ @@ -253,6 +254,7 @@ grinclude_HEADERS = \ gr_math.h \ gr_misc.h \ gr_multiply_cc.h \ + gr_multiply_ff.h \ gr_multiply_const_cc.h \ gr_multiply_const_ff.h \ gr_nco.h \ @@ -415,6 +417,7 @@ swiginclude_HEADERS = \ gr_lfsr_32k_source_s.i \ gr_map_bb.i \ gr_multiply_cc.i \ + gr_multiply_ff.i \ gr_multiply_const_cc.i \ gr_multiply_const_ff.i \ gr_nlog10_ff.i \ diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index ac3fef84c..8e1be02f9 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -107,6 +107,7 @@ #include <gr_framer_sink_1.h> #include <gr_map_bb.h> #include <gr_multiply_cc.h> +#include <gr_multiply_ff.h> #include <gr_multiply_const_cc.h> #include <gr_multiply_const_ff.h> #include <gr_feval.h> @@ -226,6 +227,7 @@ %include "gr_framer_sink_1.i" %include "gr_map_bb.i" %include "gr_multiply_cc.i" +%include "gr_multiply_ff.i" %include "gr_multiply_const_cc.i" %include "gr_multiply_const_ff.i" %include "gr_feval.i" diff --git a/gnuradio-core/src/lib/general/general_generated.i b/gnuradio-core/src/lib/general/general_generated.i index 52e09f89b..82f9a6006 100644 --- a/gnuradio-core/src/lib/general/general_generated.i +++ b/gnuradio-core/src/lib/general/general_generated.i @@ -35,7 +35,6 @@ #include <gr_multiply_const_vff.h> #include <gr_multiply_const_vii.h> #include <gr_multiply_const_vss.h> -#include <gr_multiply_ff.h> #include <gr_multiply_ii.h> #include <gr_multiply_ss.h> #include <gr_multiply_vcc.h> @@ -103,14 +102,12 @@ %include <gr_divide_ff.i> %include <gr_divide_ii.i> %include <gr_divide_ss.i> -%include <gr_multiply_const_ff.i> %include <gr_multiply_const_ii.i> %include <gr_multiply_const_ss.i> %include <gr_multiply_const_vcc.i> %include <gr_multiply_const_vff.i> %include <gr_multiply_const_vii.i> %include <gr_multiply_const_vss.i> -%include <gr_multiply_ff.i> %include <gr_multiply_ii.i> %include <gr_multiply_ss.i> %include <gr_multiply_vcc.i> diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.cc b/gnuradio-core/src/lib/general/gr_multiply_ff.cc new file mode 100644 index 000000000..a7d34ce51 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_multiply_ff.cc @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gr_multiply_ff.h> +#include <gr_io_signature.h> +#include <volk/volk.h> + +gr_multiply_ff_sptr +gr_make_multiply_ff (size_t vlen) +{ + return gnuradio::get_initial_sptr(new gr_multiply_ff (vlen)); +} + +gr_multiply_ff::gr_multiply_ff (size_t vlen) + : gr_sync_block ("gr_multiply_ff", + gr_make_io_signature (1, -1, sizeof (float)*vlen), + gr_make_io_signature (1, 1, sizeof (float)*vlen)), + d_vlen(vlen) +{ + const int alignment_multiple = + volk_get_alignment() / sizeof(float); + set_alignment(alignment_multiple); +} + +int +gr_multiply_ff::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + float *out = (float *) output_items[0]; + int noi = d_vlen*noutput_items; + + memcpy(out, input_items[0], noi*sizeof(float)); + if(is_unaligned()) { + for(size_t i = 1; i < input_items.size(); i++) + volk_32f_x2_multiply_32f_u(out, out, (const float*)input_items[i], noi); + } + else { + for(size_t i = 1; i < input_items.size(); i++) + volk_32f_x2_multiply_32f_a(out, out, (const float*)input_items[i], noi); + } + return noutput_items; +} + + + diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.h b/gnuradio-core/src/lib/general/gr_multiply_ff.h new file mode 100644 index 000000000..ae36cb1e0 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_multiply_ff.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 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 INCLUDED_GR_MULTIPLY_FF_H +#define INCLUDED_GR_MULTIPLY_FF_H + +#include <gr_core_api.h> +#include <gr_sync_block.h> + +class gr_multiply_ff; +typedef boost::shared_ptr<gr_multiply_ff> gr_multiply_ff_sptr; + +GR_CORE_API gr_multiply_ff_sptr +gr_make_multiply_ff (size_t vlen=1); + +/*! + * \brief Multiply streams of complex values + * \ingroup math_blk + */ + +class GR_CORE_API gr_multiply_ff : public gr_sync_block +{ + private: + friend GR_CORE_API gr_multiply_ff_sptr + gr_make_multiply_ff (size_t vlen); + gr_multiply_ff (size_t vlen); + + size_t d_vlen; + + public: + virtual int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + + +#endif /* INCLUDED_GR_MULTIPLY_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.i b/gnuradio-core/src/lib/general/gr_multiply_ff.i new file mode 100644 index 000000000..0f06301f2 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_multiply_ff.i @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,multiply_ff) + +gr_multiply_ff_sptr +gr_make_multiply_ff (size_t vlen=1); + +class gr_multiply_ff : public gr_sync_block +{ +public: + +}; diff --git a/gnuradio-core/src/lib/gengen/.gitignore b/gnuradio-core/src/lib/gengen/.gitignore index 4422ae0dd..72c915cb8 100644 --- a/gnuradio-core/src/lib/gengen/.gitignore +++ b/gnuradio-core/src/lib/gengen/.gitignore @@ -202,9 +202,6 @@ /gr_max_ss.cc /gr_max_ss.h /gr_max_ss.i -/gr_multiply_const_ff.cc -/gr_multiply_const_ff.h -/gr_multiply_const_ff.i /gr_multiply_const_ii.cc /gr_multiply_const_ii.h /gr_multiply_const_ii.i @@ -223,9 +220,6 @@ /gr_multiply_const_vss.cc /gr_multiply_const_vss.h /gr_multiply_const_vss.i -/gr_multiply_ff.cc -/gr_multiply_ff.h -/gr_multiply_ff.i /gr_multiply_ii.cc /gr_multiply_ii.h /gr_multiply_ii.i diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index 83213dc04..c3c4a7a35 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -89,7 +89,7 @@ expand_h_cc_i(gr_add_const_XX ss ii ff cc sf) expand_h_cc_i(gr_multiply_const_XX ss ii) expand_h_cc_i(gr_add_XX ss ii ff cc) expand_h_cc_i(gr_sub_XX ss ii ff cc) -expand_h_cc_i(gr_multiply_XX ss ii ff) +expand_h_cc_i(gr_multiply_XX ss ii) expand_h_cc_i(gr_divide_XX ss ii ff cc) expand_h_cc_i(gr_mute_XX ss ii ff cc) expand_h_cc_i(gr_add_const_vXX ss ii ff cc) diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 5caa7098b..0c3d4579d 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -65,7 +65,7 @@ others = ( ('gr_argmax_XX', ('fs','is','ss')), ('gr_max_XX', ('ff','ii','ss')), ('gr_peak_detector_XX', ('fb','ib','sb')), - ('gr_multiply_XX', ('ss','ii','ff')), + ('gr_multiply_XX', ('ss','ii')), ('gr_multiply_const_XX', ('ss','ii')) ) |