axi_ad9371: added
parent
50d018fc11
commit
b5b05bb9d1
|
@ -0,0 +1,401 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2011(c) Analog Devices, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// - Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// - Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
// - The use of this software may or may not infringe the patent rights
|
||||
// of one or more patent holders. This license does not release you
|
||||
// from the requirement that you obtain separate licenses from these
|
||||
// patent holders to use this software.
|
||||
// - Use of the software either in source or binary form, must be run
|
||||
// on or directly connected to an Analog Devices Inc. component.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
//
|
||||
// IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
|
||||
// RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
`timescale 1ns/100ps
|
||||
|
||||
module axi_ad9371 (
|
||||
|
||||
// receive
|
||||
|
||||
adc_clk,
|
||||
adc_rx_data,
|
||||
adc_os_clk,
|
||||
adc_rx_os_data,
|
||||
|
||||
// transmit
|
||||
|
||||
dac_clk,
|
||||
dac_tx_data,
|
||||
|
||||
// master/slave
|
||||
|
||||
dac_sync_in,
|
||||
dac_sync_out,
|
||||
|
||||
// dma interface
|
||||
|
||||
adc_enable_i0,
|
||||
adc_valid_i0,
|
||||
adc_data_i0,
|
||||
adc_enable_q0,
|
||||
adc_valid_q0,
|
||||
adc_data_q0,
|
||||
adc_enable_i1,
|
||||
adc_valid_i1,
|
||||
adc_data_i1,
|
||||
adc_enable_q1,
|
||||
adc_valid_q1,
|
||||
adc_data_q1,
|
||||
adc_dovf,
|
||||
adc_dunf,
|
||||
|
||||
adc_os_enable_i0,
|
||||
adc_os_valid_i0,
|
||||
adc_os_data_i0,
|
||||
adc_os_enable_q0,
|
||||
adc_os_valid_q0,
|
||||
adc_os_data_q0,
|
||||
adc_os_dovf,
|
||||
adc_os_dunf,
|
||||
|
||||
dac_enable_i0,
|
||||
dac_valid_i0,
|
||||
dac_data_i0,
|
||||
dac_enable_q0,
|
||||
dac_valid_q0,
|
||||
dac_data_q0,
|
||||
dac_enable_i1,
|
||||
dac_valid_i1,
|
||||
dac_data_i1,
|
||||
dac_enable_q1,
|
||||
dac_valid_q1,
|
||||
dac_data_q1,
|
||||
dac_dovf,
|
||||
dac_dunf,
|
||||
|
||||
// axi interface
|
||||
|
||||
s_axi_aclk,
|
||||
s_axi_aresetn,
|
||||
s_axi_awvalid,
|
||||
s_axi_awaddr,
|
||||
s_axi_awprot,
|
||||
s_axi_awready,
|
||||
s_axi_wvalid,
|
||||
s_axi_wdata,
|
||||
s_axi_wstrb,
|
||||
s_axi_wready,
|
||||
s_axi_bvalid,
|
||||
s_axi_bresp,
|
||||
s_axi_bready,
|
||||
s_axi_arvalid,
|
||||
s_axi_araddr,
|
||||
s_axi_arprot,
|
||||
s_axi_arready,
|
||||
s_axi_rvalid,
|
||||
s_axi_rdata,
|
||||
s_axi_rresp,
|
||||
s_axi_rready);
|
||||
|
||||
// parameters
|
||||
|
||||
parameter ID = 0;
|
||||
parameter DAC_DATAPATH_DISABLE = 0;
|
||||
parameter ADC_DATAPATH_DISABLE = 0;
|
||||
|
||||
// receive
|
||||
|
||||
input adc_clk;
|
||||
input [ 63:0] adc_rx_data;
|
||||
input adc_os_clk;
|
||||
input [ 63:0] adc_rx_os_data;
|
||||
|
||||
// transmit
|
||||
|
||||
input dac_clk;
|
||||
output [127:0] dac_tx_data;
|
||||
|
||||
// master/slave
|
||||
|
||||
input dac_sync_in;
|
||||
output dac_sync_out;
|
||||
|
||||
// dma interface
|
||||
|
||||
output adc_enable_i0;
|
||||
output adc_valid_i0;
|
||||
output [ 15:0] adc_data_i0;
|
||||
output adc_enable_q0;
|
||||
output adc_valid_q0;
|
||||
output [ 15:0] adc_data_q0;
|
||||
output adc_enable_i1;
|
||||
output adc_valid_i1;
|
||||
output [ 15:0] adc_data_i1;
|
||||
output adc_enable_q1;
|
||||
output adc_valid_q1;
|
||||
output [ 15:0] adc_data_q1;
|
||||
input adc_dovf;
|
||||
input adc_dunf;
|
||||
|
||||
output adc_os_enable_i0;
|
||||
output adc_os_valid_i0;
|
||||
output [ 31:0] adc_os_data_i0;
|
||||
output adc_os_enable_q0;
|
||||
output adc_os_valid_q0;
|
||||
output [ 31:0] adc_os_data_q0;
|
||||
input adc_os_dovf;
|
||||
input adc_os_dunf;
|
||||
|
||||
output dac_enable_i0;
|
||||
output dac_valid_i0;
|
||||
input [ 31:0] dac_data_i0;
|
||||
output dac_enable_q0;
|
||||
output dac_valid_q0;
|
||||
input [ 31:0] dac_data_q0;
|
||||
output dac_enable_i1;
|
||||
output dac_valid_i1;
|
||||
input [ 31:0] dac_data_i1;
|
||||
output dac_enable_q1;
|
||||
output dac_valid_q1;
|
||||
input [ 31:0] dac_data_q1;
|
||||
input dac_dovf;
|
||||
input dac_dunf;
|
||||
|
||||
// axi interface
|
||||
|
||||
input s_axi_aclk;
|
||||
input s_axi_aresetn;
|
||||
input s_axi_awvalid;
|
||||
input [ 31:0] s_axi_awaddr;
|
||||
input [ 2:0] s_axi_awprot;
|
||||
output s_axi_awready;
|
||||
input s_axi_wvalid;
|
||||
input [ 31:0] s_axi_wdata;
|
||||
input [ 3:0] s_axi_wstrb;
|
||||
output s_axi_wready;
|
||||
output s_axi_bvalid;
|
||||
output [ 1:0] s_axi_bresp;
|
||||
input s_axi_bready;
|
||||
input s_axi_arvalid;
|
||||
input [ 31:0] s_axi_araddr;
|
||||
input [ 2:0] s_axi_arprot;
|
||||
output s_axi_arready;
|
||||
output s_axi_rvalid;
|
||||
output [ 31:0] s_axi_rdata;
|
||||
output [ 1:0] s_axi_rresp;
|
||||
input s_axi_rready;
|
||||
|
||||
// internal registers
|
||||
|
||||
reg up_wack = 'd0;
|
||||
reg up_rack = 'd0;
|
||||
reg [ 31:0] up_rdata = 'd0;
|
||||
|
||||
// internal signals
|
||||
|
||||
wire up_clk;
|
||||
wire up_rstn;
|
||||
wire [ 63:0] adc_data_s;
|
||||
wire adc_os_valid_s;
|
||||
wire [ 63:0] adc_os_data_s;
|
||||
wire [127:0] dac_data_s;
|
||||
wire up_wreq_s;
|
||||
wire [ 13:0] up_waddr_s;
|
||||
wire [ 31:0] up_wdata_s;
|
||||
wire [ 2:0] up_wack_s;
|
||||
wire up_rreq_s;
|
||||
wire [ 13:0] up_raddr_s;
|
||||
wire [ 31:0] up_rdata_s[0:2];
|
||||
wire [ 2:0] up_rack_s;
|
||||
|
||||
// signal name changes
|
||||
|
||||
assign up_clk = s_axi_aclk;
|
||||
assign up_rstn = s_axi_aresetn;
|
||||
|
||||
// processor read interface
|
||||
|
||||
always @(negedge up_rstn or posedge up_clk) begin
|
||||
if (up_rstn == 0) begin
|
||||
up_wack <= 'd0;
|
||||
up_rack <= 'd0;
|
||||
up_rdata <= 'd0;
|
||||
end else begin
|
||||
up_wack <= | up_wack_s;
|
||||
up_rack <= | up_rack_s;
|
||||
up_rdata <= up_rdata_s[0] | up_rdata_s[1] | up_rdata_s[2];
|
||||
end
|
||||
end
|
||||
|
||||
// device interface
|
||||
|
||||
axi_ad9371_if i_if (
|
||||
.adc_clk (adc_clk),
|
||||
.adc_rx_data (adc_rx_data),
|
||||
.adc_os_clk (adc_os_clk),
|
||||
.adc_rx_os_data (adc_rx_os_data),
|
||||
.adc_data (adc_data_s),
|
||||
.adc_os_valid (adc_os_valid_s),
|
||||
.adc_os_data (adc_os_data_s),
|
||||
.dac_clk (dac_clk),
|
||||
.dac_tx_data (dac_tx_data),
|
||||
.dac_data (dac_data_s));
|
||||
|
||||
// receive
|
||||
|
||||
axi_ad9371_rx #(
|
||||
.ID (ID),
|
||||
.DATAPATH_DISABLE (ADC_DATAPATH_DISABLE))
|
||||
i_rx (
|
||||
.adc_rst (adc_rst),
|
||||
.adc_clk (adc_clk),
|
||||
.adc_data (adc_data_s),
|
||||
.adc_enable_i0 (adc_enable_i0),
|
||||
.adc_valid_i0 (adc_valid_i0),
|
||||
.adc_data_i0 (adc_data_i0),
|
||||
.adc_enable_q0 (adc_enable_q0),
|
||||
.adc_valid_q0 (adc_valid_q0),
|
||||
.adc_data_q0 (adc_data_q0),
|
||||
.adc_enable_i1 (adc_enable_i1),
|
||||
.adc_valid_i1 (adc_valid_i1),
|
||||
.adc_data_i1 (adc_data_i1),
|
||||
.adc_enable_q1 (adc_enable_q1),
|
||||
.adc_valid_q1 (adc_valid_q1),
|
||||
.adc_data_q1 (adc_data_q1),
|
||||
.adc_dovf (adc_dovf),
|
||||
.adc_dunf (adc_dunf),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq_s),
|
||||
.up_waddr (up_waddr_s),
|
||||
.up_wdata (up_wdata_s),
|
||||
.up_wack (up_wack_s[0]),
|
||||
.up_rreq (up_rreq_s),
|
||||
.up_raddr (up_raddr_s),
|
||||
.up_rdata (up_rdata_s[0]),
|
||||
.up_rack (up_rack_s[0]));
|
||||
|
||||
// receive (o/s)
|
||||
|
||||
axi_ad9371_rx_os #(
|
||||
.ID (ID),
|
||||
.DATAPATH_DISABLE (ADC_DATAPATH_DISABLE))
|
||||
i_rx_os (
|
||||
.adc_os_rst (adc_os_rst),
|
||||
.adc_os_clk (adc_os_clk),
|
||||
.adc_os_valid (adc_os_valid_s),
|
||||
.adc_os_data (adc_os_data_s),
|
||||
.adc_os_enable_i0 (adc_os_enable_i0),
|
||||
.adc_os_valid_i0 (adc_os_valid_i0),
|
||||
.adc_os_data_i0 (adc_os_data_i0),
|
||||
.adc_os_enable_q0 (adc_os_enable_q0),
|
||||
.adc_os_valid_q0 (adc_os_valid_q0),
|
||||
.adc_os_data_q0 (adc_os_data_q0),
|
||||
.adc_os_dovf (adc_os_dovf),
|
||||
.adc_os_dunf (adc_os_dunf),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq_s),
|
||||
.up_waddr (up_waddr_s),
|
||||
.up_wdata (up_wdata_s),
|
||||
.up_wack (up_wack_s[1]),
|
||||
.up_rreq (up_rreq_s),
|
||||
.up_raddr (up_raddr_s),
|
||||
.up_rdata (up_rdata_s[1]),
|
||||
.up_rack (up_rack_s[1]));
|
||||
|
||||
// transmit
|
||||
|
||||
axi_ad9371_tx #(
|
||||
.ID (ID),
|
||||
.DATAPATH_DISABLE (DAC_DATAPATH_DISABLE))
|
||||
i_tx (
|
||||
.dac_rst (dac_rst),
|
||||
.dac_clk (dac_clk),
|
||||
.dac_data (dac_data_s),
|
||||
.dac_sync_in (dac_sync_in),
|
||||
.dac_sync_out (dac_sync_out),
|
||||
.dac_enable_i0 (dac_enable_i0),
|
||||
.dac_valid_i0 (dac_valid_i0),
|
||||
.dac_data_i0 (dac_data_i0),
|
||||
.dac_enable_q0 (dac_enable_q0),
|
||||
.dac_valid_q0 (dac_valid_q0),
|
||||
.dac_data_q0 (dac_data_q0),
|
||||
.dac_enable_i1 (dac_enable_i1),
|
||||
.dac_valid_i1 (dac_valid_i1),
|
||||
.dac_data_i1 (dac_data_i1),
|
||||
.dac_enable_q1 (dac_enable_q1),
|
||||
.dac_valid_q1 (dac_valid_q1),
|
||||
.dac_data_q1 (dac_data_q1),
|
||||
.dac_dovf(dac_dovf),
|
||||
.dac_dunf(dac_dunf),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq_s),
|
||||
.up_waddr (up_waddr_s),
|
||||
.up_wdata (up_wdata_s),
|
||||
.up_wack (up_wack_s[2]),
|
||||
.up_rreq (up_rreq_s),
|
||||
.up_raddr (up_raddr_s),
|
||||
.up_rdata (up_rdata_s[2]),
|
||||
.up_rack (up_rack_s[2]));
|
||||
|
||||
// axi interface
|
||||
|
||||
up_axi i_up_axi (
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_axi_awvalid (s_axi_awvalid),
|
||||
.up_axi_awaddr (s_axi_awaddr),
|
||||
.up_axi_awready (s_axi_awready),
|
||||
.up_axi_wvalid (s_axi_wvalid),
|
||||
.up_axi_wdata (s_axi_wdata),
|
||||
.up_axi_wstrb (s_axi_wstrb),
|
||||
.up_axi_wready (s_axi_wready),
|
||||
.up_axi_bvalid (s_axi_bvalid),
|
||||
.up_axi_bresp (s_axi_bresp),
|
||||
.up_axi_bready (s_axi_bready),
|
||||
.up_axi_arvalid (s_axi_arvalid),
|
||||
.up_axi_araddr (s_axi_araddr),
|
||||
.up_axi_arready (s_axi_arready),
|
||||
.up_axi_rvalid (s_axi_rvalid),
|
||||
.up_axi_rresp (s_axi_rresp),
|
||||
.up_axi_rdata (s_axi_rdata),
|
||||
.up_axi_rready (s_axi_rready),
|
||||
.up_wreq (up_wreq_s),
|
||||
.up_waddr (up_waddr_s),
|
||||
.up_wdata (up_wdata_s),
|
||||
.up_wack (up_wack),
|
||||
.up_rreq (up_rreq_s),
|
||||
.up_raddr (up_raddr_s),
|
||||
.up_rdata (up_rdata),
|
||||
.up_rack (up_rack));
|
||||
|
||||
endmodule
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
|
@ -0,0 +1,119 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2011(c) Analog Devices, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// - Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// - Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
// - The use of this software may or may not infringe the patent rights
|
||||
// of one or more patent holders. This license does not release you
|
||||
// from the requirement that you obtain separate licenses from these
|
||||
// patent holders to use this software.
|
||||
// - Use of the software either in source or binary form, must be run
|
||||
// on or directly connected to an Analog Devices Inc. component.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
//
|
||||
// IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
|
||||
// RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
`timescale 1ns/100ps
|
||||
|
||||
module axi_ad9371_if (
|
||||
|
||||
// receive
|
||||
|
||||
adc_clk,
|
||||
adc_rx_data,
|
||||
adc_os_clk,
|
||||
adc_rx_os_data,
|
||||
|
||||
adc_data,
|
||||
adc_os_valid,
|
||||
adc_os_data,
|
||||
|
||||
// transmit
|
||||
|
||||
dac_clk,
|
||||
dac_tx_data,
|
||||
|
||||
dac_data);
|
||||
|
||||
// receive
|
||||
|
||||
input adc_clk;
|
||||
input [ 63:0] adc_rx_data;
|
||||
input adc_os_clk;
|
||||
input [ 63:0] adc_rx_os_data;
|
||||
|
||||
output [ 63:0] adc_data;
|
||||
output adc_os_valid;
|
||||
output [ 63:0] adc_os_data;
|
||||
|
||||
// transmit
|
||||
|
||||
input dac_clk;
|
||||
output [127:0] dac_tx_data;
|
||||
|
||||
input [127:0] dac_data;
|
||||
|
||||
// delineating
|
||||
|
||||
assign adc_data[((8* 7)+7):(8* 7)] = adc_rx_data[((8* 6)+7):(8* 6)];
|
||||
assign adc_data[((8* 6)+7):(8* 6)] = adc_rx_data[((8* 7)+7):(8* 7)];
|
||||
assign adc_data[((8* 5)+7):(8* 5)] = adc_rx_data[((8* 4)+7):(8* 4)];
|
||||
assign adc_data[((8* 4)+7):(8* 4)] = adc_rx_data[((8* 5)+7):(8* 5)];
|
||||
assign adc_data[((8* 3)+7):(8* 3)] = adc_rx_data[((8* 2)+7):(8* 2)];
|
||||
assign adc_data[((8* 2)+7):(8* 2)] = adc_rx_data[((8* 3)+7):(8* 3)];
|
||||
assign adc_data[((8* 1)+7):(8* 1)] = adc_rx_data[((8* 0)+7):(8* 0)];
|
||||
assign adc_data[((8* 0)+7):(8* 0)] = adc_rx_data[((8* 1)+7):(8* 1)];
|
||||
|
||||
assign adc_os_valid = 'd1;
|
||||
assign adc_os_data[((8* 7)+7):(8* 7)] = adc_rx_os_data[((8* 6)+7):(8* 6)];
|
||||
assign adc_os_data[((8* 6)+7):(8* 6)] = adc_rx_os_data[((8* 7)+7):(8* 7)];
|
||||
assign adc_os_data[((8* 5)+7):(8* 5)] = adc_rx_os_data[((8* 4)+7):(8* 4)];
|
||||
assign adc_os_data[((8* 4)+7):(8* 4)] = adc_rx_os_data[((8* 5)+7):(8* 5)];
|
||||
assign adc_os_data[((8* 3)+7):(8* 3)] = adc_rx_os_data[((8* 2)+7):(8* 2)];
|
||||
assign adc_os_data[((8* 2)+7):(8* 2)] = adc_rx_os_data[((8* 3)+7):(8* 3)];
|
||||
assign adc_os_data[((8* 1)+7):(8* 1)] = adc_rx_os_data[((8* 0)+7):(8* 0)];
|
||||
assign adc_os_data[((8* 0)+7):(8* 0)] = adc_rx_os_data[((8* 1)+7):(8* 1)];
|
||||
|
||||
assign dac_tx_data[((8*15)+7):(8*15)] = dac_data[((8*14)+7):(8*14)];
|
||||
assign dac_tx_data[((8*14)+7):(8*14)] = dac_data[((8*15)+7):(8*15)];
|
||||
assign dac_tx_data[((8*13)+7):(8*13)] = dac_data[((8*12)+7):(8*12)];
|
||||
assign dac_tx_data[((8*12)+7):(8*12)] = dac_data[((8*13)+7):(8*13)];
|
||||
assign dac_tx_data[((8*11)+7):(8*11)] = dac_data[((8*10)+7):(8*10)];
|
||||
assign dac_tx_data[((8*10)+7):(8*10)] = dac_data[((8*11)+7):(8*11)];
|
||||
assign dac_tx_data[((8* 9)+7):(8* 9)] = dac_data[((8* 8)+7):(8* 8)];
|
||||
assign dac_tx_data[((8* 8)+7):(8* 8)] = dac_data[((8* 9)+7):(8* 9)];
|
||||
assign dac_tx_data[((8* 7)+7):(8* 7)] = dac_data[((8* 6)+7):(8* 6)];
|
||||
assign dac_tx_data[((8* 6)+7):(8* 6)] = dac_data[((8* 7)+7):(8* 7)];
|
||||
assign dac_tx_data[((8* 5)+7):(8* 5)] = dac_data[((8* 4)+7):(8* 4)];
|
||||
assign dac_tx_data[((8* 4)+7):(8* 4)] = dac_data[((8* 5)+7):(8* 5)];
|
||||
assign dac_tx_data[((8* 3)+7):(8* 3)] = dac_data[((8* 2)+7):(8* 2)];
|
||||
assign dac_tx_data[((8* 2)+7):(8* 2)] = dac_data[((8* 3)+7):(8* 3)];
|
||||
assign dac_tx_data[((8* 1)+7):(8* 1)] = dac_data[((8* 0)+7):(8* 0)];
|
||||
assign dac_tx_data[((8* 0)+7):(8* 0)] = dac_data[((8* 1)+7):(8* 1)];
|
||||
|
||||
endmodule
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
|
@ -0,0 +1,43 @@
|
|||
# ip
|
||||
|
||||
source ../scripts/adi_env.tcl
|
||||
source $ad_hdl_dir/library/scripts/adi_ip.tcl
|
||||
|
||||
adi_ip_create axi_ad9371
|
||||
adi_ip_files axi_ad9371 [list \
|
||||
"$ad_hdl_dir/library/common/ad_axi_ip_constr.xdc" \
|
||||
"$ad_hdl_dir/library/common/ad_rst.v" \
|
||||
"$ad_hdl_dir/library/common/ad_mul.v" \
|
||||
"$ad_hdl_dir/library/common/ad_dds_sine.v" \
|
||||
"$ad_hdl_dir/library/common/ad_dds_1.v" \
|
||||
"$ad_hdl_dir/library/common/ad_dds.v" \
|
||||
"$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/up_axi.v" \
|
||||
"$ad_hdl_dir/library/common/up_xfer_cntrl.v" \
|
||||
"$ad_hdl_dir/library/common/up_xfer_status.v" \
|
||||
"$ad_hdl_dir/library/common/up_clock_mon.v" \
|
||||
"$ad_hdl_dir/library/common/up_adc_common.v" \
|
||||
"$ad_hdl_dir/library/common/up_adc_channel.v" \
|
||||
"$ad_hdl_dir/library/common/up_dac_common.v" \
|
||||
"$ad_hdl_dir/library/common/up_dac_channel.v" \
|
||||
"axi_ad9371_if.v" \
|
||||
"axi_ad9371_rx_channel.v" \
|
||||
"axi_ad9371_rx.v" \
|
||||
"axi_ad9371_rx_os.v" \
|
||||
"axi_ad9371_tx_channel.v" \
|
||||
"axi_ad9371_tx.v" \
|
||||
"axi_ad9371.v" ]
|
||||
|
||||
adi_ip_properties axi_ad9371
|
||||
|
||||
adi_ip_constraints axi_jesd_gt [list \
|
||||
"$ad_hdl_dir/library/common/ad_axi_ip_constr.xdc" ]
|
||||
|
||||
set_property driver_value 0 [ipx::get_ports *dac_sync_in* -of_objects [ipx::current_core]]
|
||||
set_property driver_value 0 [ipx::get_ports *dovf* -of_objects [ipx::current_core]]
|
||||
set_property driver_value 0 [ipx::get_ports *dunf* -of_objects [ipx::current_core]]
|
||||
|
||||
ipx::save_core [ipx::current_core]
|
||||
|
|
@ -0,0 +1,344 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2011(c) Analog Devices, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// - Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// - Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
// - The use of this software may or may not infringe the patent rights
|
||||
// of one or more patent holders. This license does not release you
|
||||
// from the requirement that you obtain separate licenses from these
|
||||
// patent holders to use this software.
|
||||
// - Use of the software either in source or binary form, must be run
|
||||
// on or directly connected to an Analog Devices Inc. component.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
//
|
||||
// IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
|
||||
// RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
`timescale 1ns/100ps
|
||||
|
||||
module axi_ad9371_rx (
|
||||
|
||||
// adc interface
|
||||
|
||||
adc_rst,
|
||||
adc_clk,
|
||||
adc_data,
|
||||
|
||||
// dma interface
|
||||
|
||||
adc_enable_i0,
|
||||
adc_valid_i0,
|
||||
adc_data_i0,
|
||||
adc_enable_q0,
|
||||
adc_valid_q0,
|
||||
adc_data_q0,
|
||||
adc_enable_i1,
|
||||
adc_valid_i1,
|
||||
adc_data_i1,
|
||||
adc_enable_q1,
|
||||
adc_valid_q1,
|
||||
adc_data_q1,
|
||||
adc_dovf,
|
||||
adc_dunf,
|
||||
|
||||
// processor interface
|
||||
|
||||
up_rstn,
|
||||
up_clk,
|
||||
up_wreq,
|
||||
up_waddr,
|
||||
up_wdata,
|
||||
up_wack,
|
||||
up_rreq,
|
||||
up_raddr,
|
||||
up_rdata,
|
||||
up_rack);
|
||||
|
||||
// parameters
|
||||
|
||||
parameter DATAPATH_DISABLE = 0;
|
||||
parameter ID = 0;
|
||||
|
||||
// adc interface
|
||||
|
||||
output adc_rst;
|
||||
input adc_clk;
|
||||
input [ 63:0] adc_data;
|
||||
|
||||
// dma interface
|
||||
|
||||
output adc_enable_i0;
|
||||
output adc_valid_i0;
|
||||
output [ 15:0] adc_data_i0;
|
||||
output adc_enable_q0;
|
||||
output adc_valid_q0;
|
||||
output [ 15:0] adc_data_q0;
|
||||
output adc_enable_i1;
|
||||
output adc_valid_i1;
|
||||
output [ 15:0] adc_data_i1;
|
||||
output adc_enable_q1;
|
||||
output adc_valid_q1;
|
||||
output [ 15:0] adc_data_q1;
|
||||
input adc_dovf;
|
||||
input adc_dunf;
|
||||
|
||||
// processor interface
|
||||
|
||||
input up_rstn;
|
||||
input up_clk;
|
||||
input up_wreq;
|
||||
input [ 13:0] up_waddr;
|
||||
input [ 31:0] up_wdata;
|
||||
output up_wack;
|
||||
input up_rreq;
|
||||
input [ 13:0] up_raddr;
|
||||
output [ 31:0] up_rdata;
|
||||
output up_rack;
|
||||
|
||||
// internal registers
|
||||
|
||||
reg up_status_pn_err = 'd0;
|
||||
reg up_status_pn_oos = 'd0;
|
||||
reg up_status_or = 'd0;
|
||||
reg up_wack = 'd0;
|
||||
reg up_rack = 'd0;
|
||||
reg [ 31:0] up_rdata = 'd0;
|
||||
|
||||
// internal signals
|
||||
|
||||
wire [ 15:0] adc_data_iq_i0_s;
|
||||
wire [ 15:0] adc_data_iq_q0_s;
|
||||
wire [ 15:0] adc_data_iq_i1_s;
|
||||
wire [ 15:0] adc_data_iq_q1_s;
|
||||
wire [ 3:0] up_adc_pn_err_s;
|
||||
wire [ 3:0] up_adc_pn_oos_s;
|
||||
wire [ 3:0] up_adc_or_s;
|
||||
wire [ 4:0] up_wack_s;
|
||||
wire [ 4:0] up_rack_s;
|
||||
wire [ 31:0] up_rdata_s[0:4];
|
||||
|
||||
// processor read interface
|
||||
|
||||
always @(negedge up_rstn or posedge up_clk) begin
|
||||
if (up_rstn == 0) begin
|
||||
up_status_pn_err <= 'd0;
|
||||
up_status_pn_oos <= 'd0;
|
||||
up_status_or <= 'd0;
|
||||
up_wack <= 'd0;
|
||||
up_rack <= 'd0;
|
||||
up_rdata <= 'd0;
|
||||
end else begin
|
||||
up_status_pn_err <= | up_adc_pn_err_s;
|
||||
up_status_pn_oos <= | up_adc_pn_oos_s;
|
||||
up_status_or <= | up_adc_or_s;
|
||||
up_wack <= | up_wack_s;
|
||||
up_rack <= | up_rack_s;
|
||||
up_rdata <= up_rdata_s[0] | up_rdata_s[1] | up_rdata_s[2] | up_rdata_s[3] | up_rdata_s[4];
|
||||
end
|
||||
end
|
||||
|
||||
// channel width is 32 bits
|
||||
|
||||
assign adc_valid_i0 = 1'b1;
|
||||
assign adc_valid_q0 = 1'b1;
|
||||
assign adc_valid_i1 = 1'b1;
|
||||
assign adc_valid_q1 = 1'b1;
|
||||
|
||||
// channel 0 (i)
|
||||
|
||||
axi_ad9371_rx_channel #(
|
||||
.Q_OR_I_N (0),
|
||||
.COMMON_ID ('h01),
|
||||
.CHANNEL_ID (0),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE),
|
||||
.DATA_WIDTH (16))
|
||||
i_rx_channel_0 (
|
||||
.adc_clk (adc_clk),
|
||||
.adc_rst (adc_rst),
|
||||
.adc_valid_in (1'b1),
|
||||
.adc_data_in (adc_data[15:0]),
|
||||
.adc_valid_out (),
|
||||
.adc_data_out (adc_data_i0),
|
||||
.adc_data_iq_in (adc_data_iq_q0_s),
|
||||
.adc_data_iq_out (adc_data_iq_i0_s),
|
||||
.adc_enable (adc_enable_i0),
|
||||
.up_adc_pn_err (up_adc_pn_err_s[0]),
|
||||
.up_adc_pn_oos (up_adc_pn_oos_s[0]),
|
||||
.up_adc_or (up_adc_or_s[0]),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[0]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[0]),
|
||||
.up_rack (up_rack_s[0]));
|
||||
|
||||
// channel 1 (q)
|
||||
|
||||
axi_ad9371_rx_channel #(
|
||||
.Q_OR_I_N (1),
|
||||
.COMMON_ID ('h01),
|
||||
.CHANNEL_ID (1),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE),
|
||||
.DATA_WIDTH (16))
|
||||
i_rx_channel_1 (
|
||||
.adc_clk (adc_clk),
|
||||
.adc_rst (adc_rst),
|
||||
.adc_valid_in (1'b1),
|
||||
.adc_data_in (adc_data[31:16]),
|
||||
.adc_valid_out (),
|
||||
.adc_data_out (adc_data_q0),
|
||||
.adc_data_iq_in (adc_data_iq_i0_s),
|
||||
.adc_data_iq_out (adc_data_iq_q0_s),
|
||||
.adc_enable (adc_enable_q0),
|
||||
.up_adc_pn_err (up_adc_pn_err_s[1]),
|
||||
.up_adc_pn_oos (up_adc_pn_oos_s[1]),
|
||||
.up_adc_or (up_adc_or_s[1]),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[1]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[1]),
|
||||
.up_rack (up_rack_s[1]));
|
||||
|
||||
// channel 2 (i)
|
||||
|
||||
axi_ad9371_rx_channel #(
|
||||
.Q_OR_I_N (0),
|
||||
.COMMON_ID ('h01),
|
||||
.CHANNEL_ID (2),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE),
|
||||
.DATA_WIDTH (16))
|
||||
i_rx_channel_2 (
|
||||
.adc_clk (adc_clk),
|
||||
.adc_rst (adc_rst),
|
||||
.adc_valid_in (1'b1),
|
||||
.adc_data_in (adc_data[47:32]),
|
||||
.adc_valid_out (),
|
||||
.adc_data_out (adc_data_i1),
|
||||
.adc_data_iq_in (adc_data_iq_q1_s),
|
||||
.adc_data_iq_out (adc_data_iq_i1_s),
|
||||
.adc_enable (adc_enable_i1),
|
||||
.up_adc_pn_err (up_adc_pn_err_s[2]),
|
||||
.up_adc_pn_oos (up_adc_pn_oos_s[2]),
|
||||
.up_adc_or (up_adc_or_s[2]),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[2]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[2]),
|
||||
.up_rack (up_rack_s[2]));
|
||||
|
||||
// channel 3 (q)
|
||||
|
||||
axi_ad9371_rx_channel #(
|
||||
.Q_OR_I_N (1),
|
||||
.COMMON_ID ('h01),
|
||||
.CHANNEL_ID (3),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE),
|
||||
.DATA_WIDTH (16))
|
||||
i_rx_channel_3 (
|
||||
.adc_clk (adc_clk),
|
||||
.adc_rst (adc_rst),
|
||||
.adc_valid_in (1'b1),
|
||||
.adc_data_in (adc_data[63:48]),
|
||||
.adc_valid_out (),
|
||||
.adc_data_out (adc_data_q1),
|
||||
.adc_data_iq_in (adc_data_iq_i1_s),
|
||||
.adc_data_iq_out (adc_data_iq_q1_s),
|
||||
.adc_enable (adc_enable_q1),
|
||||
.up_adc_pn_err (up_adc_pn_err_s[3]),
|
||||
.up_adc_pn_oos (up_adc_pn_oos_s[3]),
|
||||
.up_adc_or (up_adc_or_s[3]),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[3]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[3]),
|
||||
.up_rack (up_rack_s[3]));
|
||||
|
||||
// common processor control
|
||||
|
||||
up_adc_common #(
|
||||
.ADC_COMMON_ID ('h00),
|
||||
.ID (ID))
|
||||
i_up_adc_common (
|
||||
.mmcm_rst (),
|
||||
.adc_clk (adc_clk),
|
||||
.adc_rst (adc_rst),
|
||||
.adc_r1_mode (),
|
||||
.adc_ddr_edgesel (),
|
||||
.adc_pin_mode (),
|
||||
.adc_status (1'b1),
|
||||
.adc_sync_status (1'd0),
|
||||
.adc_status_ovf (adc_dovf),
|
||||
.adc_status_unf (adc_dunf),
|
||||
.adc_clk_ratio (32'd1),
|
||||
.adc_start_code (),
|
||||
.adc_sync (),
|
||||
.up_status_pn_err (up_status_pn_err),
|
||||
.up_status_pn_oos (up_status_pn_oos),
|
||||
.up_status_or (up_status_or),
|
||||
.up_drp_sel (),
|
||||
.up_drp_wr (),
|
||||
.up_drp_addr (),
|
||||
.up_drp_wdata (),
|
||||
.up_drp_rdata (16'd0),
|
||||
.up_drp_ready (1'd0),
|
||||
.up_drp_locked (1'd1),
|
||||
.up_usr_chanmax (),
|
||||
.adc_usr_chanmax (8'd3),
|
||||
.up_adc_gpio_in (32'd0),
|
||||
.up_adc_gpio_out (),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[4]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[4]),
|
||||
.up_rack (up_rack_s[4]));
|
||||
|
||||
endmodule
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2011(c) Analog Devices, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// - Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// - Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
// - The use of this software may or may not infringe the patent rights
|
||||
// of one or more patent holders. This license does not release you
|
||||
// from the requirement that you obtain separate licenses from these
|
||||
// patent holders to use this software.
|
||||
// - Use of the software either in source or binary form, must be run
|
||||
// on or directly connected to an Analog Devices Inc. component.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
//
|
||||
// IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
|
||||
// RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
`timescale 1ns/100ps
|
||||
|
||||
module axi_ad9371_rx_channel (
|
||||
|
||||
// adc interface
|
||||
|
||||
adc_clk,
|
||||
adc_rst,
|
||||
adc_valid_in,
|
||||
adc_data_in,
|
||||
adc_valid_out,
|
||||
adc_data_out,
|
||||
adc_data_iq_in,
|
||||
adc_data_iq_out,
|
||||
adc_enable,
|
||||
|
||||
// channel interface
|
||||
|
||||
up_adc_pn_err,
|
||||
up_adc_pn_oos,
|
||||
up_adc_or,
|
||||
|
||||
// processor interface
|
||||
|
||||
up_rstn,
|
||||
up_clk,
|
||||
up_wreq,
|
||||
up_waddr,
|
||||
up_wdata,
|
||||
up_wack,
|
||||
up_rreq,
|
||||
up_raddr,
|
||||
up_rdata,
|
||||
up_rack);
|
||||
|
||||
// parameters
|
||||
|
||||
parameter Q_OR_I_N = 0;
|
||||
parameter COMMON_ID = 0;
|
||||
parameter CHANNEL_ID = 0;
|
||||
parameter DATAPATH_DISABLE = 0;
|
||||
parameter DATA_WIDTH = 32;
|
||||
|
||||
localparam NUM_OF_SAMPLES = DATA_WIDTH/16;
|
||||
|
||||
// adc interface
|
||||
|
||||
input adc_clk;
|
||||
input adc_rst;
|
||||
input adc_valid_in;
|
||||
input [(DATA_WIDTH-1):0] adc_data_in;
|
||||
output adc_valid_out;
|
||||
output [(DATA_WIDTH-1):0] adc_data_out;
|
||||
input [(DATA_WIDTH-1):0] adc_data_iq_in;
|
||||
output [(DATA_WIDTH-1):0] adc_data_iq_out;
|
||||
output adc_enable;
|
||||
|
||||
// channel interface
|
||||
|
||||
output up_adc_pn_err;
|
||||
output up_adc_pn_oos;
|
||||
output up_adc_or;
|
||||
|
||||
// processor interface
|
||||
|
||||
input up_rstn;
|
||||
input up_clk;
|
||||
input up_wreq;
|
||||
input [13:0] up_waddr;
|
||||
input [31:0] up_wdata;
|
||||
output up_wack;
|
||||
input up_rreq;
|
||||
input [13:0] up_raddr;
|
||||
output [31:0] up_rdata;
|
||||
output up_rack;
|
||||
|
||||
// internal signals
|
||||
|
||||
wire [(NUM_OF_SAMPLES-1):0] adc_dfmt_valid_s;
|
||||
wire [(DATA_WIDTH-1):0] adc_dfmt_data_s;
|
||||
wire [(NUM_OF_SAMPLES-1):0] adc_dcfilter_valid_s;
|
||||
wire [(DATA_WIDTH-1):0] adc_dcfilter_data_s;
|
||||
wire [(NUM_OF_SAMPLES-1):0] adc_valid_out_s;
|
||||
wire adc_pn_err_s;
|
||||
wire adc_pn_oos_s;
|
||||
wire adc_dfmt_se_s;
|
||||
wire adc_dfmt_type_s;
|
||||
wire adc_dfmt_enable_s;
|
||||
wire adc_dcfilt_enb_s;
|
||||
wire [15:0] adc_dcfilt_offset_s;
|
||||
wire [15:0] adc_dcfilt_coeff_s;
|
||||
wire adc_iqcor_enb_s;
|
||||
wire [15:0] adc_iqcor_coeff_1_s;
|
||||
wire [15:0] adc_iqcor_coeff_2_s;
|
||||
|
||||
// variables
|
||||
|
||||
genvar n;
|
||||
|
||||
// iq correction inputs
|
||||
|
||||
assign adc_pn_oos_s = 1'b1;
|
||||
assign adc_pn_err_s = 1'b0;
|
||||
|
||||
generate
|
||||
for (n = 0; n < NUM_OF_SAMPLES; n = n + 1) begin: g_datafmt
|
||||
if (DATAPATH_DISABLE == 1) begin
|
||||
assign adc_dfmt_valid_s[n] = adc_valid_in;
|
||||
assign adc_dfmt_data_s[((16*n)+15):(16*n)] = adc_data_in[((16*n)+15):(16*n)];
|
||||
end else begin
|
||||
ad_datafmt #(.DATA_WIDTH (16)) i_ad_datafmt (
|
||||
.clk (adc_clk),
|
||||
.valid (adc_valid_in),
|
||||
.data (adc_data_in[((16*n)+15):(16*n)]),
|
||||
.valid_out (adc_dfmt_valid_s[n]),
|
||||
.data_out (adc_dfmt_data_s[((16*n)+15):(16*n)]),
|
||||
.dfmt_enable (adc_dfmt_enable_s),
|
||||
.dfmt_type (adc_dfmt_type_s),
|
||||
.dfmt_se (adc_dfmt_se_s));
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
generate
|
||||
for (n = 0; n < NUM_OF_SAMPLES; n = n + 1) begin: g_dcfilter
|
||||
if (DATAPATH_DISABLE == 1) begin
|
||||
assign adc_dcfilter_valid_s[n] = adc_dfmt_valid_s[n];
|
||||
assign adc_dcfilter_data_s[((16*n)+15):(16*n)] = adc_dfmt_data_s[((16*n)+15):(16*n)];
|
||||
end else begin
|
||||
ad_dcfilter i_ad_dcfilter (
|
||||
.clk (adc_clk),
|
||||
.valid (adc_dfmt_valid_s[n]),
|
||||
.data (adc_dfmt_data_s[((16*n)+15):(16*n)]),
|
||||
.valid_out (adc_dcfilter_valid_s[n]),
|
||||
.data_out (adc_dcfilter_data_s[((16*n)+15):(16*n)]),
|
||||
.dcfilt_enb (adc_dcfilt_enb_s),
|
||||
.dcfilt_coeff (adc_dcfilt_coeff_s),
|
||||
.dcfilt_offset (adc_dcfilt_offset_s));
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
assign adc_valid_out = adc_valid_out_s[0];
|
||||
assign adc_data_iq_out = adc_dcfilter_data_s;
|
||||
|
||||
generate
|
||||
for (n = 0; n < NUM_OF_SAMPLES; n = n + 1) begin: g_iqcor
|
||||
if (DATAPATH_DISABLE == 1) begin
|
||||
assign adc_valid_out_s[n] = adc_dcfilter_valid_s[n];
|
||||
assign adc_data_out[((16*n)+15):(16*n)] = adc_dcfilter_data_s[((16*n)+15):(16*n)];
|
||||
end else begin
|
||||
ad_iqcor #(.Q_OR_I_N (Q_OR_I_N)) i_ad_iqcor (
|
||||
.clk (adc_clk),
|
||||
.valid (adc_dcfilter_valid_s[n]),
|
||||
.data_in (adc_dcfilter_data_s[((16*n)+15):(16*n)]),
|
||||
.data_iq (adc_data_iq_in[((16*n)+15):(16*n)]),
|
||||
.valid_out (adc_valid_out_s[n]),
|
||||
.data_out (adc_data_out[((16*n)+15):(16*n)]),
|
||||
.iqcor_enable (adc_iqcor_enb_s),
|
||||
.iqcor_coeff_1 (adc_iqcor_coeff_1_s),
|
||||
.iqcor_coeff_2 (adc_iqcor_coeff_2_s));
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
up_adc_channel #(
|
||||
.ADC_COMMON_ID (COMMON_ID),
|
||||
.ADC_CHANNEL_ID (CHANNEL_ID))
|
||||
i_up_adc_channel (
|
||||
.adc_clk (adc_clk),
|
||||
.adc_rst (adc_rst),
|
||||
.adc_enable (adc_enable),
|
||||
.adc_iqcor_enb (adc_iqcor_enb_s),
|
||||
.adc_dcfilt_enb (adc_dcfilt_enb_s),
|
||||
.adc_dfmt_se (adc_dfmt_se_s),
|
||||
.adc_dfmt_type (adc_dfmt_type_s),
|
||||
.adc_dfmt_enable (adc_dfmt_enable_s),
|
||||
.adc_dcfilt_offset (adc_dcfilt_offset_s),
|
||||
.adc_dcfilt_coeff (adc_dcfilt_coeff_s),
|
||||
.adc_iqcor_coeff_1 (adc_iqcor_coeff_1_s),
|
||||
.adc_iqcor_coeff_2 (adc_iqcor_coeff_2_s),
|
||||
.adc_pnseq_sel (),
|
||||
.adc_data_sel (),
|
||||
.adc_pn_err (adc_pn_err_s),
|
||||
.adc_pn_oos (adc_pn_oos_s),
|
||||
.adc_or (1'd0),
|
||||
.up_adc_pn_err (up_adc_pn_err),
|
||||
.up_adc_pn_oos (up_adc_pn_oos),
|
||||
.up_adc_or (up_adc_or),
|
||||
.up_usr_datatype_be (),
|
||||
.up_usr_datatype_signed (),
|
||||
.up_usr_datatype_shift (),
|
||||
.up_usr_datatype_total_bits (),
|
||||
.up_usr_datatype_bits (),
|
||||
.up_usr_decimation_m (),
|
||||
.up_usr_decimation_n (),
|
||||
.adc_usr_datatype_be (1'b0),
|
||||
.adc_usr_datatype_signed (1'b1),
|
||||
.adc_usr_datatype_shift (8'd0),
|
||||
.adc_usr_datatype_total_bits (8'd16),
|
||||
.adc_usr_datatype_bits (8'd16),
|
||||
.adc_usr_decimation_m (16'd1),
|
||||
.adc_usr_decimation_n (16'd1),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata),
|
||||
.up_rack (up_rack));
|
||||
|
||||
endmodule
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2011(c) Analog Devices, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// - Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// - Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
// - The use of this software may or may not infringe the patent rights
|
||||
// of one or more patent holders. This license does not release you
|
||||
// from the requirement that you obtain separate licenses from these
|
||||
// patent holders to use this software.
|
||||
// - Use of the software either in source or binary form, must be run
|
||||
// on or directly connected to an Analog Devices Inc. component.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
//
|
||||
// IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
|
||||
// RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
`timescale 1ns/100ps
|
||||
|
||||
module axi_ad9371_rx_os (
|
||||
|
||||
// adc interface
|
||||
|
||||
adc_os_rst,
|
||||
adc_os_clk,
|
||||
adc_os_valid,
|
||||
adc_os_data,
|
||||
|
||||
// dma interface
|
||||
|
||||
adc_os_enable_i0,
|
||||
adc_os_valid_i0,
|
||||
adc_os_data_i0,
|
||||
adc_os_enable_q0,
|
||||
adc_os_valid_q0,
|
||||
adc_os_data_q0,
|
||||
adc_os_dovf,
|
||||
adc_os_dunf,
|
||||
|
||||
// processor interface
|
||||
|
||||
up_rstn,
|
||||
up_clk,
|
||||
up_wreq,
|
||||
up_waddr,
|
||||
up_wdata,
|
||||
up_wack,
|
||||
up_rreq,
|
||||
up_raddr,
|
||||
up_rdata,
|
||||
up_rack);
|
||||
|
||||
// parameters
|
||||
|
||||
parameter DATAPATH_DISABLE = 0;
|
||||
parameter ID = 0;
|
||||
|
||||
// adc interface
|
||||
|
||||
output adc_os_rst;
|
||||
input adc_os_clk;
|
||||
input adc_os_valid;
|
||||
input [ 63:0] adc_os_data;
|
||||
|
||||
// dma interface
|
||||
|
||||
output adc_os_enable_i0;
|
||||
output adc_os_valid_i0;
|
||||
output [ 31:0] adc_os_data_i0;
|
||||
output adc_os_enable_q0;
|
||||
output adc_os_valid_q0;
|
||||
output [ 31:0] adc_os_data_q0;
|
||||
input adc_os_dovf;
|
||||
input adc_os_dunf;
|
||||
|
||||
// processor interface
|
||||
|
||||
input up_rstn;
|
||||
input up_clk;
|
||||
input up_wreq;
|
||||
input [ 13:0] up_waddr;
|
||||
input [ 31:0] up_wdata;
|
||||
output up_wack;
|
||||
input up_rreq;
|
||||
input [ 13:0] up_raddr;
|
||||
output [ 31:0] up_rdata;
|
||||
output up_rack;
|
||||
|
||||
// internal registers
|
||||
|
||||
reg up_status_pn_err = 'd0;
|
||||
reg up_status_pn_oos = 'd0;
|
||||
reg up_status_or = 'd0;
|
||||
reg up_wack = 'd0;
|
||||
reg up_rack = 'd0;
|
||||
reg [ 31:0] up_rdata = 'd0;
|
||||
|
||||
// internal signals
|
||||
|
||||
wire [ 31:0] adc_os_data_iq_i0_s;
|
||||
wire [ 31:0] adc_os_data_iq_q0_s;
|
||||
wire [ 1:0] up_adc_pn_err_s;
|
||||
wire [ 1:0] up_adc_pn_oos_s;
|
||||
wire [ 1:0] up_adc_or_s;
|
||||
wire [ 2:0] up_wack_s;
|
||||
wire [ 2:0] up_rack_s;
|
||||
wire [ 31:0] up_rdata_s[0:2];
|
||||
|
||||
// processor read interface
|
||||
|
||||
always @(negedge up_rstn or posedge up_clk) begin
|
||||
if (up_rstn == 0) begin
|
||||
up_status_pn_err <= 'd0;
|
||||
up_status_pn_oos <= 'd0;
|
||||
up_status_or <= 'd0;
|
||||
up_wack <= 'd0;
|
||||
up_rack <= 'd0;
|
||||
up_rdata <= 'd0;
|
||||
end else begin
|
||||
up_status_pn_err <= | up_adc_pn_err_s;
|
||||
up_status_pn_oos <= | up_adc_pn_oos_s;
|
||||
up_status_or <= | up_adc_or_s;
|
||||
up_wack <= | up_wack_s;
|
||||
up_rack <= | up_rack_s;
|
||||
up_rdata <= up_rdata_s[0] | up_rdata_s[1] | up_rdata_s[2];
|
||||
end
|
||||
end
|
||||
|
||||
// channel o/s (i)
|
||||
|
||||
axi_ad9371_rx_channel #(
|
||||
.Q_OR_I_N (0),
|
||||
.COMMON_ID ('h21),
|
||||
.CHANNEL_ID (0),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE),
|
||||
.DATA_WIDTH (32))
|
||||
i_rx_os_channel_0 (
|
||||
.adc_clk (adc_os_clk),
|
||||
.adc_rst (adc_os_rst),
|
||||
.adc_valid_in (adc_os_valid),
|
||||
.adc_data_in (adc_os_data[31:0]),
|
||||
.adc_valid_out (adc_os_valid_i0),
|
||||
.adc_data_out (adc_os_data_i0),
|
||||
.adc_data_iq_in (adc_os_data_iq_q0_s),
|
||||
.adc_data_iq_out (adc_os_data_iq_i0_s),
|
||||
.adc_enable (adc_os_enable_i0),
|
||||
.up_adc_pn_err (up_adc_pn_err_s[0]),
|
||||
.up_adc_pn_oos (up_adc_pn_oos_s[0]),
|
||||
.up_adc_or (up_adc_or_s[0]),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[0]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[0]),
|
||||
.up_rack (up_rack_s[0]));
|
||||
|
||||
// channel o/s (q)
|
||||
|
||||
axi_ad9371_rx_channel #(
|
||||
.Q_OR_I_N (1),
|
||||
.COMMON_ID ('h21),
|
||||
.CHANNEL_ID (1),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE),
|
||||
.DATA_WIDTH (32))
|
||||
i_rx_os_channel_1 (
|
||||
.adc_clk (adc_os_clk),
|
||||
.adc_rst (adc_os_rst),
|
||||
.adc_valid_in (adc_os_valid),
|
||||
.adc_data_in (adc_os_data[63:32]),
|
||||
.adc_valid_out (adc_os_valid_q0),
|
||||
.adc_data_out (adc_os_data_q0),
|
||||
.adc_data_iq_in (adc_os_data_iq_i0_s),
|
||||
.adc_data_iq_out (adc_os_data_iq_q0_s),
|
||||
.adc_enable (adc_os_enable_q0),
|
||||
.up_adc_pn_err (up_adc_pn_err_s[1]),
|
||||
.up_adc_pn_oos (up_adc_pn_oos_s[1]),
|
||||
.up_adc_or (up_adc_or_s[1]),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[1]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[1]),
|
||||
.up_rack (up_rack_s[1]));
|
||||
|
||||
// common processor control
|
||||
|
||||
up_adc_common #(
|
||||
.ADC_COMMON_ID ('h20),
|
||||
.ID (ID))
|
||||
i_up_adc_common (
|
||||
.mmcm_rst (),
|
||||
.adc_clk (adc_os_clk),
|
||||
.adc_rst (adc_os_rst),
|
||||
.adc_r1_mode (),
|
||||
.adc_ddr_edgesel (),
|
||||
.adc_pin_mode (),
|
||||
.adc_status (1'b1),
|
||||
.adc_sync_status (1'd0),
|
||||
.adc_status_ovf (adc_os_dovf),
|
||||
.adc_status_unf (adc_os_dunf),
|
||||
.adc_clk_ratio (32'd1),
|
||||
.adc_start_code (),
|
||||
.adc_sync (),
|
||||
.up_status_pn_err (up_status_pn_err),
|
||||
.up_status_pn_oos (up_status_pn_oos),
|
||||
.up_status_or (up_status_or),
|
||||
.up_drp_sel (),
|
||||
.up_drp_wr (),
|
||||
.up_drp_addr (),
|
||||
.up_drp_wdata (),
|
||||
.up_drp_rdata (16'd0),
|
||||
.up_drp_ready (1'd0),
|
||||
.up_drp_locked (1'd1),
|
||||
.up_usr_chanmax (),
|
||||
.adc_usr_chanmax (8'd3),
|
||||
.up_adc_gpio_in (32'd0),
|
||||
.up_adc_gpio_out (),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[2]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[2]),
|
||||
.up_rack (up_rack_s[2]));
|
||||
|
||||
endmodule
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
|
@ -0,0 +1,329 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2011(c) Analog Devices, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// - Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// - Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
// - The use of this software may or may not infringe the patent rights
|
||||
// of one or more patent holders. This license does not release you
|
||||
// from the requirement that you obtain separate licenses from these
|
||||
// patent holders to use this software.
|
||||
// - Use of the software either in source or binary form, must be run
|
||||
// on or directly connected to an Analog Devices Inc. component.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
//
|
||||
// IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
|
||||
// RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
`timescale 1ns/100ps
|
||||
|
||||
module axi_ad9371_tx (
|
||||
|
||||
// dac interface
|
||||
|
||||
dac_rst,
|
||||
dac_clk,
|
||||
dac_data,
|
||||
|
||||
// master/slave
|
||||
|
||||
dac_sync_in,
|
||||
dac_sync_out,
|
||||
|
||||
// dma interface
|
||||
|
||||
dac_enable_i0,
|
||||
dac_valid_i0,
|
||||
dac_data_i0,
|
||||
dac_enable_q0,
|
||||
dac_valid_q0,
|
||||
dac_data_q0,
|
||||
dac_enable_i1,
|
||||
dac_valid_i1,
|
||||
dac_data_i1,
|
||||
dac_enable_q1,
|
||||
dac_valid_q1,
|
||||
dac_data_q1,
|
||||
dac_dovf,
|
||||
dac_dunf,
|
||||
|
||||
// processor interface
|
||||
|
||||
up_rstn,
|
||||
up_clk,
|
||||
up_wreq,
|
||||
up_waddr,
|
||||
up_wdata,
|
||||
up_wack,
|
||||
up_rreq,
|
||||
up_raddr,
|
||||
up_rdata,
|
||||
up_rack);
|
||||
|
||||
// parameters
|
||||
|
||||
parameter DATAPATH_DISABLE = 0;
|
||||
parameter ID = 0;
|
||||
|
||||
// dac interface
|
||||
|
||||
output dac_rst;
|
||||
input dac_clk;
|
||||
output [127:0] dac_data;
|
||||
|
||||
// master/slave
|
||||
|
||||
input dac_sync_in;
|
||||
output dac_sync_out;
|
||||
|
||||
// dma interface
|
||||
|
||||
output dac_enable_i0;
|
||||
output dac_valid_i0;
|
||||
input [ 31:0] dac_data_i0;
|
||||
output dac_enable_q0;
|
||||
output dac_valid_q0;
|
||||
input [ 31:0] dac_data_q0;
|
||||
output dac_enable_i1;
|
||||
output dac_valid_i1;
|
||||
input [ 31:0] dac_data_i1;
|
||||
output dac_enable_q1;
|
||||
output dac_valid_q1;
|
||||
input [ 31:0] dac_data_q1;
|
||||
input dac_dovf;
|
||||
input dac_dunf;
|
||||
|
||||
// processor interface
|
||||
|
||||
input up_rstn;
|
||||
input up_clk;
|
||||
input up_wreq;
|
||||
input [ 13:0] up_waddr;
|
||||
input [ 31:0] up_wdata;
|
||||
output up_wack;
|
||||
input up_rreq;
|
||||
input [ 13:0] up_raddr;
|
||||
output [ 31:0] up_rdata;
|
||||
output up_rack;
|
||||
|
||||
// internal registers
|
||||
|
||||
reg dac_data_sync = 'd0;
|
||||
reg up_wack = 'd0;
|
||||
reg up_rack = 'd0;
|
||||
reg [ 31:0] up_rdata = 'd0;
|
||||
|
||||
// internal signals
|
||||
|
||||
wire dac_data_sync_s;
|
||||
wire [ 31:0] dac_data_iq_i0_s;
|
||||
wire [ 31:0] dac_data_iq_q0_s;
|
||||
wire [ 31:0] dac_data_iq_i1_s;
|
||||
wire [ 31:0] dac_data_iq_q1_s;
|
||||
wire dac_dds_format_s;
|
||||
wire [ 4:0] up_wack_s;
|
||||
wire [ 4:0] up_rack_s;
|
||||
wire [ 31:0] up_rdata_s[0:4];
|
||||
|
||||
// master/slave
|
||||
|
||||
assign dac_data_sync_s = (ID == 0) ? dac_sync_out : dac_sync_in;
|
||||
|
||||
always @(posedge dac_clk) begin
|
||||
dac_data_sync <= dac_data_sync_s;
|
||||
end
|
||||
|
||||
// processor read interface
|
||||
|
||||
always @(negedge up_rstn or posedge up_clk) begin
|
||||
if (up_rstn == 0) begin
|
||||
up_wack <= 'd0;
|
||||
up_rack <= 'd0;
|
||||
up_rdata <= 'd0;
|
||||
end else begin
|
||||
up_wack <= | up_wack_s;
|
||||
up_rack <= | up_rack_s;
|
||||
up_rdata <= up_rdata_s[0] | up_rdata_s[1] | up_rdata_s[2] |
|
||||
up_rdata_s[3] | up_rdata_s[4];
|
||||
end
|
||||
end
|
||||
|
||||
// dac channel
|
||||
|
||||
assign dac_valid_i0 = 1'b1;
|
||||
|
||||
axi_ad9371_tx_channel #(
|
||||
.CHANNEL_ID (0),
|
||||
.Q_OR_I_N (0),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE))
|
||||
i_tx_channel_0 (
|
||||
.dac_clk (dac_clk),
|
||||
.dac_rst (dac_rst),
|
||||
.dac_data_in (dac_data_i0),
|
||||
.dac_data_out (dac_data[31:0]),
|
||||
.dac_data_iq_in (dac_data_iq_q0_s),
|
||||
.dac_data_iq_out (dac_data_iq_i0_s),
|
||||
.dac_enable (dac_enable_i0),
|
||||
.dac_data_sync (dac_data_sync),
|
||||
.dac_dds_format (dac_dds_format_s),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[0]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[0]),
|
||||
.up_rack (up_rack_s[0]));
|
||||
|
||||
// dac channel
|
||||
|
||||
assign dac_valid_q0 = 1'b1;
|
||||
|
||||
axi_ad9371_tx_channel #(
|
||||
.CHANNEL_ID (1),
|
||||
.Q_OR_I_N (1),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE))
|
||||
i_tx_channel_1 (
|
||||
.dac_clk (dac_clk),
|
||||
.dac_rst (dac_rst),
|
||||
.dac_data_in (dac_data_q0),
|
||||
.dac_data_out (dac_data[63:32]),
|
||||
.dac_data_iq_in (dac_data_iq_i0_s),
|
||||
.dac_data_iq_out (dac_data_iq_q0_s),
|
||||
.dac_enable (dac_enable_q0),
|
||||
.dac_data_sync (dac_data_sync),
|
||||
.dac_dds_format (dac_dds_format_s),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[1]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[1]),
|
||||
.up_rack (up_rack_s[1]));
|
||||
|
||||
// dac channel
|
||||
|
||||
assign dac_valid_i1 = 1'b1;
|
||||
|
||||
axi_ad9371_tx_channel #(
|
||||
.CHANNEL_ID (2),
|
||||
.Q_OR_I_N (0),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE))
|
||||
i_tx_channel_2 (
|
||||
.dac_clk (dac_clk),
|
||||
.dac_rst (dac_rst),
|
||||
.dac_data_in (dac_data_i1),
|
||||
.dac_data_out (dac_data[95:64]),
|
||||
.dac_data_iq_in (dac_data_iq_q1_s),
|
||||
.dac_data_iq_out (dac_data_iq_i1_s),
|
||||
.dac_enable (dac_enable_i1),
|
||||
.dac_data_sync (dac_data_sync),
|
||||
.dac_dds_format (dac_dds_format_s),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[2]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[2]),
|
||||
.up_rack (up_rack_s[2]));
|
||||
|
||||
// dac channel
|
||||
|
||||
assign dac_valid_q1 = 1'b1;
|
||||
|
||||
axi_ad9371_tx_channel #(
|
||||
.CHANNEL_ID (3),
|
||||
.Q_OR_I_N (1),
|
||||
.DATAPATH_DISABLE (DATAPATH_DISABLE))
|
||||
i_tx_channel_3 (
|
||||
.dac_clk (dac_clk),
|
||||
.dac_rst (dac_rst),
|
||||
.dac_data_in (dac_data_q1),
|
||||
.dac_data_out (dac_data[127:96]),
|
||||
.dac_data_iq_in (dac_data_iq_i1_s),
|
||||
.dac_data_iq_out (dac_data_iq_q1_s),
|
||||
.dac_enable (dac_enable_q1),
|
||||
.dac_data_sync (dac_data_sync),
|
||||
.dac_dds_format (dac_dds_format_s),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[3]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[3]),
|
||||
.up_rack (up_rack_s[3]));
|
||||
|
||||
// dac common processor interface
|
||||
|
||||
up_dac_common #(.ID (ID)) i_up_dac_common (
|
||||
.mmcm_rst (),
|
||||
.dac_clk (dac_clk),
|
||||
.dac_rst (dac_rst),
|
||||
.dac_sync (dac_sync_out),
|
||||
.dac_frame (),
|
||||
.dac_par_type (),
|
||||
.dac_par_enb (),
|
||||
.dac_r1_mode (),
|
||||
.dac_datafmt (dac_dds_format_s),
|
||||
.dac_datarate (),
|
||||
.dac_status (1'b1),
|
||||
.dac_status_ovf (dac_dovf),
|
||||
.dac_status_unf (dac_dunf),
|
||||
.dac_clk_ratio (32'd1),
|
||||
.up_drp_sel (),
|
||||
.up_drp_wr (),
|
||||
.up_drp_addr (),
|
||||
.up_drp_wdata (),
|
||||
.up_drp_rdata (16'd0),
|
||||
.up_drp_ready (1'd0),
|
||||
.up_drp_locked (1'd1),
|
||||
.up_usr_chanmax (),
|
||||
.dac_usr_chanmax (8'd3),
|
||||
.up_dac_gpio_in (32'd0),
|
||||
.up_dac_gpio_out (),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack_s[4]),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata_s[4]),
|
||||
.up_rack (up_rack_s[4]));
|
||||
|
||||
endmodule
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
|
@ -0,0 +1,283 @@
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Copyright 2011(c) Analog Devices, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// - Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// - Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
// - The use of this software may or may not infringe the patent rights
|
||||
// of one or more patent holders. This license does not release you
|
||||
// from the requirement that you obtain separate licenses from these
|
||||
// patent holders to use this software.
|
||||
// - Use of the software either in source or binary form, must be run
|
||||
// on or directly connected to an Analog Devices Inc. component.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
//
|
||||
// IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
|
||||
// RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
`timescale 1ns/100ps
|
||||
|
||||
module axi_ad9371_tx_channel (
|
||||
|
||||
// dac interface
|
||||
|
||||
dac_clk,
|
||||
dac_rst,
|
||||
dac_data_in,
|
||||
dac_data_out,
|
||||
dac_data_iq_in,
|
||||
dac_data_iq_out,
|
||||
|
||||
// processor interface
|
||||
|
||||
dac_enable,
|
||||
dac_data_sync,
|
||||
dac_dds_format,
|
||||
|
||||
// bus interface
|
||||
|
||||
up_rstn,
|
||||
up_clk,
|
||||
up_wreq,
|
||||
up_waddr,
|
||||
up_wdata,
|
||||
up_wack,
|
||||
up_rreq,
|
||||
up_raddr,
|
||||
up_rdata,
|
||||
up_rack);
|
||||
|
||||
// parameters
|
||||
|
||||
parameter CHANNEL_ID = 32'h0;
|
||||
parameter Q_OR_I_N = 0;
|
||||
parameter DATAPATH_DISABLE = 0;
|
||||
|
||||
// dac interface
|
||||
|
||||
input dac_clk;
|
||||
input dac_rst;
|
||||
input [31:0] dac_data_in;
|
||||
output [31:0] dac_data_out;
|
||||
input [31:0] dac_data_iq_in;
|
||||
output [31:0] dac_data_iq_out;
|
||||
|
||||
// processor interface
|
||||
|
||||
output dac_enable;
|
||||
input dac_data_sync;
|
||||
input dac_dds_format;
|
||||
|
||||
// bus interface
|
||||
|
||||
input up_rstn;
|
||||
input up_clk;
|
||||
input up_wreq;
|
||||
input [13:0] up_waddr;
|
||||
input [31:0] up_wdata;
|
||||
output up_wack;
|
||||
input up_rreq;
|
||||
input [13:0] up_raddr;
|
||||
output [31:0] up_rdata;
|
||||
output up_rack;
|
||||
|
||||
// internal registers
|
||||
|
||||
reg dac_enable = 'd0;
|
||||
reg [31:0] dac_data_iq_out = 'd0;
|
||||
reg [31:0] dac_pat_data = 'd0;
|
||||
reg [15:0] dac_dds_phase_0_0 = 'd0;
|
||||
reg [15:0] dac_dds_phase_0_1 = 'd0;
|
||||
reg [15:0] dac_dds_phase_1_0 = 'd0;
|
||||
reg [15:0] dac_dds_phase_1_1 = 'd0;
|
||||
reg [15:0] dac_dds_incr_0 = 'd0;
|
||||
reg [15:0] dac_dds_incr_1 = 'd0;
|
||||
reg [31:0] dac_dds_data = 'd0;
|
||||
|
||||
// internal signals
|
||||
|
||||
wire [15:0] dac_dds_data_0_s;
|
||||
wire [15:0] dac_dds_data_1_s;
|
||||
wire [15:0] dac_dds_scale_1_s;
|
||||
wire [15:0] dac_dds_init_1_s;
|
||||
wire [15:0] dac_dds_incr_1_s;
|
||||
wire [15:0] dac_dds_scale_2_s;
|
||||
wire [15:0] dac_dds_init_2_s;
|
||||
wire [15:0] dac_dds_incr_2_s;
|
||||
wire [15:0] dac_pat_data_1_s;
|
||||
wire [15:0] dac_pat_data_2_s;
|
||||
wire [ 3:0] dac_data_sel_s;
|
||||
wire dac_iqcor_enb_s;
|
||||
wire [15:0] dac_iqcor_coeff_1_s;
|
||||
wire [15:0] dac_iqcor_coeff_2_s;
|
||||
|
||||
// dac iq correction
|
||||
|
||||
generate
|
||||
if (DATAPATH_DISABLE == 1) begin
|
||||
|
||||
assign dac_data_out = dac_data_iq_out;
|
||||
|
||||
end else begin
|
||||
|
||||
ad_iqcor #(.Q_OR_I_N (Q_OR_I_N)) i_ad_iqcor_1 (
|
||||
.clk (dac_clk),
|
||||
.valid (1'b1),
|
||||
.data_in (dac_data_iq_out[31:16]),
|
||||
.data_iq (dac_data_iq_in[31:16]),
|
||||
.valid_out (),
|
||||
.data_out (dac_data_out[31:16]),
|
||||
.iqcor_enable (dac_iqcor_enb_s),
|
||||
.iqcor_coeff_1 (dac_iqcor_coeff_1_s),
|
||||
.iqcor_coeff_2 (dac_iqcor_coeff_2_s));
|
||||
|
||||
ad_iqcor #(.Q_OR_I_N (Q_OR_I_N)) i_ad_iqcor_0 (
|
||||
.clk (dac_clk),
|
||||
.valid (1'b1),
|
||||
.data_in (dac_data_iq_out[15:0]),
|
||||
.data_iq (dac_data_iq_in[15:0]),
|
||||
.valid_out (),
|
||||
.data_out (dac_data_out[15:0]),
|
||||
.iqcor_enable (dac_iqcor_enb_s),
|
||||
.iqcor_coeff_1 (dac_iqcor_coeff_1_s),
|
||||
.iqcor_coeff_2 (dac_iqcor_coeff_2_s));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// dac mux
|
||||
|
||||
always @(posedge dac_clk) begin
|
||||
dac_enable <= (dac_data_sel_s == 4'h2) ? 1'b1 : 1'b0;
|
||||
case (dac_data_sel_s)
|
||||
4'h3: dac_data_iq_out <= 32'd0;
|
||||
4'h2: dac_data_iq_out <= dac_data_in;
|
||||
4'h1: dac_data_iq_out <= dac_pat_data;
|
||||
default: dac_data_iq_out <= dac_dds_data;
|
||||
endcase
|
||||
end
|
||||
|
||||
// pattern
|
||||
|
||||
always @(posedge dac_clk) begin
|
||||
dac_pat_data <= {dac_pat_data_2_s, dac_pat_data_1_s};
|
||||
end
|
||||
|
||||
// dds
|
||||
|
||||
always @(posedge dac_clk) begin
|
||||
if (dac_data_sync == 1'b1) begin
|
||||
dac_dds_phase_0_0 <= dac_dds_init_1_s;
|
||||
dac_dds_phase_0_1 <= dac_dds_init_2_s;
|
||||
dac_dds_phase_1_0 <= dac_dds_phase_0_0 + dac_dds_incr_1_s;
|
||||
dac_dds_phase_1_1 <= dac_dds_phase_0_1 + dac_dds_incr_2_s;
|
||||
dac_dds_incr_0 <= {dac_dds_incr_1_s[14:0], 1'd0};
|
||||
dac_dds_incr_1 <= {dac_dds_incr_2_s[14:0], 1'd0};
|
||||
dac_dds_data <= 32'd0;
|
||||
end else begin
|
||||
dac_dds_phase_0_0 <= dac_dds_phase_0_0 + dac_dds_incr_0;
|
||||
dac_dds_phase_0_1 <= dac_dds_phase_0_1 + dac_dds_incr_1;
|
||||
dac_dds_phase_1_0 <= dac_dds_phase_1_0 + dac_dds_incr_0;
|
||||
dac_dds_phase_1_1 <= dac_dds_phase_1_1 + dac_dds_incr_1;
|
||||
dac_dds_incr_0 <= dac_dds_incr_0;
|
||||
dac_dds_incr_1 <= dac_dds_incr_1;
|
||||
dac_dds_data <= {dac_dds_data_1_s, dac_dds_data_0_s};
|
||||
end
|
||||
end
|
||||
|
||||
// dds
|
||||
|
||||
generate
|
||||
if (DATAPATH_DISABLE == 1) begin
|
||||
|
||||
assign dac_dds_data_0_s = 16'd0;
|
||||
assign dac_dds_data_1_s = 16'd0;
|
||||
|
||||
end else begin
|
||||
|
||||
ad_dds i_dds_0 (
|
||||
.clk (dac_clk),
|
||||
.dds_format (dac_dds_format),
|
||||
.dds_phase_0 (dac_dds_phase_0_0),
|
||||
.dds_scale_0 (dac_dds_scale_1_s),
|
||||
.dds_phase_1 (dac_dds_phase_0_1),
|
||||
.dds_scale_1 (dac_dds_scale_2_s),
|
||||
.dds_data (dac_dds_data_0_s));
|
||||
|
||||
ad_dds i_dds_1 (
|
||||
.clk (dac_clk),
|
||||
.dds_format (dac_dds_format),
|
||||
.dds_phase_0 (dac_dds_phase_1_0),
|
||||
.dds_scale_0 (dac_dds_scale_1_s),
|
||||
.dds_phase_1 (dac_dds_phase_1_1),
|
||||
.dds_scale_1 (dac_dds_scale_2_s),
|
||||
.dds_data (dac_dds_data_1_s));
|
||||
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// single channel processor
|
||||
|
||||
up_dac_channel #(.DAC_CHANNEL_ID (CHANNEL_ID)) i_up_dac_channel (
|
||||
.dac_clk (dac_clk),
|
||||
.dac_rst (dac_rst),
|
||||
.dac_dds_scale_1 (dac_dds_scale_1_s),
|
||||
.dac_dds_init_1 (dac_dds_init_1_s),
|
||||
.dac_dds_incr_1 (dac_dds_incr_1_s),
|
||||
.dac_dds_scale_2 (dac_dds_scale_2_s),
|
||||
.dac_dds_init_2 (dac_dds_init_2_s),
|
||||
.dac_dds_incr_2 (dac_dds_incr_2_s),
|
||||
.dac_pat_data_1 (dac_pat_data_1_s),
|
||||
.dac_pat_data_2 (dac_pat_data_2_s),
|
||||
.dac_data_sel (dac_data_sel_s),
|
||||
.dac_iqcor_enb (dac_iqcor_enb_s),
|
||||
.dac_iqcor_coeff_1 (dac_iqcor_coeff_1_s),
|
||||
.dac_iqcor_coeff_2 (dac_iqcor_coeff_2_s),
|
||||
.up_usr_datatype_be (),
|
||||
.up_usr_datatype_signed (),
|
||||
.up_usr_datatype_shift (),
|
||||
.up_usr_datatype_total_bits (),
|
||||
.up_usr_datatype_bits (),
|
||||
.up_usr_interpolation_m (),
|
||||
.up_usr_interpolation_n (),
|
||||
.dac_usr_datatype_be (1'b0),
|
||||
.dac_usr_datatype_signed (1'b1),
|
||||
.dac_usr_datatype_shift (8'd0),
|
||||
.dac_usr_datatype_total_bits (8'd16),
|
||||
.dac_usr_datatype_bits (8'd16),
|
||||
.dac_usr_interpolation_m (16'd1),
|
||||
.dac_usr_interpolation_n (16'd1),
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_wreq (up_wreq),
|
||||
.up_waddr (up_waddr),
|
||||
.up_wdata (up_wdata),
|
||||
.up_wack (up_wack),
|
||||
.up_rreq (up_rreq),
|
||||
.up_raddr (up_raddr),
|
||||
.up_rdata (up_rdata),
|
||||
.up_rack (up_rack));
|
||||
|
||||
endmodule
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
Loading…
Reference in New Issue