2015-05-11 09:09:09 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2023-07-06 13:54:40 +00:00
|
|
|
// Copyright (C) 2014-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
|
|
|
|
|
2022-04-08 10:21:52 +00:00
|
|
|
module axi_ad9361_tdd_if #(
|
|
|
|
parameter LEVEL_OR_PULSE_N = 0
|
|
|
|
) (
|
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
|
|
|
input tdd_rx_vco_en,
|
|
|
|
input tdd_tx_vco_en,
|
|
|
|
input tdd_rx_rf_en,
|
|
|
|
input tdd_tx_rf_en,
|
2015-05-11 09:09:09 +00:00
|
|
|
|
|
|
|
// device interface
|
|
|
|
|
2017-04-13 08:45:54 +00:00
|
|
|
output ad9361_txnrx,
|
|
|
|
output ad9361_enable,
|
2015-05-11 09:09:09 +00:00
|
|
|
|
|
|
|
// interface status
|
|
|
|
|
2022-04-08 10:21:52 +00:00
|
|
|
output [ 7:0] ad9361_tdd_status
|
|
|
|
);
|
2015-05-11 09:09:09 +00:00
|
|
|
|
|
|
|
localparam PULSE_MODE = 0;
|
|
|
|
localparam LEVEL_MODE = 1;
|
|
|
|
|
|
|
|
// internal registers
|
|
|
|
|
|
|
|
reg tdd_vco_overlap = 1'b0;
|
|
|
|
reg tdd_rf_overlap = 1'b0;
|
|
|
|
|
|
|
|
wire ad9361_txnrx_s;
|
|
|
|
wire ad9361_enable_s;
|
|
|
|
|
|
|
|
// just one VCO can be enabled at a time
|
2015-05-21 10:39:48 +00:00
|
|
|
assign ad9361_txnrx_s = tdd_tx_vco_en & ~tdd_rx_vco_en;
|
2015-05-11 09:09:09 +00:00
|
|
|
|
2018-03-05 09:20:20 +00:00
|
|
|
generate
|
|
|
|
if (LEVEL_OR_PULSE_N == PULSE_MODE) begin
|
|
|
|
reg tdd_rx_rf_en_d = 1'b0;
|
|
|
|
reg tdd_tx_rf_en_d = 1'b0;
|
|
|
|
always @(posedge clk) begin
|
|
|
|
tdd_rx_rf_en_d <= tdd_rx_rf_en;
|
|
|
|
tdd_tx_rf_en_d <= tdd_tx_rf_en;
|
|
|
|
end
|
|
|
|
assign ad9361_enable_s = (tdd_rx_rf_en_d ^ tdd_rx_rf_en) ||
|
|
|
|
(tdd_tx_rf_en_d ^ tdd_tx_rf_en);
|
|
|
|
end else
|
|
|
|
assign ad9361_enable_s = (tdd_rx_rf_en | tdd_tx_rf_en);
|
|
|
|
endgenerate
|
2015-05-11 09:09:09 +00:00
|
|
|
|
|
|
|
always @(posedge clk) begin
|
2022-04-08 10:21:52 +00:00
|
|
|
if (rst == 1'b1) begin
|
2015-05-11 09:09:09 +00:00
|
|
|
tdd_vco_overlap <= 1'b0;
|
|
|
|
tdd_rf_overlap <= 1'b0;
|
|
|
|
end else begin
|
|
|
|
tdd_vco_overlap <= tdd_rx_vco_en & tdd_tx_vco_en;
|
|
|
|
tdd_rf_overlap <= tdd_rx_rf_en & tdd_tx_rf_en;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
assign ad9361_tdd_status = {6'b0, tdd_rf_overlap, tdd_vco_overlap};
|
|
|
|
|
|
|
|
assign ad9361_txnrx = ad9361_txnrx_s;
|
|
|
|
assign ad9361_enable = ad9361_enable_s;
|
|
|
|
|
|
|
|
endmodule
|