#include <codeword.h>
Collaboration diagram for Codeword:

Public Member Functions | |
| Codeword () | |
| void | setSourceWordLen (unsigned long k) |
| CW_PATTERN_t | getNextCwPat () |
| CW_PATTERN_t | getNextCwPatOLD (unsigned long dtus_per_group, CW_PATTERN_t cw_pat) |
Protected Types | |
| enum | { MAX_DEGREE = 63 } |
Protected Attributes | |
| unsigned int | k |
| CW_PATTERN_t | n |
| CW_PATTERN_t | cw_index |
| CW_PATTERN_t | cw_pat |
| CW_PATTERN_t | cw_saved |
Static Protected Attributes | |
| CW_PATTERN_t | primitive_polynomial [MAX_DEGREE+1] |
|
|
Definition at line 92 of file codeword.h.
00092 { MAX_DEGREE = 63 };
|
|
|
Definition at line 108 of file codeword.cc.
|
|
|
Definition at line 142 of file codeword.cc. References cw_index, cw_pat, cw_saved, k, and primitive_polynomial. Referenced by MFTPSndAgent::init_user_file(), and MFTPSndAgent::send_data().
00143 {
00144 assert(cw_pat != 0); // or else prior call to setSourceWordLen(...) has not been made
00145 CW_PATTERN_t ret;
00146 CW_PATTERN_t cw_tmp;
00147
00148 // step 1
00149 if(cw_index != 0) {
00150 cw_pat <<= 1;
00151 if(cw_pat >= n) {
00152 cw_pat ^= primitive_polynomial[k-1];
00153 assert(cw_pat < n);
00154 }
00155 }
00156
00157 // step 2
00158 if(cw_index == k) { cw_saved = cw_pat; cw_tmp = n-1; }
00159 else if(cw_pat == n-1) cw_tmp = cw_saved;
00160 else cw_tmp = cw_pat;
00161
00162 // step 3
00163 if(cw_index < k) ret = (CW_PATTERN_t) 1 << cw_index;
00164 else ret = (cw_tmp << 1) | 1;
00165
00166 // step 4
00167 cw_index = (cw_index + 1) & (n-1); // "& (n-1)" is equivalent to "% n" here
00168
00169 return ret;
00170 }
|
|
||||||||||||
|
|
|
|
Definition at line 117 of file codeword.cc. References cw_index, cw_pat, cw_saved, k, MAX_DEGREE, and primitive_polynomial. Referenced by MFTPSndAgent::init_user_file().
00118 {
00119 k = k_;
00120 n = ((CW_PATTERN_t) 1) << (k-1);
00121 cw_index = (unsigned long) 0;
00122 cw_pat = 1;
00123 cw_saved = 0;
00124 assert(k <= 8 * sizeof(CW_PATTERN_t));
00125 if(k > MAX_DEGREE + 1 || primitive_polynomial[k-1] == 0) {
00126 fprintf(stderr, "codeword.cc: sorry, the group size %lu is not supported.\n",
00127 (unsigned long) k);
00128 exit(0);
00129 }
00130 if(k > 8 * sizeof(CW_PATTERN_t)) {
00131 fprintf(stderr, "codeword.cc: sorry, the group size %lu that you selected\n",
00132 (unsigned long) k);
00133 fprintf(stderr, "requires a datatype of at least %lu bits. To achieve this,\n",
00134 (unsigned long) k);
00135 fprintf(stderr, "adjust Codeword::size in file \"codeword.h\" accordingly.\n");
00136 exit(0);
00137 }
00138 }
|
|
|
Definition at line 97 of file codeword.h. Referenced by getNextCwPat(), and setSourceWordLen(). |
|
|
Definition at line 98 of file codeword.h. Referenced by getNextCwPat(), and setSourceWordLen(). |
|
|
Definition at line 99 of file codeword.h. Referenced by getNextCwPat(), and setSourceWordLen(). |
|
|
Definition at line 95 of file codeword.h. Referenced by getNextCwPat(), and setSourceWordLen(). |
|
|
Definition at line 96 of file codeword.h. |
|
|
Definition at line 37 of file codeword.cc. Referenced by getNextCwPat(), and setSourceWordLen(). |
1.3.3