------------------------------------------------------------------------------- -- Title : Filtre Moyennegradient -- Project : ------------------------------------------------------------------------------- -- File : gradient.vhd -- Author : -- Created : 1999/10/04 -- Last modified : 1999/10/04 ------------------------------------------------------------------------------- -- Description : gradient vertical de 9 pixels pris individuelement avec frequence de -- sorie divisee par trois ------------------------------------------------------------------------------- -- Modification history : -- 1999/10/04 : created ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE work.utils.ALL; ARCHITECTURE gradient OF filtre IS SIGNAL p1, p2 ,p3, p4, p5, p6, p7, p8, p9 : natural RANGE 0 TO 255; SIGNAL somme : integer RANGE 0 TO 255; SIGNAL autorise : std_ulogic;-- pour entree donnees SIGNAL fin_calcul : std_ulogic; BEGIN -- comportement -- purpose: lire 3 pixels et traiter memo : PROCESS (h, init) BEGIN -- PROCESS memo -- activities triggered by asynchronous reset (active high) IF init = '1' THEN p1 <= 0; p2 <= 0; p3 <= 0; p4 <= 0; p5 <= 0; p6 <= 0; p7 <= 0; p8 <= 0; p9 <= 0; ELSIF front_montant(h) AND autorise = '1' THEN p1 <= pixel; p2 <= p1; p3 <= p2; p4 <= p3; p5 <= p4; p6 <= p5; -- decalage p7 <= p6; p8 <= p7; p9 <= p8; END IF; END PROCESS memo; somme <= (ABS ( p7 + 2 * p8 + p9 - (p1 + 2 * p2 + p3 )))/4 ; autorise <= NOT( fin_calcul) AND ready_IN AND NOT (ack_OUT ) ; entree : PROCESS (h, init) BEGIN -- PROCESS entree -- activities triggered by asynchronous reset (active low) IF init = '1' THEN ack_in <= '0'; ELSIF front_montant(h) THEN ack_IN <= autorise; END IF; END PROCESS entree; calcul : PROCESS ( h, ack_out) VARIABLE nombre : natural := 0; BEGIN -- PROCESS -- activities triggered by asynchronous reset (active high) IF init = '1' OR ack_OUT = '1' THEN fin_calcul <= '0'; ELSIF front_montant(h) AND autorise = '1' THEN nombre := nombre + 1; IF nombre = 3 THEN nombre := 0; fin_calcul <= '1'; pix_calcul <= somme; END IF; END IF; END PROCESS; ready_out <= fin_calcul; END gradient ;