library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_UNSIGNED.ALL; package Aufg5_Pack is -- Vereinbarung von neuen Datentypen subtype sBit is std_logic; subtype Bitvec2 is std_logic_vector(1 downto 0); subtype HalbByte is std_logic_vector(3 downto 0); subtype Bitvec7 is std_logic_vector(6 downto 0); -- Vereinbarung einer Funktion für den 7-Segment-Decoder function Hex2Seg7 (inp: in HalbByte) return Bitvec7; end Aufg5_Pack; package body Aufg5_Pack is function Hex2Seg7 (inp : in HalbByte) return Bitvec7 is variable outp : Bitvec7; variable tmp : Bitvec2; begin -- Die nachfolgende Zuordnung zwischen Eingabe und -- Rückgabewert ist willkürlich gewählt und soll entsprechend -- Aufgabestellung verändert werden. tmp(0):= inp(1) xor inp(0); tmp(1):= inp(3) xor inp(2); case tmp is when "00" => outp:= "0111000"; when "01" => outp:= "0111110"; when "10" => outp:= "1111001"; when others => outp:= "1110111"; end case; return outp; end Hex2Seg7; end Aufg5_Pack;