链接:https://pan.baidu.com/s/1lrWVQ6092fbep4GKIkRwwg
提取码:499a
部分代码设计
library ieee;
use ieee.std_logic_1164.all;
entity edac3 is
port (clk,start:in std_logic; --时钟和清零端口;
mzint:in std_logic_vector (21 downto 0); --输入22位码组端口;
dbout:out std_logic_vector (15 downto 0); --输出16位数据位端口;
cbout:out std_logic_vector (5 downto 0); --输出6位伴随式端口;
err,int:out std_logic); --错误和报警端口;
end edac3;
architecture three of edac3 is
signal dbt:std_logic_vector(15 downto 0); --数据位信号;
signal cbt:std_logic_vector (5 downto 0); --校验位信号;
signal sbt:std_logic_vector (5 downto 0); --伴随式信号;
begin
process(clk,start,cbt)
begin
if(start='1') then
sbt<="000000";
dbout<="0000000000000000";
cbout<="000000";
int<='0';
err<='0'; --若有清零为高电平,则输出都为零;
elsif(clk'event and clk='1') then
dbt<=mzint(21) & mzint(20) & mzint(19) & mzint(18) & mzint(17) & mzint(16) & mzint(15) & mzint(14) & mzint(13) & mzint(12) & mzint(11) & mzint(10) & mzint(9) & mzint(8) & mzint(7) & mzint(6); --否则在时钟上升沿时,译出数据位;
cbt<=mzint(5) & mzint(4) & mzint(3) & mzint(2) & mzint(1) & mzint(0); --译码出校验位;
sbt(5)<=cbt(5) xor