Update ad_data_in &_out (#1060)
* ad_data_in: Add new logic and explanations * Added parameters IDELAY_TYPE, DELAY_FORMAT, US_DELAY_TYPE to be used with the IDELAY instances * Added explanations * Added option to bypass IDELAY if it's not instantiated, regardless of the FPGA_TECHNOLOGY parameter * Determined a part of the logic for EN_VTC (by the UG) but not for all modes since we don't have use cases for them * Changed logic when adding ODELAY: now you must set IODELAY_ENABLE = 1 and FPGA_TECHNOLOGY != NONE if you want it * ad_data_out: * Updated ODDR parameter * Fixed issue with ODDR inputs D1, D2: D1 must be with _p and D2 with _n, according to the Xilinx template * Removed _ES1 from IODELAY_SIM_DEVICE * Added ODELAY for UltraScale * Before, there was no support for UltraScale/+, and the output data was completely disconnected from the ODDR * The support for this was requested in this issue, although as of now we don't have a design that uses it: https://github.com/analogdevicesinc/hdl/issues/917 * Added parameters ODELAY_TYPE, DELAY_FORMAT, US_DELAY_TYPE to be used with the ODELAY instances * Added explanations * Added option to bypass ODELAY if it's not instantiated, regardless of the FPGA_TECHNOLOGY parameter * Determined a part of the logic for the EN_VTC (by the UG) but not for all modes since we don't have use cases for them * Changed logic when adding ODELAY: now you must set IODELAY_ENABLE = 1 and FPGA_TECHNOLOGY != NONE if you want it --------- Signed-off-by: Iulia Moldovan <Iulia.Moldovan@analog.com>main
parent
cadb8e637d
commit
075ee05189
|
@ -1,6 +1,6 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
|
||||
// Copyright 2014 - 2023 (c) Analog Devices, Inc. All rights reserved.
|
||||
//
|
||||
// In this HDL repository, there are many different and unique modules, consisting
|
||||
// of various HDL (Verilog or VHDL) components. The individual modules are
|
||||
|
@ -39,6 +39,12 @@ module ad_data_in #(
|
|||
parameter SINGLE_ENDED = 0,
|
||||
parameter FPGA_TECHNOLOGY = 0,
|
||||
parameter IDDR_CLK_EDGE ="SAME_EDGE",
|
||||
// for 7 series devices
|
||||
parameter IDELAY_TYPE = "VAR_LOAD",
|
||||
// for ultrascale devices
|
||||
parameter DELAY_FORMAT = "COUNT",
|
||||
parameter US_DELAY_TYPE = "VAR_LOAD",
|
||||
// for all
|
||||
parameter IODELAY_ENABLE = 1,
|
||||
parameter IODELAY_CTRL = 0,
|
||||
parameter IODELAY_GROUP = "dev_if_delay_group",
|
||||
|
@ -74,20 +80,68 @@ module ad_data_in #(
|
|||
localparam ULTRASCALE = 2;
|
||||
localparam ULTRASCALE_PLUS = 3;
|
||||
|
||||
localparam IODELAY_CTRL_ENABLED = (IODELAY_ENABLE == 1) ? IODELAY_CTRL : 0;
|
||||
// do not instantiate an IDELAYCTRL if no IDELAY is instantiated
|
||||
localparam IODELAY_CTRL_ENABLED = (IODELAY_ENABLE & IODELAY_CTRL);
|
||||
localparam IODELAY_CTRL_SIM_DEVICE = (FPGA_TECHNOLOGY == ULTRASCALE_PLUS) ? "ULTRASCALE" :
|
||||
(FPGA_TECHNOLOGY == ULTRASCALE) ? "ULTRASCALE" : "7SERIES";
|
||||
|
||||
localparam IODELAY_FPGA_TECHNOLOGY = (IODELAY_ENABLE == 1) ? FPGA_TECHNOLOGY : NONE;
|
||||
localparam IODELAY_SIM_DEVICE = (FPGA_TECHNOLOGY == ULTRASCALE_PLUS) ? "ULTRASCALE_PLUS" :
|
||||
(FPGA_TECHNOLOGY == ULTRASCALE) ? "ULTRASCALE" : "7SERIES";
|
||||
|
||||
/*
|
||||
* For 7 series, IDELAYCTRL is enabled ALWAYS, meaning in the following situations:
|
||||
* when IDELAY_TYPE = FIXED
|
||||
* when IDELAY_TYPE = VARIABLE
|
||||
* when IDELAY_TYPE = VAR_LOAD
|
||||
**/
|
||||
|
||||
/*
|
||||
* For UltraScale/UltraScale+:
|
||||
* when DELAY_FORMAT = TIME:
|
||||
* IDELAYCTRL must be used
|
||||
* REFCLK_FREQUENCY must reflect the clock frequency of REF_CLK applied to
|
||||
the IDELAYCTRL component
|
||||
* DELAY_VALUE attribute represents an amount in ps
|
||||
* The total delay through the IDELAYE3 is the align delay + DELAY_VALUE
|
||||
* EN_VTC depends on DELAY_TYPE attribute:
|
||||
* when FIXED mode: EN_VTC = 1
|
||||
* It must be actively manipulated when the delay line is used in
|
||||
VARIABLE or VAR_LOAD mode
|
||||
(this section is NOT IMPLEMENTED! More details in UG571, DELAY_TYPE = VAR_LOAD mode and VARIABLE mode)
|
||||
|
||||
* when DELAY_FORMAT = COUNT:
|
||||
* DO NOT use an IDELAYCTRL
|
||||
* REFCLK_FREQUENCY must be set to default frequency (300MHz)
|
||||
* Delay line represents an amount of taps (512 taps available)
|
||||
* CNTVALUEIN/OUT[8:0] values represent the amount of taps the delay line
|
||||
is set to
|
||||
* EN_VTC = 0
|
||||
**/
|
||||
|
||||
// internal signals
|
||||
|
||||
wire rx_data_ibuf_s;
|
||||
wire rx_data_idelay_s;
|
||||
wire [ 8:0] up_drdata_s;
|
||||
|
||||
// internal registers
|
||||
|
||||
reg en_vtc;
|
||||
|
||||
// determine EN_VTC (VAR_LOAD and VARIABLE modes not implemented as in UG571)
|
||||
|
||||
always @(posedge rx_clk) begin
|
||||
if (DELAY_FORMAT == "TIME") begin
|
||||
if (US_DELAY_TYPE == "FIXED") begin
|
||||
en_vtc <= 1'b1;
|
||||
end else begin // "VAR_LOAD", "VARIABLE"
|
||||
en_vtc <= ~up_dld;
|
||||
end
|
||||
end else begin // "COUNT"
|
||||
en_vtc <= 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
// delay controller
|
||||
|
||||
generate
|
||||
|
@ -106,6 +160,8 @@ module ad_data_in #(
|
|||
|
||||
// receive data interface, ibuf -> idelay -> iddr
|
||||
|
||||
// ibuf
|
||||
|
||||
generate
|
||||
if (SINGLE_ENDED == 1) begin
|
||||
IBUF i_rx_data_ibuf (
|
||||
|
@ -119,16 +175,25 @@ module ad_data_in #(
|
|||
end
|
||||
endgenerate
|
||||
|
||||
// bypass IDELAY
|
||||
|
||||
generate
|
||||
if (IODELAY_ENABLE == 0) begin
|
||||
assign rx_data_idelay_s = rx_data_ibuf_s;
|
||||
assign up_drdata = 5'd0;
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// idelay
|
||||
|
||||
generate
|
||||
if (IODELAY_FPGA_TECHNOLOGY == SEVEN_SERIES) begin
|
||||
if (FPGA_TECHNOLOGY == SEVEN_SERIES && IODELAY_ENABLE == 1) begin
|
||||
(* IODELAY_GROUP = IODELAY_GROUP *)
|
||||
IDELAYE2 #(
|
||||
.CINVCTRL_SEL ("FALSE"),
|
||||
.DELAY_SRC ("IDATAIN"),
|
||||
.HIGH_PERFORMANCE_MODE ("FALSE"),
|
||||
.IDELAY_TYPE ("VAR_LOAD"),
|
||||
.IDELAY_TYPE (IDELAY_TYPE),
|
||||
.IDELAY_VALUE (0),
|
||||
.REFCLK_FREQUENCY (REFCLK_FREQUENCY),
|
||||
.PIPE_SEL ("FALSE"),
|
||||
|
@ -150,15 +215,17 @@ module ad_data_in #(
|
|||
endgenerate
|
||||
|
||||
generate
|
||||
if ((IODELAY_FPGA_TECHNOLOGY == ULTRASCALE) || (IODELAY_FPGA_TECHNOLOGY == ULTRASCALE_PLUS)) begin
|
||||
if ((FPGA_TECHNOLOGY == ULTRASCALE || FPGA_TECHNOLOGY == ULTRASCALE_PLUS)
|
||||
&& (IODELAY_ENABLE == 1)) begin
|
||||
|
||||
assign up_drdata = up_drdata_s[8:4];
|
||||
(* IODELAY_GROUP = IODELAY_GROUP *)
|
||||
IDELAYE3 #(
|
||||
.SIM_DEVICE (IODELAY_SIM_DEVICE),
|
||||
.DELAY_SRC ("IDATAIN"),
|
||||
.DELAY_TYPE ("VAR_LOAD"),
|
||||
.DELAY_TYPE (US_DELAY_TYPE),
|
||||
.REFCLK_FREQUENCY (REFCLK_FREQUENCY),
|
||||
.DELAY_FORMAT ("COUNT")
|
||||
.DELAY_FORMAT (DELAY_FORMAT)
|
||||
) i_rx_data_idelay (
|
||||
.CASC_RETURN (1'b0),
|
||||
.CASC_IN (1'b0),
|
||||
|
@ -173,21 +240,14 @@ module ad_data_in #(
|
|||
.IDATAIN (rx_data_ibuf_s),
|
||||
.DATAOUT (rx_data_idelay_s),
|
||||
.RST (1'b0),
|
||||
.EN_VTC (~up_dld));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
generate
|
||||
if (IODELAY_FPGA_TECHNOLOGY == NONE) begin
|
||||
assign rx_data_idelay_s = rx_data_ibuf_s;
|
||||
assign up_drdata = 5'd0;
|
||||
.EN_VTC (en_vtc));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// iddr
|
||||
|
||||
generate
|
||||
if ((FPGA_TECHNOLOGY == ULTRASCALE) || (FPGA_TECHNOLOGY == ULTRASCALE_PLUS)) begin
|
||||
if (FPGA_TECHNOLOGY == ULTRASCALE || FPGA_TECHNOLOGY == ULTRASCALE_PLUS) begin
|
||||
IDDRE1 #(
|
||||
.DDR_CLK_EDGE (IDDR_CLK_EDGE)
|
||||
) i_rx_data_iddr (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
|
||||
// Copyright 2014 - 2023 (c) Analog Devices, Inc. All rights reserved.
|
||||
//
|
||||
// In this HDL repository, there are many different and unique modules, consisting
|
||||
// of various HDL (Verilog or VHDL) components. The individual modules are
|
||||
|
@ -40,6 +40,12 @@ module ad_data_out #(
|
|||
parameter FPGA_TECHNOLOGY = 0,
|
||||
parameter SINGLE_ENDED = 0,
|
||||
parameter IDDR_CLK_EDGE ="SAME_EDGE",
|
||||
// for 7 series devices
|
||||
parameter ODELAY_TYPE = "VAR_LOAD",
|
||||
// for ultrascale devices
|
||||
parameter DELAY_FORMAT = "COUNT",
|
||||
parameter US_DELAY_TYPE = "VAR_LOAD",
|
||||
// for all
|
||||
parameter IODELAY_ENABLE = 0,
|
||||
parameter IODELAY_CTRL = 0,
|
||||
parameter IODELAY_GROUP = "dev_if_delay_group",
|
||||
|
@ -73,73 +79,134 @@ module ad_data_out #(
|
|||
localparam ULTRASCALE = 2;
|
||||
localparam ULTRASCALE_PLUS = 3;
|
||||
|
||||
localparam IODELAY_CTRL_ENABLED = (IODELAY_ENABLE == 1) ? IODELAY_CTRL : 0;
|
||||
// do not instantiate an IDELAYCTRL if no ODELAY is instantiated
|
||||
localparam IODELAY_CTRL_ENABLED = (IODELAY_ENABLE & IODELAY_CTRL);
|
||||
localparam IODELAY_CTRL_SIM_DEVICE = (FPGA_TECHNOLOGY == ULTRASCALE_PLUS) ? "ULTRASCALE" :
|
||||
(FPGA_TECHNOLOGY == ULTRASCALE) ? "ULTRASCALE" : "7SERIES";
|
||||
|
||||
localparam IODELAY_FPGA_TECHNOLOGY = (IODELAY_ENABLE == 1) ? FPGA_TECHNOLOGY : NONE;
|
||||
localparam IODELAY_SIM_DEVICE = (FPGA_TECHNOLOGY == ULTRASCALE_PLUS) ? "ULTRASCALE_PLUS_ES1" :
|
||||
localparam IODELAY_SIM_DEVICE = (FPGA_TECHNOLOGY == ULTRASCALE_PLUS) ? "ULTRASCALE_PLUS" :
|
||||
(FPGA_TECHNOLOGY == ULTRASCALE) ? "ULTRASCALE" : "7SERIES";
|
||||
|
||||
/*
|
||||
* For 7 series, IDELAYCTRL is enabled ALWAYS, meaning in the following situations:
|
||||
* when ODELAY_TYPE = FIXED
|
||||
* when ODELAY_TYPE = VARIABLE
|
||||
* when ODELAY_TYPE = VAR_LOAD
|
||||
**/
|
||||
|
||||
/*
|
||||
* For UltraScale/UltraScale+:
|
||||
* when DELAY_FORMAT = TIME:
|
||||
* IDELAYCTRL must be used
|
||||
* REFCLK_FREQUENCY must reflect the clock frequency of REF_CLK applied to
|
||||
the IDELAYCTRL component
|
||||
* DELAY_VALUE attribute represents an amount in ps
|
||||
* The total delay through the IDELAYE3 is the align delay + DELAY_VALUE
|
||||
* EN_VTC depends on DELAY_TYPE attribute:
|
||||
* when FIXED mode: EN_VTC = 1
|
||||
* It must be actively manipulated when the delay line is used in
|
||||
VARIABLE or VAR_LOAD mode
|
||||
(this section is NOT IMPLEMENTED! More details in UG571, DELAY_TYPE = VAR_LOAD mode and VARIABLE mode)
|
||||
|
||||
* when DELAY_FORMAT = COUNT:
|
||||
* DO NOT use an IDELAYCTRL
|
||||
* REFCLK_FREQUENCY must be set to default frequency (300MHz)
|
||||
* Delay line represents an amount of taps (512 taps available)
|
||||
* CNTVALUEIN/OUT[8:0] values represent the amount of taps the delay line
|
||||
is set to
|
||||
* EN_VTC = 0
|
||||
**/
|
||||
|
||||
// internal signals
|
||||
|
||||
wire tx_data_oddr_s;
|
||||
wire tx_data_odelay_s;
|
||||
|
||||
// internal registers
|
||||
|
||||
reg en_vtc;
|
||||
|
||||
// determine EN_VTC (VAR_LOAD and VARIABLE modes not implemented as in UG571)
|
||||
|
||||
always @(posedge tx_clk) begin
|
||||
if (DELAY_FORMAT == "TIME") begin
|
||||
if (US_DELAY_TYPE == "FIXED") begin
|
||||
en_vtc <= 1'b1;
|
||||
end else begin // "VAR_LOAD", "VARIABLE"
|
||||
en_vtc <= ~up_dld;
|
||||
end
|
||||
end else begin // "COUNT"
|
||||
en_vtc <= 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
// delay controller
|
||||
|
||||
generate
|
||||
if (IODELAY_CTRL_ENABLED == 0) begin
|
||||
assign delay_locked = 1'b1;
|
||||
assign delay_locked = 1'b1;
|
||||
end else begin
|
||||
(* IODELAY_GROUP = IODELAY_GROUP *)
|
||||
IDELAYCTRL #(
|
||||
.SIM_DEVICE (IODELAY_CTRL_SIM_DEVICE)
|
||||
) i_delay_ctrl (
|
||||
.RST (delay_rst),
|
||||
.REFCLK (delay_clk),
|
||||
.RDY (delay_locked));
|
||||
(* IODELAY_GROUP = IODELAY_GROUP *)
|
||||
IDELAYCTRL #(
|
||||
.SIM_DEVICE (IODELAY_CTRL_SIM_DEVICE)
|
||||
) i_delay_ctrl (
|
||||
.RST (delay_rst),
|
||||
.REFCLK (delay_clk),
|
||||
.RDY (delay_locked));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// bypass ODELAY
|
||||
|
||||
generate
|
||||
if (IODELAY_ENABLE == 0) begin
|
||||
assign tx_data_odelay_s = tx_data_oddr_s;
|
||||
assign up_drdata = 5'd0;
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// transmit data interface, oddr -> odelay -> obuf
|
||||
|
||||
// oddr
|
||||
|
||||
generate
|
||||
if ((FPGA_TECHNOLOGY == ULTRASCALE) || (FPGA_TECHNOLOGY == ULTRASCALE_PLUS)) begin
|
||||
ODDRE1 i_tx_data_oddr (
|
||||
.SR (1'b0),
|
||||
.C (tx_clk),
|
||||
.D1 (tx_data_n),
|
||||
.D2 (tx_data_p),
|
||||
.Q (tx_data_oddr_s));
|
||||
ODDRE1 #(
|
||||
.SIM_DEVICE (IODELAY_SIM_DEVICE)
|
||||
) i_tx_data_oddr (
|
||||
.SR (1'b0),
|
||||
.C (tx_clk),
|
||||
.D1 (tx_data_p),
|
||||
.D2 (tx_data_n),
|
||||
.Q (tx_data_oddr_s));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
generate
|
||||
if (FPGA_TECHNOLOGY == SEVEN_SERIES) begin
|
||||
ODDR #(
|
||||
.DDR_CLK_EDGE (IDDR_CLK_EDGE)
|
||||
) i_tx_data_oddr (
|
||||
.CE (1'b1),
|
||||
.R (1'b0),
|
||||
.S (1'b0),
|
||||
.C (tx_clk),
|
||||
.D1 (tx_data_n),
|
||||
.D2 (tx_data_p),
|
||||
.Q (tx_data_oddr_s));
|
||||
ODDR #(
|
||||
.DDR_CLK_EDGE (IDDR_CLK_EDGE)
|
||||
) i_tx_data_oddr (
|
||||
.CE (1'b1),
|
||||
.R (1'b0),
|
||||
.S (1'b0),
|
||||
.C (tx_clk),
|
||||
.D1 (tx_data_p),
|
||||
.D2 (tx_data_n),
|
||||
.Q (tx_data_oddr_s));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// odelay
|
||||
|
||||
generate
|
||||
if (IODELAY_FPGA_TECHNOLOGY == SEVEN_SERIES) begin
|
||||
if (FPGA_TECHNOLOGY == SEVEN_SERIES && IODELAY_ENABLE == 1) begin
|
||||
(* IODELAY_GROUP = IODELAY_GROUP *)
|
||||
ODELAYE2 #(
|
||||
.CINVCTRL_SEL ("FALSE"),
|
||||
.DELAY_SRC ("ODATAIN"),
|
||||
.HIGH_PERFORMANCE_MODE ("FALSE"),
|
||||
.ODELAY_TYPE ("VAR_LOAD"),
|
||||
.ODELAY_TYPE (ODELAY_TYPE),
|
||||
.ODELAY_VALUE (0),
|
||||
.REFCLK_FREQUENCY (REFCLK_FREQUENCY),
|
||||
.PIPE_SEL ("FALSE"),
|
||||
|
@ -161,9 +228,34 @@ module ad_data_out #(
|
|||
endgenerate
|
||||
|
||||
generate
|
||||
if (IODELAY_FPGA_TECHNOLOGY == NONE) begin
|
||||
assign up_drdata = 5'd0;
|
||||
assign tx_data_odelay_s = tx_data_oddr_s;
|
||||
if ((FPGA_TECHNOLOGY == ULTRASCALE_PLUS || FPGA_TECHNOLOGY == ULTRASCALE)
|
||||
&& (IODELAY_ENABLE == 1)) begin
|
||||
|
||||
(* IODELAY_GROUP = IODELAY_GROUP *)
|
||||
ODELAYE3 #(
|
||||
.CASCADE ("NONE"),
|
||||
.DELAY_FORMAT (DELAY_FORMAT),
|
||||
.DELAY_TYPE (US_DELAY_TYPE),
|
||||
.DELAY_VALUE (0),
|
||||
.IS_CLK_INVERTED (1'b0),
|
||||
.IS_RST_INVERTED (1'b0),
|
||||
.REFCLK_FREQUENCY (REFCLK_FREQUENCY),
|
||||
.SIM_DEVICE (IODELAY_SIM_DEVICE),
|
||||
.UPDATE_MODE ("ASYNC")
|
||||
) i_tx_data_odelay (
|
||||
.CASC_RETURN (1'b0),
|
||||
.CASC_IN (1'b0),
|
||||
.CASC_OUT (),
|
||||
.CE (1'b0),
|
||||
.CLK (up_clk),
|
||||
.INC (1'b0),
|
||||
.LOAD (up_dld),
|
||||
.CNTVALUEIN (up_dwdata),
|
||||
.CNTVALUEOUT (up_drdata),
|
||||
.ODATAIN (tx_data_oddr_s),
|
||||
.DATAOUT (tx_data_odelay_s),
|
||||
.RST (1'b0),
|
||||
.EN_VTC (en_vtc));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
|
@ -171,15 +263,15 @@ module ad_data_out #(
|
|||
|
||||
generate
|
||||
if (SINGLE_ENDED == 1) begin
|
||||
assign tx_data_out_n = 1'b0;
|
||||
OBUF i_tx_data_obuf (
|
||||
.I (tx_data_odelay_s),
|
||||
.O (tx_data_out_p));
|
||||
assign tx_data_out_n = 1'b0;
|
||||
OBUF i_tx_data_obuf (
|
||||
.I (tx_data_odelay_s),
|
||||
.O (tx_data_out_p));
|
||||
end else begin
|
||||
OBUFDS i_tx_data_obuf (
|
||||
.I (tx_data_odelay_s),
|
||||
.O (tx_data_out_p),
|
||||
.OB (tx_data_out_n));
|
||||
OBUFDS i_tx_data_obuf (
|
||||
.I (tx_data_odelay_s),
|
||||
.O (tx_data_out_p),
|
||||
.OB (tx_data_out_n));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
|
|
Loading…
Reference in New Issue