Commit 191c3bd6 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

dmtd_with_deglitcher: added clock enable input to allow for undersampling/gating

parent 814e2ab2
......@@ -6,7 +6,7 @@
-- Author : Tomasz Wlostowski
-- Company : CERN BE-Co-HT
-- Created : 2010-02-25
-- Last update: 2011-10-29
-- Last update: 2012-03-06
-- Platform : FPGA-generic
-- Standard : VHDL '93
-------------------------------------------------------------------------------
......@@ -56,7 +56,7 @@ entity dmtd_with_deglitcher is
-- the following formula:
-- g_counter_bits = log2(f_in / abs(f_in - f_dmtd)) + 1
g_counter_bits : natural := 17;
g_chipscope: boolean := false
g_chipscope : boolean := false
);
port (
-- resets for different clock domains
......@@ -80,6 +80,13 @@ entity dmtd_with_deglitcher is
-- [clk_dmtd_i] phase shift direction: 1 - forward, 0 - backward
shift_dir_i : in std_logic;
-- DMTD clock enable, active high. Can be used to reduce the DMTD sampling
-- frequency - for example, two 10 MHz signals cannot be sampled directly
-- with a 125 MHz clock, but it's possible with a 5 MHz reference, obtained
-- by asserting clk_dmtd_en_i every 25 clk_dmtd_i cycles.
clk_dmtd_en_i : in std_logic := '1';
-- [clk_dmtd_i] deglitcher threshold
deglitch_threshold_i : in std_logic_vector(15 downto 0);
......@@ -167,7 +174,7 @@ begin -- rtl
state <= WAIT_STABLE_0;
free_cntr <= (others => '0');
new_edge_sreg <= (others => '0');
else
elsif(clk_dmtd_en_i = '1') then
if (shift_en_i = '0') then -- phase shifter
free_cntr <= free_cntr + 1;
......@@ -232,7 +239,7 @@ begin -- rtl
tag_stb_p1_o <= new_edge_p;
gc_extend_pulse_1: gc_extend_pulse
gc_extend_pulse_1 : gc_extend_pulse
generic map (
g_width => 3000)
port map (
......@@ -241,7 +248,7 @@ begin -- rtl
pulse_i => new_edge_p,
extended_o => dbg_dmtdout_o);
gen_with_csc: if(g_chipscope) generate
gen_with_csc : if(g_chipscope) generate
chipscope_ila_1 : chipscope_ila
port map (
......@@ -258,13 +265,13 @@ gen_with_csc: if(g_chipscope) generate
TRIG0(tag_int'left downto 0) <= std_logic_vector(tag_int);
TRIG0(31) <=clk_i_d3;
TRIG0(31) <= clk_i_d3;
TRIG0(30) <= '1' when (state = WAIT_STABLE_0) else '0';
TRIG0(29) <= '1' when (state = WAIT_EDGE) else '0';
TRIG0(28) <= '1' when (state = GOT_EDGE) else '0';
TRIG1(stab_cntr'left downto 0) <= std_logic_vector(stab_cntr);
TRIG2(free_cntr'left downto 0) <= std_logic_vector(free_cntr);
end generate gen_with_csc;
end generate gen_with_csc;
end rtl;
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