⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comparador.vhd

📁 Image_Filter_An_Image_halftone is performed over data loaded into the on board RAM and presented on
💻 VHD
字号:
-- Elemento Comparador, que compara la media de la m醩cara analizada 
-- con unos valores prefijados.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity Comparador is
    port (
        Media: in STD_LOGIC_VECTOR (7 downto 0); -- Media de los pixels 
						 -- de la mascara analizada
        masc: in STD_LOGIC; 		-- Indica el tipo de proceso
        Clk: in STD_LOGIC;
	GReset: in STD_LOGIC;		-- Reset global
        Nummasc: out STD_LOGIC_VECTOR (2 downto 0) -- Indica la mascara de 
						   -- halftone a insertar
    );
end Comparador;

architecture Comparador_arch of Comparador is
signal num,numaux: std_logic_vector(2 downto 0);
begin
          async:process(masc,media)
                  begin 
                    case masc is		-- La comparacion depende 
						-- del tipo de proceso
                       when '0'=>    		-- Binarizacion
                           if (media<"10000000" ) then 
                                numaux<= "000"; -- Pixel Negro
                           else numaux<= "111"; -- Pixel Blanco
                           end if;
                      when '1'=>   		-- Mascara 2x2 de halftone
                            if ("11001100"<media and media<="11111111") then
                                 numaux<= "111"; 	-- Masc. todo blanco
                            elsif ( "10011001"<media and media<="11001100") then
                                 numaux<= "100"; 	-- Masc. blancos y negros
                            elsif( "01100110"< media and media<="10011001") then
                                 numaux<= "010"; 	-- Masc. blancos y negros 
							-- en distintas posiciones
                            elsif("00110011"< media and media<="01100110") then
                                 numaux<="001";  	-- Otro tipo de masc. de 
							-- blancos y negros
                            else 
				 numaux<="000";  	-- Masc. todo negro
                            end if;
                      when others =>
                            numaux<="000";	                          
                    end case;
                 end process;           

        sync: process(GReset,clk,numaux)
                 begin         
		      if (GReset='1') then
			  num<=(others=>'0'); 		-- No es relevante                  
                      elsif (clk'event and clk='1') then
                          num<=numaux;
                      end if;     
        end process;                                  

nummasc<=num;
end Comparador_arch;

⌨️ 快捷键说明

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