前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CRC16 编码器的Verilog HDL 实现

CRC16 编码器的Verilog HDL 实现

作者头像
瓜大三哥
发布2018-02-24 17:20:03
2.4K0
发布2018-02-24 17:20:03
举报
文章被收录于专栏:瓜大三哥瓜大三哥

CRC-16 码采用的生成多项式为

代码语言:js
复制
G(x) = x16 + x15 + x2 +1
module crc_16(
clk,rst,x,crc_reg,crc_s
    );
 input clk;
 input rst;
 input x;//serial input
 output [15:0]crc_reg;
 output crc_s;//the synchronous signal
 reg [15:0]crc_reg;
 reg [3:0]count;
 reg crc_s; 
 wire [15:0]crc_enc;
 always @( posedge clk)
 begin
if(!rst)
begin
crc_reg<=16'b0;
count<=4'b0;
end
else
begin
crc_reg<=crc_enc;
count<=count+1;
if(count==0)
crc_s<=0;//the low level synchronous enable signal
else
crc_s<=1;
end
 end
 assign crc_enc[0]=crc_reg[15]^x;
 assign crc_enc[1]=crc_reg[0];
 assign crc_enc[2]=crc_reg[1]^crc_reg[15]^x;
 assign crc_enc[14:3]=crc_reg[13:2];
 assign crc_enc[15]=crc_reg[15]^crc_reg[14]^x;
endmodule
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2016-06-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 瓜大三哥 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • ?
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档