diff options
author | Tom Rondeau | 2012-04-19 16:29:39 -0400 |
---|---|---|
committer | Tom Rondeau | 2012-04-23 19:56:14 -0400 |
commit | 362d45bb829a9b190586cca79717cc175f4d06d2 (patch) | |
tree | 15001c96271defad12908e24958aabd158d5159a /gr-digital/lib/digital_impl_glfsr.cc | |
parent | 6d1419febab128d82bad00abaf0935624f8aa6cb (diff) | |
download | gnuradio-362d45bb829a9b190586cca79717cc175f4d06d2.tar.gz gnuradio-362d45bb829a9b190586cca79717cc175f4d06d2.tar.bz2 gnuradio-362d45bb829a9b190586cca79717cc175f4d06d2.zip |
digital: copying over rest of blocks from gnuradio-core to gr-digital.
Includes moving GRC and QA code; new ones where missing.
Have not removed blocks from gnuradio-core for compatibility.
Diffstat (limited to 'gr-digital/lib/digital_impl_glfsr.cc')
-rw-r--r-- | gr-digital/lib/digital_impl_glfsr.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gr-digital/lib/digital_impl_glfsr.cc b/gr-digital/lib/digital_impl_glfsr.cc new file mode 100644 index 000000000..342980e53 --- /dev/null +++ b/gr-digital/lib/digital_impl_glfsr.cc @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,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. + */ + +#include <digital_impl_glfsr.h> +#include <stdexcept> + +static int s_polynomial_masks[] = { + 0x00000000, + 0x00000001, // x^1 + 1 + 0x00000003, // x^2 + x^1 + 1 + 0x00000005, // x^3 + x^1 + 1 + 0x00000009, // x^4 + x^1 + 1 + 0x00000012, // x^5 + x^2 + 1 + 0x00000021, // x^6 + x^1 + 1 + 0x00000041, // x^7 + x^1 + 1 + 0x0000008E, // x^8 + x^4 + x^3 + x^2 + 1 + 0x00000108, // x^9 + x^4 + 1 + 0x00000204, // x^10 + x^4 + 1 + 0x00000402, // x^11 + x^2 + 1 + 0x00000829, // x^12 + x^6 + x^4 + x^1 + 1 + 0x0000100D, // x^13 + x^4 + x^3 + x^1 + 1 + 0x00002015, // x^14 + x^5 + x^3 + x^1 + 1 + 0x00004001, // x^15 + x^1 + 1 + 0x00008016, // x^16 + x^5 + x^3 + x^2 + 1 + 0x00010004, // x^17 + x^3 + 1 + 0x00020013, // x^18 + x^5 + x^2 + x^1 + 1 + 0x00040013, // x^19 + x^5 + x^2 + x^1 + 1 + 0x00080004, // x^20 + x^3 + 1 + 0x00100002, // x^21 + x^2 + 1 + 0x00200001, // x^22 + x^1 + 1 + 0x00400010, // x^23 + x^5 + 1 + 0x0080000D, // x^24 + x^4 + x^3 + x^1 + 1 + 0x01000004, // x^25 + x^3 + 1 + 0x02000023, // x^26 + x^6 + x^2 + x^1 + 1 + 0x04000013, // x^27 + x^5 + x^2 + x^1 + 1 + 0x08000004, // x^28 + x^3 + 1 + 0x10000002, // x^29 + x^2 + 1 + 0x20000029, // x^30 + x^4 + x^1 + 1 + 0x40000004, // x^31 + x^3 + 1 + 0x80000057 // x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + 1 +}; + +int digital_impl_glfsr::glfsr_mask(int degree) +{ + if (degree < 1 || degree > 32) + throw std::runtime_error("digital_impl_glfsr::glfsr_mask(): degree must be between 1 and 32 inclusive"); + return s_polynomial_masks[degree]; +} |