2017-01-31 14:18:58 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2023-07-06 13:54:40 +00:00
|
|
|
// Copyright (C) 2014-2023 Analog Devices, Inc. All rights reserved.
|
2017-01-31 14:18:58 +00:00
|
|
|
//
|
2017-05-31 15:15:24 +00:00
|
|
|
// In this HDL repository, there are many different and unique modules, consisting
|
|
|
|
// of various HDL (Verilog or VHDL) components. The individual modules are
|
|
|
|
// developed independently, and may be accompanied by separate and unique license
|
|
|
|
// terms.
|
|
|
|
//
|
|
|
|
// The user should read each of these license terms, and understand the
|
2018-03-14 14:45:47 +00:00
|
|
|
// freedoms and responsibilities that he or she has by using this source/core.
|
2017-05-31 15:15:24 +00:00
|
|
|
//
|
|
|
|
// This core is distributed in the hope that it will be useful, but WITHOUT ANY
|
2017-05-29 06:55:41 +00:00
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE.
|
2017-01-31 14:18:58 +00:00
|
|
|
//
|
2017-05-29 06:55:41 +00:00
|
|
|
// Redistribution and use of source or resulting binaries, with or without modification
|
|
|
|
// of this file, are permitted under one of the following two license terms:
|
2017-01-31 14:18:58 +00:00
|
|
|
//
|
2017-05-17 08:44:52 +00:00
|
|
|
// 1. The GNU General Public License version 2 as published by the
|
2017-05-31 15:15:24 +00:00
|
|
|
// Free Software Foundation, which can be found in the top level directory
|
|
|
|
// of this repository (LICENSE_GPL2), and also online at:
|
|
|
|
// <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
|
2017-05-17 08:44:52 +00:00
|
|
|
//
|
|
|
|
// OR
|
|
|
|
//
|
2017-05-31 15:15:24 +00:00
|
|
|
// 2. An ADI specific BSD license, which can be found in the top level directory
|
|
|
|
// of this repository (LICENSE_ADIBSD), and also on-line at:
|
2017-05-29 06:55:41 +00:00
|
|
|
// https://github.com/analogdevicesinc/hdl/blob/master/LICENSE_ADIBSD
|
|
|
|
// This will allow to generate bit files and not release the source code,
|
|
|
|
// as long as it attaches to an ADI device.
|
2017-01-31 14:18:58 +00:00
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
|
|
|
|
`timescale 1ns/100ps
|
|
|
|
|
|
|
|
module axi_ad9963_tx #(
|
|
|
|
|
|
|
|
// parameters
|
|
|
|
|
2018-02-07 12:57:06 +00:00
|
|
|
parameter ID = 0,
|
2019-01-11 08:54:16 +00:00
|
|
|
parameter FPGA_TECHNOLOGY = 0,
|
|
|
|
parameter FPGA_FAMILY = 0,
|
|
|
|
parameter SPEED_GRADE = 0,
|
|
|
|
parameter DEV_PACKAGE = 0,
|
2018-06-06 10:01:53 +00:00
|
|
|
parameter DAC_DDS_TYPE = 1,
|
|
|
|
parameter DAC_DDS_CORDIC_DW = 14,
|
|
|
|
parameter DAC_DDS_CORDIC_PHASE_DW = 13,
|
2022-04-08 10:21:52 +00:00
|
|
|
parameter DATAPATH_DISABLE = 0
|
|
|
|
) (
|
2017-01-31 14:18:58 +00:00
|
|
|
|
|
|
|
// dac interface
|
|
|
|
|
|
|
|
input dac_clk,
|
2017-03-29 07:28:38 +00:00
|
|
|
output dac_rst,
|
2017-01-31 14:18:58 +00:00
|
|
|
output [23:0] dac_data,
|
|
|
|
input [23:0] adc_data,
|
|
|
|
|
|
|
|
// master/slave
|
|
|
|
|
|
|
|
input dac_sync_in,
|
|
|
|
output dac_sync_out,
|
|
|
|
|
|
|
|
// dma interface
|
|
|
|
|
|
|
|
output dac_enable_i,
|
|
|
|
output reg dac_valid_i,
|
|
|
|
input [15:0] dac_data_i,
|
2020-08-28 20:30:08 +00:00
|
|
|
input dma_valid_i,
|
2017-01-31 14:18:58 +00:00
|
|
|
output dac_enable_q,
|
|
|
|
output reg dac_valid_q,
|
|
|
|
input [15:0] dac_data_q,
|
2020-08-28 20:30:08 +00:00
|
|
|
input dma_valid_q,
|
2017-01-31 14:18:58 +00:00
|
|
|
input dac_dunf,
|
|
|
|
|
2017-04-18 09:24:42 +00:00
|
|
|
output up_dac_ce,
|
|
|
|
|
2017-01-31 14:18:58 +00:00
|
|
|
// processor interface
|
|
|
|
|
|
|
|
input up_rstn,
|
|
|
|
input up_clk,
|
|
|
|
input up_wreq,
|
|
|
|
input [13:0] up_waddr,
|
|
|
|
input [31:0] up_wdata,
|
|
|
|
output reg up_wack,
|
|
|
|
input up_rreq,
|
|
|
|
input [13:0] up_raddr,
|
|
|
|
output reg [31:0] up_rdata,
|
2022-04-08 10:21:52 +00:00
|
|
|
output reg up_rack
|
|
|
|
);
|
2017-01-31 14:18:58 +00:00
|
|
|
|
|
|
|
// internal signals
|
|
|
|
|
|
|
|
wire dac_data_sync_s;
|
|
|
|
wire dac_dds_format_s;
|
|
|
|
wire [23:0] dac_data_int_s;
|
2017-03-30 18:12:58 +00:00
|
|
|
wire [31:0] up_rdata_s[0:2];
|
|
|
|
wire up_rack_s[0:2];
|
|
|
|
wire up_wack_s[0:2];
|
2017-01-31 14:18:58 +00:00
|
|
|
|
|
|
|
// master/slave
|
|
|
|
|
|
|
|
assign dac_data_sync_s = (ID == 0) ? dac_sync_out : dac_sync_in;
|
|
|
|
|
2017-04-18 09:24:42 +00:00
|
|
|
// dma interface
|
2017-01-31 14:18:58 +00:00
|
|
|
|
|
|
|
always @(posedge dac_clk) begin
|
2017-04-18 09:24:42 +00:00
|
|
|
if (dac_rst == 1'b1) begin
|
|
|
|
dac_valid_i <= 1'b0;
|
|
|
|
dac_valid_q <= 1'b0;
|
2017-01-31 14:18:58 +00:00
|
|
|
end else begin
|
2020-08-28 20:30:08 +00:00
|
|
|
dac_valid_i <= 1'b1;
|
|
|
|
dac_valid_q <= 1'b1;
|
2017-01-31 14:18:58 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
// processor read interface
|
|
|
|
|
2017-03-17 12:29:31 +00:00
|
|
|
always @(*) begin
|
2017-03-30 18:12:58 +00:00
|
|
|
up_rdata <= up_rdata_s[0] | up_rdata_s[1] | up_rdata_s[2];
|
|
|
|
up_rack <= up_rack_s[0] | up_rack_s[1] | up_rack_s[2];
|
|
|
|
up_wack <= up_wack_s[0] | up_wack_s[1] | up_wack_s[2];
|
2017-01-31 14:18:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
// dac channel
|
|
|
|
|
|
|
|
axi_ad9963_tx_channel #(
|
|
|
|
.CHANNEL_ID (0),
|
|
|
|
.Q_OR_I_N (0),
|
2018-06-06 10:01:53 +00:00
|
|
|
.DAC_DDS_TYPE (DAC_DDS_TYPE),
|
|
|
|
.DAC_DDS_CORDIC_DW (DAC_DDS_CORDIC_DW),
|
|
|
|
.DAC_DDS_CORDIC_PHASE_DW (DAC_DDS_CORDIC_PHASE_DW),
|
2022-04-08 10:21:52 +00:00
|
|
|
.DATAPATH_DISABLE (DATAPATH_DISABLE)
|
|
|
|
) i_tx_channel_0 (
|
2017-01-31 14:18:58 +00:00
|
|
|
.dac_clk (dac_clk),
|
|
|
|
.dac_rst (dac_rst),
|
2020-08-28 20:30:08 +00:00
|
|
|
.dac_valid (dac_valid_i),
|
2017-01-31 14:18:58 +00:00
|
|
|
.dma_data (dac_data_i),
|
|
|
|
.adc_data (adc_data[11:0]),
|
|
|
|
.dac_data (dac_data[11:0]),
|
|
|
|
.dac_data_out (dac_data_int_s[11:0]),
|
|
|
|
.dac_data_in (dac_data_int_s[23:12]),
|
|
|
|
.dac_enable (dac_enable_i),
|
2017-04-18 09:24:42 +00:00
|
|
|
.dac_data_sync (dac_data_sync_s),
|
2017-01-31 14:18:58 +00:00
|
|
|
.dac_dds_format (dac_dds_format_s),
|
2020-08-28 20:30:08 +00:00
|
|
|
.dma_valid (dma_valid_i),
|
2017-01-31 14:18:58 +00:00
|
|
|
.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
|
|
|
|
|
|
|
|
axi_ad9963_tx_channel #(
|
|
|
|
.CHANNEL_ID (1),
|
|
|
|
.Q_OR_I_N (1),
|
2018-06-06 10:01:53 +00:00
|
|
|
.DAC_DDS_TYPE (DAC_DDS_TYPE),
|
|
|
|
.DAC_DDS_CORDIC_DW (DAC_DDS_CORDIC_DW),
|
|
|
|
.DAC_DDS_CORDIC_PHASE_DW (DAC_DDS_CORDIC_PHASE_DW),
|
2022-04-08 10:21:52 +00:00
|
|
|
.DATAPATH_DISABLE (DATAPATH_DISABLE)
|
|
|
|
) i_tx_channel_1 (
|
2017-01-31 14:18:58 +00:00
|
|
|
.dac_clk (dac_clk),
|
|
|
|
.dac_rst (dac_rst),
|
2020-08-28 20:30:08 +00:00
|
|
|
.dac_valid (dac_valid_q),
|
2017-01-31 14:18:58 +00:00
|
|
|
.dma_data (dac_data_q),
|
|
|
|
.adc_data (adc_data[23:12]),
|
|
|
|
.dac_data (dac_data[23:12]),
|
|
|
|
.dac_data_out (dac_data_int_s[23:12]),
|
|
|
|
.dac_data_in (dac_data_int_s[11:0]),
|
|
|
|
.dac_enable (dac_enable_q),
|
2017-04-18 09:24:42 +00:00
|
|
|
.dac_data_sync (dac_data_sync_s),
|
2017-01-31 14:18:58 +00:00
|
|
|
.dac_dds_format (dac_dds_format_s),
|
2020-08-28 20:30:08 +00:00
|
|
|
.dma_valid (dma_valid_q),
|
2017-01-31 14:18:58 +00:00
|
|
|
.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 common processor interface
|
|
|
|
|
2017-03-17 11:31:44 +00:00
|
|
|
up_dac_common #(
|
|
|
|
.ID (ID),
|
2019-01-11 08:54:16 +00:00
|
|
|
.FPGA_TECHNOLOGY (FPGA_TECHNOLOGY),
|
|
|
|
.FPGA_FAMILY (FPGA_FAMILY),
|
|
|
|
.SPEED_GRADE (SPEED_GRADE),
|
|
|
|
.DEV_PACKAGE (DEV_PACKAGE),
|
2018-02-16 09:57:48 +00:00
|
|
|
.CONFIG(0),
|
|
|
|
.CLK_EDGE_SEL(0),
|
|
|
|
.COMMON_ID(6'h10),
|
2017-03-17 11:31:44 +00:00
|
|
|
.DRP_DISABLE (1),
|
|
|
|
.USERPORTS_DISABLE (1),
|
|
|
|
.GPIO_DISABLE(1)
|
|
|
|
) i_up_dac_common (
|
2017-01-31 14:18:58 +00:00
|
|
|
.mmcm_rst (),
|
|
|
|
.dac_clk (dac_clk),
|
|
|
|
.dac_rst (dac_rst),
|
2020-09-10 06:17:05 +00:00
|
|
|
.dac_num_lanes (),
|
|
|
|
.dac_sdr_ddr_n (),
|
2017-01-31 14:18:58 +00:00
|
|
|
.dac_sync (dac_sync_out),
|
|
|
|
.dac_frame (),
|
|
|
|
.dac_clksel(),
|
2023-02-20 12:33:45 +00:00
|
|
|
.dac_custom_wr(),
|
|
|
|
.dac_custom_rd(32'b0),
|
|
|
|
.dac_custom_control(),
|
|
|
|
.dac_status_if_busy(1'b0),
|
2017-01-31 14:18:58 +00:00
|
|
|
.dac_par_type (),
|
|
|
|
.dac_par_enb (),
|
|
|
|
.dac_r1_mode (),
|
|
|
|
.dac_datafmt (dac_dds_format_s),
|
2017-04-18 09:24:42 +00:00
|
|
|
.dac_datarate (),
|
2017-01-31 14:18:58 +00:00
|
|
|
.dac_status (1'b1),
|
2020-09-10 06:17:05 +00:00
|
|
|
.dac_sync_in_status (1'b1),
|
2017-01-31 14:18:58 +00:00
|
|
|
.dac_status_unf (dac_dunf),
|
|
|
|
.dac_clk_ratio (32'd1),
|
2017-04-18 09:24:42 +00:00
|
|
|
.up_dac_ce(up_dac_ce),
|
2018-02-16 09:57:48 +00:00
|
|
|
.up_pps_rcounter(32'h0),
|
|
|
|
.up_pps_status(1'b0),
|
|
|
|
.up_pps_irq_mask(),
|
2017-01-31 14:18:58 +00:00
|
|
|
.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'd2),
|
|
|
|
.up_dac_gpio_in (32'h0),
|
|
|
|
.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[2]),
|
|
|
|
.up_rreq (up_rreq),
|
|
|
|
.up_raddr (up_raddr),
|
|
|
|
.up_rdata (up_rdata_s[2]),
|
|
|
|
.up_rack (up_rack_s[2]));
|
|
|
|
|
|
|
|
endmodule
|