Commit 5c33a4d4 authored by Mathias Kreider's avatar Mathias Kreider

TLU: rework on sync chains

parent c68d12eb
This diff is collapsed.
...@@ -98,7 +98,7 @@ architecture behavioral of wr_tlu_fsm is ...@@ -98,7 +98,7 @@ architecture behavioral of wr_tlu_fsm is
constant c_datbits : natural := 72; constant c_datbits : natural := 72;
type t_state is (e_LOW, e_TRANS_RISE, e_HIGH, e_TRANS_FALL); type t_state is (e_LOW, e_TRANS_RISE, e_HIGH, e_TRANS_FALL, e_ERROR);
signal r_state : t_state; signal r_state : t_state;
signal r_wed0, signal r_wed0,
...@@ -239,7 +239,10 @@ captured_time_o <= s_add_x(66 downto 0); ...@@ -239,7 +239,10 @@ captured_time_o <= s_add_x(66 downto 0);
r_state <= e_LOW; r_state <= e_LOW;
end if; end if;
when others => r_state <= e_LOW;
when e_ERROR => r_state <= e_LOW;
when others => r_state <= e_ERROR;
end case; end case;
end if; end if;
......
...@@ -16,13 +16,14 @@ architecture rtl of tlu_tb is ...@@ -16,13 +16,14 @@ architecture rtl of tlu_tb is
constant c_dummy_master_out : t_wishbone_master_out := c_dummy_slave_in; constant c_dummy_master_out : t_wishbone_master_out := c_dummy_slave_in;
constant c_dummy_master_in : t_wishbone_master_in := c_dummy_slave_out; constant c_dummy_master_in : t_wishbone_master_in := c_dummy_slave_out;
signal r_ref_time : std_logic_vector(63 downto 0); signal r_ref_time : std_logic_vector(63 downto 0);
signal r_test_time : std_logic_vector(63 downto 0);
signal clk_sys, clk_ref : std_logic := '0'; signal clk_sys, clk_ref, clk_test : std_logic := '0';
signal rst_n : std_logic := '0'; signal rst_n : std_logic := '0';
-- Clock period definitions -- Clock period definitions
constant clk_period_sys : time := 10 ns; constant clk_period_sys : time := 8 ns;
constant clk_period_ref : time := 8 ns; constant clk_period_ref : time := 8 ns;
signal s_ctrl_i : t_wishbone_slave_in; signal s_ctrl_i : t_wishbone_slave_in;
...@@ -105,6 +106,14 @@ begin ...@@ -105,6 +106,14 @@ begin
end process; end process;
clk_process2 :process clk_process2 :process
begin
clk_test <= '0';
wait for 500 ps; --for 0.5 ns signal is '0'.
clk_test <= '1';
wait for 500 ps; --for 0.5 ns signal is '0'
end process;
clk_process3 :process
begin begin
clk_ref <= '0'; clk_ref <= '0';
wait for clk_period_ref/2; --for 0.5 ns signal is '0'. wait for clk_period_ref/2; --for 0.5 ns signal is '0'.
...@@ -112,8 +121,6 @@ begin ...@@ -112,8 +121,6 @@ begin
wait for clk_period_ref/2; --for next 0.5 ns signal is '1'. wait for clk_period_ref/2; --for next 0.5 ns signal is '1'.
end process; end process;
sample :process(clk_ref) sample :process(clk_ref)
begin begin
...@@ -128,7 +135,18 @@ begin ...@@ -128,7 +135,18 @@ begin
s_irq_i.ack <= s_irq_o.cyc and s_irq_o.stb; s_irq_i.ack <= s_irq_o.cyc and s_irq_o.stb;
end if; end if;
end if; end if;
end process; end process;
sample2 :process(clk_test)
begin
if(rising_edge(clk_test)) then
if(rst_n = '0') then
r_test_time <= (others => '0' );
else
r_test_time <= std_logic_vector(unsigned(r_test_time) +1);
end if;
end if;
end process;
...@@ -213,22 +231,70 @@ begin ...@@ -213,22 +231,70 @@ begin
wait until rising_edge(clk_ref); wait until rising_edge(clk_ref);
v_t := clk_period_ref; v_t := clk_period_ref;
wait for v_T/2; wait for 7 ns;
s_triggers <= (x"00", x"00", x"00"); s_triggers <= (x"00", x"00", x"00");
wait for v_T*20; wait for v_T*20;
report "TRIGGER!" severity warning; report "TRIGGER!" severity warning;
s_triggers <= (x"00", x"01", x"00"); s_triggers <= (x"00", x"00", x"00");
wait for v_T;
s_triggers <= (x"00", x"03", x"00");
wait for v_T;
s_triggers <= (x"00", x"fc", x"00");
wait for v_T;
s_triggers <= (x"00", x"00", x"00");
wait for v_T;
s_triggers <= (x"00", x"00", x"00");
wait for v_T*5;
report "TRIGGER!" severity warning;
s_triggers <= (x"00", x"00", x"00");
wait for v_T;
s_triggers <= (x"00", x"07", x"00");
wait for v_T;
s_triggers <= (x"00", x"f8", x"00");
wait for v_T;
s_triggers <= (x"00", x"00", x"00");
wait for v_T;
s_triggers <= (x"00", x"00", x"00");
wait for v_T*5;
report "TRIGGER!" severity warning;
s_triggers <= (x"00", x"00", x"00");
wait for v_T; wait for v_T;
s_triggers <= (x"00", x"0f", x"00"); s_triggers <= (x"00", x"0f", x"00");
wait for v_T; wait for v_T;
s_triggers <= (x"00", x"a1", x"00"); s_triggers <= (x"00", x"f0", x"00");
wait for v_T; wait for v_T;
s_triggers <= (x"00", x"fe", x"00"); s_triggers <= (x"00", x"00", x"00");
wait for v_T; wait for v_T;
s_triggers <= (x"00", x"00", x"00"); s_triggers <= (x"00", x"00", x"00");
wait for v_T*20; wait for v_T*5;
report "TRIGGER!" severity warning;
s_triggers <= (x"00", x"00", x"00");
wait for v_T;
s_triggers <= (x"00", x"ff", x"00");
wait for v_T;
s_triggers <= (x"00", x"00", x"00");
wait for v_T;
s_triggers <= (x"00", x"00", x"00");
wait for v_T;
s_triggers <= (x"00", x"00", x"00");
wait for v_T*5;
report "TRIGGER!" severity warning;
s_triggers <= (x"00", x"00", x"00");
wait for v_T;
s_triggers <= (x"00", x"ff", x"00");
wait for v_T;
s_triggers <= (x"00", x"ff", x"00");
wait for v_T;
s_triggers <= (x"00", x"ff", x"00");
wait for v_T;
s_triggers <= (x"00", x"00", x"00");
wait for v_T*5;
report "TRIGGER!" severity warning; report "TRIGGER!" severity warning;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment