discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] work function - how it fits in the big picture


From: Michael Dickens
Subject: Re: [Discuss-gnuradio] work function - how it fits in the big picture
Date: Wed, 19 Apr 2006 16:54:10 -0400

Chuck - A variety of comments; someone please correct me if my understanding is not correct. - MLD

1) The "work()" method is used by the "gr_sync_block" class as a subcall from "general_work()". The latter ("general_work()") is called by the scheduler (quoted from a previous email from Eric; see "gr_single_threaded_scheduler::main_loop()" for the actual "scheduler" code which does all the 'work' ... ha ha):
+++++++++++++
Part of the setup is in Python, the runtime part is in C++.

gnuradio-core/src/python/gnuradio/gr:

   basic_flow_graph.py
   flow_graph.py
   scheduler.py

gnuradio-core/src/lib/runtime:

   gr_single_threaded_scheduler.{h,cc}          # the runtime scheduler

      you'll also want to look at

   gr_block.{h,cc} and gr_block_detail.{h,cc}
+++++++++++++
2) The scheduler calls each block's "forecast()" method repeatedly starting with a "large" buffer size (e.g. 2^16) and dropping down by powers of 2 nearest the block's "output_multiple". The end result is that each block's "general_work()" method is provided with a correct "output_multiple" multiple of number of output items to create (i.e. if the "o_m" is 10, then "noutput_items" = 10*X, where X is any non- negative integer). The number is clearly dependent on the number of "input_items" available for processing, as well as the "forecast()" to create a reasonable number of output items given those input items (really vice versa, but it's one way of looking at things).

3) The "forecast()" method is important (as per 2 above); make sure it returns an accurate number of input items required for the provided number of output items.

4) The return value for "work()" or "general_work()" is the number of output items actually created, but no more than the input "noutput_items". Remember, these are -items- as defined by the "output_io_signature", not necessarily Bytes or whatever.

5) Instead of looping over "atsci_trellis_encoder::NCODERS" or the number of output items, you should use the size of the input_items or output_items (depending on how your computation works;e.g. "output_items.size()"). These may or not be the same depending on how your "io_signature"s are set. Looking at the code from 0.9, maybe something like:

  for (int i = 0; i < output_items.size(); i++) {
    d_trellis_encoder.encode (&out[i], &in[i]);

But what you do really depends on how the rest of the block is configured.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]