library ieee;
use ieee.std_logic_1164.all;
entity pattern_generation is
port( clock : in std_logic;
B_in : in std_logic_vector(0 to 7);
C_in : in std_logic;
pattern_out : out std_logic_vector(0 to 7) );
end pattern_generation;
architecture ar of pattern_generation is
component Recon_JC is
port(clk2 : in std_logic;
rst : in std_logic;
mode_sel : in std_logic_vector(1 downto 0);
Jn_in : in std_logic_vector(0 to 7);
Jn_cw : out std_logic_vector(0 to 7)
);
End component;
component accumulator_cell is
port( clock : in std_logic;
set : in std_logic_vector(0 to 7);
reset : in std_logic;
c_in : in std_logic:='0';
B_in : in std_logic_vector(0 to 7);
Pattern : out std_logic_vector(0 to 7) );
end component;
signal count_out : std_logic_vector(0 to 7);
signal temp:std_logic_vector(0 to 7):="00000000";
signal mode_sel:std_logic_vector(1 downto 0):="00";
signal rst:std_logic:='1';
--signal count:integer:=0;
begin
process(clock)
variable count:integer:=0;
begin
if rising_edge(clock)then
count:=count+1;
if rst='1'then
mode_sel<="00";
rst<='0';
count:=0;
elsif count=0 then
mode_sel<="10";
elsif count>=1 and count<=9 then
mode_sel<="01";
elsif count>9 then
mode_sel<="10";
count:=1;
end if;
end if;
end process;
S00: Recon_JC port map(clock,rst,mode_sel,temp,count_out);
S01: accumulator_cell port map(clock,B_in,rst,C_in,count_out,pattern_out);
end ar;