process(clk,rst)
begin
if(rst = '1') then
pr_mux <= mux0;
elsif(clk'event and clk = '1') then
pr_mux <= nx_mux;
end if;
end process;
process(pr_mux, addr6240_delay)
begin
case pr_mux is
when mux0 => -- 0 ~ 2079
buffer_data <= doutb_interleaver_0;
if(addr6240_delay = "0100000011111") then --2079
nx_mux <= mux1;
end if;
when mux1 => --2080 ~ 4159
buffer_data <= doutb_interleaver_1;
if(addr6240_delay = "1000000111111") then
nx_mux <= mux2;
end if;
when mux2 => -- 4160 ~ 6239
buffer_data <= doutb_interleaver_2;
if(addr6240_delay = "1100001011111") then
nx_mux <= mux0;
end if;
end case;
end process;