Gast
#1978305
hallo zusammen.
ich möchte gern einen zähler schreiben, der bei jeder steigenden flanke
der clock hochzählt. das hochzählen soll auch nur dann passieren, wenn
set 1 ist.
in der testbench hab ich aber als zählerwert nur xe und keine zahl. was
heisst das?
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity count is
Port ( clock : in STD_LOGIC;
set: in std_logic := '1';
counter : out STD_LOGIC_VECTOR(7 downto 0)
);
end count;
architecture Behavioral of count is
signal temp : std_logic_vector(7 downto 0);
begin
process(clock)
begin
if rising_edge(clock) then
if set = '1' then
temp <= temp + "1";
end if;
end if;
end process;
counter <= temp;
end Behavioral;