第一范文网 - 专业文章范例文档资料分享平台

循环冗余校验(CRC)模块设计 - 图文

来源:用户分享 时间:2025/5/24 15:06:00 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

《EDA技术》实验报告

实验名称: 循环冗余校验(CRC)模块设计 姓名:xxx 班级:xxxx 学号:xxxxx 实验日期: 指导教师:

一、 实验设计要求

编译示例文件,给出仿真波形。建立一个新的设计,调入crcm模块。把其中的CRC校验生成模块和CRC校验查错模块连接在一起,协调工作。引出必要的信号,锁定引脚,并在EDA实验系统上实现。

二、设计原理

电路结构图或原理图: Crcm:

Crcma:

电路功能描述:把crcm模块的datacrco和datacrci连接起来,hrecv和hsend连接起来,输入有效数据后CRC校验生成模块对数据进行特殊运算,产生5位校验码,并和原数据并接成17位传输数据,CRC校验查错模块取出传输数据后12位并对它进行同样的特殊运算,得到5位校验码,于传输数据钱5位比较,如果一样那么传输无误,不一样说明数据在传输途中错误了。

三、实验程序

程序一: library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all;

entity crcm is

port(clk,hrecv,datald,rst:in std_logic;

sdata:in std_logic_vector(11 downto 0); datacrco:out std_logic_vector(16 downto 0); datacrci:in std_logic_vector(16 downto 0); rdata:out std_logic_vector(11 downto 0); datafini:out std_logic; error0,hsend:out std_logic); end crcm;

architecture comm of crcm is

constant multi_coef: std_logic_vector(5 downto 0) :=\ signal cnt,rcnt:std_logic_vector(4 downto 0);

signal dtemp,sdatam,rdtemp:std_logic_vector(11 downto 0); signal rdatacrc:std_logic_vector(16 downto 0); signal st,rt:std_logic; begin

process(rst,clk)

variable crcvar :std_logic_vector(5 downto 0); begin

if rst ='1' then st <='0' ;

elsif(clk'event and clk ='1')then

if(st = '0' and datald ='1') then dtemp <= sdata; sdatam <= sdata;cnt <= (others=>'0'); hsend<='0'; st<='1'; elsif(st ='1' and cnt < 7) then cnt <= cnt + 1;

if(dtemp(11)='1') then crcvar :=dtemp(11 downto 6)xor multi_coef; dtemp <= crcvar(4 downto 0) & dtemp(5 downto 0) & '0'; else dtemp <= dtemp(10 downto 0) & '0';end if;

elsif(st='1' and cnt=7)then datacrco<=sdatam & dtemp(11 downto 7); hsend <='1';cnt <=cnt + 1;

elsif(st='1' and cnt =8) then hsend <= '0';st <= '0'; end if; end if; end process;

process(rst,hrecv,clk)

variable rcrcvar : std_logic_vector(5 downto 0); begin

if rst ='1' then rt <='0';

elsif(clk'event and clk ='1')then

if(rt = '0' and hrecv ='1')then rdtemp <=datacrci(16 downto 5); rdatacrc <=datacrci;rcnt <=(others=>'0');error0<= '0';rt<='1'; elsif(rt = '1' and rcnt<7)then datafini<='0';rcnt<=rcnt+1;

if(rdtemp(11) = '1')then rcrcvar := rdtemp(11 downto 6)xor multi_coef; rdtemp<= rcrcvar(4 downto 0) & rdtemp(5 downto 0) & '0'; else rdtemp<= rdtemp(10 downto 0)&'0';

end if;

elsif(rt='1' and rcnt=7)then datafini<='1'; rdata<=rdatacrc(16 downto 5); rt<='0';

if(rdatacrc(4 downto 0)/=rdtemp(11 downto 7))then error0<='1';end if; end if; end if;

end process; end comm; 程序二: library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity crcma is

port (clk,datald,rst:in std_logic;

sdata:in std_logic_vector(11 downto 0); rdata:out std_logic_vector(11 downto 0); error0:out std_logic; datafini:out std_logic); end crcma;

architecture comm of crcma is component crcm

port (clk,hrecv,datald,rst:in std_logic;

sdata:in std_logic_vector(11 downto 0); datacrco:out std_logic_vector(16 downto 0); datacrci:in std_logic_vector(16 downto 0); rdata:out std_logic_vector(11 downto 0); datafini:out std_logic; error0,hsend:out std_logic); end component;

signal datacrcp:std_logic_vector(16 downto 0); signal hsenp:std_logic; begin u1: crcm

map(rst=>rst,clk=>clk,sdata=>sdata,datald=>datald,datacrco=>datacrcp,hrecv=>hsenp, hsend=>hsenp,datacrci=>datacrcp,rdata=>rdata,error0=>error0,datafini=>datafini); end architecture comm;

四、编译及仿真结果

选用器件型号、编译后使用器件资源情况、引脚配置情况(硬件实验):

port

搜索更多关于: 循环冗余校验(CRC)模块设计 - 图文 的文档
循环冗余校验(CRC)模块设计 - 图文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c3kc64511yy3fmdy9vdc7_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top