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. 010.Oracle数据库 , ORDER BY 按升序降序排序

    /*Oracle数据库查询日期在两者之间*/ SELECT DISTINCT ATA FROM LM_FAULT WHERE ( OCCUR_DATE BETWEEN to_date( '2017-0 ...

  2. 配置gem5-gpu docker版

    1 安装docker:wget -qO- https://get.docker.com/ | sh,启动服务:sudo service docker start 2 把非root用户添加到docker ...

  3. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 字体图标(Glyphicons):glyphicon glyphicon-fast-forward

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...

  4. NO15 第一关课后考试

    第一关课后考试: 1.创建目录/data/oldboy,并且在该目录下创建文件oldboy.txt,然后在文件oldboy.txt里写如内容:inet addr:10.0.0.8 Bcast:10.0 ...

  5. [BJDCTF2020]EasySearch

    0x00 知识点 Apache SSI 远程命令执行漏洞 链接: https://www.cnblogs.com/yuzly/p/11226439.html 当目标服务器开启了SSI与CGI支持,我们 ...

  6. python --- unittest如何传cookies

    1. #将CookieJar转为字典: cookies = requests.utils.dict_from_cookiejar(r.cookies) #将字典转为CookieJar: cookies ...

  7. DNS原理和智能DNS及CDN

    CDN是什么 CDN(Content Delivery Network)是内容分发网络. 作用: 使用户可以就近取的所需要的内容,加速用户访问网站资源的速度.物理距离更近,响应速度更快.拦截部分网络请 ...

  8. tools.eclipse.内存配置

    环境:jdk1.7+eclipse luna 选择:Run ->Run Configurations, 在弹出框右侧中选择Arguments, 在VM arguments最后加入 -Xms256 ...

  9. 【转】ASP.NET Core 2.0中的HttpContext

      ASP.NET Core 2.0中的HttpContext相较于ASP.NET Framework有一些变化,这边列出一些之间的区别.   在ASP.NET Framework中的 System. ...

  10. spark-submit脚本分析

    执行任务 ./spark-submit \ --class cn.com.dtmobile.spark.DebugTest \ --master yarn \ --deploy-mode client ...