2015-05-11 09:09:09 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2023-07-06 13:54:40 +00:00
|
|
|
// Copyright (C) 2015-2023 Analog Devices, Inc. All rights reserved.
|
2015-05-11 09:09:09 +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.
|
2015-05-11 09:09:09 +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:
|
2015-05-11 09:09:09 +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-05-11 09:09:09 +00:00
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
|
|
|
|
`timescale 1ns/1ps
|
|
|
|
|
|
|
|
module axi_ad9361_tdd (
|
|
|
|
|
|
|
|
// clock
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
input clk,
|
|
|
|
input rst,
|
2015-05-11 09:09:09 +00:00
|
|
|
|
|
|
|
// control signals from the tdd control
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
output tdd_rx_vco_en,
|
|
|
|
output tdd_tx_vco_en,
|
|
|
|
output tdd_rx_rf_en,
|
|
|
|
output tdd_tx_rf_en,
|
2015-05-11 09:09:09 +00:00
|
|
|
|
|
|
|
// status signal
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
output tdd_enabled,
|
|
|
|
input [ 7:0] tdd_status,
|
2015-05-11 09:09:09 +00:00
|
|
|
|
2015-11-11 09:06:19 +00:00
|
|
|
// sync signal
|
2015-07-28 11:41:32 +00:00
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
input tdd_sync,
|
|
|
|
output reg tdd_sync_cntr,
|
2015-07-28 11:41:32 +00:00
|
|
|
|
2015-07-16 11:10:49 +00:00
|
|
|
// tx/rx data flow control
|
2015-06-04 13:46:28 +00:00
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
output reg tdd_tx_valid,
|
|
|
|
output reg tdd_rx_valid,
|
2015-07-16 11:10:49 +00:00
|
|
|
|
2015-05-11 09:09:09 +00:00
|
|
|
// bus interface
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
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,
|
2022-04-08 10:21:52 +00:00
|
|
|
output up_rack
|
|
|
|
);
|
2015-12-03 09:13:56 +00:00
|
|
|
|
2015-05-11 09:09:09 +00:00
|
|
|
// internal signals
|
|
|
|
|
2015-05-21 10:39:48 +00:00
|
|
|
wire tdd_enable_s;
|
2015-05-11 09:09:09 +00:00
|
|
|
wire tdd_secondary_s;
|
2015-07-28 11:41:32 +00:00
|
|
|
wire [ 7:0] tdd_burst_count_s;
|
2015-06-04 13:46:28 +00:00
|
|
|
wire tdd_rx_only_s;
|
|
|
|
wire tdd_tx_only_s;
|
2015-07-16 11:10:49 +00:00
|
|
|
wire tdd_gated_rx_dmapath_s;
|
|
|
|
wire tdd_gated_tx_dmapath_s;
|
2015-07-28 11:41:32 +00:00
|
|
|
wire [23:0] tdd_counter_init_s;
|
|
|
|
wire [23:0] tdd_frame_length_s;
|
|
|
|
wire tdd_terminal_type_s;
|
2015-08-06 12:14:36 +00:00
|
|
|
wire tdd_sync_enable_s;
|
2015-07-28 11:41:32 +00:00
|
|
|
wire [23:0] tdd_vco_rx_on_1_s;
|
|
|
|
wire [23:0] tdd_vco_rx_off_1_s;
|
|
|
|
wire [23:0] tdd_vco_tx_on_1_s;
|
|
|
|
wire [23:0] tdd_vco_tx_off_1_s;
|
|
|
|
wire [23:0] tdd_rx_on_1_s;
|
|
|
|
wire [23:0] tdd_rx_off_1_s;
|
2016-07-28 10:29:09 +00:00
|
|
|
wire [23:0] tdd_rx_dp_on_1_s;
|
|
|
|
wire [23:0] tdd_rx_dp_off_1_s;
|
2015-07-28 11:41:32 +00:00
|
|
|
wire [23:0] tdd_tx_on_1_s;
|
|
|
|
wire [23:0] tdd_tx_off_1_s;
|
|
|
|
wire [23:0] tdd_tx_dp_on_1_s;
|
|
|
|
wire [23:0] tdd_tx_dp_off_1_s;
|
|
|
|
wire [23:0] tdd_vco_rx_on_2_s;
|
|
|
|
wire [23:0] tdd_vco_rx_off_2_s;
|
|
|
|
wire [23:0] tdd_vco_tx_on_2_s;
|
|
|
|
wire [23:0] tdd_vco_tx_off_2_s;
|
|
|
|
wire [23:0] tdd_rx_on_2_s;
|
|
|
|
wire [23:0] tdd_rx_off_2_s;
|
2016-07-28 10:29:09 +00:00
|
|
|
wire [23:0] tdd_rx_dp_on_2_s;
|
|
|
|
wire [23:0] tdd_rx_dp_off_2_s;
|
2015-07-28 11:41:32 +00:00
|
|
|
wire [23:0] tdd_tx_on_2_s;
|
|
|
|
wire [23:0] tdd_tx_off_2_s;
|
|
|
|
wire [23:0] tdd_tx_dp_on_2_s;
|
|
|
|
wire [23:0] tdd_tx_dp_off_2_s;
|
|
|
|
|
|
|
|
wire [23:0] tdd_counter_status;
|
2015-05-11 09:09:09 +00:00
|
|
|
|
2016-07-28 10:29:09 +00:00
|
|
|
wire tdd_rx_dp_en_s;
|
2015-06-08 13:21:40 +00:00
|
|
|
wire tdd_tx_dp_en_s;
|
|
|
|
|
2016-02-10 10:43:16 +00:00
|
|
|
assign tdd_enabled = tdd_enable_s;
|
2017-02-23 09:31:23 +00:00
|
|
|
|
|
|
|
// syncronization control signal
|
|
|
|
|
|
|
|
always @(posedge clk) begin
|
|
|
|
if (tdd_enable_s == 1'b1) begin
|
|
|
|
tdd_sync_cntr <= ~tdd_terminal_type_s;
|
|
|
|
end else begin
|
|
|
|
tdd_sync_cntr <= 1'b0;
|
|
|
|
end
|
|
|
|
end
|
2016-02-10 10:43:16 +00:00
|
|
|
|
2015-07-16 11:10:49 +00:00
|
|
|
// tx/rx data flow control
|
|
|
|
|
2015-12-03 09:13:56 +00:00
|
|
|
always @(posedge clk) begin
|
|
|
|
if((tdd_enable_s == 1) && (tdd_gated_tx_dmapath_s == 1)) begin
|
2016-09-28 13:36:13 +00:00
|
|
|
tdd_tx_valid <= tdd_tx_dp_en_s;
|
2015-12-03 09:13:56 +00:00
|
|
|
end else begin
|
2016-09-28 13:36:13 +00:00
|
|
|
tdd_tx_valid <= 1'b1;
|
2015-12-03 09:13:56 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge clk) begin
|
2021-06-10 08:05:04 +00:00
|
|
|
if((tdd_enable_s == 1) && (tdd_gated_rx_dmapath_s == 1)) begin
|
2016-09-28 13:36:13 +00:00
|
|
|
tdd_rx_valid <= tdd_rx_dp_en_s;
|
2015-12-03 09:13:56 +00:00
|
|
|
end else begin
|
2016-09-28 13:36:13 +00:00
|
|
|
tdd_rx_valid <= 1'b1;
|
2015-12-03 09:13:56 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-11 09:09:09 +00:00
|
|
|
// instantiations
|
|
|
|
|
2022-04-08 10:21:52 +00:00
|
|
|
up_tdd_cntrl i_up_tdd_cntrl (
|
2015-05-11 09:09:09 +00:00
|
|
|
.clk(clk),
|
2015-05-21 10:39:48 +00:00
|
|
|
.rst(rst),
|
|
|
|
.tdd_enable(tdd_enable_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_secondary(tdd_secondary_s),
|
|
|
|
.tdd_burst_count(tdd_burst_count_s),
|
2015-06-04 13:46:28 +00:00
|
|
|
.tdd_tx_only(tdd_tx_only_s),
|
|
|
|
.tdd_rx_only(tdd_rx_only_s),
|
2015-07-16 11:10:49 +00:00
|
|
|
.tdd_gated_rx_dmapath(tdd_gated_rx_dmapath_s),
|
|
|
|
.tdd_gated_tx_dmapath(tdd_gated_tx_dmapath_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_counter_init(tdd_counter_init_s),
|
|
|
|
.tdd_frame_length(tdd_frame_length_s),
|
2015-07-28 11:41:32 +00:00
|
|
|
.tdd_terminal_type(tdd_terminal_type_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_vco_rx_on_1(tdd_vco_rx_on_1_s),
|
|
|
|
.tdd_vco_rx_off_1(tdd_vco_rx_off_1_s),
|
|
|
|
.tdd_vco_tx_on_1(tdd_vco_tx_on_1_s),
|
|
|
|
.tdd_vco_tx_off_1(tdd_vco_tx_off_1_s),
|
|
|
|
.tdd_rx_on_1(tdd_rx_on_1_s),
|
|
|
|
.tdd_rx_off_1(tdd_rx_off_1_s),
|
2016-07-28 10:29:09 +00:00
|
|
|
.tdd_rx_dp_on_1(tdd_rx_dp_on_1_s),
|
|
|
|
.tdd_rx_dp_off_1(tdd_rx_dp_off_1_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_tx_on_1(tdd_tx_on_1_s),
|
|
|
|
.tdd_tx_off_1(tdd_tx_off_1_s),
|
|
|
|
.tdd_tx_dp_on_1(tdd_tx_dp_on_1_s),
|
|
|
|
.tdd_tx_dp_off_1(tdd_tx_dp_off_1_s),
|
|
|
|
.tdd_vco_rx_on_2(tdd_vco_rx_on_2_s),
|
|
|
|
.tdd_vco_rx_off_2(tdd_vco_rx_off_2_s),
|
|
|
|
.tdd_vco_tx_on_2(tdd_vco_tx_on_2_s),
|
|
|
|
.tdd_vco_tx_off_2(tdd_vco_tx_off_2_s),
|
|
|
|
.tdd_rx_on_2(tdd_rx_on_2_s),
|
|
|
|
.tdd_rx_off_2(tdd_rx_off_2_s),
|
2016-07-28 10:29:09 +00:00
|
|
|
.tdd_rx_dp_on_2(tdd_rx_dp_on_2_s),
|
|
|
|
.tdd_rx_dp_off_2(tdd_rx_dp_off_2_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_tx_on_2(tdd_tx_on_2_s),
|
|
|
|
.tdd_tx_off_2(tdd_tx_off_2_s),
|
|
|
|
.tdd_tx_dp_on_2(tdd_tx_dp_on_2_s),
|
|
|
|
.tdd_tx_dp_off_2(tdd_tx_dp_off_2_s),
|
|
|
|
.tdd_status(tdd_status),
|
|
|
|
.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));
|
|
|
|
|
2015-09-09 09:24:26 +00:00
|
|
|
// the TX_DATA_PATH_DELAY and CONTROL_PATH_DELAY are specificly defined
|
|
|
|
// for the axi_ad9361 core
|
|
|
|
|
|
|
|
ad_tdd_control #(
|
2016-07-28 10:29:09 +00:00
|
|
|
.TX_DATA_PATH_DELAY(),
|
2022-04-08 10:21:52 +00:00
|
|
|
.CONTROL_PATH_DELAY()
|
|
|
|
) i_tdd_control(
|
2015-05-11 09:09:09 +00:00
|
|
|
.clk(clk),
|
|
|
|
.rst(rst),
|
2015-11-11 09:06:19 +00:00
|
|
|
.tdd_enable(tdd_enable_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_secondary(tdd_secondary_s),
|
|
|
|
.tdd_counter_init(tdd_counter_init_s),
|
|
|
|
.tdd_frame_length(tdd_frame_length_s),
|
|
|
|
.tdd_burst_count(tdd_burst_count_s),
|
2015-06-04 13:46:28 +00:00
|
|
|
.tdd_rx_only(tdd_rx_only_s),
|
|
|
|
.tdd_tx_only(tdd_tx_only_s),
|
2015-11-11 09:06:19 +00:00
|
|
|
.tdd_sync (tdd_sync),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_vco_rx_on_1(tdd_vco_rx_on_1_s),
|
|
|
|
.tdd_vco_rx_off_1(tdd_vco_rx_off_1_s),
|
|
|
|
.tdd_vco_tx_on_1(tdd_vco_tx_on_1_s),
|
|
|
|
.tdd_vco_tx_off_1(tdd_vco_tx_off_1_s),
|
|
|
|
.tdd_rx_on_1(tdd_rx_on_1_s),
|
|
|
|
.tdd_rx_off_1(tdd_rx_off_1_s),
|
2016-07-28 10:29:09 +00:00
|
|
|
.tdd_rx_dp_on_1(tdd_rx_dp_on_1_s),
|
|
|
|
.tdd_rx_dp_off_1(tdd_rx_dp_off_1_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_tx_on_1(tdd_tx_on_1_s),
|
|
|
|
.tdd_tx_off_1(tdd_tx_off_1_s),
|
|
|
|
.tdd_tx_dp_on_1(tdd_tx_dp_on_1_s),
|
|
|
|
.tdd_tx_dp_off_1(tdd_tx_dp_off_1_s),
|
|
|
|
.tdd_vco_rx_on_2(tdd_vco_rx_on_2_s),
|
|
|
|
.tdd_vco_rx_off_2(tdd_vco_rx_off_2_s),
|
|
|
|
.tdd_vco_tx_on_2(tdd_vco_tx_on_2_s),
|
|
|
|
.tdd_vco_tx_off_2(tdd_vco_tx_off_2_s),
|
|
|
|
.tdd_rx_on_2(tdd_rx_on_2_s),
|
|
|
|
.tdd_rx_off_2(tdd_rx_off_2_s),
|
2016-07-28 10:29:09 +00:00
|
|
|
.tdd_rx_dp_on_2(tdd_rx_dp_on_2_s),
|
|
|
|
.tdd_rx_dp_off_2(tdd_rx_dp_off_2_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_tx_on_2(tdd_tx_on_2_s),
|
|
|
|
.tdd_tx_off_2(tdd_tx_off_2_s),
|
|
|
|
.tdd_tx_dp_on_2(tdd_tx_dp_on_2_s),
|
|
|
|
.tdd_tx_dp_off_2(tdd_tx_dp_off_2_s),
|
2016-07-28 10:29:09 +00:00
|
|
|
.tdd_rx_dp_en(tdd_rx_dp_en_s),
|
2015-06-08 13:21:40 +00:00
|
|
|
.tdd_tx_dp_en(tdd_tx_dp_en_s),
|
2015-05-11 09:09:09 +00:00
|
|
|
.tdd_rx_vco_en(tdd_rx_vco_en),
|
|
|
|
.tdd_tx_vco_en(tdd_tx_vco_en),
|
|
|
|
.tdd_rx_rf_en(tdd_rx_rf_en),
|
|
|
|
.tdd_tx_rf_en(tdd_tx_rf_en),
|
|
|
|
.tdd_counter_status(tdd_counter_status));
|
|
|
|
|
|
|
|
endmodule
|