axi_adrv9001:rx: Add reset to link layer

Fix random valid signals after resets on the Rx interface.
main
Laszlo Nagy 2021-01-05 16:20:40 +00:00 committed by Laszlo Nagy
parent 4c35af74d4
commit 9a93b56882
5 changed files with 38 additions and 5 deletions

View File

@ -37,6 +37,7 @@
module adrv9001_aligner4 ( module adrv9001_aligner4 (
input clk, input clk,
input rst,
input [3:0] idata, input [3:0] idata,
input ivalid, input ivalid,
input [3:0] strobe, input [3:0] strobe,
@ -48,7 +49,9 @@ module adrv9001_aligner4 (
reg ivalid_d = 'b0; reg ivalid_d = 'b0;
always @(posedge clk) begin always @(posedge clk) begin
if (ivalid) begin if (rst) begin
idata_d <= 'h0;
end else if (ivalid) begin
idata_d <= idata; idata_d <= idata;
end end
ivalid_d <= ivalid; ivalid_d <= ivalid;
@ -56,7 +59,9 @@ module adrv9001_aligner4 (
reg [1:0] phase = 'h0; reg [1:0] phase = 'h0;
always @(posedge clk) begin always @(posedge clk) begin
if (ivalid) begin if (rst) begin
phase <= 0;
end else if (ivalid) begin
if ((strobe != 'b1111) && (strobe != 'b0000)) begin if ((strobe != 'b1111) && (strobe != 'b0000)) begin
casex (strobe) casex (strobe)
'b1xxx : phase <= 0; 'b1xxx : phase <= 0;

View File

@ -37,6 +37,7 @@
module adrv9001_aligner8 ( module adrv9001_aligner8 (
input clk, input clk,
input rst,
input [7:0] idata, input [7:0] idata,
input ivalid, input ivalid,
input [7:0] strobe, input [7:0] strobe,
@ -48,7 +49,9 @@ module adrv9001_aligner8 (
reg ivalid_d = 'b0; reg ivalid_d = 'b0;
always @(posedge clk) begin always @(posedge clk) begin
if (ivalid) begin if (rst) begin
idata_d <= 'h0;
end else if (ivalid) begin
idata_d <= idata; idata_d <= idata;
end end
ivalid_d <= ivalid; ivalid_d <= ivalid;
@ -56,7 +59,9 @@ module adrv9001_aligner8 (
reg [2:0] phase = 'h0; reg [2:0] phase = 'h0;
always @(posedge clk) begin always @(posedge clk) begin
if (ivalid) begin if (rst) begin
phase <= 0;
end if (ivalid) begin
if ((strobe != 'b1111_1111) && (strobe != 'b0000_0000)) begin if ((strobe != 'b1111_1111) && (strobe != 'b0000_0000)) begin
casex (strobe) casex (strobe)
'b1xxx_xxxx : phase <= 0; 'b1xxx_xxxx : phase <= 0;

View File

@ -53,6 +53,7 @@ module adrv9001_pack #(
parameter WIDTH = 8 parameter WIDTH = 8
)( )(
input clk, // Input clock input clk, // Input clock
input rst,
input sof, // Start of frame indicator marking the MS Beat input sof, // Start of frame indicator marking the MS Beat
input [WIDTH-1:0] idata, // Input data beat input [WIDTH-1:0] idata, // Input data beat
input ivalid, // Input data qualifier input ivalid, // Input data qualifier
@ -73,7 +74,9 @@ module adrv9001_pack #(
// Use sof_d[2] for frame size of 4 beats // Use sof_d[2] for frame size of 4 beats
// Use sof_d[4,6] for frame size of 8 beats // Use sof_d[4,6] for frame size of 8 beats
always @(posedge clk) begin always @(posedge clk) begin
if (ivalid) begin if (rst) begin
sof_d <= 7'b0;
end else if (ivalid) begin
sof_d <= {sof_d[5:0],sof}; sof_d <= {sof_d[5:0],sof};
end end
if (ivalid &(sof_d[0] | sof_d[2] | sof_d[4] | sof_d[6])) begin if (ivalid &(sof_d[0] | sof_d[2] | sof_d[4] | sof_d[6])) begin

View File

@ -39,6 +39,7 @@ module adrv9001_rx_link #(
parameter CMOS_LVDS_N = 0 parameter CMOS_LVDS_N = 0
) ( ) (
input adc_rst,
input adc_clk_div, input adc_clk_div,
input [7:0] adc_data_0, input [7:0] adc_data_0,
input [7:0] adc_data_1, input [7:0] adc_data_1,
@ -100,6 +101,7 @@ module adrv9001_rx_link #(
adrv9001_aligner4 i_rx_aligner4_0 ( adrv9001_aligner4 i_rx_aligner4_0 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_0), .idata (sdr_data_0),
.ivalid (adc_valid), .ivalid (adc_valid),
.strobe (sdr_data_strobe), .strobe (sdr_data_strobe),
@ -108,6 +110,7 @@ module adrv9001_rx_link #(
adrv9001_aligner4 i_rx_aligner4_1 ( adrv9001_aligner4 i_rx_aligner4_1 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_1), .idata (sdr_data_1),
.ivalid (adc_valid), .ivalid (adc_valid),
.strobe (sdr_data_strobe), .strobe (sdr_data_strobe),
@ -116,6 +119,7 @@ module adrv9001_rx_link #(
adrv9001_aligner4 i_rx_aligner4_2 ( adrv9001_aligner4 i_rx_aligner4_2 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_2), .idata (sdr_data_2),
.ivalid (adc_valid), .ivalid (adc_valid),
.strobe (sdr_data_strobe), .strobe (sdr_data_strobe),
@ -124,6 +128,7 @@ module adrv9001_rx_link #(
adrv9001_aligner4 i_rx_aligner4_3 ( adrv9001_aligner4 i_rx_aligner4_3 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_3), .idata (sdr_data_3),
.ivalid (adc_valid), .ivalid (adc_valid),
.strobe (sdr_data_strobe), .strobe (sdr_data_strobe),
@ -132,6 +137,7 @@ module adrv9001_rx_link #(
adrv9001_aligner4 i_rx_aligner4_strobe ( adrv9001_aligner4 i_rx_aligner4_strobe (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_strobe), .idata (sdr_data_strobe),
.ivalid (adc_valid), .ivalid (adc_valid),
.strobe (sdr_data_strobe), .strobe (sdr_data_strobe),
@ -143,6 +149,7 @@ module adrv9001_rx_link #(
.WIDTH(4) .WIDTH(4)
) i_rx_pack_4_to_8_0 ( ) i_rx_pack_4_to_8_0 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_0_aligned), .idata (sdr_data_0_aligned),
.ivalid (aligner4_ovalid), .ivalid (aligner4_ovalid),
.sof (sdr_data_strobe_aligned[3]), .sof (sdr_data_strobe_aligned[3]),
@ -154,6 +161,7 @@ module adrv9001_rx_link #(
.WIDTH(4) .WIDTH(4)
) i_rx_pack_4_to_8_1 ( ) i_rx_pack_4_to_8_1 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_1_aligned), .idata (sdr_data_1_aligned),
.ivalid (aligner4_ovalid), .ivalid (aligner4_ovalid),
.sof (sdr_data_strobe_aligned[3]), .sof (sdr_data_strobe_aligned[3]),
@ -176,6 +184,7 @@ module adrv9001_rx_link #(
.WIDTH(4) .WIDTH(4)
) i_rx_pack_4_to_8_3 ( ) i_rx_pack_4_to_8_3 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_3_aligned), .idata (sdr_data_3_aligned),
.ivalid (aligner4_ovalid), .ivalid (aligner4_ovalid),
.sof (sdr_data_strobe_aligned[3]), .sof (sdr_data_strobe_aligned[3]),
@ -187,6 +196,7 @@ module adrv9001_rx_link #(
.WIDTH(4) .WIDTH(4)
) i_rx_pack_4_to_8_strobe ( ) i_rx_pack_4_to_8_strobe (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (sdr_data_strobe_aligned), .idata (sdr_data_strobe_aligned),
.ivalid (aligner4_ovalid), .ivalid (aligner4_ovalid),
.sof (sdr_data_strobe_aligned[3]), .sof (sdr_data_strobe_aligned[3]),
@ -229,6 +239,7 @@ module adrv9001_rx_link #(
adrv9001_aligner8 i_rx_aligner8_0( adrv9001_aligner8 i_rx_aligner8_0(
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (data_0), .idata (data_0),
.ivalid (data_valid), .ivalid (data_valid),
.strobe (data_strobe), .strobe (data_strobe),
@ -238,6 +249,7 @@ module adrv9001_rx_link #(
adrv9001_aligner8 i_rx_aligner8_1( adrv9001_aligner8 i_rx_aligner8_1(
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.ivalid (data_valid), .ivalid (data_valid),
.idata (data_1), .idata (data_1),
.strobe (data_strobe), .strobe (data_strobe),
@ -248,6 +260,7 @@ module adrv9001_rx_link #(
generate if (CMOS_LVDS_N) begin : cmos_aligner8 generate if (CMOS_LVDS_N) begin : cmos_aligner8
adrv9001_aligner8 i_rx_aligner8_2( adrv9001_aligner8 i_rx_aligner8_2(
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (data_2), .idata (data_2),
.ivalid (data_valid), .ivalid (data_valid),
.strobe (data_strobe), .strobe (data_strobe),
@ -255,6 +268,7 @@ module adrv9001_rx_link #(
); );
adrv9001_aligner8 i_rx_aligner8_3( adrv9001_aligner8 i_rx_aligner8_3(
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (data_3), .idata (data_3),
.ivalid (data_valid), .ivalid (data_valid),
.strobe (data_strobe), .strobe (data_strobe),
@ -265,6 +279,7 @@ module adrv9001_rx_link #(
adrv9001_aligner8 i_rx_strobe_aligner( adrv9001_aligner8 i_rx_strobe_aligner(
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.idata (data_strobe), .idata (data_strobe),
.ivalid (data_valid), .ivalid (data_valid),
.strobe (data_strobe), .strobe (data_strobe),
@ -275,6 +290,7 @@ module adrv9001_rx_link #(
.WIDTH (8) .WIDTH (8)
) i_rx_pack_8_to_16_0 ( ) i_rx_pack_8_to_16_0 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.ivalid (rx_data8_0_aligned_valid), .ivalid (rx_data8_0_aligned_valid),
.idata (rx_data8_0_aligned), .idata (rx_data8_0_aligned),
.sof (rx_data8_strobe_aligned[7]), .sof (rx_data8_strobe_aligned[7]),
@ -287,6 +303,7 @@ module adrv9001_rx_link #(
.WIDTH (8) .WIDTH (8)
) i_rx_pack_8_to_16_1 ( ) i_rx_pack_8_to_16_1 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.ivalid (rx_data8_1_aligned_valid), .ivalid (rx_data8_1_aligned_valid),
.idata (rx_data8_1_aligned), .idata (rx_data8_1_aligned),
.sof (rx_data8_strobe_aligned[7]), .sof (rx_data8_strobe_aligned[7]),
@ -298,6 +315,7 @@ module adrv9001_rx_link #(
.WIDTH (16) .WIDTH (16)
) i_rx_pack_16_to_32_0 ( ) i_rx_pack_16_to_32_0 (
.clk (adc_clk_div), .clk (adc_clk_div),
.rst (adc_rst),
.ivalid (rx_data16_0_packed_valid), .ivalid (rx_data16_0_packed_valid),
.idata (rx_data16_0_packed), .idata (rx_data16_0_packed),
.sof (rx_data16_0_packed_osof), .sof (rx_data16_0_packed_osof),

View File

@ -237,6 +237,7 @@ module axi_adrv9001_if #(
adrv9001_rx_link #( adrv9001_rx_link #(
.CMOS_LVDS_N (CMOS_LVDS_N) .CMOS_LVDS_N (CMOS_LVDS_N)
) i_rx_1_link ( ) i_rx_1_link (
.adc_rst (rx1_rst),
.adc_clk_div (adc_1_clk_div), .adc_clk_div (adc_1_clk_div),
.adc_data_0 (adc_1_data_0), .adc_data_0 (adc_1_data_0),
.adc_data_1 (adc_1_data_1), .adc_data_1 (adc_1_data_1),
@ -297,6 +298,7 @@ module axi_adrv9001_if #(
adrv9001_rx_link #( adrv9001_rx_link #(
.CMOS_LVDS_N (CMOS_LVDS_N) .CMOS_LVDS_N (CMOS_LVDS_N)
) i_rx_2_link ( ) i_rx_2_link (
.adc_rst (rx2_rst),
.adc_clk_div (adc_2_clk_div), .adc_clk_div (adc_2_clk_div),
.adc_data_0 (adc_2_data_0), .adc_data_0 (adc_2_data_0),
.adc_data_1 (adc_2_data_1), .adc_data_1 (adc_2_data_1),