当前位置:   article > 正文

十六、基于FPGA的CRC校验设计实现_fpga crc校验

fpga crc校验

1,CRC校验

循环冗余校验(Cyclic Redundancy Check, CRC)是一种根据网络数据包或计算机文件等数据产生简短固定位数校验码的一种信道编码技术,主要用来检测或校验数据传输或者保存后可能出现的错误。它是利用除法及余数的原理来作错误侦测的。

2,CRC 多项式

多项式一般指输入数据异或的对象;其中相关参数还包括:初值,结果异或值,输入翻转,输出翻转。

初始值:计算之前给CRC赋初始值;

结果异或值:计算完CRC输出前;对CRC结果异或的参数值;

输入值反转:输入翻转指对输入输入按字节翻转;

输出值反转:对输出结果在CRC计算之后,异或之前整体翻转

一般常用的CRC多项式如下:

3 CRC逻辑设计实现

设计实现CRC-8 CRC-16 CRC-32位校验计算;下面分别介绍串行,并行的不同实现思路;

3.1 CRC串行实现

实现流程:

a, 输入数据 翻转控制;

b, 翻转后数据与CRC初值异或;8位直接异或;16位与32位先异或高8位;

c, 循环左移异或计算;8位左移8次;16位左移16次;32位左移32次;

16位;在左移8次后需要用异或结果的高8位异或原始数据的低8位;然后在继续左移运算

32位;在左移8,16,24位后用异或结果的高8位异或原始数据的次高8位,次低8位,低8位,然后再继续左移运算;

d, 对计算的CRC结果进行翻转处理;

e, 对输出的翻转数据进行异或数据处理;输出

(1)CRC-8位实现
  1. module crc_8 #(
  2. parameter [7:0] CRC8_PARAM = 8'h07,//多项式
  3. parameter [7:0] CRC_INIT = 8'h00,
  4. parameter [7:0] DATA_XOROUT = 8'h55
  5. )(
  6. input sys_clk,
  7. input sys_rst,
  8. input in_swap_en,
  9. input out_swap_en,
  10. input data_in_en,
  11. input [7:0] data_in,
  12. output data_out_en,
  13. output [7:0] data_out
  14. );
  15. wire [7:0] swap_data;
  16. reg [7:0] crc_reg = CRC_INIT;
  17. reg [7:0] crc_cnt = 0;
  18. reg data_out_en_reg = 0;
  19. reg [7:0] data_out_reg = 0;
  20. assign swap_data = in_swap_en ? {data_in[0],data_in[1],data_in[2],data_in[3],data_in[4],data_in[5],data_in[6],data_in[7]}:data_in;
  21. always @ (posedge sys_clk) begin
  22. if(sys_rst) begin
  23. crc_reg <= CRC_INIT;
  24. crc_cnt <= 0;
  25. end
  26. else if(data_in_en && crc_cnt == 0) begin
  27. crc_reg <= swap_data^crc_reg;
  28. crc_cnt <= 1;
  29. end
  30. else if(crc_cnt == 9) begin
  31. crc_reg <= crc_reg;
  32. crc_cnt <= 0;
  33. end
  34. else if(crc_cnt !=0) begin
  35. crc_reg <= (crc_reg[7] == 0 ? crc_reg << 1 : (crc_reg << 1 ^ CRC8_PARAM));
  36. crc_cnt <= crc_cnt + 1;
  37. end
  38. else begin
  39. crc_reg <= crc_reg;
  40. crc_cnt <= 0;
  41. end
  42. end
  43. always @ (posedge sys_clk) begin
  44. if(sys_rst) begin
  45. data_out_en_reg <= 0;
  46. data_out_reg <= 0;
  47. end
  48. else if(crc_cnt == 9) begin
  49. data_out_en_reg <= 1;
  50. data_out_reg <= out_swap_en ? {crc_reg[0],crc_reg[1],crc_reg[2],crc_reg[3],crc_reg[4],crc_reg[5],crc_reg[6],crc_reg[7]}:crc_reg;
  51. end
  52. else begin
  53. data_out_en_reg <= 0;
  54. data_out_reg <= data_out_reg;
  55. end
  56. end
  57. assign data_out_en = data_out_en_reg;
  58. assign data_out = data_out_reg ^ DATA_XOROUT;
  59. endmodule
(2)CRC-16位实现
  1. module crc_16 #(
  2. parameter [15:0] CRC16_PARAM = 16'h8005,
  3. parameter [15:0] CRC_INIT = 16'h0000,
  4. parameter [15:0] DATA_XOROUT = 16'hFFFF
  5. )(
  6. input sys_clk,
  7. input sys_rst,
  8. input in_swap_en,
  9. input out_swap_en,
  10. input data_in_en,
  11. input [15:0] data_in,
  12. output data_out_en,
  13. output [15:0] data_out
  14. );
  15. wire [15:0] swap_data;
  16. reg [15:0] crc_reg = CRC_INIT;
  17. reg [7:0] crc_cnt = 0;
  18. reg data_out_en_reg = 0;
  19. reg [15:0] data_out_reg = 0;
  20. assign swap_data = in_swap_en ? {data_in[8],data_in[9],data_in[10],data_in[11],data_in[12],data_in[13],data_in[14],data_in[15],
  21. data_in[0],data_in[1],data_in[2],data_in[3],data_in[4],data_in[5],data_in[6],data_in[7]}:data_in;
  22. always @ (posedge sys_clk) begin
  23. if(sys_rst) begin
  24. crc_reg <= CRC_INIT;
  25. crc_cnt <= 0;
  26. end
  27. else if(data_in_en && crc_cnt == 0) begin
  28. crc_reg <={swap_data[15:8]^crc_reg[15:8],crc_reg[7:0]};
  29. crc_cnt <= 1;
  30. end
  31. else if(crc_cnt == 9) begin
  32. crc_reg <={swap_data[7:0]^crc_reg[15:8],crc_reg[7:0]};
  33. crc_cnt <= crc_cnt + 1;
  34. end
  35. else if(crc_cnt == 18) begin
  36. crc_reg <= crc_reg;
  37. crc_cnt <= 0;
  38. end
  39. else if(crc_cnt !=0) begin// && shift_en == 0) begin
  40. crc_reg <= (crc_reg[15] == 0 ? crc_reg << 1 : (crc_reg << 1 ^ CRC16_PARAM));
  41. crc_cnt <= crc_cnt + 1;
  42. end
  43. else begin
  44. crc_reg <= crc_reg;
  45. crc_cnt <= 0;
  46. end
  47. end
  48. always @ (posedge sys_clk) begin
  49. if(sys_rst) begin
  50. data_out_en_reg <= 0;
  51. data_out_reg <= 0;
  52. end
  53. else if(crc_cnt == 18) begin
  54. data_out_en_reg <= 1;
  55. data_out_reg <= out_swap_en ? {crc_reg[0],crc_reg[1],crc_reg[2],crc_reg[3],crc_reg[4],crc_reg[5],crc_reg[6],crc_reg[7],crc_reg[8],crc_reg[9],
  56. crc_reg[10],crc_reg[11],crc_reg[12],crc_reg[13],crc_reg[14],crc_reg[15]}:crc_reg;
  57. end
  58. else begin
  59. data_out_en_reg <= 0;
  60. data_out_reg <= data_out_reg;
  61. end
  62. end
  63. assign data_out_en = data_out_en_reg;
  64. assign data_out = data_out_reg ^ DATA_XOROUT;
  65. endmodule
(3)CRC-32位实现
  1. module crc_32 #(
  2. parameter [31:0] CRC32_PARAM = 32'h04C11DB7,
  3. parameter [31:0] CRC_INIT = 32'hFFFFFFFF,
  4. parameter [31:0] DATA_XOROUT = 32'hFFFFFFFF
  5. )(
  6. input sys_clk,
  7. input sys_rst,
  8. input in_swap_en,
  9. input out_swap_en,
  10. input data_in_en,
  11. input [31:0] data_in,
  12. output data_out_en,
  13. output [31:0] data_out
  14. );
  15. wire [31:0] swap_data;
  16. reg [31:0] crc_reg = CRC_INIT;
  17. reg [7:0] crc_cnt = 0;
  18. reg data_out_en_reg = 0;
  19. reg [31:0] data_out_reg = 0;
  20. assign swap_data = in_swap_en ? {data_in[24],data_in[25],data_in[26],data_in[27],data_in[28],data_in[29],data_in[30],data_in[31],
  21. data_in[16],data_in[17],data_in[18],data_in[19],data_in[20],data_in[21],data_in[22],data_in[23],
  22. data_in[8],data_in[9],data_in[10],data_in[11],data_in[12],data_in[13],data_in[14],data_in[15],
  23. data_in[0],data_in[1],data_in[2],data_in[3],data_in[4],data_in[5],data_in[6],data_in[7]}:data_in;
  24. always @ (posedge sys_clk) begin
  25. if(sys_rst) begin
  26. crc_reg <= CRC_INIT;
  27. crc_cnt <= 0;
  28. end
  29. else if(data_in_en && crc_cnt == 0) begin
  30. crc_reg <={swap_data[31:24]^crc_reg[31:24],crc_reg[23:0]};
  31. crc_cnt <= 1;
  32. end
  33. else if(crc_cnt == 9) begin
  34. crc_reg <={swap_data[23:16]^crc_reg[31:24],crc_reg[23:0]};
  35. crc_cnt <= crc_cnt + 1;
  36. end
  37. else if(crc_cnt == 18) begin
  38. crc_reg <={swap_data[15:8]^crc_reg[31:24],crc_reg[23:0]};
  39. crc_cnt <= crc_cnt + 1;
  40. end
  41. else if(crc_cnt == 27) begin
  42. crc_reg <={swap_data[7:0]^crc_reg[31:24],crc_reg[23:0]};
  43. crc_cnt <= crc_cnt + 1;
  44. end
  45. else if(crc_cnt == 36) begin
  46. crc_reg <= crc_reg;
  47. crc_cnt <= 0;
  48. end
  49. else if(crc_cnt !=0) begin// && shift_en == 0) begin
  50. crc_reg <= (crc_reg[31] == 0 ? crc_reg << 1 : (crc_reg << 1 ^ CRC32_PARAM));
  51. crc_cnt <= crc_cnt + 1;
  52. end
  53. else begin
  54. crc_reg <= crc_reg;
  55. crc_cnt <= 0;
  56. end
  57. end
  58. always @ (posedge sys_clk) begin
  59. if(sys_rst) begin
  60. data_out_en_reg <= 0;
  61. data_out_reg <= 0;
  62. end
  63. else if(crc_cnt == 36) begin
  64. data_out_en_reg <= 1;
  65. data_out_reg <= out_swap_en ? {crc_reg[0],crc_reg[1],crc_reg[2],crc_reg[3],crc_reg[4],crc_reg[5],crc_reg[6],crc_reg[7],
  66. crc_reg[8],crc_reg[9],crc_reg[10],crc_reg[11],crc_reg[12],crc_reg[13],crc_reg[14],crc_reg[15],
  67. crc_reg[16],crc_reg[17],crc_reg[18],crc_reg[19],crc_reg[20],crc_reg[21],crc_reg[22],crc_reg[23],
  68. crc_reg[24],crc_reg[25],crc_reg[26],crc_reg[27],crc_reg[28],crc_reg[29],crc_reg[30],crc_reg[31]}:crc_reg;
  69. end
  70. else begin
  71. data_out_en_reg <= 0;
  72. data_out_reg <= data_out_reg;
  73. end
  74. end
  75. assign data_out_en = data_out_en_reg;
  76. assign data_out = data_out_reg ^ DATA_XOROUT;
  77. endmodule

3.2 CRC并行实现

并行实现需要在网站生成计算 代码:OutputLogic.com » CRC Generator

计算流程:

a, 输入数据 翻转控制;

b,使用生成逻辑代码进行计算;

c, 对计算的CRC结果进行翻转处理;

d, 对输出的翻转数据进行异或数据处理;输出

说明:生成代码中CRC初值都为FFFF;需要根据具体设计修改;翻转控制,结果异或值等需要根据设计处理。

(1)CRC-8位实现:

实现多项式: 1+x^4+x^5+x^8

CRC初始值: 0x00

输出结果异或值:0x00

输入值使能:使能

输出值使能:使能

  1. module crc_8(
  2. input sys_clk,
  3. input sys_rst,
  4. input [7:0] data_in,
  5. input crc_en,
  6. output [7:0] crc_out
  7. );
  8. wire [7:0] swap_in_data;
  9. wire [7:0] swap_out_data;
  10. reg [7:0] lfsr_q,lfsr_c;
  11. assign swap_in_data = {data_in[0],data_in[1],data_in[2],data_in[3],data_in[4],data_in[5],data_in[6],data_in[7]};
  12. assign swap_out_data = {lfsr_q[0],lfsr_q[1],lfsr_q[2],lfsr_q[3],lfsr_q[4],lfsr_q[5],lfsr_q[6],lfsr_q[7]};
  13. assign crc_out = swap_out_data ^ 8'h00;
  14. //----------------------------------------------------------------------------------------------------------------------------------------
  15. always @(*) begin
  16. lfsr_c[0] = lfsr_q[0] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[6] ^ swap_in_data[0] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[6];
  17. lfsr_c[1] = lfsr_q[1] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[7] ^ swap_in_data[1] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[7];
  18. lfsr_c[2] = lfsr_q[2] ^ lfsr_q[5] ^ lfsr_q[6] ^ swap_in_data[2] ^ swap_in_data[5] ^ swap_in_data[6];
  19. lfsr_c[3] = lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[7] ^ swap_in_data[3] ^ swap_in_data[6] ^ swap_in_data[7];
  20. lfsr_c[4] = lfsr_q[0] ^ lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[7] ^ swap_in_data[0] ^ swap_in_data[3] ^ swap_in_data[6] ^ swap_in_data[7];
  21. lfsr_c[5] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[7] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[3] ^ swap_in_data[6] ^ swap_in_data[7];
  22. lfsr_c[6] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[7] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[4] ^ swap_in_data[7];
  23. lfsr_c[7] = lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[5] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[5];
  24. end // always
  25. always @(posedge sys_clk) begin
  26. if(sys_rst)
  27. lfsr_q <= {8{1'b0}};
  28. else if(crc_en)
  29. lfsr_q <= lfsr_c;
  30. else
  31. lfsr_q <= lfsr_q;
  32. end
  33. endmodule
(2)CRC-16位实现:

实现多项式: 1+x^2+x^15+x^16

CRC初始值: 0x0000

输出结果异或值:0xFFFF

输入值使能:使能

输出值使能:使能

  1. module crc_16(
  2. input sys_clk,
  3. input sys_rst,
  4. input [15:0] data_in,
  5. input crc_en,
  6. output [15:0] crc_out
  7. );
  8. wire [15:0] swap_in_data;
  9. wire [15:0] swap_out_data;
  10. reg [15:0] lfsr_q,lfsr_c;
  11. assign swap_in_data = {data_in[8],data_in[9],data_in[10],data_in[11],data_in[12],data_in[13],data_in[14],data_in[15],
  12. data_in[0],data_in[1],data_in[2],data_in[3],data_in[4],data_in[5],data_in[6],data_in[7]};
  13. assign swap_out_data = {lfsr_q[0],lfsr_q[1],lfsr_q[2],lfsr_q[3],lfsr_q[4],lfsr_q[5],lfsr_q[6],lfsr_q[7],
  14. lfsr_q[8],lfsr_q[9],lfsr_q[10],lfsr_q[11],lfsr_q[12],lfsr_q[13],lfsr_q[14],lfsr_q[15]};
  15. assign crc_out = swap_out_data ^ 16'hFFFF;
  16. //----------------------------------------------------------------------------------------------------------------------------------------
  17. always @(*) begin
  18. lfsr_c[0] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[15] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[9] ^ swap_in_data[10] ^ swap_in_data[11] ^ swap_in_data[12] ^ swap_in_data[13] ^ swap_in_data[15];
  19. lfsr_c[1] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[14] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[9] ^ swap_in_data[10] ^ swap_in_data[11] ^ swap_in_data[12] ^ swap_in_data[13] ^ swap_in_data[14];
  20. lfsr_c[2] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[14] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[14];
  21. lfsr_c[3] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[15] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[15];
  22. lfsr_c[4] = lfsr_q[2] ^ lfsr_q[3] ^ swap_in_data[2] ^ swap_in_data[3];
  23. lfsr_c[5] = lfsr_q[3] ^ lfsr_q[4] ^ swap_in_data[3] ^ swap_in_data[4];
  24. lfsr_c[6] = lfsr_q[4] ^ lfsr_q[5] ^ swap_in_data[4] ^ swap_in_data[5];
  25. lfsr_c[7] = lfsr_q[5] ^ lfsr_q[6] ^ swap_in_data[5] ^ swap_in_data[6];
  26. lfsr_c[8] = lfsr_q[6] ^ lfsr_q[7] ^ swap_in_data[6] ^ swap_in_data[7];
  27. lfsr_c[9] = lfsr_q[7] ^ lfsr_q[8] ^ swap_in_data[7] ^ swap_in_data[8];
  28. lfsr_c[10] = lfsr_q[8] ^ lfsr_q[9] ^ swap_in_data[8] ^ swap_in_data[9];
  29. lfsr_c[11] = lfsr_q[9] ^ lfsr_q[10] ^ swap_in_data[9] ^ swap_in_data[10];
  30. lfsr_c[12] = lfsr_q[10] ^ lfsr_q[11] ^ swap_in_data[10] ^ swap_in_data[11];
  31. lfsr_c[13] = lfsr_q[11] ^ lfsr_q[12] ^ swap_in_data[11] ^ swap_in_data[12];
  32. lfsr_c[14] = lfsr_q[12] ^ lfsr_q[13] ^ swap_in_data[12] ^ swap_in_data[13];
  33. lfsr_c[15] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[15] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[9] ^ swap_in_data[10] ^ swap_in_data[11] ^ swap_in_data[12] ^ swap_in_data[14] ^ swap_in_data[15];
  34. end // always
  35. always @(posedge sys_clk) begin
  36. if(sys_rst)
  37. lfsr_q <= {16{1'b0}};
  38. else if(crc_en)
  39. lfsr_q <= lfsr_c;
  40. else
  41. lfsr_q <= lfsr_q;
  42. end
  43. endmodule
(3)CRC-32位实现:

实现多项式: 1+x^1+x^2+x^4+x^5+x^7+x^8+x^10+x^11+x^12+x^16+x^22+x^23+x^26+x^32

CRC初始值: 0xFFFFFFFF

输出结果异或值:0xFFFFFFFF

输入值使能:使能

输出值使能:使能

  1. module crc_32(
  2. input sys_clk,
  3. input sys_rst,
  4. input [31:0] data_in,
  5. input crc_en,
  6. output [31:0] crc_out
  7. );
  8. wire [31:0] swap_in_data;
  9. wire [31:0] swap_out_data;
  10. reg [31:0] lfsr_q,lfsr_c;
  11. assign swap_in_data = {data_in[24],data_in[25],data_in[26],data_in[27],data_in[28],data_in[29],data_in[30],data_in[31],
  12. data_in[16],data_in[17],data_in[18],data_in[19],data_in[20],data_in[21],data_in[22],data_in[23],
  13. data_in[8],data_in[9],data_in[10],data_in[11],data_in[12],data_in[13],data_in[14],data_in[15],
  14. data_in[0],data_in[1],data_in[2],data_in[3],data_in[4],data_in[5],data_in[6],data_in[7]};
  15. assign swap_out_data = {lfsr_q[0],lfsr_q[1],lfsr_q[2],lfsr_q[3],lfsr_q[4],lfsr_q[5],lfsr_q[6],lfsr_q[7],
  16. lfsr_q[8],lfsr_q[9],lfsr_q[10],lfsr_q[11],lfsr_q[12],lfsr_q[13],lfsr_q[14],lfsr_q[15],
  17. lfsr_q[16],lfsr_q[17],lfsr_q[18],lfsr_q[19],lfsr_q[20],lfsr_q[21],lfsr_q[22],lfsr_q[23],
  18. lfsr_q[24],lfsr_q[25],lfsr_q[26],lfsr_q[27],lfsr_q[28],lfsr_q[29],lfsr_q[30],lfsr_q[31]};
  19. assign crc_out = swap_out_data ^ 32'hFFFFFFFF;
  20. //----------------------------------------------------------------------------------------------------------------------------------------
  21. always @(*) begin
  22. lfsr_c[0] = lfsr_q[0] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[12] ^ lfsr_q[16] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[26] ^ lfsr_q[28] ^ lfsr_q[29] ^ lfsr_q[30] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[6] ^ swap_in_data[9] ^ swap_in_data[10] ^ swap_in_data[12] ^ swap_in_data[16] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[26] ^ swap_in_data[28] ^ swap_in_data[29] ^ swap_in_data[30] ^ swap_in_data[31];
  23. lfsr_c[1] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[24] ^ lfsr_q[27] ^ lfsr_q[28] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[9] ^ swap_in_data[11] ^ swap_in_data[12] ^ swap_in_data[13] ^ swap_in_data[16] ^ swap_in_data[17] ^ swap_in_data[24] ^ swap_in_data[27] ^ swap_in_data[28];
  24. lfsr_c[2] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[13] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[24] ^ lfsr_q[26] ^ lfsr_q[30] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[9] ^ swap_in_data[13] ^ swap_in_data[14] ^ swap_in_data[16] ^ swap_in_data[17] ^ swap_in_data[18] ^ swap_in_data[24] ^ swap_in_data[26] ^ swap_in_data[30] ^ swap_in_data[31];
  25. lfsr_c[3] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[14] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[19] ^ lfsr_q[25] ^ lfsr_q[27] ^ lfsr_q[31] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[9] ^ swap_in_data[10] ^ swap_in_data[14] ^ swap_in_data[15] ^ swap_in_data[17] ^ swap_in_data[18] ^ swap_in_data[19] ^ swap_in_data[25] ^ swap_in_data[27] ^ swap_in_data[31];
  26. lfsr_c[4] = lfsr_q[0] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[6] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[15] ^ lfsr_q[18] ^ lfsr_q[19] ^ lfsr_q[20] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[29] ^ lfsr_q[30] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[6] ^ swap_in_data[8] ^ swap_in_data[11] ^ swap_in_data[12] ^ swap_in_data[15] ^ swap_in_data[18] ^ swap_in_data[19] ^ swap_in_data[20] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[29] ^ swap_in_data[30] ^ swap_in_data[31];
  27. lfsr_c[5] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[10] ^ lfsr_q[13] ^ lfsr_q[19] ^ lfsr_q[20] ^ lfsr_q[21] ^ lfsr_q[24] ^ lfsr_q[28] ^ lfsr_q[29] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[10] ^ swap_in_data[13] ^ swap_in_data[19] ^ swap_in_data[20] ^ swap_in_data[21] ^ swap_in_data[24] ^ swap_in_data[28] ^ swap_in_data[29];
  28. lfsr_c[6] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[14] ^ lfsr_q[20] ^ lfsr_q[21] ^ lfsr_q[22] ^ lfsr_q[25] ^ lfsr_q[29] ^ lfsr_q[30] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[11] ^ swap_in_data[14] ^ swap_in_data[20] ^ swap_in_data[21] ^ swap_in_data[22] ^ swap_in_data[25] ^ swap_in_data[29] ^ swap_in_data[30];
  29. lfsr_c[7] = lfsr_q[0] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[21] ^ lfsr_q[22] ^ lfsr_q[23] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[28] ^ lfsr_q[29] ^ swap_in_data[0] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[5] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[10] ^ swap_in_data[15] ^ swap_in_data[16] ^ swap_in_data[21] ^ swap_in_data[22] ^ swap_in_data[23] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[28] ^ swap_in_data[29];
  30. lfsr_c[8] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[17] ^ lfsr_q[22] ^ lfsr_q[23] ^ lfsr_q[28] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[8] ^ swap_in_data[10] ^ swap_in_data[11] ^ swap_in_data[12] ^ swap_in_data[17] ^ swap_in_data[22] ^ swap_in_data[23] ^ swap_in_data[28] ^ swap_in_data[31];
  31. lfsr_c[9] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[18] ^ lfsr_q[23] ^ lfsr_q[24] ^ lfsr_q[29] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[9] ^ swap_in_data[11] ^ swap_in_data[12] ^ swap_in_data[13] ^ swap_in_data[18] ^ swap_in_data[23] ^ swap_in_data[24] ^ swap_in_data[29];
  32. lfsr_c[10] = lfsr_q[0] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[5] ^ lfsr_q[9] ^ lfsr_q[13] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[19] ^ lfsr_q[26] ^ lfsr_q[28] ^ lfsr_q[29] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[5] ^ swap_in_data[9] ^ swap_in_data[13] ^ swap_in_data[14] ^ swap_in_data[16] ^ swap_in_data[19] ^ swap_in_data[26] ^ swap_in_data[28] ^ swap_in_data[29] ^ swap_in_data[31];
  33. lfsr_c[11] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[9] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[20] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[26] ^ lfsr_q[27] ^ lfsr_q[28] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[9] ^ swap_in_data[12] ^ swap_in_data[14] ^ swap_in_data[15] ^ swap_in_data[16] ^ swap_in_data[17] ^ swap_in_data[20] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[26] ^ swap_in_data[27] ^ swap_in_data[28] ^ swap_in_data[31];
  34. lfsr_c[12] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[21] ^ lfsr_q[24] ^ lfsr_q[27] ^ lfsr_q[30] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[9] ^ swap_in_data[12] ^ swap_in_data[13] ^ swap_in_data[15] ^ swap_in_data[17] ^ swap_in_data[18] ^ swap_in_data[21] ^ swap_in_data[24] ^ swap_in_data[27] ^ swap_in_data[30] ^ swap_in_data[31];
  35. lfsr_c[13] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[10] ^ lfsr_q[13] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[18] ^ lfsr_q[19] ^ lfsr_q[22] ^ lfsr_q[25] ^ lfsr_q[28] ^ lfsr_q[31] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[10] ^ swap_in_data[13] ^ swap_in_data[14] ^ swap_in_data[16] ^ swap_in_data[18] ^ swap_in_data[19] ^ swap_in_data[22] ^ swap_in_data[25] ^ swap_in_data[28] ^ swap_in_data[31];
  36. lfsr_c[14] = lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[14] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[19] ^ lfsr_q[20] ^ lfsr_q[23] ^ lfsr_q[26] ^ lfsr_q[29] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[11] ^ swap_in_data[14] ^ swap_in_data[15] ^ swap_in_data[17] ^ swap_in_data[19] ^ swap_in_data[20] ^ swap_in_data[23] ^ swap_in_data[26] ^ swap_in_data[29];
  37. lfsr_c[15] = lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[12] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[18] ^ lfsr_q[20] ^ lfsr_q[21] ^ lfsr_q[24] ^ lfsr_q[27] ^ lfsr_q[30] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[9] ^ swap_in_data[12] ^ swap_in_data[15] ^ swap_in_data[16] ^ swap_in_data[18] ^ swap_in_data[20] ^ swap_in_data[21] ^ swap_in_data[24] ^ swap_in_data[27] ^ swap_in_data[30];
  38. lfsr_c[16] = lfsr_q[0] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[8] ^ lfsr_q[12] ^ lfsr_q[13] ^ lfsr_q[17] ^ lfsr_q[19] ^ lfsr_q[21] ^ lfsr_q[22] ^ lfsr_q[24] ^ lfsr_q[26] ^ lfsr_q[29] ^ lfsr_q[30] ^ swap_in_data[0] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[8] ^ swap_in_data[12] ^ swap_in_data[13] ^ swap_in_data[17] ^ swap_in_data[19] ^ swap_in_data[21] ^ swap_in_data[22] ^ swap_in_data[24] ^ swap_in_data[26] ^ swap_in_data[29] ^ swap_in_data[30];
  39. lfsr_c[17] = lfsr_q[1] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[13] ^ lfsr_q[14] ^ lfsr_q[18] ^ lfsr_q[20] ^ lfsr_q[22] ^ lfsr_q[23] ^ lfsr_q[25] ^ lfsr_q[27] ^ lfsr_q[30] ^ lfsr_q[31] ^ swap_in_data[1] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[9] ^ swap_in_data[13] ^ swap_in_data[14] ^ swap_in_data[18] ^ swap_in_data[20] ^ swap_in_data[22] ^ swap_in_data[23] ^ swap_in_data[25] ^ swap_in_data[27] ^ swap_in_data[30] ^ swap_in_data[31];
  40. lfsr_c[18] = lfsr_q[2] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[10] ^ lfsr_q[14] ^ lfsr_q[15] ^ lfsr_q[19] ^ lfsr_q[21] ^ lfsr_q[23] ^ lfsr_q[24] ^ lfsr_q[26] ^ lfsr_q[28] ^ lfsr_q[31] ^ swap_in_data[2] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[10] ^ swap_in_data[14] ^ swap_in_data[15] ^ swap_in_data[19] ^ swap_in_data[21] ^ swap_in_data[23] ^ swap_in_data[24] ^ swap_in_data[26] ^ swap_in_data[28] ^ swap_in_data[31];
  41. lfsr_c[19] = lfsr_q[3] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[20] ^ lfsr_q[22] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[27] ^ lfsr_q[29] ^ swap_in_data[3] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[11] ^ swap_in_data[15] ^ swap_in_data[16] ^ swap_in_data[20] ^ swap_in_data[22] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[27] ^ swap_in_data[29];
  42. lfsr_c[20] = lfsr_q[4] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[12] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[21] ^ lfsr_q[23] ^ lfsr_q[25] ^ lfsr_q[26] ^ lfsr_q[28] ^ lfsr_q[30] ^ swap_in_data[4] ^ swap_in_data[8] ^ swap_in_data[9] ^ swap_in_data[12] ^ swap_in_data[16] ^ swap_in_data[17] ^ swap_in_data[21] ^ swap_in_data[23] ^ swap_in_data[25] ^ swap_in_data[26] ^ swap_in_data[28] ^ swap_in_data[30];
  43. lfsr_c[21] = lfsr_q[5] ^ lfsr_q[9] ^ lfsr_q[10] ^ lfsr_q[13] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[22] ^ lfsr_q[24] ^ lfsr_q[26] ^ lfsr_q[27] ^ lfsr_q[29] ^ lfsr_q[31] ^ swap_in_data[5] ^ swap_in_data[9] ^ swap_in_data[10] ^ swap_in_data[13] ^ swap_in_data[17] ^ swap_in_data[18] ^ swap_in_data[22] ^ swap_in_data[24] ^ swap_in_data[26] ^ swap_in_data[27] ^ swap_in_data[29] ^ swap_in_data[31];
  44. lfsr_c[22] = lfsr_q[0] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[12] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[18] ^ lfsr_q[19] ^ lfsr_q[23] ^ lfsr_q[24] ^ lfsr_q[26] ^ lfsr_q[27] ^ lfsr_q[29] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[9] ^ swap_in_data[11] ^ swap_in_data[12] ^ swap_in_data[14] ^ swap_in_data[16] ^ swap_in_data[18] ^ swap_in_data[19] ^ swap_in_data[23] ^ swap_in_data[24] ^ swap_in_data[26] ^ swap_in_data[27] ^ swap_in_data[29] ^ swap_in_data[31];
  45. lfsr_c[23] = lfsr_q[0] ^ lfsr_q[1] ^ lfsr_q[6] ^ lfsr_q[9] ^ lfsr_q[13] ^ lfsr_q[15] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[19] ^ lfsr_q[20] ^ lfsr_q[26] ^ lfsr_q[27] ^ lfsr_q[29] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[1] ^ swap_in_data[6] ^ swap_in_data[9] ^ swap_in_data[13] ^ swap_in_data[15] ^ swap_in_data[16] ^ swap_in_data[17] ^ swap_in_data[19] ^ swap_in_data[20] ^ swap_in_data[26] ^ swap_in_data[27] ^ swap_in_data[29] ^ swap_in_data[31];
  46. lfsr_c[24] = lfsr_q[1] ^ lfsr_q[2] ^ lfsr_q[7] ^ lfsr_q[10] ^ lfsr_q[14] ^ lfsr_q[16] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[20] ^ lfsr_q[21] ^ lfsr_q[27] ^ lfsr_q[28] ^ lfsr_q[30] ^ swap_in_data[1] ^ swap_in_data[2] ^ swap_in_data[7] ^ swap_in_data[10] ^ swap_in_data[14] ^ swap_in_data[16] ^ swap_in_data[17] ^ swap_in_data[18] ^ swap_in_data[20] ^ swap_in_data[21] ^ swap_in_data[27] ^ swap_in_data[28] ^ swap_in_data[30];
  47. lfsr_c[25] = lfsr_q[2] ^ lfsr_q[3] ^ lfsr_q[8] ^ lfsr_q[11] ^ lfsr_q[15] ^ lfsr_q[17] ^ lfsr_q[18] ^ lfsr_q[19] ^ lfsr_q[21] ^ lfsr_q[22] ^ lfsr_q[28] ^ lfsr_q[29] ^ lfsr_q[31] ^ swap_in_data[2] ^ swap_in_data[3] ^ swap_in_data[8] ^ swap_in_data[11] ^ swap_in_data[15] ^ swap_in_data[17] ^ swap_in_data[18] ^ swap_in_data[19] ^ swap_in_data[21] ^ swap_in_data[22] ^ swap_in_data[28] ^ swap_in_data[29] ^ swap_in_data[31];
  48. lfsr_c[26] = lfsr_q[0] ^ lfsr_q[3] ^ lfsr_q[4] ^ lfsr_q[6] ^ lfsr_q[10] ^ lfsr_q[18] ^ lfsr_q[19] ^ lfsr_q[20] ^ lfsr_q[22] ^ lfsr_q[23] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[26] ^ lfsr_q[28] ^ lfsr_q[31] ^ swap_in_data[0] ^ swap_in_data[3] ^ swap_in_data[4] ^ swap_in_data[6] ^ swap_in_data[10] ^ swap_in_data[18] ^ swap_in_data[19] ^ swap_in_data[20] ^ swap_in_data[22] ^ swap_in_data[23] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[26] ^ swap_in_data[28] ^ swap_in_data[31];
  49. lfsr_c[27] = lfsr_q[1] ^ lfsr_q[4] ^ lfsr_q[5] ^ lfsr_q[7] ^ lfsr_q[11] ^ lfsr_q[19] ^ lfsr_q[20] ^ lfsr_q[21] ^ lfsr_q[23] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[26] ^ lfsr_q[27] ^ lfsr_q[29] ^ swap_in_data[1] ^ swap_in_data[4] ^ swap_in_data[5] ^ swap_in_data[7] ^ swap_in_data[11] ^ swap_in_data[19] ^ swap_in_data[20] ^ swap_in_data[21] ^ swap_in_data[23] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[26] ^ swap_in_data[27] ^ swap_in_data[29];
  50. lfsr_c[28] = lfsr_q[2] ^ lfsr_q[5] ^ lfsr_q[6] ^ lfsr_q[8] ^ lfsr_q[12] ^ lfsr_q[20] ^ lfsr_q[21] ^ lfsr_q[22] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[26] ^ lfsr_q[27] ^ lfsr_q[28] ^ lfsr_q[30] ^ swap_in_data[2] ^ swap_in_data[5] ^ swap_in_data[6] ^ swap_in_data[8] ^ swap_in_data[12] ^ swap_in_data[20] ^ swap_in_data[21] ^ swap_in_data[22] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[26] ^ swap_in_data[27] ^ swap_in_data[28] ^ swap_in_data[30];
  51. lfsr_c[29] = lfsr_q[3] ^ lfsr_q[6] ^ lfsr_q[7] ^ lfsr_q[9] ^ lfsr_q[13] ^ lfsr_q[21] ^ lfsr_q[22] ^ lfsr_q[23] ^ lfsr_q[25] ^ lfsr_q[26] ^ lfsr_q[27] ^ lfsr_q[28] ^ lfsr_q[29] ^ lfsr_q[31] ^ swap_in_data[3] ^ swap_in_data[6] ^ swap_in_data[7] ^ swap_in_data[9] ^ swap_in_data[13] ^ swap_in_data[21] ^ swap_in_data[22] ^ swap_in_data[23] ^ swap_in_data[25] ^ swap_in_data[26] ^ swap_in_data[27] ^ swap_in_data[28] ^ swap_in_data[29] ^ swap_in_data[31];
  52. lfsr_c[30] = lfsr_q[4] ^ lfsr_q[7] ^ lfsr_q[8] ^ lfsr_q[10] ^ lfsr_q[14] ^ lfsr_q[22] ^ lfsr_q[23] ^ lfsr_q[24] ^ lfsr_q[26] ^ lfsr_q[27] ^ lfsr_q[28] ^ lfsr_q[29] ^ lfsr_q[30] ^ swap_in_data[4] ^ swap_in_data[7] ^ swap_in_data[8] ^ swap_in_data[10] ^ swap_in_data[14] ^ swap_in_data[22] ^ swap_in_data[23] ^ swap_in_data[24] ^ swap_in_data[26] ^ swap_in_data[27] ^ swap_in_data[28] ^ swap_in_data[29] ^ swap_in_data[30];
  53. lfsr_c[31] = lfsr_q[5] ^ lfsr_q[8] ^ lfsr_q[9] ^ lfsr_q[11] ^ lfsr_q[15] ^ lfsr_q[23] ^ lfsr_q[24] ^ lfsr_q[25] ^ lfsr_q[27] ^ lfsr_q[28] ^ lfsr_q[29] ^ lfsr_q[30] ^ lfsr_q[31] ^ swap_in_data[5] ^ swap_in_data[8] ^ swap_in_data[9] ^ swap_in_data[11] ^ swap_in_data[15] ^ swap_in_data[23] ^ swap_in_data[24] ^ swap_in_data[25] ^ swap_in_data[27] ^ swap_in_data[28] ^ swap_in_data[29] ^ swap_in_data[30] ^ swap_in_data[31];
  54. end // always
  55. always @(posedge sys_clk) begin
  56. if(sys_rst)
  57. lfsr_q <= {32{1'b1}};
  58. else if(crc_en)
  59. lfsr_q <= lfsr_c;
  60. else
  61. lfsr_q <= lfsr_q;
  62. end
  63. endmodule
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/671684
推荐阅读
相关标签
  

闽ICP备14008679号