library ieee;
use ieee.std_logic_1164.all;
Package my_pack is
type arr1 is array(0 to 15) of std_logic_vector(0 to 7);
type arr2 is array(0 to 31) of std_logic_vector(0 to 7);
end package;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
use work.my_pack.all;
entity fcsty is
port( clk1 : in std_logic;
clk2 :in std_logic;
seed :in std_logic_vector(0 to 4);
fault : inout std_logic;
fcoverage:out real;
choice:in std_logic_vector(3 downto 0));
end fcsty;
architecture behavioral of fcsty is
component patternn is
port(clk1:in std_logic;
clk2:in std_logic;
seed:in std_logic_vector(0 to 4);
ready:out std_logic:='0';
chain1,chain2,chain3,chain4:inout arr1
);
end component;
component fcs is
port( clk2:in std_logic;
A : in std_logic_vector(3 downto 0);
B: inout std_logic_vector(3 downto 0);
enable:in std_logic:='0';
M_Out : inout std_logic_vector(7 downto 0):="00000000" );
end component;
component fcst is
port( clk2:in std_logic;
choice : in std_logic_vector(3 downto 0);
A:in std_logic_vector(3 downto 0);
B : inout std_logic_vector(3 downto 0);
fout:inout std_logic_vector(7 downto 0):="00000000";
fault:inout std_logic;
cs,nss:inout integer;
enable:in std_logic:='0';
fcoverage:out real);
end component;
signal ref_out,test_out:std_logic_vector(7 downto 0):="00000000";
signal ready:std_logic:='0';
signal chain1,chain2,chain3,chain4:arr1;
signal vector:std_logic_vector(0 to 7):="00000000";
signal ct:integer:=0;
signal cs,nss:integer:=0;
begin
-- ------------------------------------------------------------------------------------
x1:patternn port map(clk1,clk2,seed,ready,chain1,chain2,chain3,chain4);
x2:fcs port map(clk2,vector(0 to 3),vector(4 to 7),ready,ref_out);
x3:fcst port map(clk2,choice,vector(0 to 3),vector(4 to 7),test_out,fault,cs,nss,ready,fcoverage);
process(ref_out,test_out,clk2,vector,choice,ready,fault,cs,nss)
begin
if rising_edge(clk2)then
if ref_out=test_out then
fault<='0';
else
fault<='1';
end if;
end if;
end process;
process(ready,chain2,clk2)
variable ctt1:integer:=0;
begin
if rising_edge(clk2)then
if ready='1' then
ctt1:=ctt1+1;
if ctt1<17 then
vector<=chain2(ctt1-1);
end if;
end if;
end if;
end process;
end behavioral;