summaryrefslogtreecommitdiff
path: root/gr-blocks/grc
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-11-21 13:45:42 -0800
committerMartin Braun <martin.braun@ettus.com>2018-11-22 14:47:14 -0800
commit30a08a60d6e4aba113dcc8d9633a011c66dbc305 (patch)
tree537e35b5a3461aa0d114646c448c1fa2d635eead /gr-blocks/grc
parent45540395106426bb162e8f436156806113c11cee (diff)
blocks: Fix add and multiply const blocks GRC bindings
The 'add' and 'multiply' const blocks have different implementations in C++ for vector- and scalar use cases. In GRC, there was only one type of bindings. This commit fixes the switching between the vector- and scalar versions. It also fixes the assertion error that would require users to specify scalars as vectors of length one.
Diffstat (limited to 'gr-blocks/grc')
-rw-r--r--gr-blocks/grc/blocks_add_const_vxx.block.yml9
-rw-r--r--gr-blocks/grc/blocks_multiply_const_vxx.block.yml11
2 files changed, 11 insertions, 9 deletions
diff --git a/gr-blocks/grc/blocks_add_const_vxx.block.yml b/gr-blocks/grc/blocks_add_const_vxx.block.yml
index b95065cdba..a3ce37b9b5 100644
--- a/gr-blocks/grc/blocks_add_const_vxx.block.yml
+++ b/gr-blocks/grc/blocks_add_const_vxx.block.yml
@@ -7,12 +7,13 @@ parameters:
dtype: enum
options: [complex, float, int, short]
option_attributes:
- const_type: [complex_vector, real_vector, int_vector, int_vector]
+ vconst_type: [complex_vector, real_vector, int_vector, int_vector]
+ const_type: [complex, real, int, int]
fcn: [cc, ff, ii, ss]
hide: part
- id: const
label: Constant
- dtype: ${ type.const_type }
+ dtype: ${ type.const_type if vlen == 1 else type.vconst_type }
default: '0'
- id: vlen
label: Vec Length
@@ -31,12 +32,12 @@ outputs:
vlen: ${ vlen }
asserts:
-- ${ len(const) == vlen }
- ${ vlen > 0 }
+- ${ (vlen > 1 and len(const) == vlen) or (vlen == 1) }
templates:
imports: from gnuradio import blocks
- make: blocks.add_const_v${type.fcn}(${const})
+ make: blocks.add_const_${ 'v' if context.get('vlen')() > 1 else '' }${type.fcn}(${const})
callbacks:
- set_k(${const})
diff --git a/gr-blocks/grc/blocks_multiply_const_vxx.block.yml b/gr-blocks/grc/blocks_multiply_const_vxx.block.yml
index fe7efa4647..41dd9c9c68 100644
--- a/gr-blocks/grc/blocks_multiply_const_vxx.block.yml
+++ b/gr-blocks/grc/blocks_multiply_const_vxx.block.yml
@@ -7,13 +7,14 @@ parameters:
dtype: enum
options: [complex, float, int, short]
option_attributes:
- const_type: [complex_vector, real_vector, int_vector, int_vector]
+ vconst_type: [complex_vector, real_vector, int_vector, int_vector]
+ const_type: [complex, real, int, int]
fcn: [cc, ff, ii, ss]
hide: part
- id: const
label: Constant
- dtype: ${ type.const_type }
- default: '0'
+ dtype: ${ type.const_type if vlen == 1 else type.vconst_type }
+ default: '1'
- id: vlen
label: Vec Length
dtype: int
@@ -31,12 +32,12 @@ outputs:
vlen: ${ vlen }
asserts:
-- ${ len(const) == vlen }
- ${ vlen > 0 }
+- ${ (vlen > 1 and len(const) == vlen) or (vlen == 1) }
templates:
imports: from gnuradio import blocks
- make: blocks.multiply_const_v${type.fcn}(${const})
+ make: blocks.multiply_const_${ 'v' if context.get('vlen')() > 1 else '' }${type.fcn}(${const})
callbacks:
- set_k(${const})