diff options
Diffstat (limited to 'grc')
-rw-r--r-- | grc/blocks/block_tree.xml | 3 | ||||
-rw-r--r-- | grc/blocks/gr_keep_m_in_n.xml | 74 | ||||
-rw-r--r-- | grc/blocks/gr_pack_k_bits_bb.xml | 30 | ||||
-rw-r--r-- | grc/blocks/gr_vector_insert_x.xml | 80 | ||||
-rw-r--r-- | grc/blocks/options.xml | 17 | ||||
-rw-r--r-- | grc/python/flow_graph.tmpl | 16 |
6 files changed, 220 insertions, 0 deletions
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 18bc050ba..0b0b6854e 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -61,6 +61,7 @@ <block>gr_fft_vxx</block> <block>blks2_logpwrfft_x</block> + <block>gr_vector_insert_x</block> </cat> <cat> <name>Type Conversions</name> @@ -114,6 +115,7 @@ <block>gr_unpacked_to_packed_xx</block> <block>gr_packed_to_unpacked_xx</block> <block>gr_unpack_k_bits_bb</block> + <block>gr_pack_k_bits_bb</block> <block>gr_chunks_to_symbols_xx</block> <block>gr_map_bb</block> </cat> @@ -183,6 +185,7 @@ <block>blks2_rational_resampler_xxx</block> <block>gr_fractional_interpolator_xx</block> <block>gr_keep_one_in_n</block> + <block>gr_keep_m_in_n</block> <block>gr_moving_average_xx</block> <block>gr_iqcomp_cc</block> <block>gr_dc_blocker</block> diff --git a/grc/blocks/gr_keep_m_in_n.xml b/grc/blocks/gr_keep_m_in_n.xml new file mode 100644 index 000000000..a63ef47a6 --- /dev/null +++ b/grc/blocks/gr_keep_m_in_n.xml @@ -0,0 +1,74 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Keep M in N +################################################### + --> +<block> + <name>Keep M in N</name> + <key>gr_keep_m_in_n</key> + <import>from gnuradio import gr</import> + <make>gr.keep_m_in_n($type.size, $m, $n, $offset)</make> + <callback>set_offset($offset)</callback> + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Complex</name> + <key>complex</key> + <opt>size:gr.sizeof_gr_complex</opt> + </option> + <option> + <name>Float</name> + <key>float</key> + <opt>size:gr.sizeof_float</opt> + </option> + <option> + <name>Int</name> + <key>int</key> + <opt>size:gr.sizeof_int</opt> + </option> + <option> + <name>Short</name> + <key>short</key> + <opt>size:gr.sizeof_short</opt> + </option> + <option> + <name>Byte</name> + <key>byte</key> + <opt>size:gr.sizeof_char</opt> + </option> + </param> + <param> + <name>M</name> + <key>m</key> + <value>1</value> + <type>int</type> + </param> + <param> + <name>N</name> + <key>n</key> + <value>2</value> + <type>int</type> + </param> + <param> + <name>initial offset</name> + <key>offset</key> + <value>0</value> + <type>int</type> + </param> + <check>$n > 0</check> + <check>$m > 0</check> + <check>$m < $n</check> + <sink> + <name>in</name> + <type>$type</type> + <vlen>$n</vlen> + </sink> + <source> + <name>out</name> + <type>$type</type> + <vlen>$m</vlen> + </source> +</block> diff --git a/grc/blocks/gr_pack_k_bits_bb.xml b/grc/blocks/gr_pack_k_bits_bb.xml new file mode 100644 index 000000000..34e64a5d9 --- /dev/null +++ b/grc/blocks/gr_pack_k_bits_bb.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Pack K Bits +################################################### + --> +<block> + <name>Pack K Bits</name> + <key>gr_pack_k_bits_bb</key> + <import>from gnuradio import gr</import> + <make>gr.pack_k_bits_bb($k)</make> + <param> + <name>K</name> + <key>k</key> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>byte</type> + </sink> + <source> + <name>out</name> + <type>byte</type> + </source> + + <doc> + Pack K unpacked bits (one bit per byte) into a single packed byte containing k bits and 8 - k zeros. + </doc> + +</block> diff --git a/grc/blocks/gr_vector_insert_x.xml b/grc/blocks/gr_vector_insert_x.xml new file mode 100644 index 000000000..f9ce1f654 --- /dev/null +++ b/grc/blocks/gr_vector_insert_x.xml @@ -0,0 +1,80 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Vector Source +################################################### + --> +<block> + <name>Vector Insert</name> + <key>gr_vector_insert_x</key> + <import>from gnuradio import gr</import> + <make>gr.vector_insert_$(type.fcn)($vector, $period, $offset)</make> + <param> + <name>Output Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Byte</name> + <key>byte</key> + <opt>fcn:b</opt> + <opt>vec_type:int_vector</opt> + </option> + <option> + <name>Complex</name> + <key>complex</key> + <opt>fcn:c</opt> + <opt>vec_type:complex_vector</opt> + </option> + <option> + <name>Float</name> + <key>float</key> + <opt>fcn:f</opt> + <opt>vec_type:real_vector</opt> + </option> + <option> + <name>Int</name> + <key>int</key> + <opt>fcn:i</opt> + <opt>vec_type:int_vector</opt> + </option> + <option> + <name>Short</name> + <key>short</key> + <opt>fcn:s</opt> + <opt>vec_type:int_vector</opt> + </option> + </param> + <param> + <name>Vector</name> + <key>vector</key> + <value>0, 0, 0</value> + <type>$type.vec_type</type> + </param> + <param> + <name>Periodicity</name> + <key>period</key> + <value>100</value> + <type>int</type> + </param> + <param> + <name>Offset</name> + <key>offset</key> + <value>0</value> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>$type</type> + </sink> + <source> + <name>out</name> + <type>$type</type> + </source> + + <doc> + Periodicity, the length of the periodicity at which the vector should be inserted at the output. + (i.e. one vector for every N output items) + + Offset sepcifies where in the cycle period we should begin at. + </doc> +</block> diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml index b27ea900c..1cf0b7707 100644 --- a/grc/blocks/options.xml +++ b/grc/blocks/options.xml @@ -125,6 +125,19 @@ else: self.stop(); self.wait()</callback> </option> </param> <param> + <name>Max Number of Output</name> + <key>max_nouts</key> + <value>0</value> + <type>int</type> + <hide>#if $generate_options() == 'hb' +all#slurp +#elif $max_nouts() +none#slurp +#else +part#slurp +#end if</hide> + </param> + <param> <name>Realtime Scheduling</name> <key>realtime_scheduling</key> <value></value> @@ -169,5 +182,9 @@ For example, an id of my_block will generate the file my_block.py and class my_b The category parameter determines the placement of the block in the block selection window. \ The category only applies when creating hier blocks. \ To put hier blocks into the root category, enter / for the category. + +The Max Number of Output is the maximum number of output items allowed for any block \ +in the flowgraph; to disable this set the max_nouts equal to 0.\ +Use this to adjust the maximum latency a flowgraph can exhibit. </doc> </block> diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 0878be4ba..17feb01f6 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -244,12 +244,20 @@ if __name__ == '__main__': #end if #if $generate_options == 'wx_gui' tb = $(class_name)($(', '.join($params_eq_list))) + #if $flow_graph.get_option('max_nouts') + tb.Run($flow_graph.get_option('run'), $flow_graph.get_option('max_nouts')) + #else tb.Run($flow_graph.get_option('run')) + #end if #elif $generate_options == 'qt_gui' qapp = Qt.QApplication(sys.argv) tb = $(class_name)($(', '.join($params_eq_list))) #if $flow_graph.get_option('run') + #if $flow_graph.get_option('max_nouts') + tb.start($flow_graph.get_option('max_nouts')) + #else tb.start() + #end if #end if tb.show() qapp.exec_() @@ -258,11 +266,19 @@ if __name__ == '__main__': tb = $(class_name)($(', '.join($params_eq_list))) #set $run_options = $flow_graph.get_option('run_options') #if $run_options == 'prompt' + #if $flow_graph.get_option('max_nouts') + tb.start($flow_graph.get_option('max_nouts')) + #else tb.start() + #end if raw_input('Press Enter to quit: ') tb.stop() #elif $run_options == 'run' + #if $flow_graph.get_option('max_nouts') + tb.run($flow_graph.get_option('max_nouts')) + #else tb.run() + #end if #end if #end if #end if |