📄 generatorpolyproto.cpp
字号:
/* ********************************************************************* * * * Galois Field Arithmetic Library * * Prototype: Generator Polynomial Prototype * * Version: 0.0.1 * * Author: Arash Partow - 2000 * * URL: http://www.partow.net/projects/galois/index.html * * * * Copyright Notice: * * Free use of this library is permitted under the guidelines and * * in accordance with the most current version of the Common Public * * License. * * http://www.opensource.org/licenses/cpl.php * * * **********************************************************************//* The generator polynomial g(x) is produced by repeatedly multiplying the polynomial of the form 1x^1+alpha^ix^0 to an accumulating polynomial (in this case g(x)) The number of times the multiplication occurs is equal to the number of FEC blocks needed, ie: 6 FEC blocks means 6 multiplications, 10 FEC blocks means 10 multiplications. In GF(2^8), one FEC block is equal to "one byte" or "eight bits" Example: The generator polynomial for 6 FEC blocks, over GF(2^8) with p(x) defined is: g(x) = (1*x^1 + alpha^1*x^0) * (1*x^1 + alpha^2*x^0) * (1*x^1 + alpha^3*x^0) * (1*x^1 + alpha^4*x^0) * (1*x^1 + alpha^5*x^0) * (1*x^1 + alpha^6*x^0) Example: The generator polynomial for 10 FEC blocks, over GF(2^8) with p(x) defined is: g(x) = (1*x^1+alpha^1*x^0) * (1*x^1+alpha^2*x^0) * (1*x^1+alpha^3*x^0) * (1*x^1+alpha^4*x^0) * (1*x^1+alpha^5*x^0) * (1*x^1+alpha^6*x^0) * (1*x^1+alpha^7*x^0) * (1*x^1+alpha^8*x^0) * (1*x^1+alpha^9*x^0) * (1*x^1+alpha^10*x^0) Note: The VDL Mode 2 generator polynomial is defined as being the generator polynomial with 6 roots. The indexes of the alpha values are sequential beginning at index 120-125. The generator polynomial is produced using the RTCA's definition of Galois field. The following example should display the VDL Mode 2 generator polynomial as being: g(x) = 225x^0 + 156x^1 + 176x^2 + 244x^3 + 186x^4 + 176x^5 + 0x^6*/#include <iostream>#include <stdlib.h>#include <stdio.h>#include "GaloisField.h"#include "GaloisFieldElement.h"#include "GaloisFieldPolynomial.h"#include "SequentialRootGeneratorPolynomialCreator.h"/* p(x) = 1x^8+1x^7+0x^6+0x^5+0x^4+0x^3+1x^2+1x^1+1x^0 1 1 0 0 0 0 1 1 1*/unsigned int poly[9] = {1,1,1,0,0,0,0,1,1};int main(int argc, char *argv[]){ galois::SequentialRootGeneratorPolynomialCreator generator(new galois::GaloisField(8,poly),120,6); std::cout << "g(x) = "<< generator.create() << std::endl; exit(EXIT_SUCCESS); return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -