Hallo Leute,
ich hab folgedes Problem:
Ich habe für mein Projekt ein Modul entworfen (clock_generator), dass
als
Input einen 50 MHz Clock erhält (CLOCK50_I), und aus diesem dann jeweils
nach 0,5 sec (CLOCK_F) bzw. nach 2 sec (CLOCK_S) zwei projektinterne
Clocks generieren soll. In einer Testbench erzeuge ich diesen 50 MHz
Clock
nun über einen entspr. Prozess und lese als Ausgabe die beiden neuen
Clocks ab. Obwohl ich meine, alle Signale zwischen Testbench und
Component richtig gemappt zu haben, kommt der in der Testbench erzeugte
Clock nicht in der Komponente an, sondern bleibt undefiniert. Außerdem
bleiben die modulinternen Register ebenfalls undefiniert. Ich stell hier
mal den Code des Moduls und der zugehörigen Testbench rein, vielleicht
fällt ja einem von euch ein, woran das liegen könnte? Wäre über jede
Hilfe dankbar.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity clock_generator is
port (
-- eingehende 50 MHz Clock
CLOCK50_I : in std_logic;
CLOCK_F : out std_logic;
CLOCK_S : out std_logic
);
end clock_generator;
architecture Behavioral of clock_generator is
signal current_erg_fast : std_logic_vector(26 downto 0);
signal next_erg_fast : std_logic_vector(26 downto 0) := (others =>
'0');
signal current_erg_slow : std_logic_vector(24 downto 0);
signal next_erg_slow : std_logic_vector(24 downto 0) := (others =>
'0');
signal clock_fast_we : std_logic;
signal clock_slow_we : std_logic;
signal flag_fast : std_logic;
signal flag_slow : std_logic;
begin
CLOCK_F <= flag_fast;
CLOCK_S <= flag_slow;
CALC_PERIOD_FAST : process(current_erg_fast, next_erg_fast)
begin
clock_fast_we <= '0';
if (next_erg_fast < "101111101011110000100000000") then
next_erg_fast <= current_erg_fast + 1;
elsif (next_erg_fast = "101111101011110000100000000") then
next_erg_fast <= (others => '0');
clock_fast_we <= '1';
end if;
end process CALC_PERIOD_FAST;
CALC_PERIOD_SLOW : process(current_erg_slow, next_erg_slow)
begin
clock_slow_we <= '0';
if (next_erg_slow < "1011111010111100001000000") then
next_erg_slow <= current_erg_slow + 1;
elsif (next_erg_slow = "1011111010111100001000000") then
next_erg_slow <= (others => '0');
clock_slow_we <= '1';
end if;
end process CALC_PERIOD_SLOW;
REGISTERS : process(CLOCK50_I)
begin
flag_fast <= '0';
flag_slow <= '0';
if (CLOCK50_I'event and CLOCK50_I = '1') then
current_erg_fast <= next_erg_fast;
current_erg_slow <= next_erg_slow;
if (clock_fast_we = '1') then
flag_fast <= '1';
elsif (clock_slow_we = '1') then
flag_slow <= '1';
end if;
end if;
end process REGISTERS;
end Behavioral;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity clock_generator_tb_vhd is
end clock_generator_tb_vhd;
architecture behavior of clock_generator_tb_vhd is
-- component Declaration for the Unit Under Test (UUT)
component clock_generator
port(
CLOCK50_I : in std_logic;
CLOCK_F : out std_logic;
CLOCK_S : out std_logic
);
end component;
--Inputs
signal clock50_i_tb : std_logic := '0';
--Outputs
signal clock_f_tb : std_logic;
signal clock_s_tb : std_logic;
begin
-- Instantiate the Unit Under Test (UUT)
UUT : clock_generator
port map (
CLOCK50_I => clock50_i_tb,
CLOCK_F => clock_f_tb,
CLOCK_S => clock_s_tb
);
TAKT : process -- simuliert 50 MHz Takt
begin
wait for 10 ns;
clock50_i_tb <= '1';
wait for 10 ns;
clock50_i_tb <= '0';
end process;
TB : process
begin
-- Wait 100 ns for global reset to finish
wait for 100 ns;
wait; -- will wait forever
end process;
end;
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.