summaryrefslogtreecommitdiff
path: root/gr-blocks
diff options
context:
space:
mode:
authorJohnathan Corgan2012-07-03 09:49:20 -0700
committerJohnathan Corgan2012-07-03 09:49:20 -0700
commit84f9822b4a8fe4290e971c09b2bd99f1bf59517b (patch)
tree9da3968db1543db85049d5d1c8cbb56dcdca009d /gr-blocks
parent025f323d9857715a31a1117693c5debd19393a46 (diff)
downloadgnuradio-84f9822b4a8fe4290e971c09b2bd99f1bf59517b.tar.gz
gnuradio-84f9822b4a8fe4290e971c09b2bd99f1bf59517b.tar.bz2
gnuradio-84f9822b4a8fe4290e971c09b2bd99f1bf59517b.zip
blocks: added gr::blocks::not_XX (bb ss ii)
Diffstat (limited to 'gr-blocks')
-rw-r--r--gr-blocks/grc/blocks_block_tree.xml1
-rw-r--r--gr-blocks/grc/blocks_not_xx.xml40
-rw-r--r--gr-blocks/include/blocks/CMakeLists.txt1
-rw-r--r--gr-blocks/include/blocks/not_XX.h.t53
-rw-r--r--gr-blocks/lib/CMakeLists.txt1
-rw-r--r--gr-blocks/lib/not_XX_impl.cc.t65
-rw-r--r--gr-blocks/lib/not_XX_impl.h.t48
-rwxr-xr-xgr-blocks/python/qa_boolean_operators.py8
-rw-r--r--gr-blocks/swig/blocks_swig.i9
9 files changed, 222 insertions, 4 deletions
diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml
index e5566ee43..bc2a6fa4e 100644
--- a/gr-blocks/grc/blocks_block_tree.xml
+++ b/gr-blocks/grc/blocks_block_tree.xml
@@ -45,6 +45,7 @@
<name>Boolean Operations (New) </name>
<block>blocks_and_xx.xml</block>
<block>blocks_and_const_xx.xml</block>
+ <block>blocks_not_xx.xml</block>
</cat>
<cat>
<name>Stream Type Conversions (New) </name>
diff --git a/gr-blocks/grc/blocks_not_xx.xml b/gr-blocks/grc/blocks_not_xx.xml
new file mode 100644
index 000000000..fe8916d8b
--- /dev/null
+++ b/gr-blocks/grc/blocks_not_xx.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical Not Block
+###################################################
+ -->
+<block>
+ <name>Not</name>
+ <key>blocks_not_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.not_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt
index 5b29219cc..f6be20235 100644
--- a/gr-blocks/include/blocks/CMakeLists.txt
+++ b/gr-blocks/include/blocks/CMakeLists.txt
@@ -74,6 +74,7 @@ expand_h(integrate_XX ss ii ff cc)
expand_h(multiply_XX ss ii)
expand_h(multiply_const_XX ss ii)
expand_h(multiply_const_vXX ss ii ff cc)
+expand_h(not_XX bb ss ii)
expand_h(sub_XX ss ii ff cc)
add_custom_target(blocks_generated_includes DEPENDS
diff --git a/gr-blocks/include/blocks/not_XX.h.t b/gr-blocks/include/blocks/not_XX.h.t
new file mode 100644
index 000000000..e406c82dc
--- /dev/null
+++ b/gr-blocks/include/blocks/not_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = ~input
+ * \ingroup math_blk
+ *
+ * bitwise boolean not of input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index 9c67c7b03..3bf1db750 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -95,6 +95,7 @@ expand_cc_h_impl(integrate_XX ss ii ff cc)
expand_cc_h_impl(multiply_XX ss ii)
expand_cc_h_impl(multiply_const_XX ss ii)
expand_cc_h_impl(multiply_const_vXX ss ii ff cc)
+expand_cc_h_impl(not_XX bb ss ii)
expand_cc_h_impl(sub_XX ss ii ff cc)
########################################################################
diff --git a/gr-blocks/lib/not_XX_impl.cc.t b/gr-blocks/lib/not_XX_impl.cc.t
new file mode 100644
index 000000000..b491a4ccc
--- /dev/null
+++ b/gr-blocks/lib/not_XX_impl.cc.t
@@ -0,0 +1,65 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)*vlen),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)),
+ d_vlen(vlen)
+ {
+ }
+
+ int
+ @NAME_IMPL@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+ const @I_TYPE@ *inptr = (const @I_TYPE@ *) input_items[0];
+
+ int noi = noutput_items*d_vlen;
+
+ for (int i = 0; i < noi; i++)
+ *optr++ = ~(inptr[i]);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/not_XX_impl.h.t b/gr-blocks/lib/not_XX_impl.h.t
new file mode 100644
index 000000000..25f0da0c8
--- /dev/null
+++ b/gr-blocks/lib/not_XX_impl.h.t
@@ -0,0 +1,48 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/python/qa_boolean_operators.py b/gr-blocks/python/qa_boolean_operators.py
index 8dad41a92..dc011c14e 100755
--- a/gr-blocks/python/qa_boolean_operators.py
+++ b/gr-blocks/python/qa_boolean_operators.py
@@ -169,27 +169,27 @@ class test_boolean_operators (gr_unittest.TestCase):
self.help_ii ((src1_data, src2_data),
expected_result, op)
+ """
def test_not_ss (self):
src1_data = (1, 2, 3, 0x5004, 0x1150)
expected_result = (~1, ~2, ~3, ~0x5004, ~0x1150)
- op = gr.not_ss ()
+ op = blocks_swig.not_ss ()
self.help_ss ((((src1_data),)),
expected_result, op)
def test_not_bb (self):
src1_data = (1, 2, 2, 3, 0x04, 0x50)
expected_result = (0xFE, 0xFD, 0xFD, 0xFC, 0xFB, 0xAF)
- op = gr.not_bb ()
+ op = blocks_swig.not_bb ()
self.help_bb (((src1_data), ),
expected_result, op)
def test_not_ii (self):
src1_data = (1, 2, 3, 0x50005004, 0x11001150)
expected_result = (~1 , ~2, ~3, ~0x50005004, ~0x11001150)
- op = gr.not_ii ()
+ op = blocks_swig.not_ii ()
self.help_ii (((src1_data),),
expected_result, op)
- """
if __name__ == '__main__':
diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i
index 4482757ec..38e815a98 100644
--- a/gr-blocks/swig/blocks_swig.i
+++ b/gr-blocks/swig/blocks_swig.i
@@ -85,6 +85,9 @@
#include "blocks/multiply_const_vff.h"
#include "blocks/multiply_const_vcc.h"
#include "blocks/nlog10_ff.h"
+#include "blocks/not_bb.h"
+#include "blocks/not_ss.h"
+#include "blocks/not_ii.h"
#include "blocks/short_to_char.h"
#include "blocks/short_to_float.h"
#include "blocks/sub_ff.h"
@@ -151,6 +154,9 @@
%include "blocks/multiply_const_vff.h"
%include "blocks/multiply_const_vcc.h"
%include "blocks/nlog10_ff.h"
+%include "blocks/not_bb.h"
+%include "blocks/not_ss.h"
+%include "blocks/not_ii.h"
%include "blocks/short_to_char.h"
%include "blocks/short_to_float.h"
%include "blocks/sub_ff.h"
@@ -216,6 +222,9 @@ GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vii);
GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vff);
GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vcc);
GR_SWIG_BLOCK_MAGIC2(blocks, nlog10_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, not_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, not_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, not_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, short_to_char);
GR_SWIG_BLOCK_MAGIC2(blocks, short_to_float);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff);