g_nof_dp_phs_clk:NATURAL:=2;-- nof dp_phs_clk that can be used to detect lock
g_nof_dp_phs_clk:NATURAL:=2;-- nof dp_phs_clk that can be used to detect lock
g_dp_phs_clk_period:NATURAL:=32;-- number of dp_clk periods per dp_phs_clk period, must match g_clk*_divide_by in unb_clk200_pll
g_dd_phs_locked_w:NATURAL:=8;-- used to ensure that dd_phs_locked is only declared if dd_phs_detected is stable for at least 2**(g_dd_phs_locked_w-1) cycles
g_dd_phs_locked_w:NATURAL:=8;-- used to ensure that dd_phs_locked is only declared if dd_phs_detected is stable for at least 2**(g_dd_phs_locked_w-1) cycles
g_in_dat_w:NATURAL:=8-- nof PHY data bits
g_in_dat_w:NATURAL:=8-- nof PHY data bits
);
);
...
@@ -46,6 +56,7 @@ ENTITY lvdsh_dd_phs4_align IS
...
@@ -46,6 +56,7 @@ ENTITY lvdsh_dd_phs4_align IS
in_clk:INSTD_LOGIC:='1';
in_clk:INSTD_LOGIC:='1';
in_dat_hi:INSTD_LOGIC_VECTOR(g_in_dat_w-1DOWNTO0);-- input samples [t1], [t3], [t5], [t7], ... --> time
in_dat_hi:INSTD_LOGIC_VECTOR(g_in_dat_w-1DOWNTO0);-- input samples [t1], [t3], [t5], [t7], ... --> time
in_dat_lo:INSTD_LOGIC_VECTOR(g_in_dat_w-1DOWNTO0);-- input samples [t0], [t2], [t4], [t6], ... --> time
in_dat_lo:INSTD_LOGIC_VECTOR(g_in_dat_w-1DOWNTO0);-- input samples [t0], [t2], [t4], [t6], ... --> time
in_maintain_phs:INSTD_LOGIC:='0';
raw_phs:OUTSTD_LOGIC_VECTOR(g_wb_factor-1DOWNTO0);-- the measured sample phase before realignment
raw_phs:OUTSTD_LOGIC_VECTOR(g_wb_factor-1DOWNTO0);-- the measured sample phase before realignment
out_phs_locked:OUTSTD_LOGIC;-- '1' when realigned sample phase is stable and correct for at least 2**(g_dd_phs_locked_w-1) cycles
out_phs_locked:OUTSTD_LOGIC;-- '1' when realigned sample phase is stable and correct for at least 2**(g_dd_phs_locked_w-1) cycles
...
@@ -58,10 +69,13 @@ END lvdsh_dd_phs4_align;
...
@@ -58,10 +69,13 @@ END lvdsh_dd_phs4_align;
ARCHITECTUREstrOFlvdsh_dd_phs4_alignIS
ARCHITECTUREstrOFlvdsh_dd_phs4_alignIS
CONSTANTc_delay_len:NATURAL:=c_meta_delay_len;
CONSTANTc_ref_pipeline:NATURAL:=1;-- need pipeline to achieve 400 MHz when g_nof_dp_phs_clk=8
CONSTANTc_ref_pipeline:NATURAL:=1;-- need pipeline to achieve 400 MHz when g_nof_dp_phs_clk=8
CONSTANTc_align_pipeline:NATURAL:=1;-- use pipeline to achieve 400 MHz
CONSTANTc_exp_raw_phs_arr:t_natural_arr(g_wb_factor-1DOWNTO0):=(3,6,12,9);-- the expected word phase before realignment is fixed, the other values in the range indicate incorrect phase detection
CONSTANTc_exp_raw_phs_arr:t_natural_arr(g_wb_factor-1DOWNTO0):=(3,6,12,9);-- the expected word phase before realignment is fixed, the other values in the range indicate incorrect phase detection
...
@@ -71,6 +85,9 @@ ARCHITECTURE str OF lvdsh_dd_phs4_align IS
...
@@ -71,6 +85,9 @@ ARCHITECTURE str OF lvdsh_dd_phs4_align IS
-- . Note: a single sample phase shift due to missing a sample (when g_clk_drift=-2 ps in tb) is not noticed in realigned dd_phs. Therefore also check phs_evt and raw_phs.
-- . Note: a single sample phase shift due to missing a sample (when g_clk_drift=-2 ps in tb) is not noticed in realigned dd_phs. Therefore also check phs_evt and raw_phs.