2015-06-26 09:04:19 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2017-05-17 08:44:52 +00:00
|
|
|
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
|
2016-09-21 13:09:55 +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.
|
2016-09-21 13:09:55 +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:
|
2016-09-21 13:09:55 +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.
|
2015-06-26 09:04:19 +00:00
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
// This is the dac physical interface (drives samples from the low speed clock to the
|
|
|
|
// dac clock domain.
|
|
|
|
|
|
|
|
`timescale 1ns/100ps
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
module axi_ad9122_if #(
|
|
|
|
|
2019-01-11 08:54:16 +00:00
|
|
|
parameter FPGA_TECHNOLOGY = 0,
|
2017-04-13 08:45:54 +00:00
|
|
|
parameter SERDES_OR_DDR_N = 1,
|
|
|
|
parameter MMCM_OR_BUFIO_N = 1,
|
|
|
|
parameter MMCM_CLKIN_PERIOD = 1.667,
|
|
|
|
parameter MMCM_VCO_DIV = 6,
|
|
|
|
parameter MMCM_VCO_MUL = 12,
|
|
|
|
parameter MMCM_CLK0_DIV = 2,
|
|
|
|
parameter MMCM_CLK1_DIV = 8,
|
2022-04-08 10:21:52 +00:00
|
|
|
parameter IO_DELAY_GROUP = "dac_if_delay_group"
|
|
|
|
) (
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
// dac interface
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
input dac_clk_in_p,
|
|
|
|
input dac_clk_in_n,
|
|
|
|
output dac_clk_out_p,
|
|
|
|
output dac_clk_out_n,
|
|
|
|
output dac_frame_out_p,
|
|
|
|
output dac_frame_out_n,
|
|
|
|
output [15:0] dac_data_out_p,
|
|
|
|
output [15:0] dac_data_out_n,
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
// internal resets and clocks
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
input dac_rst,
|
|
|
|
output dac_clk,
|
|
|
|
output dac_div_clk,
|
|
|
|
output reg dac_status,
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
// data interface
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
input dac_frame_i0,
|
|
|
|
input [15:0] dac_data_i0,
|
|
|
|
input dac_frame_i1,
|
|
|
|
input [15:0] dac_data_i1,
|
|
|
|
input dac_frame_i2,
|
|
|
|
input [15:0] dac_data_i2,
|
|
|
|
input dac_frame_i3,
|
|
|
|
input [15:0] dac_data_i3,
|
|
|
|
|
|
|
|
input dac_frame_q0,
|
|
|
|
input [15:0] dac_data_q0,
|
|
|
|
input dac_frame_q1,
|
|
|
|
input [15:0] dac_data_q1,
|
|
|
|
input dac_frame_q2,
|
|
|
|
input [15:0] dac_data_q2,
|
|
|
|
input dac_frame_q3,
|
|
|
|
input [15:0] dac_data_q3,
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
// mmcm reset
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
input mmcm_rst,
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
// drp interface
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
input up_clk,
|
|
|
|
input up_rstn,
|
|
|
|
input up_drp_sel,
|
|
|
|
input up_drp_wr,
|
|
|
|
input [11:0] up_drp_addr,
|
|
|
|
input [31:0] up_drp_wdata,
|
|
|
|
output [31:0] up_drp_rdata,
|
|
|
|
output up_drp_ready,
|
2022-04-08 10:21:52 +00:00
|
|
|
output up_drp_locked
|
|
|
|
);
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
// internal registers
|
|
|
|
|
|
|
|
reg dac_status_m1 = 'd0;
|
|
|
|
|
2016-03-22 16:50:02 +00:00
|
|
|
// internal signals
|
|
|
|
|
|
|
|
wire dac_out_clk;
|
2016-12-06 12:49:33 +00:00
|
|
|
wire loaden_s;
|
2016-03-22 16:50:02 +00:00
|
|
|
|
2015-06-26 09:04:19 +00:00
|
|
|
// dac status
|
|
|
|
|
|
|
|
always @(posedge dac_div_clk) begin
|
|
|
|
if (dac_rst == 1'b1) begin
|
|
|
|
dac_status_m1 <= 1'd0;
|
|
|
|
dac_status <= 1'd0;
|
|
|
|
end else begin
|
|
|
|
dac_status_m1 <= up_drp_locked;
|
|
|
|
dac_status <= dac_status_m1;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
// dac data output serdes(s) & buffers
|
|
|
|
|
|
|
|
ad_serdes_out #(
|
2019-01-11 08:54:16 +00:00
|
|
|
.FPGA_TECHNOLOGY (FPGA_TECHNOLOGY),
|
2016-09-21 13:09:55 +00:00
|
|
|
.DDR_OR_SDR_N (SERDES_OR_DDR_N),
|
2022-04-08 10:21:52 +00:00
|
|
|
.DATA_WIDTH (16)
|
|
|
|
) i_serdes_out_data (
|
2015-06-26 09:04:19 +00:00
|
|
|
.rst (dac_rst),
|
|
|
|
.clk (dac_clk),
|
|
|
|
.div_clk (dac_div_clk),
|
2016-12-06 12:49:33 +00:00
|
|
|
.loaden (loaden_s),
|
2019-07-19 09:15:06 +00:00
|
|
|
.data_oe (1'b1),
|
2015-06-26 09:04:19 +00:00
|
|
|
.data_s0 (dac_data_i0),
|
|
|
|
.data_s1 (dac_data_q0),
|
|
|
|
.data_s2 (dac_data_i1),
|
|
|
|
.data_s3 (dac_data_q1),
|
|
|
|
.data_s4 (dac_data_i2),
|
|
|
|
.data_s5 (dac_data_q2),
|
|
|
|
.data_s6 (dac_data_i3),
|
|
|
|
.data_s7 (dac_data_q3),
|
2017-05-16 13:20:51 +00:00
|
|
|
.data_out_se (),
|
2015-06-26 09:04:19 +00:00
|
|
|
.data_out_p (dac_data_out_p),
|
|
|
|
.data_out_n (dac_data_out_n));
|
|
|
|
|
|
|
|
// dac frame output serdes & buffer
|
2016-09-21 13:09:55 +00:00
|
|
|
|
2015-06-26 09:04:19 +00:00
|
|
|
ad_serdes_out #(
|
2019-01-11 08:54:16 +00:00
|
|
|
.FPGA_TECHNOLOGY (FPGA_TECHNOLOGY),
|
2016-09-21 13:09:55 +00:00
|
|
|
.DDR_OR_SDR_N (SERDES_OR_DDR_N),
|
2022-04-08 10:21:52 +00:00
|
|
|
.DATA_WIDTH (1)
|
|
|
|
) i_serdes_out_frame (
|
2015-06-26 09:04:19 +00:00
|
|
|
.rst (dac_rst),
|
|
|
|
.clk (dac_clk),
|
|
|
|
.div_clk (dac_div_clk),
|
2016-12-06 12:49:33 +00:00
|
|
|
.loaden (loaden_s),
|
2019-07-19 09:15:06 +00:00
|
|
|
.data_oe (1'b1),
|
2015-06-26 09:04:19 +00:00
|
|
|
.data_s0 (dac_frame_i0),
|
|
|
|
.data_s1 (dac_frame_q0),
|
|
|
|
.data_s2 (dac_frame_i1),
|
|
|
|
.data_s3 (dac_frame_q1),
|
|
|
|
.data_s4 (dac_frame_i2),
|
|
|
|
.data_s5 (dac_frame_q2),
|
|
|
|
.data_s6 (dac_frame_i3),
|
|
|
|
.data_s7 (dac_frame_q3),
|
2017-05-16 13:20:51 +00:00
|
|
|
.data_out_se (),
|
2015-06-26 09:04:19 +00:00
|
|
|
.data_out_p (dac_frame_out_p),
|
|
|
|
.data_out_n (dac_frame_out_n));
|
|
|
|
|
|
|
|
// dac clock output serdes & buffer
|
2016-09-21 13:09:55 +00:00
|
|
|
|
2015-06-26 09:04:19 +00:00
|
|
|
ad_serdes_out #(
|
2019-01-11 08:54:16 +00:00
|
|
|
.FPGA_TECHNOLOGY (FPGA_TECHNOLOGY),
|
2016-09-21 13:09:55 +00:00
|
|
|
.DDR_OR_SDR_N (SERDES_OR_DDR_N),
|
2022-04-08 10:21:52 +00:00
|
|
|
.DATA_WIDTH (1)
|
|
|
|
) i_serdes_out_clk (
|
2015-06-26 09:04:19 +00:00
|
|
|
.rst (dac_rst),
|
2016-12-06 12:49:33 +00:00
|
|
|
.clk (dac_clk),
|
2015-06-26 09:04:19 +00:00
|
|
|
.div_clk (dac_div_clk),
|
2016-12-06 12:49:33 +00:00
|
|
|
.loaden (loaden_s),
|
2019-07-19 09:15:06 +00:00
|
|
|
.data_oe (1'b1),
|
2015-06-26 09:04:19 +00:00
|
|
|
.data_s0 (1'b1),
|
|
|
|
.data_s1 (1'b0),
|
|
|
|
.data_s2 (1'b1),
|
|
|
|
.data_s3 (1'b0),
|
|
|
|
.data_s4 (1'b1),
|
|
|
|
.data_s5 (1'b0),
|
|
|
|
.data_s6 (1'b1),
|
|
|
|
.data_s7 (1'b0),
|
2017-05-16 13:20:51 +00:00
|
|
|
.data_out_se (),
|
2015-06-26 09:04:19 +00:00
|
|
|
.data_out_p (dac_clk_out_p),
|
|
|
|
.data_out_n (dac_clk_out_n));
|
|
|
|
|
|
|
|
// dac clock input buffers
|
|
|
|
|
|
|
|
ad_serdes_clk #(
|
2016-09-21 13:09:55 +00:00
|
|
|
.DDR_OR_SDR_N (SERDES_OR_DDR_N),
|
2015-08-19 11:11:47 +00:00
|
|
|
.MMCM_OR_BUFR_N (MMCM_OR_BUFIO_N),
|
2019-01-11 08:54:16 +00:00
|
|
|
.FPGA_TECHNOLOGY (FPGA_TECHNOLOGY),
|
2016-03-22 16:50:02 +00:00
|
|
|
.MMCM_CLKIN_PERIOD (MMCM_CLKIN_PERIOD),
|
|
|
|
.MMCM_VCO_DIV (MMCM_VCO_DIV),
|
|
|
|
.MMCM_VCO_MUL (MMCM_VCO_MUL),
|
|
|
|
.MMCM_CLK0_DIV (MMCM_CLK0_DIV),
|
2022-04-08 10:21:52 +00:00
|
|
|
.MMCM_CLK1_DIV (MMCM_CLK1_DIV)
|
|
|
|
) i_serdes_clk (
|
2016-09-21 13:09:55 +00:00
|
|
|
.rst (mmcm_rst),
|
2015-06-26 09:04:19 +00:00
|
|
|
.clk_in_p (dac_clk_in_p),
|
|
|
|
.clk_in_n (dac_clk_in_n),
|
|
|
|
.clk (dac_clk),
|
|
|
|
.div_clk (dac_div_clk),
|
2016-03-22 16:50:02 +00:00
|
|
|
.out_clk (dac_out_clk),
|
2016-12-06 12:49:33 +00:00
|
|
|
.loaden (loaden_s),
|
2016-09-21 13:09:55 +00:00
|
|
|
.phase (),
|
2015-06-26 09:04:19 +00:00
|
|
|
.up_clk (up_clk),
|
|
|
|
.up_rstn (up_rstn),
|
|
|
|
.up_drp_sel (up_drp_sel),
|
|
|
|
.up_drp_wr (up_drp_wr),
|
|
|
|
.up_drp_addr (up_drp_addr),
|
|
|
|
.up_drp_wdata (up_drp_wdata),
|
|
|
|
.up_drp_rdata (up_drp_rdata),
|
|
|
|
.up_drp_ready (up_drp_ready),
|
|
|
|
.up_drp_locked (up_drp_locked));
|
|
|
|
|
|
|
|
endmodule
|