library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity TestMain is Port ( -- Board: clk : in std_logic; led : out std_logic_vector(7 downto 0); sw : in std_logic_vector(7 downto 0); -- Funkmodul: addr : in std_logic_vector(7 downto 0); din : in std_logic; dout : out std_logic; recvEn : out std_logic; sendEn : out std_logic ); end TestMain; architecture Behavioral of TestMain is signal clkRadio : std_logic; signal output : std_logic; signal pattern : std_logic_vector(7 downto 0); begin recvEn <= not sw(0); -- Empfaenger aktiv, wenn Schalter 0 ein sendEn <= not sw(1); -- Sender aktiv, wenn Schalter 1 ein -- Schalter-Byte auf LEDs ausgeben led <= addr; -- Schalter auch als Pattern nehmen pattern <= addr; -- Daten senden, wenn Schalter 1 ein dout <= output and sw(1); -- Takt erzeugen (ca. 100 kHz) process(clk) variable Q : std_logic_vector(15 downto 0) := x"0000"; begin if clk'event and clk='1' then clkRadio <= Q(8); Q := Q + 1; end if; end process; -- Pattern ausgeben process(clkRadio) variable cnt : integer range 0 to 7 := 7; begin if clkRadio'event and clkRadio='1' then output <= pattern(cnt); if cnt = 0 then cnt := 7; else cnt := cnt - 1; end if; end if; end process; end Behavioral;