<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>GNU Radio 3.2.2 C++ API: gri_lfsr Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">GNU Radio 3.2.2 C++ API</div> </td> </tr> </tbody> </table> </div> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('classgri__lfsr.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> </div> <div class="headertitle"> <h1>gri_lfsr Class Reference<div class="ingroups"><a class="el" href="group__misc.html">Miscellaneous</a></div></h1> </div> </div> <div class="contents"> <!-- doxytag: class="gri_lfsr" --> <p>Fibonacci Linear Feedback Shift Register using specified polynomial maskGenerates a maximal length pseudo-random sequence of length 2^degree-1. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="gri__lfsr_8h_source.html">gri_lfsr.h</a>></code></p> <p><a href="classgri__lfsr-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgri__lfsr.html#a9d75c0d9937724f0784ccbae11114950">gri_lfsr</a> (uint32_t mask, uint32_t seed, uint32_t reg_len)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="classgri__lfsr.html#ab48a354944fe18d9d261be11aa558b0f">next_bit</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="classgri__lfsr.html#afd1989999dcc0306a1b73f5822d38357">next_bit_scramble</a> (unsigned char input)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="classgri__lfsr.html#af23672b2652cbfa71cd34d99b5b3edd2">next_bit_descramble</a> (unsigned char input)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classgri__lfsr.html#af04de11f558b49d79265df6f32f343c1">pre_shift</a> (int num)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgri__lfsr.html#ab11f525cf4205ac9e77ed3b23d353812">mask</a> () const </td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><p>Fibonacci Linear Feedback Shift Register using specified polynomial mask</p> <p>Generates a maximal length pseudo-random sequence of length 2^degree-1. </p> <p>Constructor: gri_lfsr(int mask, int seed, int reg_len);</p> <p>mask - polynomial coefficients representing the locations of feedback taps from a shift register which are xor'ed together to form the new high order bit.</p> <p>Some common masks might be: x^4 + x^3 + x^0 = 0x19 x^5 + x^3 + x^0 = 0x29 x^6 + x^5 + x^0 = 0x61</p> <p>seed - the initialization vector placed into the register durring initialization. Low order bit corresponds to x^0 coefficient -- the first to be shifted as output.</p> <p>reg_len - specifies the length of the feedback shift register to be used. Durring each iteration, the register is rightshifted one and the new bit is placed in bit reg_len. reg_len should generally be at least order(mask) + 1</p> <p>see <a href="http://en.wikipedia.org/wiki/Linear_feedback_shift_register">http://en.wikipedia.org/wiki/Linear_feedback_shift_register</a> for more explanation.</p> <p><a class="el" href="classgri__lfsr.html#ab48a354944fe18d9d261be11aa558b0f">next_bit()</a> - Standard LFSR operation</p> <p>Perform one cycle of the LFSR. The output bit is taken from the shift register LSB. The shift register MSB is assigned from the modulo 2 sum of the masked shift register.</p> <p><a class="el" href="classgri__lfsr.html#afd1989999dcc0306a1b73f5822d38357">next_bit_scramble(unsigned char input)</a> - Scramble an input stream</p> <p>Perform one cycle of the LFSR. The output bit is taken from the shift register LSB. The shift register MSB is assigned from the modulo 2 sum of the masked shift register and the input LSB.</p> <p><a class="el" href="classgri__lfsr.html#af23672b2652cbfa71cd34d99b5b3edd2">next_bit_descramble(unsigned char input)</a> - Descramble an input stream</p> <p>Perform one cycle of the LFSR. The output bit is taken from the modulo 2 sum of the masked shift register and the input LSB. The shift register MSB is assigned from the LSB of the input.</p> <p>See <a href="http://en.wikipedia.org/wiki/Scrambler">http://en.wikipedia.org/wiki/Scrambler</a> for operation of these last two functions (see multiplicative scrambler.) </p> </div><hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a9d75c0d9937724f0784ccbae11114950"></a><!-- doxytag: member="gri_lfsr::gri_lfsr" ref="a9d75c0d9937724f0784ccbae11114950" args="(uint32_t mask, uint32_t seed, uint32_t reg_len)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">gri_lfsr::gri_lfsr </td> <td>(</td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>mask</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>seed</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>reg_len</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="ab11f525cf4205ac9e77ed3b23d353812"></a><!-- doxytag: member="gri_lfsr::mask" ref="ab11f525cf4205ac9e77ed3b23d353812" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int gri_lfsr::mask </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="ab48a354944fe18d9d261be11aa558b0f"></a><!-- doxytag: member="gri_lfsr::next_bit" ref="ab48a354944fe18d9d261be11aa558b0f" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">unsigned char gri_lfsr::next_bit </td> <td>(</td> <td class="paramname"></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Referenced by <a class="el" href="classgri__lfsr.html#af04de11f558b49d79265df6f32f343c1">pre_shift()</a>.</p> </div> </div> <a class="anchor" id="af23672b2652cbfa71cd34d99b5b3edd2"></a><!-- doxytag: member="gri_lfsr::next_bit_descramble" ref="af23672b2652cbfa71cd34d99b5b3edd2" args="(unsigned char input)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">unsigned char gri_lfsr::next_bit_descramble </td> <td>(</td> <td class="paramtype">unsigned char </td> <td class="paramname"><em>input</em></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="afd1989999dcc0306a1b73f5822d38357"></a><!-- doxytag: member="gri_lfsr::next_bit_scramble" ref="afd1989999dcc0306a1b73f5822d38357" args="(unsigned char input)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">unsigned char gri_lfsr::next_bit_scramble </td> <td>(</td> <td class="paramtype">unsigned char </td> <td class="paramname"><em>input</em></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="af04de11f558b49d79265df6f32f343c1"></a><!-- doxytag: member="gri_lfsr::pre_shift" ref="af04de11f558b49d79265df6f32f343c1" args="(int num)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void gri_lfsr::pre_shift </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"><em>num</em></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Rotate the register through x number of bits where we are just throwing away the results to get queued up correctly </p> <p>References <a class="el" href="classgri__lfsr.html#ab48a354944fe18d9d261be11aa558b0f">next_bit()</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="gri__lfsr_8h_source.html">gri_lfsr.h</a></li> </ul> </div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="classgri__lfsr.html">gri_lfsr</a> </li> <li class="footer">Generated on Thu Feb 17 2011 for GNU Radio 3.2.2 C++ API by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> </ul> </div> </body> </html>