Professional Documents
Culture Documents
Bptorgb
Bptorgb
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
entity BPtoRGB is
port ( iCLK : in std_logic;
iRST : in std_logic;
next_row : in std_logic_vector (7 downto 0);
current_row : in std_logic_vector (7 downto 0);
previuos_row : in std_logic_vector (7 downto 0);
sel : in std_logic_vector(1 downto 0);--sel
r : out unsigned (7 downto 0);
g : out unsigned (7 downto 0);
b : out unsigned (7 downto 0)
);
end BPtoRGB;
--process (iCLK)
--begin
-- if rising_edge(iCLK) then
-- if(bayer_phase = "00") then--RG-GB
-- if(position = "00") then
-- sel <= "10";
-- else if(position = "01") then
-- sel <= "00";
-- else if(position = "10") then
-- sel <= "01";
-- else if(position = "11") then
-- sel <= "11";
-- end if;
-- end if;
-- end if;
-- end if;
process (iCLK)
begin
if rising_edge(iCLK) then
if (iRST='0') then
c1 <= "00000000";
c2 <= "00000000";
n1 <= "00000000";
p1 <= "00000000";
c3 <= "00000000";
d1 <= "00000000";
d2 <= "00000000";
p2 <= "00000000";
p3 <= "00000000";
d3 <= "00000000";
d4 <= "00000000";
else
n1 <= unsigned(next_row);
c1 <= unsigned(current_row);
p1 <= unsigned(previuos_row);
c2 <= c1;
c3 <= c2;
d1 <= shift_right(unsigned(c1+c3),1);
d2 <= shift_right(unsigned(p1+n1),1);
p2 <= d2;
p3 <= p2;
d3 <= shift_right(unsigned(d1+p2),1);
d4 <= shift_right(unsigned(p3+d2),1);
end if;
end if;
end process;
end Behavioral;