crcgen.vhd
来自「这是用CPLD开发的读取绝对式编码器反馈的信号的代码」· VHDL 代码 · 共 37 行
VHD
37 行
library IEEE;
use IEEE.std_logic_1164.all;
entity CRCGEN is
port(
SD :in std_logic;
CLRN :in std_logic;
SFT :in std_logic;
CRC :out std_logic_vector(7 downto 0);
clk :in std_logic;
rstn :in std_logic
);
end CRCGEN;
architecture MAIN of CRCGEN is
signal CRCbuf :std_logic_vector(7 downto 0);
begin
process(clk,rstn)begin
if(rstn='0')then
CRCbuf<=(others=>'0');
elsif(clk='1' and clk' event)then
if(CLRN='0')then
CRCbuf<=(others=>'0');
elsif(SFT='1')then
CRCbuf(6 downto 0)<=CRCbuf(7 downto 1);
CRCbuf(7)<=CRCbuf(0) xor SD;
end if;
end if;
end process;
CRC<=CRCbuf;
end MAIN;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?