------------------------------------------------------------------------------- -- Title : Différentes fonctions -- Project : ------------------------------------------------------------------------------- -- File : primitives_pack.vhd -- Author : -- Company : http://vhdl33.free.fr -- Last update: 2008/04/16 -- Platform : ------------------------------------------------------------------------------- -- Description: ------------------------------------------------------------------------------- -- Revisions : -- Date Version Author Description -- 2008/04/15 1.0 patrice Created ------------------------------------------------------------------------------- -- Les afficheurs sont des anodes communes. Pour emettre de la lumiere, ils -- doivent etre traverses par un courant et donc recevoir un niveau haut ('1') -- sur leur anode et un niveau bas ('0') sur leur cathode. -- Dans le cas contraire, on appliquera un operateur NOT sur les sorties -- -- a -- ------- -- f | | b -- | g | -- |------| -- e | | c -- | d | -- ------- -- -- On considere 16 affichages possibles de 0 a 9 , de A a F -- les segments sont classes dans l'ordre a, b, c, d, e, f, g LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE ieee.numeric_std.ALL; PACKAGE primitives_pack IS FUNCTION hexato7seg (e : STD_LOGIC_vector) RETURN STD_LOGIC_vector; END; PACKAGE BODY primitives_pack IS function hexato7seg (e : STD_LOGIC_vector ) RETURN STD_LOGIC_vector IS TYPE tableau IS ARRAY (0 TO 15) OF STD_LOGIC_vector(6 DOWNTO 0); CONSTANT segments : tableau := ("0000001", -- 0 "1001111", -- 1 "0010010", -- 2 "0000110", -- 3 "1001100", -- 4 "0100100", -- 5 "0100000", -- 6 "0001111", -- 7 "0000000", -- 8 "0001100", -- 9 "0001000", -- A "1100000", -- B "0110001", -- C "1000010", -- D "0110000", -- E "0111000"); -- F VARIABLE entree : natural RANGE 0 TO 15; BEGIN entree := to_integer(unsigned(e)); RETURN segments(entree); END hexato7seg; END;