📄 crc-16串行实现程序.txt
字号:
library ieee;
use ieee.std_logic_1164.all;
entity crc is
port(clk,s_in,reset:in std_logic;
q:out std_logic_vector(15 downto 0));
end crc;
architecture crc_arch of crc is
signal t1,t2,t3:std_logic;
signal d_new:std_logic_vector(15 downto 0);
begin
t1<=d_new(0) xor s_in;
t2<=d_new(11) xor '1';
t3<=d_new(4) xor '1';
process(clk,reset)
begin
if clk'event and clk='1'then
if reset='1'then
d_new<="0000000000000000";
elsif t1='1'then
d_new<=t1&d_new(15 downto 12)&t2&d_new(10 downto 5)&t3&d_new(3 downto 1);
elsif t1='0'then
d_new<=t1&d_new(15 downto 1);
end if;
end if;
end process;
q<=d_new;
end crc_arch;
crc读数时q从小到大读数,因为移位存储器结构所致
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -