📄 crc.vhd
字号:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity crc is
port (
clk: in std_logic;
reset_n:in std_logic;
din: in std_logic;
dout: out std_logic_vector(3 downto 0)
);
end crc;
architecture crc_arch of crc is
signal d1,d2:std_logic;
signal d:std_logic_vector(3 downto 0):=(others =>'0');
begin
d1 <= d(0) xor din;
d2 <= d(3) xor '1';
process(clk ,reset_n)
begin
if (clk'event and clk ='1') then
if (reset_n ='0') then -- 同步复位
d <= (others => '0');-- CRC 码置零
else
if (d1 = '1') then
d <= d1&d2&d(2 downto 1);
elsif (d1 = '0') then
d <= d1&d(3 downto 1);
end if ;
end if ;
dout <=d;
end if ;
end process ;
end crc_arch;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -