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 rst
if(rst) begin
hash_complete<=0;
crc_16<=0;
temp<=0;
temp_flag<=0;
end
else 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
end
else if(hash_enable)begin
temp<=stemp;
temp_flag<=1;
end
else begin
hash_complete<=0;
temp_flag<=0;
end
end
endmodule

FPGA CRC-16/XMODEM x16+x12+x5+1的更多相关文章

  1. CRC-16/XMODE X16+X12+X5+1 C#、C和java环境下实现

    private byte[] CRC(byte[] x, int len) //CRC校验函数 { ]; UInt16 crc = ; byte da; ; UInt16[] yu = { 0x000 ...

  2. 关于FPGA设计16位乘法器的两…

    原文地址:关于FPGA设计16位乘法器的两种算法作者:ChrisChan 部分原代码如下: 用特权的右移算法虽复杂点,但节省不少LEs,如下图: 用左移算法尽管浅显易懂,但因每次都会从最右端移位,会占 ...

  3. CRC(16位)多项式为 X16+X15+X2+1

    其对应校验二进制位列为1 1000 0000 0000 0101,可这有17位啊,我怎么和16位信息进行异或啊?是不是不要最高位的1 你没有弄明白crc的意思.这17位后面再添上16个零,然后开始抑或 ...

  4. C# CRC - 16

    using System; static class Program { static void Main() { string input = "8000"; var bytes ...

  5. Modbus CRC 16 (C#)

    算法 1.预置一个值为 0xFFFF 的 16 位寄存器,此寄存器为 CRC 寄存器. 2.把第 1 个 8 位二进制数据(即通信消息帧的第 1 个字节)与 16 位的 CRC 寄存器相异或,异或的结 ...

  6. 基于FPGA的16阶级联型iir带通滤波器实现

    警告 此文章将耗费你成吨的流量,请wifi下阅读,造成的流量浪费本人不承担任何责任.初版源代码获取(请勿用作他用,仅供学习):https://gitee.com/kingstacker/iir.git ...

  7. HJ212 CRC 16 (C#)

    算法 CRC16 校验寄存器赋值为 0xFFFF: 取被校验串的第一个字节赋值给临时寄存器: 临时寄存器与 CRC16 校验寄存器的高位字节进行"异或"运算,赋值给 CRC16 校 ...

  8. CRC全套~~~ 转载

    经测试CRC16-CCITT是可以了,其它暂时没有测试哦. 00 0E 00 01 00 01 20 17 12 26 20 19 16 01 00 00 01 01 00 00 00 00 00 0 ...

  9. 用C#实现的几种常用数据校验方法整理(CRC校验;LRC校验;BCC校验;累加和校验)

    CRC即循环冗余校验码(Cyclic Redundancy Check):是数据通信领域中最常用的一种查错校验码,其特征是信息字段和校验字段的长度可以任意选定.循环冗余检查(CRC)是一种数据传输检错 ...

随机推荐

  1. leetcode1143 Longest Common Subsequence

    """ Given two strings text1 and text2, return the length of their longest common subs ...

  2. oracle进入CDB

    第一步:使用sys登陆 CONN sys/change_on_install AS SYSDBA; 第二步:查看现在的容器名称 SHOW con_name; 第三步:改变容器为PDB ALTER SE ...

  3. Delphi另一个多线程函数:BeginThread用法

    Delphi另一个多线程函数:BeginThread━━━━━━━━━━━━━━━━━━━━━━━━━━ Delphi也提供了一个相同功能的类似函数:function BeginThread(    ...

  4. net.sf.json.JSONObject maven下载到了但是java后台一直用不了问题

    需求,实体转JSON,然后用到JSONObject转JSON,但是我向下面这样引入,后台就是用不了,还是报红, <dependency> <groupId>net.sf.jso ...

  5. 解决物理机U盘安装Kali Linux2018.1,光驱无法加载问题

    1.无效的方法: (1)执行 df -m,然后查看U盘设备是否挂载到了/media,导致cd-rom不能被挂载,执行 umount  /media. (2)在光驱加载安装界面,把U盘拔下换到电脑的另外 ...

  6. 破解centos7 密码

    1.在CentOS7的启动选项,按“e”选择编辑启动选项2.进入下图画面,点下箭头直到看到“linux162174542514”,按end键跳到行尾3.在行尾加上“rd.break”,并敲击键盘“ct ...

  7. hive表字段注释显示乱码问题

    创建了一张hive表,对字段增加了注释,比如comment '注释内容' 之类的,但是在hive client查看时候却是乱码 比如: create table test_ultraedit ( id ...

  8. Spark 资源调度 与 任务调度

    Spark 资源调度与任务调度的流程(Standalone): 启动集群后, Worker 节点会向 Master 节点汇报资源情况, Master掌握了集群资源状况. 当 Spark 提交一个 Ap ...

  9. JAVA的控制结构

    一.控制结构 1.控制结构概述 控制结构是控制程序如何运行的特殊的语句结构.控制结构可以分为:顺序控制结构,分支控制结构和循环控制结构. 2.顺序控制结构 除了分支控制结构和循环控制结构之外的语句都是 ...

  10. archlinux下安装mysql

    mysql的安装 这里安装的是mariadb一个mysql的开源版本,实际使用体验没有差别 1. 安装Maria DB sudo pacman -S mariadb 2. 配置目录 sudo mari ...