Я написал RT C Таймер. Он работает, однако затем я помещаю его в testbench (использую как компонент) - я не получаю выводов в симуляторе. Я использую Quartus Waveform Editor для выполнения моделирования ModelSim. Форма волны. Код испытательного стенда:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_unsigned.ALL;
entity rtc is
port
(
nRST : in std_logic;
clk : in std_logic;
Seconds : out std_logic_vector(5 downto 0);
Minutes : out std_logic_vector(5 downto 0);
Hours : out std_logic_vector(4 downto 0)
);
end rtc;
architecture Behavioral of rtc is
constant CLK_FREQ : integer := 2;
component rtc_timer is
generic(CLK_FREQ : integer);
port
(
nRST : in std_logic;
clk : in std_logic;
Seconds : out std_logic_vector(5 downto 0);
Minutes : out std_logic_vector(5 downto 0);
Hours : out std_logic_vector(4 downto 0)
);
end component;
begin
RTC1: rtc_timer
generic map( CLK_FREQ => CLK_FREQ )
port map
(
nRST => nRST,
clk => clk,
Seconds => Seconds,
Minutes => Minutes,
Hours => Hours
);
end Behavioral;
Таймер часов реального времени (тестируется отдельно, как и ожидалось). Форма волны. Код компонента:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_unsigned.ALL; -- Enables Adding
entity rtc_timer is
generic( CLK_FREQ : integer :=2);
port
(
nRST : in std_logic;
clk : in std_logic;
Seconds : out std_logic_vector(5 downto 0);
Minutes : out std_logic_vector(5 downto 0);
Hours : out std_logic_vector(4 downto 0)
);
end rtc_timer;
architecture Behavioral of rtc_timer is
signal counter : integer;
signal sec : std_logic_vector(5 downto 0);
signal min : std_logic_vector(5 downto 0);
signal hr : std_logic_vector(4 downto 0);
begin
process(clk, nRST)
begin
if rising_edge(clk) then
-- Negative Reset Signal
if nRST = '0' then
counter <= -1; -- To account very first clk
sec <= (others => '0');
min <= (others => '0');
hr <= (others => '0');
elsif counter = CLK_FREQ - 1 then
counter <= 0;
if sec = 59 then
sec <= (others => '0');
if min = 59 then
min <= (others => '0');
if hr = 23 then
hr <= (others => '0');
else hr <= hr + 1;
end if;
else min <= min + 1;
end if;
else sec <= sec + 1;
end if;
else counter <= counter + 1;
end if;
end if;
Seconds <= sec;
Minutes <= min;
Hours <= hr;
end process;
end Behavioral;