Hi Marcus,

Thank you for your advice, it is really helpful!!

I successfully made Vflicker.v as a source block in GNU Radio, and it passed 
the python QA code with the help of *head* block you suggested.

I actually tried two different ways to build the Vflicker.v source block. 
Surprisingly, from my point of view, it is easier to build the block with 
dynamic-link library (shared library) mechanism, rather than just to include 
tons of Verilator-related header files and build it statically. The main reason 
is that in order to build it with Verilator-related header files, I have to 
modify CMakeList.txt (modify include directory paths and link rules), which is 
not a trivial thing for me. As for building the block with dynamic-link library 
(shared library) mechanism, I just have to generate the shared library 
manually, then load the library in the block.

I will cover more details in the weekly report this weekend.

Best regards,
Bowen

________________________________
From: Marcus Müller <[email protected]>
Sent: Friday, May 24, 2019 8:40
To: Bowen Hu; [email protected]
Subject: Re: Problems on writing QA code for source block

Hi Bowen,

yeah! Community bonding :) And progress!!

So, the trick with GNU Radio is that you can think of blocks being
"called" by the scheduling algorithm. That always happens when there's
new input to process (doesn't apply to sources), and there's enough
output space to write results to, *as long as the flow graph is
running*.
So, all you have to do is *stop the flowgraph*, and that is as easy as
adding a "Head" block after your source. That block just copies a set
number of items from its input to its output and then signals "hey, I'm
done, don't give me any more input items", at which point your source
block will simply not be asked to produce any more.

Best regards,
Marcus

On Fri, 2019-05-24 at 02:08 +0000, Bowen Hu wrote:
> Hi all,
>
> I am having trouble writing QA code in python for C++ **source**
> blocks. Unlike the **sync** block demonstrated in the tutorial (
> https://wiki.gnuradio.org/index.php/Guided_Tutorial_GNU_Radio_in_C%2B%2B
> ), which stops when there are no more input items. Since **source**
> blocks do not take any input, I have no idea how to stop the
> **source** block once the python QA code  was started.
>
> thanks in advance for any advice.
>
> Best regards,
> Bowen

_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to