[独创算法] HotCRC CRC8R_8C_00_00 FPGA模块 HotPower@163.com(菜农独创)

[复制链接]
 楼主| hotpower 发表于 2023-9-21 10:49 | 显示全部楼层 |阅读模式
本帖最后由 hotpower 于 2023-9-21 11:19 编辑
  1. /*-----------------------------------------------------------------------------------------------
  2.       HotCRC CRC8R_8C_00_00 FPGA模块 HotPower[url=home.php?mod=space&uid=516618]@163.com[/url] 2023-09-21 10:49:06
  3. -----------------------------------------------------------------------------------------------*/
  4. module CRC8R_8C(clk, rst, data, outcrc8)
  5. input clk, rst;
  6. input [7:0] data;
  7. output reg[7:0] outcrc8;
  8. reg [7:0] crc8;

  9. task CRC8R_8C;
  10. inout[7:0] crc8;
  11. input[7:0] indata;
  12.     crc8 = CRC8R_8C_Table(crc8 ^ indata);
  13. endtask

  14. function [7:0] CRC8R_8C_Table;
  15.     input [7:0] data;
  16.     CRC8R_8C_Table = CRC8R_8C_Table0(data[1:0]) ^ CRC8R_8C_Table1(data[3:2]) ^ CRC8R_8C_Table2(data[5:4]) ^ CRC8R_8C_Table3(data[7:6]);
  17. endfunction

  18. function [7:0] CRC8R_8C_Table0;
  19.     input[1:0] data;
  20.     case(data)
  21.         2'b00: CRC8R_8C_Table0 = 8'h00; 2'b01: CRC8R_8C_Table0 = 8'h5E; 2'b10: CRC8R_8C_Table0 = 8'hBC; 2'b11: CRC8R_8C_Table0 = 8'hE2;
  22.         default: CRC8R_8C_Table0 = 8'h00;
  23.     endcase
  24. endfunction

  25. function [7:0] CRC8R_8C_Table1;
  26.     input[1:0] data;
  27.     case(data)
  28.         2'b00: CRC8R_8C_Table1 = 8'h00; 2'b01: CRC8R_8C_Table1 = 8'h61; 2'b10: CRC8R_8C_Table1 = 8'hC2; 2'b11: CRC8R_8C_Table1 = 8'hA3;
  29.         default: CRC8R_8C_Table1 = 8'h00;
  30.     endcase
  31. endfunction

  32. function [7:0] CRC8R_8C_Table2;
  33.     input[1:0] data;
  34.     case(data)
  35.         2'b00: CRC8R_8C_Table2 = 8'h00; 2'b01: CRC8R_8C_Table2 = 8'h9D; 2'b10: CRC8R_8C_Table2 = 8'h23; 2'b11: CRC8R_8C_Table2 = 8'hBE;
  36.         default: CRC8R_8C_Table2 = 8'h00;
  37.     endcase
  38. endfunction

  39. function [7:0] CRC8R_8C_Table3;
  40.     input[1:0] data;
  41.     case(data)
  42.         2'b00: CRC8R_8C_Table3 = 8'h00; 2'b01: CRC8R_8C_Table3 = 8'h46; 2'b10: CRC8R_8C_Table3 = 8'h8C; 2'b11: CRC8R_8C_Table3 = 8'hCA;
  43.         default: CRC8R_8C_Table3 = 8'h00;
  44.     endcase
  45. endfunction


  46. always @(posedge clk or negedge rst)
  47. begin
  48.     if (!rst)
  49.     begin
  50.         crc8 <= 8'h00;
  51.     end
  52.     else
  53.     begin
  54.         CRC8R_8(crc8, data);
  55.         outcrc8 <= crc8;
  56.         crc8 <= crc8;
  57.     end
  58. end
  59. endmodule


   
HotCRC CRC8R_8C_00_00 FPGA模块 HotPower@163.com(源码自动生成).png
微信扫码截图.jpg
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:[url=http://www.21ic.com/tools/HotWC3_V1.23.html]

1460

主题

21619

帖子

508

粉丝
快速回复 在线客服 返回列表 返回顶部
个人签名:[url=http://www.21ic.com/tools/HotWC3_V1.23.html]

1460

主题

21619

帖子

508

粉丝
快速回复 在线客服 返回列表 返回顶部