-- ==============================================================
-- RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
-- Version: 2017.2
-- Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
-- 
-- ===========================================================

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;

entity Mat2AXIvideo is
port (
    ap_clk : IN STD_LOGIC;
    ap_rst : IN STD_LOGIC;
    ap_start : IN STD_LOGIC;
    ap_done : OUT STD_LOGIC;
    ap_continue : IN STD_LOGIC;
    ap_idle : OUT STD_LOGIC;
    ap_ready : OUT STD_LOGIC;
    img_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0);
    img_data_stream_0_V_empty_n : IN STD_LOGIC;
    img_data_stream_0_V_read : OUT STD_LOGIC;
    img_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0);
    img_data_stream_1_V_empty_n : IN STD_LOGIC;
    img_data_stream_1_V_read : OUT STD_LOGIC;
    img_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0);
    img_data_stream_2_V_empty_n : IN STD_LOGIC;
    img_data_stream_2_V_read : OUT STD_LOGIC;
    video_out_TDATA : OUT STD_LOGIC_VECTOR (23 downto 0);
    video_out_TVALID : OUT STD_LOGIC;
    video_out_TREADY : IN STD_LOGIC;
    video_out_TKEEP : OUT STD_LOGIC_VECTOR (2 downto 0);
    video_out_TSTRB : OUT STD_LOGIC_VECTOR (2 downto 0);
    video_out_TUSER : OUT STD_LOGIC_VECTOR (0 downto 0);
    video_out_TLAST : OUT STD_LOGIC_VECTOR (0 downto 0);
    video_out_TID : OUT STD_LOGIC_VECTOR (0 downto 0);
    video_out_TDEST : OUT STD_LOGIC_VECTOR (0 downto 0) );
end;


architecture behav of Mat2AXIvideo is 
    constant ap_const_logic_1 : STD_LOGIC := '1';
    constant ap_const_logic_0 : STD_LOGIC := '0';
    constant ap_ST_fsm_state1 : STD_LOGIC_VECTOR (3 downto 0) := "0001";
    constant ap_ST_fsm_state2 : STD_LOGIC_VECTOR (3 downto 0) := "0010";
    constant ap_ST_fsm_pp0_stage0 : STD_LOGIC_VECTOR (3 downto 0) := "0100";
    constant ap_ST_fsm_state6 : STD_LOGIC_VECTOR (3 downto 0) := "1000";
    constant ap_const_lv32_0 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000000";
    constant ap_const_boolean_1 : BOOLEAN := true;
    constant ap_const_lv1_0 : STD_LOGIC_VECTOR (0 downto 0) := "0";
    constant ap_const_lv1_1 : STD_LOGIC_VECTOR (0 downto 0) := "1";
    constant ap_const_lv2_0 : STD_LOGIC_VECTOR (1 downto 0) := "00";
    constant ap_const_lv2_2 : STD_LOGIC_VECTOR (1 downto 0) := "10";
    constant ap_const_lv2_3 : STD_LOGIC_VECTOR (1 downto 0) := "11";
    constant ap_const_lv2_1 : STD_LOGIC_VECTOR (1 downto 0) := "01";
    constant ap_const_lv32_2 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000010";
    constant ap_const_boolean_0 : BOOLEAN := false;
    constant ap_const_lv32_1 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000001";
    constant ap_const_lv9_0 : STD_LOGIC_VECTOR (8 downto 0) := "000000000";
    constant ap_const_lv32_3 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000011";
    constant ap_const_lv10_0 : STD_LOGIC_VECTOR (9 downto 0) := "0000000000";
    constant ap_const_lv3_7 : STD_LOGIC_VECTOR (2 downto 0) := "111";
    constant ap_const_lv3_0 : STD_LOGIC_VECTOR (2 downto 0) := "000";
    constant ap_const_lv9_1E0 : STD_LOGIC_VECTOR (8 downto 0) := "111100000";
    constant ap_const_lv9_1 : STD_LOGIC_VECTOR (8 downto 0) := "000000001";
    constant ap_const_lv10_280 : STD_LOGIC_VECTOR (9 downto 0) := "1010000000";
    constant ap_const_lv10_1 : STD_LOGIC_VECTOR (9 downto 0) := "0000000001";
    constant ap_const_lv10_27F : STD_LOGIC_VECTOR (9 downto 0) := "1001111111";

    signal ap_done_reg : STD_LOGIC := '0';
    signal ap_CS_fsm : STD_LOGIC_VECTOR (3 downto 0) := "0001";
    attribute fsm_encoding : string;
    attribute fsm_encoding of ap_CS_fsm : signal is "none";
    signal ap_CS_fsm_state1 : STD_LOGIC;
    attribute fsm_encoding of ap_CS_fsm_state1 : signal is "none";
    signal AXI_video_strm_V_data_V_1_data_out : STD_LOGIC_VECTOR (23 downto 0);
    signal AXI_video_strm_V_data_V_1_vld_in : STD_LOGIC;
    signal AXI_video_strm_V_data_V_1_vld_out : STD_LOGIC;
    signal AXI_video_strm_V_data_V_1_ack_in : STD_LOGIC;
    signal AXI_video_strm_V_data_V_1_ack_out : STD_LOGIC;
    signal AXI_video_strm_V_data_V_1_payload_A : STD_LOGIC_VECTOR (23 downto 0);
    signal AXI_video_strm_V_data_V_1_payload_B : STD_LOGIC_VECTOR (23 downto 0);
    signal AXI_video_strm_V_data_V_1_sel_rd : STD_LOGIC := '0';
    signal AXI_video_strm_V_data_V_1_sel_wr : STD_LOGIC := '0';
    signal AXI_video_strm_V_data_V_1_sel : STD_LOGIC;
    signal AXI_video_strm_V_data_V_1_load_A : STD_LOGIC;
    signal AXI_video_strm_V_data_V_1_load_B : STD_LOGIC;
    signal AXI_video_strm_V_data_V_1_state : STD_LOGIC_VECTOR (1 downto 0) := "00";
    signal AXI_video_strm_V_data_V_1_state_cmp_full : STD_LOGIC;
    signal AXI_video_strm_V_keep_V_1_data_out : STD_LOGIC_VECTOR (2 downto 0);
    signal AXI_video_strm_V_keep_V_1_vld_in : STD_LOGIC;
    signal AXI_video_strm_V_keep_V_1_vld_out : STD_LOGIC;
    signal AXI_video_strm_V_keep_V_1_ack_in : STD_LOGIC;
    signal AXI_video_strm_V_keep_V_1_ack_out : STD_LOGIC;
    signal AXI_video_strm_V_keep_V_1_sel_rd : STD_LOGIC := '0';
    signal AXI_video_strm_V_keep_V_1_sel : STD_LOGIC;
    signal AXI_video_strm_V_keep_V_1_state : STD_LOGIC_VECTOR (1 downto 0) := "00";
    signal AXI_video_strm_V_strb_V_1_data_out : STD_LOGIC_VECTOR (2 downto 0);
    signal AXI_video_strm_V_strb_V_1_vld_in : STD_LOGIC;
    signal AXI_video_strm_V_strb_V_1_vld_out : STD_LOGIC;
    signal AXI_video_strm_V_strb_V_1_ack_in : STD_LOGIC;
    signal AXI_video_strm_V_strb_V_1_ack_out : STD_LOGIC;
    signal AXI_video_strm_V_strb_V_1_sel_rd : STD_LOGIC := '0';
    signal AXI_video_strm_V_strb_V_1_sel : STD_LOGIC;
    signal AXI_video_strm_V_strb_V_1_state : STD_LOGIC_VECTOR (1 downto 0) := "00";
    signal AXI_video_strm_V_user_V_1_data_out : STD_LOGIC_VECTOR (0 downto 0);
    signal AXI_video_strm_V_user_V_1_vld_in : STD_LOGIC;
    signal AXI_video_strm_V_user_V_1_vld_out : STD_LOGIC;
    signal AXI_video_strm_V_user_V_1_ack_in : STD_LOGIC;
    signal AXI_video_strm_V_user_V_1_ack_out : STD_LOGIC;
    signal AXI_video_strm_V_user_V_1_payload_A : STD_LOGIC_VECTOR (0 downto 0);
    signal AXI_video_strm_V_user_V_1_payload_B : STD_LOGIC_VECTOR (0 downto 0);
    signal AXI_video_strm_V_user_V_1_sel_rd : STD_LOGIC := '0';
    signal AXI_video_strm_V_user_V_1_sel_wr : STD_LOGIC := '0';
    signal AXI_video_strm_V_user_V_1_sel : STD_LOGIC;
    signal AXI_video_strm_V_user_V_1_load_A : STD_LOGIC;
    signal AXI_video_strm_V_user_V_1_load_B : STD_LOGIC;
    signal AXI_video_strm_V_user_V_1_state : STD_LOGIC_VECTOR (1 downto 0) := "00";
    signal AXI_video_strm_V_user_V_1_state_cmp_full : STD_LOGIC;
    signal AXI_video_strm_V_last_V_1_data_out : STD_LOGIC_VECTOR (0 downto 0);
    signal AXI_video_strm_V_last_V_1_vld_in : STD_LOGIC;
    signal AXI_video_strm_V_last_V_1_vld_out : STD_LOGIC;
    signal AXI_video_strm_V_last_V_1_ack_in : STD_LOGIC;
    signal AXI_video_strm_V_last_V_1_ack_out : STD_LOGIC;
    signal AXI_video_strm_V_last_V_1_payload_A : STD_LOGIC_VECTOR (0 downto 0);
    signal AXI_video_strm_V_last_V_1_payload_B : STD_LOGIC_VECTOR (0 downto 0);
    signal AXI_video_strm_V_last_V_1_sel_rd : STD_LOGIC := '0';
    signal AXI_video_strm_V_last_V_1_sel_wr : STD_LOGIC := '0';
    signal AXI_video_strm_V_last_V_1_sel : STD_LOGIC;
    signal AXI_video_strm_V_last_V_1_load_A : STD_LOGIC;
    signal AXI_video_strm_V_last_V_1_load_B : STD_LOGIC;
    signal AXI_video_strm_V_last_V_1_state : STD_LOGIC_VECTOR (1 downto 0) := "00";
    signal AXI_video_strm_V_last_V_1_state_cmp_full : STD_LOGIC;
    signal AXI_video_strm_V_id_V_1_data_out : STD_LOGIC_VECTOR (0 downto 0);
    signal AXI_video_strm_V_id_V_1_vld_in : STD_LOGIC;
    signal AXI_video_strm_V_id_V_1_vld_out : STD_LOGIC;
    signal AXI_video_strm_V_id_V_1_ack_in : STD_LOGIC;
    signal AXI_video_strm_V_id_V_1_ack_out : STD_LOGIC;
    signal AXI_video_strm_V_id_V_1_sel_rd : STD_LOGIC := '0';
    signal AXI_video_strm_V_id_V_1_sel : STD_LOGIC;
    signal AXI_video_strm_V_id_V_1_state : STD_LOGIC_VECTOR (1 downto 0) := "00";
    signal AXI_video_strm_V_dest_V_1_data_out : STD_LOGIC_VECTOR (0 downto 0);
    signal AXI_video_strm_V_dest_V_1_vld_in : STD_LOGIC;
    signal AXI_video_strm_V_dest_V_1_vld_out : STD_LOGIC;
    signal AXI_video_strm_V_dest_V_1_ack_in : STD_LOGIC;
    signal AXI_video_strm_V_dest_V_1_ack_out : STD_LOGIC;
    signal AXI_video_strm_V_dest_V_1_sel_rd : STD_LOGIC := '0';
    signal AXI_video_strm_V_dest_V_1_sel : STD_LOGIC;
    signal AXI_video_strm_V_dest_V_1_state : STD_LOGIC_VECTOR (1 downto 0) := "00";
    signal img_data_stream_0_V_blk_n : STD_LOGIC;
    signal ap_CS_fsm_pp0_stage0 : STD_LOGIC;
    attribute fsm_encoding of ap_CS_fsm_pp0_stage0 : signal is "none";
    signal ap_enable_reg_pp0_iter1 : STD_LOGIC := '0';
    signal ap_block_pp0_stage0_flag00000000 : BOOLEAN;
    signal exitcond_reg_238 : STD_LOGIC_VECTOR (0 downto 0);
    signal img_data_stream_1_V_blk_n : STD_LOGIC;
    signal img_data_stream_2_V_blk_n : STD_LOGIC;
    signal video_out_TDATA_blk_n : STD_LOGIC;
    signal ap_enable_reg_pp0_iter2 : STD_LOGIC := '0';
    signal ap_reg_pp0_iter1_exitcond_reg_238 : STD_LOGIC_VECTOR (0 downto 0);
    signal t_V_2_reg_156 : STD_LOGIC_VECTOR (9 downto 0);
    signal exitcond5_fu_172_p2 : STD_LOGIC_VECTOR (0 downto 0);
    signal ap_CS_fsm_state2 : STD_LOGIC;
    attribute fsm_encoding of ap_CS_fsm_state2 : signal is "none";
    signal ap_block_state2 : BOOLEAN;
    signal i_V_fu_178_p2 : STD_LOGIC_VECTOR (8 downto 0);
    signal i_V_reg_233 : STD_LOGIC_VECTOR (8 downto 0);
    signal exitcond_fu_184_p2 : STD_LOGIC_VECTOR (0 downto 0);
    signal ap_block_state3_pp0_stage0_iter0 : BOOLEAN;
    signal ap_block_state4_pp0_stage0_iter1 : BOOLEAN;
    signal ap_block_state4_io : BOOLEAN;
    signal ap_block_state5_pp0_stage0_iter2 : BOOLEAN;
    signal ap_block_state5_io : BOOLEAN;
    signal ap_block_pp0_stage0_flag00011001 : BOOLEAN;
    signal j_V_fu_190_p2 : STD_LOGIC_VECTOR (9 downto 0);
    signal ap_enable_reg_pp0_iter0 : STD_LOGIC := '0';
    signal axi_last_V_fu_196_p2 : STD_LOGIC_VECTOR (0 downto 0);
    signal axi_last_V_reg_247 : STD_LOGIC_VECTOR (0 downto 0);
    signal tmp_data_V_fu_206_p4 : STD_LOGIC_VECTOR (23 downto 0);
    signal ap_block_pp0_stage0_flag00011011 : BOOLEAN;
    signal ap_condition_pp0_exit_iter0_state3 : STD_LOGIC;
    signal t_V_reg_145 : STD_LOGIC_VECTOR (8 downto 0);
    signal ap_block_state1 : BOOLEAN;
    signal ap_CS_fsm_state6 : STD_LOGIC;
    attribute fsm_encoding of ap_CS_fsm_state6 : signal is "none";
    signal tmp_user_V_fu_94 : STD_LOGIC_VECTOR (0 downto 0);
    signal ap_block_pp0_stage0_flag00001001 : BOOLEAN;
    signal ap_NS_fsm : STD_LOGIC_VECTOR (3 downto 0);
    signal ap_idle_pp0 : STD_LOGIC;
    signal ap_enable_pp0 : STD_LOGIC;


begin




    AXI_video_strm_V_data_V_1_sel_rd_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_data_V_1_sel_rd <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_data_V_1_ack_out) and (ap_const_logic_1 = AXI_video_strm_V_data_V_1_vld_out))) then 
                                        AXI_video_strm_V_data_V_1_sel_rd <= not(AXI_video_strm_V_data_V_1_sel_rd);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_data_V_1_sel_wr_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_data_V_1_sel_wr <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_data_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_data_V_1_ack_in))) then 
                                        AXI_video_strm_V_data_V_1_sel_wr <= not(AXI_video_strm_V_data_V_1_sel_wr);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_data_V_1_state_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_data_V_1_state <= ap_const_lv2_0;
            else
                if ((((ap_const_logic_0 = AXI_video_strm_V_data_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_data_V_1_ack_out) and (AXI_video_strm_V_data_V_1_state = ap_const_lv2_3)) or ((ap_const_logic_0 = AXI_video_strm_V_data_V_1_vld_in) and (AXI_video_strm_V_data_V_1_state = ap_const_lv2_2)))) then 
                    AXI_video_strm_V_data_V_1_state <= ap_const_lv2_2;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_data_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_out) and (AXI_video_strm_V_data_V_1_state = ap_const_lv2_3)) or ((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_out) and (AXI_video_strm_V_data_V_1_state = ap_const_lv2_1)))) then 
                    AXI_video_strm_V_data_V_1_state <= ap_const_lv2_1;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_data_V_1_vld_in) and (AXI_video_strm_V_data_V_1_state = ap_const_lv2_2)) or ((ap_const_logic_1 = AXI_video_strm_V_data_V_1_ack_out) and (AXI_video_strm_V_data_V_1_state = ap_const_lv2_1)) or ((AXI_video_strm_V_data_V_1_state = ap_const_lv2_3) and not(((ap_const_logic_1 = AXI_video_strm_V_data_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_out))) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_data_V_1_ack_out)))))) then 
                    AXI_video_strm_V_data_V_1_state <= ap_const_lv2_3;
                else 
                    AXI_video_strm_V_data_V_1_state <= ap_const_lv2_2;
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_dest_V_1_sel_rd_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_dest_V_1_sel_rd <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_dest_V_1_ack_out) and (ap_const_logic_1 = AXI_video_strm_V_dest_V_1_vld_out))) then 
                                        AXI_video_strm_V_dest_V_1_sel_rd <= not(AXI_video_strm_V_dest_V_1_sel_rd);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_dest_V_1_state_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_dest_V_1_state <= ap_const_lv2_0;
            else
                if ((((ap_const_logic_0 = AXI_video_strm_V_dest_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_dest_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_dest_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_dest_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_dest_V_1_state)))) then 
                    AXI_video_strm_V_dest_V_1_state <= ap_const_lv2_2;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_dest_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_dest_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_dest_V_1_state)))) then 
                    AXI_video_strm_V_dest_V_1_state <= ap_const_lv2_1;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_dest_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_dest_V_1_state)) or ((ap_const_logic_1 = AXI_video_strm_V_dest_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_dest_V_1_state)) or ((ap_const_lv2_3 = AXI_video_strm_V_dest_V_1_state) and not(((ap_const_logic_1 = AXI_video_strm_V_dest_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_out))) and not(((ap_const_logic_0 = AXI_video_strm_V_dest_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_dest_V_1_ack_out)))))) then 
                    AXI_video_strm_V_dest_V_1_state <= ap_const_lv2_3;
                else 
                    AXI_video_strm_V_dest_V_1_state <= ap_const_lv2_2;
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_id_V_1_sel_rd_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_id_V_1_sel_rd <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_id_V_1_ack_out) and (ap_const_logic_1 = AXI_video_strm_V_id_V_1_vld_out))) then 
                                        AXI_video_strm_V_id_V_1_sel_rd <= not(AXI_video_strm_V_id_V_1_sel_rd);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_id_V_1_state_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_id_V_1_state <= ap_const_lv2_0;
            else
                if ((((ap_const_logic_0 = AXI_video_strm_V_id_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_id_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_id_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_id_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_id_V_1_state)))) then 
                    AXI_video_strm_V_id_V_1_state <= ap_const_lv2_2;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_id_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_id_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_id_V_1_state)))) then 
                    AXI_video_strm_V_id_V_1_state <= ap_const_lv2_1;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_id_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_id_V_1_state)) or ((ap_const_logic_1 = AXI_video_strm_V_id_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_id_V_1_state)) or ((ap_const_lv2_3 = AXI_video_strm_V_id_V_1_state) and not(((ap_const_logic_1 = AXI_video_strm_V_id_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_out))) and not(((ap_const_logic_0 = AXI_video_strm_V_id_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_id_V_1_ack_out)))))) then 
                    AXI_video_strm_V_id_V_1_state <= ap_const_lv2_3;
                else 
                    AXI_video_strm_V_id_V_1_state <= ap_const_lv2_2;
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_keep_V_1_sel_rd_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_keep_V_1_sel_rd <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_keep_V_1_ack_out) and (ap_const_logic_1 = AXI_video_strm_V_keep_V_1_vld_out))) then 
                                        AXI_video_strm_V_keep_V_1_sel_rd <= not(AXI_video_strm_V_keep_V_1_sel_rd);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_keep_V_1_state_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_keep_V_1_state <= ap_const_lv2_0;
            else
                if ((((ap_const_logic_0 = AXI_video_strm_V_keep_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_keep_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_keep_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_keep_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_keep_V_1_state)))) then 
                    AXI_video_strm_V_keep_V_1_state <= ap_const_lv2_2;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_keep_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_keep_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_keep_V_1_state)))) then 
                    AXI_video_strm_V_keep_V_1_state <= ap_const_lv2_1;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_keep_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_keep_V_1_state)) or ((ap_const_logic_1 = AXI_video_strm_V_keep_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_keep_V_1_state)) or ((ap_const_lv2_3 = AXI_video_strm_V_keep_V_1_state) and not(((ap_const_logic_1 = AXI_video_strm_V_keep_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_out))) and not(((ap_const_logic_0 = AXI_video_strm_V_keep_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_keep_V_1_ack_out)))))) then 
                    AXI_video_strm_V_keep_V_1_state <= ap_const_lv2_3;
                else 
                    AXI_video_strm_V_keep_V_1_state <= ap_const_lv2_2;
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_last_V_1_sel_rd_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_last_V_1_sel_rd <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_last_V_1_ack_out) and (ap_const_logic_1 = AXI_video_strm_V_last_V_1_vld_out))) then 
                                        AXI_video_strm_V_last_V_1_sel_rd <= not(AXI_video_strm_V_last_V_1_sel_rd);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_last_V_1_sel_wr_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_last_V_1_sel_wr <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_last_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_last_V_1_ack_in))) then 
                                        AXI_video_strm_V_last_V_1_sel_wr <= not(AXI_video_strm_V_last_V_1_sel_wr);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_last_V_1_state_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_last_V_1_state <= ap_const_lv2_0;
            else
                if ((((ap_const_logic_0 = AXI_video_strm_V_last_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_last_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_last_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_last_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_last_V_1_state)))) then 
                    AXI_video_strm_V_last_V_1_state <= ap_const_lv2_2;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_last_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_last_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_last_V_1_state)))) then 
                    AXI_video_strm_V_last_V_1_state <= ap_const_lv2_1;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_last_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_last_V_1_state)) or ((ap_const_logic_1 = AXI_video_strm_V_last_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_last_V_1_state)) or ((ap_const_lv2_3 = AXI_video_strm_V_last_V_1_state) and not(((ap_const_logic_1 = AXI_video_strm_V_last_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_out))) and not(((ap_const_logic_0 = AXI_video_strm_V_last_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_last_V_1_ack_out)))))) then 
                    AXI_video_strm_V_last_V_1_state <= ap_const_lv2_3;
                else 
                    AXI_video_strm_V_last_V_1_state <= ap_const_lv2_2;
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_strb_V_1_sel_rd_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_strb_V_1_sel_rd <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_strb_V_1_ack_out) and (ap_const_logic_1 = AXI_video_strm_V_strb_V_1_vld_out))) then 
                                        AXI_video_strm_V_strb_V_1_sel_rd <= not(AXI_video_strm_V_strb_V_1_sel_rd);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_strb_V_1_state_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_strb_V_1_state <= ap_const_lv2_0;
            else
                if ((((ap_const_logic_0 = AXI_video_strm_V_strb_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_strb_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_strb_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_strb_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_strb_V_1_state)))) then 
                    AXI_video_strm_V_strb_V_1_state <= ap_const_lv2_2;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_strb_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_strb_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_strb_V_1_state)))) then 
                    AXI_video_strm_V_strb_V_1_state <= ap_const_lv2_1;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_strb_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_strb_V_1_state)) or ((ap_const_logic_1 = AXI_video_strm_V_strb_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_strb_V_1_state)) or ((ap_const_lv2_3 = AXI_video_strm_V_strb_V_1_state) and not(((ap_const_logic_1 = AXI_video_strm_V_strb_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_out))) and not(((ap_const_logic_0 = AXI_video_strm_V_strb_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_strb_V_1_ack_out)))))) then 
                    AXI_video_strm_V_strb_V_1_state <= ap_const_lv2_3;
                else 
                    AXI_video_strm_V_strb_V_1_state <= ap_const_lv2_2;
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_user_V_1_sel_rd_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_user_V_1_sel_rd <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_user_V_1_ack_out) and (ap_const_logic_1 = AXI_video_strm_V_user_V_1_vld_out))) then 
                                        AXI_video_strm_V_user_V_1_sel_rd <= not(AXI_video_strm_V_user_V_1_sel_rd);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_user_V_1_sel_wr_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_user_V_1_sel_wr <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = AXI_video_strm_V_user_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_user_V_1_ack_in))) then 
                                        AXI_video_strm_V_user_V_1_sel_wr <= not(AXI_video_strm_V_user_V_1_sel_wr);
                end if; 
            end if;
        end if;
    end process;


    AXI_video_strm_V_user_V_1_state_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                AXI_video_strm_V_user_V_1_state <= ap_const_lv2_0;
            else
                if ((((ap_const_logic_0 = AXI_video_strm_V_user_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_user_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_user_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_user_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_user_V_1_state)))) then 
                    AXI_video_strm_V_user_V_1_state <= ap_const_lv2_2;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_user_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_out) and (ap_const_lv2_3 = AXI_video_strm_V_user_V_1_state)) or ((ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_user_V_1_state)))) then 
                    AXI_video_strm_V_user_V_1_state <= ap_const_lv2_1;
                elsif ((((ap_const_logic_1 = AXI_video_strm_V_user_V_1_vld_in) and (ap_const_lv2_2 = AXI_video_strm_V_user_V_1_state)) or ((ap_const_logic_1 = AXI_video_strm_V_user_V_1_ack_out) and (ap_const_lv2_1 = AXI_video_strm_V_user_V_1_state)) or ((ap_const_lv2_3 = AXI_video_strm_V_user_V_1_state) and not(((ap_const_logic_1 = AXI_video_strm_V_user_V_1_vld_in) and (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_out))) and not(((ap_const_logic_0 = AXI_video_strm_V_user_V_1_vld_in) and (ap_const_logic_1 = AXI_video_strm_V_user_V_1_ack_out)))))) then 
                    AXI_video_strm_V_user_V_1_state <= ap_const_lv2_3;
                else 
                    AXI_video_strm_V_user_V_1_state <= ap_const_lv2_2;
                end if; 
            end if;
        end if;
    end process;


    ap_CS_fsm_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                ap_CS_fsm <= ap_ST_fsm_state1;
            else
                ap_CS_fsm <= ap_NS_fsm;
            end if;
        end if;
    end process;


    ap_done_reg_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                ap_done_reg <= ap_const_logic_0;
            else
                if ((ap_const_logic_1 = ap_continue)) then 
                    ap_done_reg <= ap_const_logic_0;
                elsif (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))) and (ap_const_lv1_1 = exitcond5_fu_172_p2))) then 
                    ap_done_reg <= ap_const_logic_1;
                end if; 
            end if;
        end if;
    end process;


    ap_enable_reg_pp0_iter0_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                ap_enable_reg_pp0_iter0 <= ap_const_logic_0;
            else
                if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_block_pp0_stage0_flag00011011 = ap_const_boolean_0) and (ap_const_logic_1 = ap_condition_pp0_exit_iter0_state3))) then 
                    ap_enable_reg_pp0_iter0 <= ap_const_logic_0;
                elsif (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))) and (ap_const_lv1_0 = exitcond5_fu_172_p2))) then 
                    ap_enable_reg_pp0_iter0 <= ap_const_logic_1;
                end if; 
            end if;
        end if;
    end process;


    ap_enable_reg_pp0_iter1_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                ap_enable_reg_pp0_iter1 <= ap_const_logic_0;
            else
                if ((ap_block_pp0_stage0_flag00011011 = ap_const_boolean_0)) then
                    if ((ap_const_logic_1 = ap_condition_pp0_exit_iter0_state3)) then 
                        ap_enable_reg_pp0_iter1 <= (ap_condition_pp0_exit_iter0_state3 xor ap_const_logic_1);
                    elsif ((ap_const_boolean_1 = ap_const_boolean_1)) then 
                        ap_enable_reg_pp0_iter1 <= ap_enable_reg_pp0_iter0;
                    end if;
                end if; 
            end if;
        end if;
    end process;


    ap_enable_reg_pp0_iter2_assign_proc : process(ap_clk)
    begin
        if (ap_clk'event and ap_clk =  '1') then
            if (ap_rst = '1') then
                ap_enable_reg_pp0_iter2 <= ap_const_logic_0;
            else
                if ((ap_block_pp0_stage0_flag00011011 = ap_const_boolean_0)) then 
                    ap_enable_reg_pp0_iter2 <= ap_enable_reg_pp0_iter1;
                elsif (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))) and (ap_const_lv1_0 = exitcond5_fu_172_p2))) then 
                    ap_enable_reg_pp0_iter2 <= ap_const_logic_0;
                end if; 
            end if;
        end if;
    end process;


    t_V_2_reg_156_assign_proc : process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter0) and (ap_const_lv1_0 = exitcond_fu_184_p2))) then 
                t_V_2_reg_156 <= j_V_fu_190_p2;
            elsif (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))) and (ap_const_lv1_0 = exitcond5_fu_172_p2))) then 
                t_V_2_reg_156 <= ap_const_lv10_0;
            end if; 
        end if;
    end process;

    t_V_reg_145_assign_proc : process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if ((ap_const_logic_1 = ap_CS_fsm_state6)) then 
                t_V_reg_145 <= i_V_reg_233;
            elsif (((ap_const_logic_1 = ap_CS_fsm_state1) and not(((ap_const_logic_0 = ap_start) or (ap_done_reg = ap_const_logic_1))))) then 
                t_V_reg_145 <= ap_const_lv9_0;
            end if; 
        end if;
    end process;

    tmp_user_V_fu_94_assign_proc : process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
                tmp_user_V_fu_94 <= ap_const_lv1_0;
            elsif (((ap_const_logic_1 = ap_CS_fsm_state1) and not(((ap_const_logic_0 = ap_start) or (ap_done_reg = ap_const_logic_1))))) then 
                tmp_user_V_fu_94 <= ap_const_lv1_1;
            end if; 
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if ((ap_const_logic_1 = AXI_video_strm_V_data_V_1_load_A)) then
                AXI_video_strm_V_data_V_1_payload_A <= tmp_data_V_fu_206_p4;
            end if;
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if ((ap_const_logic_1 = AXI_video_strm_V_data_V_1_load_B)) then
                AXI_video_strm_V_data_V_1_payload_B <= tmp_data_V_fu_206_p4;
            end if;
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if ((ap_const_logic_1 = AXI_video_strm_V_last_V_1_load_A)) then
                AXI_video_strm_V_last_V_1_payload_A <= axi_last_V_reg_247;
            end if;
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if ((ap_const_logic_1 = AXI_video_strm_V_last_V_1_load_B)) then
                AXI_video_strm_V_last_V_1_payload_B <= axi_last_V_reg_247;
            end if;
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if ((ap_const_logic_1 = AXI_video_strm_V_user_V_1_load_A)) then
                AXI_video_strm_V_user_V_1_payload_A <= tmp_user_V_fu_94;
            end if;
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if ((ap_const_logic_1 = AXI_video_strm_V_user_V_1_load_B)) then
                AXI_video_strm_V_user_V_1_payload_B <= tmp_user_V_fu_94;
            end if;
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then
                ap_reg_pp0_iter1_exitcond_reg_238 <= exitcond_reg_238;
                exitcond_reg_238 <= exitcond_fu_184_p2;
            end if;
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0) and (ap_const_lv1_0 = exitcond_fu_184_p2))) then
                axi_last_V_reg_247 <= axi_last_V_fu_196_p2;
            end if;
        end if;
    end process;
    process (ap_clk)
    begin
        if (ap_clk'event and ap_clk = '1') then
            if (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))))) then
                i_V_reg_233 <= i_V_fu_178_p2;
            end if;
        end if;
    end process;

    ap_NS_fsm_assign_proc : process (ap_start, ap_done_reg, ap_CS_fsm, ap_CS_fsm_state1, AXI_video_strm_V_data_V_1_ack_in, AXI_video_strm_V_keep_V_1_ack_in, AXI_video_strm_V_strb_V_1_ack_in, AXI_video_strm_V_user_V_1_ack_in, AXI_video_strm_V_last_V_1_ack_in, AXI_video_strm_V_id_V_1_ack_in, AXI_video_strm_V_dest_V_1_ack_in, ap_enable_reg_pp0_iter1, ap_enable_reg_pp0_iter2, exitcond5_fu_172_p2, ap_CS_fsm_state2, exitcond_fu_184_p2, ap_enable_reg_pp0_iter0, ap_block_pp0_stage0_flag00011011)
    begin
        case ap_CS_fsm is
            when ap_ST_fsm_state1 => 
                if (((ap_const_logic_1 = ap_CS_fsm_state1) and not(((ap_const_logic_0 = ap_start) or (ap_done_reg = ap_const_logic_1))))) then
                    ap_NS_fsm <= ap_ST_fsm_state2;
                else
                    ap_NS_fsm <= ap_ST_fsm_state1;
                end if;
            when ap_ST_fsm_state2 => 
                if (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))) and (ap_const_lv1_1 = exitcond5_fu_172_p2))) then
                    ap_NS_fsm <= ap_ST_fsm_state1;
                elsif (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))) and (ap_const_lv1_0 = exitcond5_fu_172_p2))) then
                    ap_NS_fsm <= ap_ST_fsm_pp0_stage0;
                else
                    ap_NS_fsm <= ap_ST_fsm_state2;
                end if;
            when ap_ST_fsm_pp0_stage0 => 
                if ((not(((ap_const_logic_1 = ap_enable_reg_pp0_iter2) and (ap_block_pp0_stage0_flag00011011 = ap_const_boolean_0) and (ap_enable_reg_pp0_iter1 = ap_const_logic_0))) and not(((ap_const_logic_1 = ap_enable_reg_pp0_iter0) and (ap_block_pp0_stage0_flag00011011 = ap_const_boolean_0) and (ap_const_lv1_1 = exitcond_fu_184_p2) and (ap_enable_reg_pp0_iter1 = ap_const_logic_0))))) then
                    ap_NS_fsm <= ap_ST_fsm_pp0_stage0;
                elsif ((((ap_const_logic_1 = ap_enable_reg_pp0_iter2) and (ap_block_pp0_stage0_flag00011011 = ap_const_boolean_0) and (ap_enable_reg_pp0_iter1 = ap_const_logic_0)) or ((ap_const_logic_1 = ap_enable_reg_pp0_iter0) and (ap_block_pp0_stage0_flag00011011 = ap_const_boolean_0) and (ap_const_lv1_1 = exitcond_fu_184_p2) and (ap_enable_reg_pp0_iter1 = ap_const_logic_0)))) then
                    ap_NS_fsm <= ap_ST_fsm_state6;
                else
                    ap_NS_fsm <= ap_ST_fsm_pp0_stage0;
                end if;
            when ap_ST_fsm_state6 => 
                ap_NS_fsm <= ap_ST_fsm_state2;
            when others =>  
                ap_NS_fsm <= "XXXX";
        end case;
    end process;
    AXI_video_strm_V_data_V_1_ack_in <= AXI_video_strm_V_data_V_1_state(1);
    AXI_video_strm_V_data_V_1_ack_out <= video_out_TREADY;

    AXI_video_strm_V_data_V_1_data_out_assign_proc : process(AXI_video_strm_V_data_V_1_payload_A, AXI_video_strm_V_data_V_1_payload_B, AXI_video_strm_V_data_V_1_sel)
    begin
        if ((ap_const_logic_1 = AXI_video_strm_V_data_V_1_sel)) then 
            AXI_video_strm_V_data_V_1_data_out <= AXI_video_strm_V_data_V_1_payload_B;
        else 
            AXI_video_strm_V_data_V_1_data_out <= AXI_video_strm_V_data_V_1_payload_A;
        end if; 
    end process;

    AXI_video_strm_V_data_V_1_load_A <= (AXI_video_strm_V_data_V_1_state_cmp_full and not(AXI_video_strm_V_data_V_1_sel_wr));
    AXI_video_strm_V_data_V_1_load_B <= (AXI_video_strm_V_data_V_1_sel_wr and AXI_video_strm_V_data_V_1_state_cmp_full);
    AXI_video_strm_V_data_V_1_sel <= AXI_video_strm_V_data_V_1_sel_rd;
    AXI_video_strm_V_data_V_1_state_cmp_full <= '0' when (AXI_video_strm_V_data_V_1_state = ap_const_lv2_1) else '1';

    AXI_video_strm_V_data_V_1_vld_in_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            AXI_video_strm_V_data_V_1_vld_in <= ap_const_logic_1;
        else 
            AXI_video_strm_V_data_V_1_vld_in <= ap_const_logic_0;
        end if; 
    end process;

    AXI_video_strm_V_data_V_1_vld_out <= AXI_video_strm_V_data_V_1_state(0);
    AXI_video_strm_V_dest_V_1_ack_in <= AXI_video_strm_V_dest_V_1_state(1);
    AXI_video_strm_V_dest_V_1_ack_out <= video_out_TREADY;
    AXI_video_strm_V_dest_V_1_data_out <= ap_const_lv1_0;
    AXI_video_strm_V_dest_V_1_sel <= AXI_video_strm_V_dest_V_1_sel_rd;

    AXI_video_strm_V_dest_V_1_vld_in_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            AXI_video_strm_V_dest_V_1_vld_in <= ap_const_logic_1;
        else 
            AXI_video_strm_V_dest_V_1_vld_in <= ap_const_logic_0;
        end if; 
    end process;

    AXI_video_strm_V_dest_V_1_vld_out <= AXI_video_strm_V_dest_V_1_state(0);
    AXI_video_strm_V_id_V_1_ack_in <= AXI_video_strm_V_id_V_1_state(1);
    AXI_video_strm_V_id_V_1_ack_out <= video_out_TREADY;
    AXI_video_strm_V_id_V_1_data_out <= ap_const_lv1_0;
    AXI_video_strm_V_id_V_1_sel <= AXI_video_strm_V_id_V_1_sel_rd;

    AXI_video_strm_V_id_V_1_vld_in_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            AXI_video_strm_V_id_V_1_vld_in <= ap_const_logic_1;
        else 
            AXI_video_strm_V_id_V_1_vld_in <= ap_const_logic_0;
        end if; 
    end process;

    AXI_video_strm_V_id_V_1_vld_out <= AXI_video_strm_V_id_V_1_state(0);
    AXI_video_strm_V_keep_V_1_ack_in <= AXI_video_strm_V_keep_V_1_state(1);
    AXI_video_strm_V_keep_V_1_ack_out <= video_out_TREADY;
    AXI_video_strm_V_keep_V_1_data_out <= ap_const_lv3_7;
    AXI_video_strm_V_keep_V_1_sel <= AXI_video_strm_V_keep_V_1_sel_rd;

    AXI_video_strm_V_keep_V_1_vld_in_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            AXI_video_strm_V_keep_V_1_vld_in <= ap_const_logic_1;
        else 
            AXI_video_strm_V_keep_V_1_vld_in <= ap_const_logic_0;
        end if; 
    end process;

    AXI_video_strm_V_keep_V_1_vld_out <= AXI_video_strm_V_keep_V_1_state(0);
    AXI_video_strm_V_last_V_1_ack_in <= AXI_video_strm_V_last_V_1_state(1);
    AXI_video_strm_V_last_V_1_ack_out <= video_out_TREADY;

    AXI_video_strm_V_last_V_1_data_out_assign_proc : process(AXI_video_strm_V_last_V_1_payload_A, AXI_video_strm_V_last_V_1_payload_B, AXI_video_strm_V_last_V_1_sel)
    begin
        if ((ap_const_logic_1 = AXI_video_strm_V_last_V_1_sel)) then 
            AXI_video_strm_V_last_V_1_data_out <= AXI_video_strm_V_last_V_1_payload_B;
        else 
            AXI_video_strm_V_last_V_1_data_out <= AXI_video_strm_V_last_V_1_payload_A;
        end if; 
    end process;

    AXI_video_strm_V_last_V_1_load_A <= (AXI_video_strm_V_last_V_1_state_cmp_full and not(AXI_video_strm_V_last_V_1_sel_wr));
    AXI_video_strm_V_last_V_1_load_B <= (AXI_video_strm_V_last_V_1_sel_wr and AXI_video_strm_V_last_V_1_state_cmp_full);
    AXI_video_strm_V_last_V_1_sel <= AXI_video_strm_V_last_V_1_sel_rd;
    AXI_video_strm_V_last_V_1_state_cmp_full <= '0' when (AXI_video_strm_V_last_V_1_state = ap_const_lv2_1) else '1';

    AXI_video_strm_V_last_V_1_vld_in_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            AXI_video_strm_V_last_V_1_vld_in <= ap_const_logic_1;
        else 
            AXI_video_strm_V_last_V_1_vld_in <= ap_const_logic_0;
        end if; 
    end process;

    AXI_video_strm_V_last_V_1_vld_out <= AXI_video_strm_V_last_V_1_state(0);
    AXI_video_strm_V_strb_V_1_ack_in <= AXI_video_strm_V_strb_V_1_state(1);
    AXI_video_strm_V_strb_V_1_ack_out <= video_out_TREADY;
    AXI_video_strm_V_strb_V_1_data_out <= ap_const_lv3_0;
    AXI_video_strm_V_strb_V_1_sel <= AXI_video_strm_V_strb_V_1_sel_rd;

    AXI_video_strm_V_strb_V_1_vld_in_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            AXI_video_strm_V_strb_V_1_vld_in <= ap_const_logic_1;
        else 
            AXI_video_strm_V_strb_V_1_vld_in <= ap_const_logic_0;
        end if; 
    end process;

    AXI_video_strm_V_strb_V_1_vld_out <= AXI_video_strm_V_strb_V_1_state(0);
    AXI_video_strm_V_user_V_1_ack_in <= AXI_video_strm_V_user_V_1_state(1);
    AXI_video_strm_V_user_V_1_ack_out <= video_out_TREADY;

    AXI_video_strm_V_user_V_1_data_out_assign_proc : process(AXI_video_strm_V_user_V_1_payload_A, AXI_video_strm_V_user_V_1_payload_B, AXI_video_strm_V_user_V_1_sel)
    begin
        if ((ap_const_logic_1 = AXI_video_strm_V_user_V_1_sel)) then 
            AXI_video_strm_V_user_V_1_data_out <= AXI_video_strm_V_user_V_1_payload_B;
        else 
            AXI_video_strm_V_user_V_1_data_out <= AXI_video_strm_V_user_V_1_payload_A;
        end if; 
    end process;

    AXI_video_strm_V_user_V_1_load_A <= (AXI_video_strm_V_user_V_1_state_cmp_full and not(AXI_video_strm_V_user_V_1_sel_wr));
    AXI_video_strm_V_user_V_1_load_B <= (AXI_video_strm_V_user_V_1_sel_wr and AXI_video_strm_V_user_V_1_state_cmp_full);
    AXI_video_strm_V_user_V_1_sel <= AXI_video_strm_V_user_V_1_sel_rd;
    AXI_video_strm_V_user_V_1_state_cmp_full <= '0' when (AXI_video_strm_V_user_V_1_state = ap_const_lv2_1) else '1';

    AXI_video_strm_V_user_V_1_vld_in_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            AXI_video_strm_V_user_V_1_vld_in <= ap_const_logic_1;
        else 
            AXI_video_strm_V_user_V_1_vld_in <= ap_const_logic_0;
        end if; 
    end process;

    AXI_video_strm_V_user_V_1_vld_out <= AXI_video_strm_V_user_V_1_state(0);
    ap_CS_fsm_pp0_stage0 <= ap_CS_fsm(2);
    ap_CS_fsm_state1 <= ap_CS_fsm(0);
    ap_CS_fsm_state2 <= ap_CS_fsm(1);
    ap_CS_fsm_state6 <= ap_CS_fsm(3);
        ap_block_pp0_stage0_flag00000000 <= not((ap_const_boolean_1 = ap_const_boolean_1));

    ap_block_pp0_stage0_flag00001001_assign_proc : process(img_data_stream_0_V_empty_n, img_data_stream_1_V_empty_n, img_data_stream_2_V_empty_n, ap_enable_reg_pp0_iter1, exitcond_reg_238)
    begin
                ap_block_pp0_stage0_flag00001001 <= ((ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_0_V_empty_n)) or ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_1_V_empty_n)) or ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_2_V_empty_n))));
    end process;


    ap_block_pp0_stage0_flag00011001_assign_proc : process(img_data_stream_0_V_empty_n, img_data_stream_1_V_empty_n, img_data_stream_2_V_empty_n, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_enable_reg_pp0_iter2, ap_block_state4_io, ap_block_state5_io)
    begin
                ap_block_pp0_stage0_flag00011001 <= (((ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_0_V_empty_n)) or ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_1_V_empty_n)) or ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_2_V_empty_n)) or (ap_const_boolean_1 = ap_block_state4_io))) or ((ap_const_logic_1 = ap_enable_reg_pp0_iter2) and (ap_const_boolean_1 = ap_block_state5_io)));
    end process;


    ap_block_pp0_stage0_flag00011011_assign_proc : process(img_data_stream_0_V_empty_n, img_data_stream_1_V_empty_n, img_data_stream_2_V_empty_n, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_enable_reg_pp0_iter2, ap_block_state4_io, ap_block_state5_io)
    begin
                ap_block_pp0_stage0_flag00011011 <= (((ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_0_V_empty_n)) or ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_1_V_empty_n)) or ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_2_V_empty_n)) or (ap_const_boolean_1 = ap_block_state4_io))) or ((ap_const_logic_1 = ap_enable_reg_pp0_iter2) and (ap_const_boolean_1 = ap_block_state5_io)));
    end process;


    ap_block_state1_assign_proc : process(ap_start, ap_done_reg)
    begin
                ap_block_state1 <= ((ap_const_logic_0 = ap_start) or (ap_done_reg = ap_const_logic_1));
    end process;


    ap_block_state2_assign_proc : process(AXI_video_strm_V_data_V_1_ack_in, AXI_video_strm_V_keep_V_1_ack_in, AXI_video_strm_V_strb_V_1_ack_in, AXI_video_strm_V_user_V_1_ack_in, AXI_video_strm_V_last_V_1_ack_in, AXI_video_strm_V_id_V_1_ack_in, AXI_video_strm_V_dest_V_1_ack_in)
    begin
                ap_block_state2 <= ((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in));
    end process;

        ap_block_state3_pp0_stage0_iter0 <= not((ap_const_boolean_1 = ap_const_boolean_1));

    ap_block_state4_io_assign_proc : process(AXI_video_strm_V_data_V_1_ack_in, exitcond_reg_238)
    begin
                ap_block_state4_io <= ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in));
    end process;


    ap_block_state4_pp0_stage0_iter1_assign_proc : process(img_data_stream_0_V_empty_n, img_data_stream_1_V_empty_n, img_data_stream_2_V_empty_n, exitcond_reg_238)
    begin
                ap_block_state4_pp0_stage0_iter1 <= (((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_0_V_empty_n)) or ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_1_V_empty_n)) or ((ap_const_lv1_0 = exitcond_reg_238) and (ap_const_logic_0 = img_data_stream_2_V_empty_n)));
    end process;


    ap_block_state5_io_assign_proc : process(AXI_video_strm_V_data_V_1_ack_in, ap_reg_pp0_iter1_exitcond_reg_238)
    begin
                ap_block_state5_io <= ((ap_const_lv1_0 = ap_reg_pp0_iter1_exitcond_reg_238) and (ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in));
    end process;

        ap_block_state5_pp0_stage0_iter2 <= not((ap_const_boolean_1 = ap_const_boolean_1));

    ap_condition_pp0_exit_iter0_state3_assign_proc : process(exitcond_fu_184_p2)
    begin
        if ((ap_const_lv1_1 = exitcond_fu_184_p2)) then 
            ap_condition_pp0_exit_iter0_state3 <= ap_const_logic_1;
        else 
            ap_condition_pp0_exit_iter0_state3 <= ap_const_logic_0;
        end if; 
    end process;


    ap_done_assign_proc : process(ap_done_reg, AXI_video_strm_V_data_V_1_ack_in, AXI_video_strm_V_keep_V_1_ack_in, AXI_video_strm_V_strb_V_1_ack_in, AXI_video_strm_V_user_V_1_ack_in, AXI_video_strm_V_last_V_1_ack_in, AXI_video_strm_V_id_V_1_ack_in, AXI_video_strm_V_dest_V_1_ack_in, exitcond5_fu_172_p2, ap_CS_fsm_state2)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))) and (ap_const_lv1_1 = exitcond5_fu_172_p2))) then 
            ap_done <= ap_const_logic_1;
        else 
            ap_done <= ap_done_reg;
        end if; 
    end process;

    ap_enable_pp0 <= (ap_idle_pp0 xor ap_const_logic_1);

    ap_idle_assign_proc : process(ap_start, ap_CS_fsm_state1)
    begin
        if (((ap_const_logic_0 = ap_start) and (ap_const_logic_1 = ap_CS_fsm_state1))) then 
            ap_idle <= ap_const_logic_1;
        else 
            ap_idle <= ap_const_logic_0;
        end if; 
    end process;


    ap_idle_pp0_assign_proc : process(ap_enable_reg_pp0_iter1, ap_enable_reg_pp0_iter2, ap_enable_reg_pp0_iter0)
    begin
        if (((ap_const_logic_0 = ap_enable_reg_pp0_iter0) and (ap_const_logic_0 = ap_enable_reg_pp0_iter1) and (ap_const_logic_0 = ap_enable_reg_pp0_iter2))) then 
            ap_idle_pp0 <= ap_const_logic_1;
        else 
            ap_idle_pp0 <= ap_const_logic_0;
        end if; 
    end process;


    ap_ready_assign_proc : process(AXI_video_strm_V_data_V_1_ack_in, AXI_video_strm_V_keep_V_1_ack_in, AXI_video_strm_V_strb_V_1_ack_in, AXI_video_strm_V_user_V_1_ack_in, AXI_video_strm_V_last_V_1_ack_in, AXI_video_strm_V_id_V_1_ack_in, AXI_video_strm_V_dest_V_1_ack_in, exitcond5_fu_172_p2, ap_CS_fsm_state2)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_state2) and not(((ap_const_logic_0 = AXI_video_strm_V_data_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_keep_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_strb_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_user_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_last_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_id_V_1_ack_in) or (ap_const_logic_0 = AXI_video_strm_V_dest_V_1_ack_in))) and (ap_const_lv1_1 = exitcond5_fu_172_p2))) then 
            ap_ready <= ap_const_logic_1;
        else 
            ap_ready <= ap_const_logic_0;
        end if; 
    end process;

    axi_last_V_fu_196_p2 <= "1" when (t_V_2_reg_156 = ap_const_lv10_27F) else "0";
    exitcond5_fu_172_p2 <= "1" when (t_V_reg_145 = ap_const_lv9_1E0) else "0";
    exitcond_fu_184_p2 <= "1" when (t_V_2_reg_156 = ap_const_lv10_280) else "0";
    i_V_fu_178_p2 <= std_logic_vector(unsigned(t_V_reg_145) + unsigned(ap_const_lv9_1));

    img_data_stream_0_V_blk_n_assign_proc : process(img_data_stream_0_V_empty_n, ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, ap_block_pp0_stage0_flag00000000, exitcond_reg_238)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_block_pp0_stage0_flag00000000 = ap_const_boolean_0) and (ap_const_lv1_0 = exitcond_reg_238))) then 
            img_data_stream_0_V_blk_n <= img_data_stream_0_V_empty_n;
        else 
            img_data_stream_0_V_blk_n <= ap_const_logic_1;
        end if; 
    end process;


    img_data_stream_0_V_read_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            img_data_stream_0_V_read <= ap_const_logic_1;
        else 
            img_data_stream_0_V_read <= ap_const_logic_0;
        end if; 
    end process;


    img_data_stream_1_V_blk_n_assign_proc : process(img_data_stream_1_V_empty_n, ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, ap_block_pp0_stage0_flag00000000, exitcond_reg_238)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_block_pp0_stage0_flag00000000 = ap_const_boolean_0) and (ap_const_lv1_0 = exitcond_reg_238))) then 
            img_data_stream_1_V_blk_n <= img_data_stream_1_V_empty_n;
        else 
            img_data_stream_1_V_blk_n <= ap_const_logic_1;
        end if; 
    end process;


    img_data_stream_1_V_read_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            img_data_stream_1_V_read <= ap_const_logic_1;
        else 
            img_data_stream_1_V_read <= ap_const_logic_0;
        end if; 
    end process;


    img_data_stream_2_V_blk_n_assign_proc : process(img_data_stream_2_V_empty_n, ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, ap_block_pp0_stage0_flag00000000, exitcond_reg_238)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_block_pp0_stage0_flag00000000 = ap_const_boolean_0) and (ap_const_lv1_0 = exitcond_reg_238))) then 
            img_data_stream_2_V_blk_n <= img_data_stream_2_V_empty_n;
        else 
            img_data_stream_2_V_blk_n <= ap_const_logic_1;
        end if; 
    end process;


    img_data_stream_2_V_read_assign_proc : process(ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, exitcond_reg_238, ap_block_pp0_stage0_flag00011001)
    begin
        if (((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_const_lv1_0 = exitcond_reg_238) and (ap_block_pp0_stage0_flag00011001 = ap_const_boolean_0))) then 
            img_data_stream_2_V_read <= ap_const_logic_1;
        else 
            img_data_stream_2_V_read <= ap_const_logic_0;
        end if; 
    end process;

    j_V_fu_190_p2 <= std_logic_vector(unsigned(t_V_2_reg_156) + unsigned(ap_const_lv10_1));
    tmp_data_V_fu_206_p4 <= ((img_data_stream_2_V_dout & img_data_stream_1_V_dout) & img_data_stream_0_V_dout);
    video_out_TDATA <= AXI_video_strm_V_data_V_1_data_out;

    video_out_TDATA_blk_n_assign_proc : process(AXI_video_strm_V_data_V_1_state, ap_CS_fsm_pp0_stage0, ap_enable_reg_pp0_iter1, ap_block_pp0_stage0_flag00000000, exitcond_reg_238, ap_enable_reg_pp0_iter2, ap_reg_pp0_iter1_exitcond_reg_238)
    begin
        if ((((ap_const_logic_1 = ap_CS_fsm_pp0_stage0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter1) and (ap_block_pp0_stage0_flag00000000 = ap_const_boolean_0) and (ap_const_lv1_0 = exitcond_reg_238)) or ((ap_block_pp0_stage0_flag00000000 = ap_const_boolean_0) and (ap_const_logic_1 = ap_enable_reg_pp0_iter2) and (ap_const_lv1_0 = ap_reg_pp0_iter1_exitcond_reg_238)))) then 
            video_out_TDATA_blk_n <= AXI_video_strm_V_data_V_1_state(1);
        else 
            video_out_TDATA_blk_n <= ap_const_logic_1;
        end if; 
    end process;

    video_out_TDEST <= AXI_video_strm_V_dest_V_1_data_out;
    video_out_TID <= AXI_video_strm_V_id_V_1_data_out;
    video_out_TKEEP <= AXI_video_strm_V_keep_V_1_data_out;
    video_out_TLAST <= AXI_video_strm_V_last_V_1_data_out;
    video_out_TSTRB <= AXI_video_strm_V_strb_V_1_data_out;
    video_out_TUSER <= AXI_video_strm_V_user_V_1_data_out;
    video_out_TVALID <= AXI_video_strm_V_dest_V_1_state(0);
end behav;
