discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Suggestions for C++ Coding of a new PRNG


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:
So I'm working on an FHSS implementation. I'm using a XORSHIFT PRNG. I wanted to make a GRC block so I can configure certain parameters for the PRNG (seed numbers, total number of hops to generate, etc.). The only output is an array (or vector output?) storing a hop sequence of, for example, 10,000 integers (channels). This sequence is generated once, when the program is initialized.

It should then be accessed every time the frequency-hopping block (on the Tx side) or the synchronizer (on the Rx side) needs the current/next channel in the sequence.

So, since this block won't be handling streams of samples or even passing messages/PMTs, what block type should I use? Just the generic "block"?

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.

-Jason


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

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