entity edac is port(c0, c1: in std_logic; dbin: in unsigned (15 downto 0); cbin: in unsigned (5 downto 0); dbout: out unsigned (15 downto 0); cbout: out unsigned (5 downto 0); err, int: out std_logic ); end edac;
architecture edac of edac is signal dbs: unsigned (15 downto 0); signal cbs: unsigned (5 downto 0); signal cbt: unsigned (5 downto 0); begin process(c0,c1,dbin,cbin) variable temp: std_logic; begin if (c1='0') and (c0='0') then cbout(0)<=dbin(0) xor dbin(1) xor dbin(3) xor dbin(4) xor dbin(8) xor dbin(9) xor dbin(10) xor dbin(13); cbout(1)<=dbin(0) xor dbin(2) xor dbin(3) xor dbin(5) xor dbin(6) xor dbin(8) xor dbin(11) xor dbin(14); cbout(2)<=dbin(1) xor dbin(2) xor dbin(4) xor dbin(5) xor dbin(7) xor dbin(9) xor dbin(12) xor dbin(15); cbout(3)<=dbin(0) xor dbin(1) xor dbin(2) xor dbin(6) xor dbin(7) xor dbin(10) xor dbin(11) xor dbin(12); cbout(4)<=dbin(3) xor dbin(4) xor dbin(5) xor dbin(6) xor dbin(7) xor dbin(13) xor dbin(14) xor dbin(15); cbout(5)<=dbin(8) xor dbin(9) xor dbin(10) xor dbin(11) xor dbin(12) xor dbin(13) xor dbin(14) xor dbin(15); err<='0'; int<='0'; dbout<="ZZZZZZZZZZZZZZZZ"; else cbt(0)<=not(dbs(0) xor dbs(1) xor dbs(3) xor dbs(4) xor dbs(8) xor dbs(9) xor dbs(10) xor dbs(13) xor cbs(0)); cbt(1)<=not(dbs(0) xor dbs(2) xor dbs(3) xor dbs(5) xor dbs(6) xor dbs(8) xor dbs(11) xor dbs(14) xor cbs(1)); cbt(2)<=not(dbs(1) xor dbs(2) xor dbs(4) xor dbs(5) xor dbs(7) xor dbs(9) xor dbs(12) xor dbs(15) xor cbs(2)); cbt(3)<=not(dbs(0) xor dbs(1) xor dbs(2) xor dbs(6) xor dbs(7) xor dbs(10) xor dbs(11) xor dbs(12) xor cbs(3)); cbt(4)<=not(dbs(3) xor dbs(4) xor dbs(5) xor dbs(6) xor dbs(7) xor dbs(13) xor dbs(14) xor dbs(15) xor cbs(4)); cbt(5)<=not(dbs(8) xor dbs(9) xor dbs(10) xor dbs(11) xor dbs(12) xor dbs(13) xor dbs(14) xor dbs(15) xor cbs(5)); if (c1='0') and (c0='1') then dbs<=dbin; cbs<=cbin; err<='0'; int<='0'; dbout<="ZZZZZZZZZZZZZZZZ"; cbout<="ZZZZZZ"; elsif (c1='1') then case cbt is when "110100" => err<='1'; int<='0'; if (c0='0') then dbout(0)<=not(dbs(0)); for i in 1 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "110010" => err<='1'; int<='0'; if (c0='0') then dbout(0)<=dbs(0); dbout(1)<=not(dbs(1)); for i in 2 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "110001" => err<='1'; int<='0'; if (c0='0') then dbout(0)<=dbs(0); dbout(1)<=dbs(1); dbout(2)<=not(dbs(2)); for i in 3 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "101100" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 2 loop dbout(i)<=dbs(i); end loop; dbout(3)<=not(dbs(3)); for i in 4 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "101010" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 3 loop dbout(i)<=dbs(i); end loop; dbout(4)<=not(dbs(4)); for i in 5 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "101001" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 4 loop dbout(i)<=dbs(i); end loop; dbout(5)<=not(dbs(5)); for i in 6 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "100101" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 5 loop dbout(i)<=dbs(i); end loop; dbout(6)<=not(dbs(6)); for i in 7 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "100011" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 6 loop dbout(i)<=dbs(i); end loop; dbout(7)<=not(dbs(7)); for i in 8 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "011100" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 7 loop dbout(i)<=dbs(i); end loop; dbout(8)<=not(dbs(8)); for i in 9 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "011010" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 8 loop dbout(i)<=dbs(i); end loop; dbout(9)<=not(dbs(9)); for i in 10 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "010110" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 9 loop dbout(i)<=dbs(i); end loop; dbout(10)<=not(dbs(10)); for i in 11 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "010101" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 10 loop dbout(i)<=dbs(i); end loop; dbout(11)<=not(dbs(11)); for i in 12 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "010011" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 11 loop dbout(i)<=dbs(i); end loop; dbout(12)<=not(dbs(12)); for i in 13 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "001110" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 12 loop dbout(i)<=dbs(i); end loop; dbout(13)<=not(dbs(13)); for i in 14 to 15 loop dbout(i)<=dbs(i); end loop; cbout<=cbt; end if;
when "001101" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 13 loop dbout(i)<=dbs(i); end loop; dbout(14)<=not(dbs(14)); dbout(15)<=dbs(15); cbout<=cbt; end if;
when "001011" => err<='1'; int<='0'; if (c0='0') then for i in 0 to 14 loop dbout(i)<=dbs(i); end loop; dbout(15)<=not(dbs(15)); cbout<=cbt; end if;
when "111110" => err<='1'; int<='0'; if (c0='0') then dbout<=dbs; cbout<=cbt; end if;
when "111101" => err<='1'; int<='0'; if (c0='0') then dbout<=dbs; cbout<=cbt; end if;
when "111011" => err<='1'; int<='0'; if (c0='0') then dbout<=dbs; cbout<=cbt; end if; when "110111" => err<='1'; int<='0'; if (c0='0') then dbout<=dbs; cbout<=cbt; end if;
when "101111" => err<='1'; int<='0'; if (c0='0') then dbout<=dbs; cbout<=cbt; end if;
when "011111" => err<='1'; int<='0'; if (c0='0') then dbout<=dbs; cbout<=cbt; end if; when "111111" => err<='0'; int<='0'; if (c0='0') then dbout<=dbs; cbout<=cbt; end if;
when others => err<='1'; int<='1'; if (c0='0') then dbout<=dbs; cbout<=cbt; end if; end case; end if; end if;
if (c1='1') and (c0='0') then cbout<=cbt; end if; end process; end edac;