module crc_16(input clk,input [47:0]mac,input rst,input hash_enable,//哈希控制器使能位output reg hash_complete,//哈希转换完成标志位output reg [15:0]crc_16  );wire[63:0]stemp; reg[63:0]temp=0;reg temp_flag;parameter polynomial=17'b1_0001_0000_0010_0001;assign stemp={mac,16'b0000000000000000};always @ (*) begin//posedge clk or negedge rstif(rst) beginhash_complete<=0;crc_16<=0;               temp<=0; temp_flag<=0;endelse if(hash_enable && temp_flag)begin           if(temp[63]) temp[63:47]<=temp[63:47]^polynomial;else if(temp[62]) temp[62:46]<=temp[62:46]^polynomial;else if(temp[61]) temp[61:45]<=temp[61:45]^polynomial;else if(temp[60]) temp[60:44]<=temp[60:44]^polynomial;else if(temp[59]) temp[59:43]<=temp[59:43]^polynomial;else if(temp[58]) temp[58:42]<=temp[58:42]^polynomial;else if(temp[57]) temp[57:41]<=temp[57:41]^polynomial;else if(temp[56]) temp[56:40]<=temp[56:40]^polynomial;else if(temp[55]) temp[55:39]<=temp[55:39]^polynomial;else if(temp[54]) temp[54:38]<=temp[54:38]^polynomial;else if(temp[53]) temp[53:37]<=temp[53:37]^polynomial;else if(temp[52]) temp[52:36]<=temp[52:36]^polynomial;else if(temp[51]) temp[51:35]<=temp[51:35]^polynomial;else if(temp[50]) temp[50:34]<=temp[50:34]^polynomial;else if(temp[49]) temp[49:33]<=temp[49:33]^polynomial;else if(temp[48]) temp[48:32]<=temp[48:32]^polynomial;else if(temp[47]) temp[47:31]<=temp[47:31]^polynomial;else if(temp[46]) temp[46:30]<=temp[46:30]^polynomial;else if(temp[45]) temp[45:29]<=temp[45:29]^polynomial;else if(temp[44]) temp[44:28]<=temp[44:28]^polynomial;else if(temp[43]) temp[43:27]<=temp[43:27]^polynomial;else if(temp[42]) temp[42:26]<=temp[42:26]^polynomial;else if(temp[41]) temp[41:25]<=temp[41:25]^polynomial;else if(temp[40]) temp[40:24]<=temp[40:24]^polynomial;else if(temp[39]) temp[39:23]<=temp[39:23]^polynomial;else if(temp[38]) temp[38:22]<=temp[38:22]^polynomial;else if(temp[37]) temp[37:21]<=temp[37:21]^polynomial;else if(temp[36]) temp[36:20]<=temp[36:20]^polynomial;else if(temp[35]) temp[35:19]<=temp[35:19]^polynomial;else if(temp[34]) temp[34:18]<=temp[34:18]^polynomial;else if(temp[33]) temp[33:17]<=temp[33:17]^polynomial;else if(temp[32]) temp[32:16]<=temp[32:16]^polynomial;else if(temp[31]) temp[31:15]<=temp[31:15]^polynomial;else if(temp[30]) temp[30:14]<=temp[30:14]^polynomial;else if(temp[29]) temp[29:13]<=temp[29:13]^polynomial;else if(temp[28]) temp[28:12]<=temp[28:12]^polynomial;else if(temp[27]) temp[27:11]<=temp[27:11]^polynomial;else if(temp[26]) temp[26:10]<=temp[26:10]^polynomial;else if(temp[25]) temp[25:9]<=temp[25:9]^polynomial;else if(temp[24]) temp[24:8]<=temp[24:8]^polynomial;else if(temp[23]) temp[23:7]<=temp[23:7]^polynomial;else if(temp[22]) temp[22:6]<=temp[22:6]^polynomial;else if(temp[21]) temp[21:5]<=temp[21:5]^polynomial;else if(temp[20]) temp[20:4]<=temp[20:4]^polynomial;else if(temp[19]) temp[19:3]<=temp[19:3]^polynomial;else if(temp[18]) temp[18:2]<=temp[18:2]^polynomial;else if(temp[17]) temp[17:1]<=temp[17:1]^polynomial;else if(temp[16]) temp[16:0]<=temp[16:0]^polynomial;else begin  crc_16<=temp[15:0];  hash_complete <= 1;end               endelse if(hash_enable)begintemp<=stemp;temp_flag<=1;endelse begin hash_complete<=0;temp_flag<=0;endend
endmodule

FPGA CRC-16/XMODEM x16+x12+x5+1相关推荐

  1. java crc-16校验位 xmodem x16+x12+x5+1(0x11021)实现

    由于近期和硬件设备进行通信.涉及到了crc校验位.设备要求crc-16/xmodem进行校验. public static int CRC_XModem(byte[] bytes) {// initi ...

  2. C++ CRC校验 CRC16 CCITT FALSE x16 + x12 + x5 + 1

    以下样例为ASCII 请注意 //CRC - 16 / CCITT - FALSE  x16 + x12 + x5 + 1 unsigned short crc16(const unsigned ch ...

  3. crc 16 1021 java_【软件升级】CCITT标准CRC16(1021)算法 Java代码【转】

    转自https://blog.csdn.net/ywb201314/article/details/52083036 package com.jst.util; /** * CRC-CCITT 算法校 ...

  4. 【 FPGA 】16点并行DIT FFT的实现

    目录 整体架构介绍 旋转因子介绍 代码文件结构 重点难点易错点 整体架构介绍 16点并行FFT分为4级蝶形运算,每一级蝶形运算有一个基本的蝶形单元: 如下是16点DIT FFT的数据流图: 可见,第0 ...

  5. 从底层结构开始学习FPGA(16)----PLL/MMCM IP的定制与测试

    目录 系列目录与传送门 1.PLL IP的定制 ①.第一页 ②.第二页 ③.第三页 ④.第四页 ⑤.第五页 2.PLL IP的例化与测试 2.1.例化一个PLL IP核 2.2.编写testbench ...

  6. CRC-16原理及通用的16位CRC校验算法代码

    CRC-16原理及通用的16位CRC校验算法代码 循环冗余码校验英文名称为Cyclical Redundancy Check,简称CRC.它是利用除法及余数的原理来作错误侦测(Error Detect ...

  7. TPS929120的CRC校验的三种实现方法

    文章目录 CRC基础知识 CRC概念 CRC参数模型 常用的21个标准CRC参数模型: TPS929120的CRC值计算方式 CRC参数: 算法图: 计算方法一: 计算步骤: 实现代码为: 计算方法二 ...

  8. gfp 通用成帧程序 帧结构 校验 crc 多项式 加扰

    参考文档:G.7041Y.1303 GFP帧长最大为65535字节,GFP帧结构如下: //-------------核心报头---------------- PLI:净荷长度指示符,表示4个字节的核 ...

  9. 来搞清楚CRC校验的原理和实现

    在MIPI_CSI-2协议里payload数据的校验使用了CRC校验,但是关于CRC校验只知其一,或者说只知的还不到其一,因此非常有必要搞清楚它,自然的我搜查了一些博主的文章尝试得到答案,最终在知乎前 ...

最新文章

  1. python技巧提升
  2. 流程表单中js如何清空SheetUser控件数据?
  3. MATLAB某数组间隔取值
  4. Activiti 初步学习
  5. Excel中删除链接
  6. 【经典回放】多种语言系列数据结构线性表之一:顺序表
  7. mysql 排序 过滤_【MYSQL】-3 排序与过滤
  8. 显示照片的二维直方图
  9. div中的p标签于img设置同一水平_前端工程师:css中一些需要注意的东西
  10. python一对一教学质量怎么样_Python大牛开小灶,一对一问答
  11. Anders Hejlsberg语录
  12. 如何优化 Java 性能? 1
  13. 7月6号奥特曼服务器维护中,泰迦奥特曼:7月6号开播,泰迦是泰罗儿子,优幸可变为三个奥特曼...
  14. 前端工作汇报PPT技巧
  15. 药品质量检测方法:电感耦合等离子体质谱仪
  16. 玩客云宝塔面板安装到外接硬盘
  17. 找到100亿个URL中重复的URL
  18. 使用Visio画各种可视化的流程图之PERT图和日历图
  19. 最好的开源App锦集
  20. 什么是语言?什么是自然语言?

热门文章

  1. Jvm基础篇-01-Java虚拟机家族起源
  2. YOLOV5训练自己目标检测模型和cpu检测
  3. 2021年熔化焊接与热切割找答案及熔化焊接与热切割模拟考试软件
  4. FlashFXP 3.6 Final(正式版)注册码
  5. perl语言linux培训,linux-Perl-语言入门
  6. Handler源码分析(超详细的)
  7. 论文解析:Inception-V3设计思路分析
  8. 自定义搜索引擎_如何创建自己的自定义Google搜索引擎
  9. Vue v-show
  10. IDEA搭建Struts 2框架以及Struts测试实例