Skip to content

Instantly share code, notes, and snippets.

@haakov
Created July 24, 2018 16:30
Show Gist options
  • Save haakov/fb381bf3de1dd6a02b697c9d92d7dae5 to your computer and use it in GitHub Desktop.
Save haakov/fb381bf3de1dd6a02b697c9d92d7dae5 to your computer and use it in GitHub Desktop.
Multiply Const block
id: blocks_multiply_const_vxx
label: Multiply Const
parameters:
- id: type
label: IO Type
dtype: enum
options: [complex, float, int, short]
option_attributes:
const_type: [complex_vector, real_vector, int_vector, int_vector]
fcn: [cc, ff, ii, ss]
hide: part
- id: const
label: Constant
dtype: ${ type.const_type }
default: '0'
- id: vlen
label: Vec Length
dtype: int
default: '1'
hide: ${ 'part' if vlen == 1 else 'none' }
inputs:
- domain: stream
dtype: ${ type }
vlen: ${ vlen }
outputs:
- domain: stream
dtype: ${ type }
vlen: ${ vlen }
asserts:
- ${ (len(const) == vlen) if str(const).strip().startswith('[') else (vlen == 1) }
- ${ vlen > 0 }
templates:
imports: from gnuradio import blocks
make: blocks.multiply_const_v${type.fcn}(${ str(const) if str(const).strip().startswith('[') else ('[' + str(const) + ']') })
callbacks:
- set_k(${const})
file_format: 1
@haakov
Copy link
Author

haakov commented Jul 28, 2018

Okay so I've found the problem.

This namespace property ignores the option_attributes. This is why type is recognized but not type.const_type.

@haakov
Copy link
Author

haakov commented Jul 28, 2018

Pull request created: gnuradio/gnuradio#1925

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment