Skip to content

Latest commit

 

History

History
458 lines (426 loc) · 9.65 KB

grep-0020-restructure_blocks.md

File metadata and controls

458 lines (426 loc) · 9.65 KB

GREP 0020 -- Restructure GNU Radio Blocks

[Note: All parts in square brackets are meant to be replaced as part of authoring a new GREP]

History:

  • 03-March-2020: Initial Draft
  • 20-June-2020: Accepted in its current form
  • 23-December-2020: Proposed inclusion of gr-pdu module

Abstract

This GREP proposes restructuring the blocks within each of the top level GNU Radio modules to have the overall API be more intuitive amongst other benefits

Copyright / License

CC-BY-ND

Motivation

Several of the GNU Radio modules (e.g. blocks, digital) have become massively large and do not contain functionally grouped blocks in each single module. Restructuring should help by making it easier to:

  • compile modules
  • find blocks and related source code
  • reduce interdependencies between modules
  • simplify maintenance

Description

(This is taken from @marcusmueller's recommendation here: [gnuradio/gnuradio#1230 (comment)])

Goal

  • Make location of blocks more intuitive to the user
  • Make GNU Radio faster to build (smaller linker and SWIG objects)
  • Make Maintenance easier by having assignable subsystems

Approach

  • Move semantically similar blocks into logically named modules
  • Avoid cross-dependencies between modules, aside from unittests and very common blocks
  • Where breakage of end-user applications is to be expected, add a temporary alias to the individual Python modules, so that one can import the block from its old position, but gets a deprecation warning
  • Don't be afraid of having more separate modules.

Proposed Structure

diffs for illustration; generated by manually cut'n'pasting text generated by

    >>> from gnuradio import MODULENAME
    >>> l = [ k[:-5]+"\n"  for k in  MODULENAME.__dict__.keys() if k.endswith("_make")]
    >>> f = open("MODULENAME.txt", "w")
    >>> f.writelines(l)
    >>> f.close()
  • gr-blocks should shrink
  • gr-math should get all the zero-dependencies (aside from VOLK/Boost) basic math blocks
  • gr-fileio gets... file io. I'd like to see more file sinks/sources upstreamed to that, and those being dynamically enabled on a per-block basis. E.g. a WAVPACK source/sink (relatively good compression for IQ data), MIT Haystack… This would however be a prime candidate for aggressive maintenance, ie. automated tests with test files.
  • gr-streamops: things like stream_to_vector, head, you get the idea. zero-deps
  • gr-logical kind of on the border to gr-math, should maybe get the packed/unpacked? zero-deps
  • gr-filter gets the moving_average, which for some reason is in gr-blocks
  • gr-pdu: create new in tree module for generic PDU utility blocks that operate on PDUs or convert to/from PDUs; blocks extending existing streaming functionality to the PDU API will go in the appropriate module.

Not included in this draft (yet):

  • gr-sigsources: noise sources, signal_source

gr-blocks

  --- blocks.txt	2017-07-25 16:55:17.213755879 +0200
  +++ blocks_new.txt	2017-07-25 17:08:47.707595894 +0200
  @@ -1,232 +1,34 @@
  -abs_…
  -add_const_bb …
  -add_…
  -and_bb
  -and_const_…
  -and_…
  -annotator_1to1 …
  -argmax_…
  bin_statistics_f
  -burst_tagger
  -char_to_…
  check_lfsr_32k_s
  -complex_to_…
  -conjugate_cc
  -copy
  ctrlport_probe2_…
  -deinterleave
  -delay
  -divide_…
  -endian_swap
  -exponentiate_const_cci
  -file_descriptor_sink
  -file_descriptor_source
  -file_meta_sink
  -file_meta_source
  -file_sink
  -file_source
  -float_to_…
  -head
  -int_to…
  -integrate_…
  -interleave
  -interleaved_…_to_…
  -keep_m_in_n
  -keep_one_in_n
  -lfsr_32k_source_s
  -magphase_to_complex
  -max_…
  message_…
  +message_counter
  +message_drop_random
  +message_emitter
  +message_gate
  +message_keep_1_in_n
  -min_…
  -moving_average_…
  multiply_by_tag_value_cc
  -multiply_…
  -multiply_conjugate_cc
  -multiply_const_…
  -multiply_matrix_…
  -mute_…
  -nlog10_ff
  -nop
  -not_…
  null_sink
  null_source
  -or_…
  -pack_k_bits_bb
  -packed_to_unpacked_…
  -patterned_interleaver
  -pdu_filter
  -pdu_remove
  -pdu_set
  -pdu_to_tagged_stream
  peak_detector2_fb
  peak_detector_fb
  peak_detector_ib
  peak_detector_sb
  plateau_detector_fb
  -probe_rate
  -probe_signal_…
  -random_pdu
  regenerate_bb
  -repack_bits_bb
  -repeat
  -rms_…
  -rotator_cc
  -sample_and_hold_…
  -short_to_…
  -short_to_float
  -skiphead
  -socket_pdu
  -stream_mux
  -stream_to_…
  stretch_ff
  -sub_…
  -tag_debug
  -tag_gate
  -tag_share
  -tagged_file_sink
  -tagged_stream_align
  -tagged_stream_multiply_length
  -tagged_stream_mux
  -tagged_stream_to_pdu
  -tags_strobe
  tcp_server_sink
  -test_tag_variable_rate_ff
  -threshold_ff
  -throttle
  -transcendental
  -tsb_vector_sink_…
  -tuntap_pdu
  -uchar_to_float
  udp_sink
  udp_source
  -unpack_k_bits_…
  -unpacked_to_packed_…
  vco_c
  vco_f
  -vector_insert_…
  -vector_map
  -vector_sink_…
  -vector_source_…
  -wavfile_sink
  -wavfile_source
  -xor_…

gr-math

  --- math.txt	2017-07-25 16:54:10.109610007 +0200
  +++ math_new.txt	2017-07-25 17:08:45.506558311 +0200
  @@ -0,0 +1,83 @@
  +abs_ff
  +abs_ii
  +abs_ss
  +add_cc
  +add_const_bb
  +add_const_cc
  +add_const_ff
  +add_const_ii
  +add_const_ss
  +add_const_vbb
  +add_const_vcc
  +add_const_vff
  +add_const_vii
  +add_const_vss
  +add_ff
  +add_ii
  +add_ss
  +and_bb
  +argmax_fs
  +argmax_is
  +argmax_ss
  +char_to_float (rename: schar_to_float)
  +char_to_short (rename: schar_to_short)
  +complex_to_arg
  +complex_to_float
  +complex_to_imag
  +complex_to_interleaved_char
  +complex_to_interleaved_short
  +complex_to_mag
  +complex_to_mag_squared
  +complex_to_magphase
  +complex_to_real
  +conjugate_cc
  +divide_cc
  +divide_ff
  +divide_ii
  +divide_ss
  +exponentiate_const_cci
  +float_to_char
  +float_to_complex
  +float_to_int
  +float_to_short
  +float_to_uchar
  +int_to_float
  +integrate_cc
  +integrate_ff
  +integrate_ii
  +integrate_ss
  +magphase_to_complex
  +max_ff
  +max_ii
  +max_ss
  +min_ff
  +min_ii
  +min_ss
  +multiply_cc
  +multiply_conjugate_cc
  +multiply_const_cc
  +multiply_const_ff
  +multiply_const_ii
  +multiply_const_ss
  +multiply_const_vcc
  +multiply_const_vff
  +multiply_const_vii
  +multiply_const_vss
  +multiply_ff
  +multiply_ii
  +multiply_matrix_cc
  +multiply_matrix_ff
  +multiply_ss
  +nlog10_ff
  +rms_cf
  +rms_ff
  +rotator_cc
  +short_to_char
  +short_to_float
  +sub_cc
  +sub_ff
  +sub_ii
  +sub_ss
  +threshold_ff
  +transcendental (new implementation, )
  +uchar_to_float

gr-streamops

  --- streamops.txt	2017-07-25 17:03:25.709097445 +0200
  +++ streamops-new.txt	2017-07-25 17:07:11.466952490 +0200
  @@ -0,0 +1,85 @@
  +annotator_1to1 (?)
  +annotator_alltoall (?)
  +annotator_raw (?)
  +burst_tagger
  +copy
  +deinterleave
  +delay
  +head
  +interleave
  +interleaved_char_to_complex
  +interleaved_short_to_complex
  +keep_m_in_n
  +keep_one_in_n
  +nop (redundant?)
  +pack_k_bits_bb
  +packed_to_unpacked_bb
  +packed_to_unpacked_ii
  +packed_to_unpacked_ss
  +patterned_interleaver
  +probe_rate
  +probe_signal_b
  +probe_signal_c
  +probe_signal_f
  +probe_signal_i
  +probe_signal_s
  +probe_signal_vb
  +probe_signal_vc
  +probe_signal_vf
  +probe_signal_vi
  +probe_signal_vs
  +repack_bits_bb
  +repeat
  +sample_and_hold_bb
  +sample_and_hold_ff
  +sample_and_hold_ii
  +sample_and_hold_ss
  +skiphead
  +stream_mux
  +stream_to_streams
  +stream_to_tagged_stream
  +stream_to_vector
  +streams_to_stream
  +streams_to_vector
  +tag_debug
  +tag_gate
  +tag_share
  +tagged_stream_align
  +tagged_stream_multiply_length
  +tagged_stream_mux
  +tags_strobe
  +throttle
  +tsb_vector_sink_b
  +tsb_vector_sink_c
  +tsb_vector_sink_f
  +tsb_vector_sink_i
  +tsb_vector_sink_s
  +unpack_k_bits_bb
  +unpacked_to_packed_bb
  +unpacked_to_packed_ii
  +unpacked_to_packed_ss
  +vector_insert_b
  +vector_insert_c
  +vector_insert_f
  +vector_insert_i
  +vector_insert_s
  +vector_map
  +vector_sink_b
  +vector_sink_c
  +vector_sink_f
  +vector_sink_i
  +vector_sink_s
  +vector_source_b
  +vector_source_c
  +vector_source_f
  +vector_source_i
  +vector_source_s
  +vector_to_stream
  +vector_to_streams

gr-logical

  --- logical.txt	2017-07-25 17:07:16.019030224 +0200
  +++ logical_new.txt	2017-07-25 17:08:24.786204492 +0200
  @@ -0,0 +1,16 @@
  +and_const_bb
  +and_const_ii
  +and_const_ss
  +and_ii
  +and_ss
  +endian_swap
  +lfsr_32k_source_s
  +not_bb
  +not_ii
  +not_ss
  +or_bb
  +or_ii
  +or_ss
  +xor_bb
  +xor_ii
  +xor_ss

gr-fileio


  --- fileio.txt	2017-07-25 17:00:54.823520916 +0200
  +++ fileio_new.txt	2017-07-25 17:03:14.550906905 +0200
  @@ -0,0 +1,9 @@
  +file_descriptor_sink
  +file_descriptor_source
  +file_meta_sink
  +file_meta_source
  +file_sink
  +file_source
  +tagged_file_sink
  +wavfile_sink
  +wavfile_source

gr-filter


  --- filter.txt	2017-07-25 17:10:47.873647748 +0200
  +++ filter_new.txt	2017-07-25 17:10:39.083497654 +0200
  @@ -33,6 +33,10 @@
  +moving_average_cc
  +moving_average_ff
  +moving_average_ii
  +moving_average_ss

gr-pdu


  --- pdu.txt		2017-07-25 17:10:47.873647748 +0200
  +++ pdu_new.txt	2017-07-25 17:10:39.083497654 +0200
  @@ -0,0 +1,9 @@
  +add_wall_clock_time
  +align
  +binary_tools
  +complex_to_mag2
  +filter
  +length_filter
  +logger
  +pack_unpack
  +pdu_lambda
  +pdu_to_bursts
  +pdu_to_tagged_stream
  +preamble
  +random_pdu
  +remove_meta
  +set_meta
  +socket_pdu
  +split
  +tagged_stream_to_pdu
  +tag_message_trigger
  +tags_to_pdu
  +take_skip_to_pdu
  +time_delta
  +tuntap_pdu