proc.vhd

来自「用VHDL实现视频控制程序(实现对图像的采集和压缩)」· VHDL 代码 · 共 54 行

VHD
54
字号
library IEEE;
use IEEE.std_logic_1164.all;

entity Proc is
    port (
        Pix_IN: in STD_LOGIC_VECTOR (5 downto 0);
        OP: in STD_LOGIC_VECTOR (2 downto 0);
        Pix_OUT: out STD_LOGIC_VECTOR (5 downto 0)
    );
end Proc;

architecture Proc_arch of Proc is
begin
p:process(OP,Pix_IN)
begin

    case OP is
    	when "000" =>
    	    Pix_OUT<= Pix_IN;       -- Saca la imagen original por pantalla
    	
    	when "001" =>
 	    Pix_OUT<= not Pix_IN;   -- Saca la imagen inversa por pantalla

    	when "010" =>               --Aumenta el contraste
    	    if(Pix_IN(5)='1')then
    	    	Pix_OUT(5 downto 4)<="11";  
    	    else
    	    	Pix_OUT(5 downto 4)<="00";
    	    end if;

    	    if(Pix_IN(3)='1')then
    	    	Pix_OUT(3 downto 2)<="11";
    	    else
    	    	Pix_OUT(3 downto 2)<="00";
    	    end if;

    	    if(Pix_IN(1)='1')then
    	    	Pix_OUT(1 downto 0)<="11";
    	    else
    	    	Pix_OUT(1 downto 0)<="00";
    	    end if;
    	    
	when "011" =>
	    Pix_OUT(5 downto 4)<=Pix_IN(3 downto 2);  --Intercambia los colores
	    Pix_OUT(3 downto 2)<=Pix_IN(1 downto 0);
	    Pix_OUT(1 downto 0)<=Pix_IN(5 downto 4);
		    
  	when others =>                                --Futuras extensiones
  	    Pix_OUT<=Pix_IN;
    end case;
end process;

end Proc_arch;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?