Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Package Declaration
- package func_lib is
- function f_hex_seg is
- (
- i_int : in integer range 0 to 15
- ) return std_logic_vector(7 downto 0);
- end package func_lib;
- -- Package Body Section
- package body func_lib is
- function f_hex_seg is
- (
- i_int : in integer range 0 to 15
- ) return std_logic_vector(7 downto 0) is
- variable v_temp : std_logic_vector(7 downto 0);
- begin
- case i_int is
- when 0 =>
- v_temp := X"7E";
- when 1 =>
- v_temp := X"30";
- when 2 =>
- v_temp := X"6D";
- when 3 =>
- v_temp := X"79";
- when 4 =>
- v_temp := X"33";
- when 5 =>
- v_temp := X"5B";
- when 6 =>
- v_temp := X"5F";
- when 7 =>
- v_temp := X"70";
- when 8 =>
- v_temp := X"7F";
- when 9 =>
- v_temp := X"7B";
- when 10 => -- A
- v_temp := X"77";
- when 11 => -- b
- v_temp := X"1F";
- when 12 => -- C
- v_temp := X"4E";
- when 13 => -- d
- v_temp := X"3D";
- when 14 => -- E
- v_temp := X"4F";
- when 15 => -- F
- v_temp := X"47";
- end case;
- return v_temp(7 downto 0);
- end function f_hex_seg;
- end package body func_lib;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement