|
From: | Marcus Müller |
Subject: | Re: [Discuss-gnuradio] Suggestions for C++ Coding of a new PRNG |
Date: | Fri, 16 Oct 2015 15:28:33 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
Hi Jason, from a data flow perspective, your block is a /source/, because it doesn't need input, and produces output. In fact, although the sequence is only generated once, it can be iterated through arbitrary many times. So, without much doubt, this is a stream block source (which is a sync_block without an input port). Now, GNU Radio really doesn't care about what's inside the stream items (in the source code, GNU Radio lingo is "item", not "sample", because of exactly that), so you could as well just push text around, or whatever you like. In fact, many of the arithmetic blocks (which, unlike GNU Radio as a framework itself, have to care about data types) exist in a variant for int16 (short). If you don't want to write your own block, you could as well just generate the sequence, and feed a vector source with it. But: have a look at the GLFSR block -- A Galois-field linear shift register pseudorandom generator. XORSHIFT suspiciously much sounds like you're actually doing the same; or maybe just feed a constant 0 source into a scrambler block, which is also but a wrapper for shift registers. I'm not a coder by trade, so figuring out what to put in each of the 3 files (public header, implementation header, implementation source), input/output forecasts, etc. has been a headache.That shouldn't be the case! First of all, as mentioned above, maybe you shouldn't be writing code, but using the Linear Shift Register blocks in GNU Radio. Then, general block is really not what you need here, and that saves you both complexity in the (general_)work function and things like forecast. And then: Maybe you'd want to read [1], the Guided Tutorials, if you haven't already :) Best regards, Marcus [1] https://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorials On 10/16/2015 11:53 AM, Jason Noble
wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |