|
From: | Koslowski, Sebastian (CEL) |
Subject: | Re: [Discuss-gnuradio] [GSoC] GNU Radio Companion Extensions: Output C++ Code |
Date: | Fri, 31 Mar 2017 16:32:17 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
Dear Håkon,
I am very excited to see interest in this topic! A few additional comments: - Any new templating should be done using Mako. The new YAML format Martin mentioned roughly looks like this: """ id: blocks_add_const_vxx label: Add 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: - dtype: ${ type } vlen: ${ vlen } outputs: - dtype: ${ type } vlen: ${ vlen } templates: imports: from gnuradio import blocks make: blocks.add_const_v${type.fcn}(${const}) callbacks: - set_k(${const}) """ C++ specific templates could be added under "cpp_templates" or sth. The main part of your work would be to implement a Generator subclass. You maybe want to checkout my latest dev version to use as a starting point [0] Another issue is how to deal with parameter values: Say, I have a variable with "np.pi" as value. Or specify some filter coeffs using a list [1, 1, 1, 1,...]. Or so some calculation "2 ** 4 + 1". Those usually end up in the generated code somewhere. For C++ that would fail... I suggest, that at least some simple expressions should be transpiled for the C++ code generation. The alternative, writing all parameter values in C++ code, would require a separate eval, validation, .... - basically a C++ version of GRC. I'd rather do everything in Python and get the C++ output as a bonus on top. This means that all blocks must still be available in Python - even if they are just in output C++. This way we can load and instantiate things like filter and constellation objects during design time (before you hit generate) and do validation with those. Sebastian [0] https://github.com/skoslowski/gnuradio/blob/df1e94831c05e3b8a25e5490f50ebf9e98795182/grc/core/generator/top_block.py On 03/31/2017 02:07 PM, Håkon Vågsether wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |