From 229829e4dc52372b1fb0e07794ab999fac81f418 Mon Sep 17 00:00:00 2001 From: Adrian Costina Date: Wed, 24 May 2017 15:55:45 +0300 Subject: [PATCH] axi_ad9963: Add scale only correction option --- library/axi_ad9963/axi_ad9963.v | 13 +++++++-- library/axi_ad9963/axi_ad9963_ip.tcl | 1 + library/axi_ad9963/axi_ad9963_rx.v | 32 ++++++++++++++++++---- library/axi_ad9963/axi_ad9963_rx_channel.v | 30 ++++++++++---------- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/library/axi_ad9963/axi_ad9963.v b/library/axi_ad9963/axi_ad9963.v index f7be3a39d..582b886f2 100644 --- a/library/axi_ad9963/axi_ad9963.v +++ b/library/axi_ad9963/axi_ad9963.v @@ -31,8 +31,13 @@ module axi_ad9963 #( parameter DEVICE_TYPE = 0, parameter ADC_IODELAY_ENABLE = 0, parameter IO_DELAY_GROUP = "dev_if_delay_group", + parameter IODELAY_ENABLE = 0, parameter DAC_DATAPATH_DISABLE = 0, - parameter ADC_DATAPATH_DISABLE = 0 ) ( + parameter ADC_USERPORTS_DISABLE = 0, + parameter ADC_DATAFORMAT_DISABLE = 0, + parameter ADC_DCFILTER_DISABLE = 0, + parameter ADC_IQCORRECTION_DISABLE = 0, + parameter ADC_SCALECORRECTION_ONLY = 1) ( // physical interface (receive) @@ -192,7 +197,11 @@ module axi_ad9963 #( axi_ad9963_rx #( .ID (ID), - .DATAPATH_DISABLE (ADC_DATAPATH_DISABLE), + .USERPORTS_DISABLE (ADC_USERPORTS_DISABLE), + .DATAFORMAT_DISABLE (ADC_DATAFORMAT_DISABLE), + .DCFILTER_DISABLE (ADC_DCFILTER_DISABLE), + .IQCORRECTION_DISABLE (ADC_IQCORRECTION_DISABLE), + .SCALECORRECTION_ONLY (ADC_SCALECORRECTION_ONLY), .IODELAY_ENABLE (ADC_IODELAY_ENABLE) ) i_rx ( .adc_rst (adc_rst), diff --git a/library/axi_ad9963/axi_ad9963_ip.tcl b/library/axi_ad9963/axi_ad9963_ip.tcl index 4d583cf50..76c293399 100644 --- a/library/axi_ad9963/axi_ad9963_ip.tcl +++ b/library/axi_ad9963/axi_ad9963_ip.tcl @@ -19,6 +19,7 @@ adi_ip_files axi_ad9963 [list \ "$ad_hdl_dir/library/common/ad_datafmt.v" \ "$ad_hdl_dir/library/common/ad_dcfilter.v" \ "$ad_hdl_dir/library/common/ad_iqcor.v" \ + "$ad_hdl_dir/library/common/ad_scalecor.v" \ "$ad_hdl_dir/library/common/up_axi.v" \ "$ad_hdl_dir/library/common/up_xfer_cntrl.v" \ "$ad_hdl_dir/library/common/up_xfer_status.v" \ diff --git a/library/axi_ad9963/axi_ad9963_rx.v b/library/axi_ad9963/axi_ad9963_rx.v index a1ed85514..322dbc605 100644 --- a/library/axi_ad9963/axi_ad9963_rx.v +++ b/library/axi_ad9963/axi_ad9963_rx.v @@ -27,9 +27,13 @@ module axi_ad9963_rx #( // parameters - parameter DATAPATH_DISABLE = 0, - parameter IODELAY_ENABLE = 0, - parameter ID = 0) ( + parameter USERPORTS_DISABLE = 0, + parameter DATAFORMAT_DISABLE = 0, + parameter DCFILTER_DISABLE = 0, + parameter IQCORRECTION_DISABLE = 0, + parameter SCALECORRECTION_ONLY = 1, + parameter IODELAY_ENABLE = 0, + parameter ID = 0) ( // adc interface @@ -74,6 +78,15 @@ module axi_ad9963_rx #( output reg [31:0] up_rdata, output reg up_rack); + // configuration settings + + localparam CONFIG = (SCALECORRECTION_ONLY * 32) + + (0 * 16) + + (USERPORTS_DISABLE * 8) + + (DATAFORMAT_DISABLE * 4) + + (DCFILTER_DISABLE * 2) + + (IQCORRECTION_DISABLE * 1); + // internal registers reg up_status_pn_err = 'd0; @@ -116,7 +129,11 @@ module axi_ad9963_rx #( axi_ad9963_rx_channel #( .Q_OR_I_N(0), .CHANNEL_ID(0), - .DATAPATH_DISABLE (DATAPATH_DISABLE)) + .USERPORTS_DISABLE (USERPORTS_DISABLE), + .DATAFORMAT_DISABLE (DATAFORMAT_DISABLE), + .DCFILTER_DISABLE (DCFILTER_DISABLE), + .IQCORRECTION_DISABLE (IQCORRECTION_DISABLE), + .SCALECORRECTION_ONLY (SCALECORRECTION_ONLY)) i_rx_channel_0 ( .adc_clk (adc_clk), .adc_rst (adc_rst), @@ -147,7 +164,11 @@ module axi_ad9963_rx #( axi_ad9963_rx_channel #( .Q_OR_I_N(1), .CHANNEL_ID(1), - .DATAPATH_DISABLE (DATAPATH_DISABLE)) + .USERPORTS_DISABLE (USERPORTS_DISABLE), + .DATAFORMAT_DISABLE (DATAFORMAT_DISABLE), + .DCFILTER_DISABLE (DCFILTER_DISABLE), + .IQCORRECTION_DISABLE (IQCORRECTION_DISABLE), + .SCALECORRECTION_ONLY (SCALECORRECTION_ONLY)) i_rx_channel_1 ( .adc_clk (adc_clk), .adc_rst (adc_rst), @@ -177,6 +198,7 @@ module axi_ad9963_rx #( up_adc_common #( .ID (ID), + .CONFIG (CONFIG), .DRP_DISABLE (1), .USERPORTS_DISABLE (1), .GPIO_DISABLE (1), diff --git a/library/axi_ad9963/axi_ad9963_rx_channel.v b/library/axi_ad9963/axi_ad9963_rx_channel.v index 6ebd50be6..98036fd03 100644 --- a/library/axi_ad9963/axi_ad9963_rx_channel.v +++ b/library/axi_ad9963/axi_ad9963_rx_channel.v @@ -29,7 +29,11 @@ module axi_ad9963_rx_channel #( parameter Q_OR_I_N = 0, parameter CHANNEL_ID = 0, - parameter DATAPATH_DISABLE = 0) ( + parameter USERPORTS_DISABLE = 0, + parameter DATAFORMAT_DISABLE = 0, + parameter DCFILTER_DISABLE = 0, + parameter IQCORRECTION_DISABLE = 0, + parameter SCALECORRECTION_ONLY = 1) ( // adc interface @@ -96,7 +100,7 @@ module axi_ad9963_rx_channel #( .adc_pn_err (adc_pn_err_s)); generate - if (DATAPATH_DISABLE == 1) begin + if (DATAFORMAT_DISABLE == 1) begin assign adc_dfmt_valid_s = adc_valid; assign adc_dfmt_data_s = {{4{adc_data[11]}}, adc_data}; end else begin @@ -113,7 +117,7 @@ module axi_ad9963_rx_channel #( endgenerate generate - if (DATAPATH_DISABLE == 1) begin + if (DCFILTER_DISABLE == 1) begin assign adc_dcfilter_valid_s = adc_dfmt_valid_s; assign adc_dcfilter_data_s = adc_dfmt_data_s; end else begin @@ -129,12 +133,10 @@ module axi_ad9963_rx_channel #( end endgenerate - generate - if (DATAPATH_DISABLE == 1) begin - assign adc_iqcor_valid = adc_dcfilter_valid_s; - assign adc_iqcor_data = adc_dcfilter_data_s; - end else begin - ad_iqcor #(.Q_OR_I_N (Q_OR_I_N)) i_ad_iqcor ( + ad_iqcor #(.Q_OR_I_N (Q_OR_I_N), + .DISABLE(IQCORRECTION_DISABLE == 1), + .SCALE_ONLY(SCALECORRECTION_ONLY)) + i_ad_iqcor ( .clk (adc_clk), .valid (adc_dcfilter_valid_s), .data_in (adc_dcfilter_data_s), @@ -144,15 +146,13 @@ module axi_ad9963_rx_channel #( .iqcor_enable (adc_iqcor_enb_s), .iqcor_coeff_1 (adc_iqcor_coeff_1_s), .iqcor_coeff_2 (adc_iqcor_coeff_2_s)); - end - endgenerate up_adc_channel #( .CHANNEL_ID (CHANNEL_ID), - .DATAFORMAT_DISABLE (DATAPATH_DISABLE), - .DCFILTER_DISABLE (DATAPATH_DISABLE), - .IQCORRECTION_DISABLE (DATAPATH_DISABLE), - .USERPORTS_DISABLE (1) + .DATAFORMAT_DISABLE (DATAFORMAT_DISABLE), + .DCFILTER_DISABLE (DCFILTER_DISABLE), + .IQCORRECTION_DISABLE (IQCORRECTION_DISABLE == 1), + .USERPORTS_DISABLE (USERPORTS_DISABLE) ) i_up_adc_channel ( .adc_clk (adc_clk), .adc_rst (adc_rst),