2020-06-02 16:56:17 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2023-07-06 13:54:40 +00:00
|
|
|
// Copyright (C) 2020-2023 Analog Devices, Inc. All rights reserved.
|
2020-06-02 16:56:17 +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
|
|
|
|
// freedoms and responsibilities that he or she has by using this source/core.
|
|
|
|
//
|
|
|
|
// This core is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// 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:
|
|
|
|
//
|
|
|
|
// 1. The GNU General Public License version 2 as published by the
|
|
|
|
// 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>
|
|
|
|
//
|
|
|
|
// OR
|
|
|
|
//
|
|
|
|
// 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:
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
|
|
|
|
`timescale 1ns/100ps
|
|
|
|
|
|
|
|
module system_top (
|
|
|
|
|
|
|
|
input [12:0] gpio_bd_i,
|
|
|
|
output [ 7:0] gpio_bd_o,
|
|
|
|
|
|
|
|
inout iic_scl,
|
|
|
|
inout iic_sda,
|
|
|
|
|
|
|
|
output spi_clk,
|
|
|
|
output spi_dio,
|
|
|
|
input spi_do,
|
|
|
|
output spi_en,
|
|
|
|
|
|
|
|
// Device clock
|
|
|
|
input fpga_ref_clk_n,
|
|
|
|
input fpga_ref_clk_p,
|
|
|
|
// Device clock passed through 9001
|
2020-08-25 07:17:35 +00:00
|
|
|
input dev_clk_in,
|
2020-06-02 16:56:17 +00:00
|
|
|
|
|
|
|
input fpga_mcs_in_n,
|
|
|
|
input fpga_mcs_in_p,
|
2020-08-25 07:17:35 +00:00
|
|
|
output dev_mcs_fpga_out_n,
|
|
|
|
output dev_mcs_fpga_out_p,
|
2020-06-02 16:56:17 +00:00
|
|
|
|
|
|
|
inout dgpio_0,
|
|
|
|
inout dgpio_1,
|
|
|
|
inout dgpio_2,
|
|
|
|
inout dgpio_3,
|
|
|
|
inout dgpio_4,
|
|
|
|
inout dgpio_5,
|
|
|
|
inout dgpio_6,
|
|
|
|
inout dgpio_7,
|
|
|
|
inout dgpio_8,
|
|
|
|
inout dgpio_9,
|
|
|
|
inout dgpio_10,
|
|
|
|
inout dgpio_11,
|
|
|
|
|
|
|
|
inout gp_int,
|
|
|
|
inout mode,
|
|
|
|
inout reset_trx,
|
|
|
|
|
2020-08-25 07:17:35 +00:00
|
|
|
input rx1_dclk_in_n,
|
|
|
|
input rx1_dclk_in_p,
|
2020-08-24 10:35:44 +00:00
|
|
|
output rx1_enable,
|
2020-08-25 07:17:35 +00:00
|
|
|
input rx1_idata_in_n,
|
|
|
|
input rx1_idata_in_p,
|
|
|
|
input rx1_qdata_in_n,
|
|
|
|
input rx1_qdata_in_p,
|
|
|
|
input rx1_strobe_in_n,
|
|
|
|
input rx1_strobe_in_p,
|
|
|
|
|
|
|
|
input rx2_dclk_in_n,
|
|
|
|
input rx2_dclk_in_p,
|
2020-08-24 10:35:44 +00:00
|
|
|
output rx2_enable,
|
2020-08-25 07:17:35 +00:00
|
|
|
input rx2_idata_in_n,
|
|
|
|
input rx2_idata_in_p,
|
|
|
|
input rx2_qdata_in_n,
|
|
|
|
input rx2_qdata_in_p,
|
|
|
|
input rx2_strobe_in_n,
|
|
|
|
input rx2_strobe_in_p,
|
|
|
|
|
|
|
|
output tx1_dclk_out_n,
|
|
|
|
output tx1_dclk_out_p,
|
|
|
|
input tx1_dclk_in_n,
|
|
|
|
input tx1_dclk_in_p,
|
2020-08-24 10:35:44 +00:00
|
|
|
output tx1_enable,
|
2020-08-25 07:17:35 +00:00
|
|
|
output tx1_idata_out_n,
|
|
|
|
output tx1_idata_out_p,
|
|
|
|
output tx1_qdata_out_n,
|
|
|
|
output tx1_qdata_out_p,
|
|
|
|
output tx1_strobe_out_n,
|
|
|
|
output tx1_strobe_out_p,
|
|
|
|
|
|
|
|
output tx2_dclk_out_n,
|
|
|
|
output tx2_dclk_out_p,
|
|
|
|
input tx2_dclk_in_n,
|
|
|
|
input tx2_dclk_in_p,
|
2020-08-24 10:35:44 +00:00
|
|
|
output tx2_enable,
|
2020-08-25 07:17:35 +00:00
|
|
|
output tx2_idata_out_n,
|
|
|
|
output tx2_idata_out_p,
|
|
|
|
output tx2_qdata_out_n,
|
|
|
|
output tx2_qdata_out_p,
|
|
|
|
output tx2_strobe_out_n,
|
|
|
|
output tx2_strobe_out_p,
|
2020-06-02 16:56:17 +00:00
|
|
|
|
|
|
|
inout sm_fan_tach,
|
2020-08-26 14:17:55 +00:00
|
|
|
input vadj_err,
|
2020-09-11 12:14:33 +00:00
|
|
|
output platform_status,
|
|
|
|
|
2020-06-19 07:52:10 +00:00
|
|
|
inout tdd_sync,
|
|
|
|
|
|
|
|
//debug hdr
|
|
|
|
output [9:0] proto_hdr
|
2020-06-02 16:56:17 +00:00
|
|
|
);
|
2022-04-14 13:13:22 +00:00
|
|
|
|
2020-06-02 16:56:17 +00:00
|
|
|
// internal registers
|
|
|
|
reg [ 2:0] mcs_sync_m = 'd0;
|
|
|
|
reg dev_mcs_fpga_in = 1'b0;
|
|
|
|
|
|
|
|
// internal signals
|
|
|
|
wire [94:0] gpio_i;
|
|
|
|
wire [94:0] gpio_o;
|
|
|
|
wire [94:0] gpio_t;
|
2020-08-24 10:35:44 +00:00
|
|
|
wire gpio_rx1_enable_in;
|
|
|
|
wire gpio_rx2_enable_in;
|
|
|
|
wire gpio_tx1_enable_in;
|
|
|
|
wire gpio_tx2_enable_in;
|
2020-06-02 16:56:17 +00:00
|
|
|
wire [ 2:0] spi_csn;
|
|
|
|
|
|
|
|
wire fpga_ref_clk;
|
|
|
|
wire fpga_mcs_in;
|
2020-09-11 12:14:33 +00:00
|
|
|
wire tdd_sync_loc;
|
|
|
|
wire tdd_sync_i;
|
|
|
|
wire tdd_sync_cntr;
|
2020-06-02 16:56:17 +00:00
|
|
|
|
|
|
|
// instantiations
|
|
|
|
|
|
|
|
IBUFDS i_ibufgs_fpga_ref_clk (
|
|
|
|
.I (fpga_ref_clk_p),
|
|
|
|
.IB (fpga_ref_clk_n),
|
|
|
|
.O (fpga_ref_clk));
|
|
|
|
|
|
|
|
IBUFDS i_ibufgs_fpga_mcs_in (
|
|
|
|
.I (fpga_mcs_in_p),
|
|
|
|
.IB (fpga_mcs_in_n),
|
|
|
|
.O (fpga_mcs_in));
|
|
|
|
|
|
|
|
OBUFDS i_obufds_dev_mcs_fpga_in (
|
|
|
|
.I (dev_mcs_fpga_in),
|
2020-08-25 07:17:35 +00:00
|
|
|
.O (dev_mcs_fpga_out_p),
|
|
|
|
.OB (dev_mcs_fpga_out_n));
|
2020-06-02 16:56:17 +00:00
|
|
|
|
|
|
|
// multi-chip synchronization
|
|
|
|
//
|
|
|
|
always @(posedge fpga_ref_clk) begin
|
|
|
|
mcs_sync_m <= {mcs_sync_m[1:0], gpio_o[53]};
|
|
|
|
dev_mcs_fpga_in <= mcs_sync_m[2] & ~mcs_sync_m[1];
|
|
|
|
end
|
|
|
|
|
|
|
|
// multi-ssi synchronization
|
|
|
|
//
|
|
|
|
assign mssi_sync = gpio_o[54];
|
|
|
|
|
2020-08-26 14:17:55 +00:00
|
|
|
assign platform_status = vadj_err;
|
2020-06-02 16:56:17 +00:00
|
|
|
|
2022-04-14 13:13:22 +00:00
|
|
|
ad_iobuf #(
|
|
|
|
.DATA_WIDTH(16)
|
|
|
|
) i_iobuf (
|
2020-08-24 10:35:44 +00:00
|
|
|
.dio_t ({gpio_t[47:32]}),
|
|
|
|
.dio_i ({gpio_o[47:32]}),
|
|
|
|
.dio_o ({gpio_i[47:32]}),
|
2020-09-11 12:14:33 +00:00
|
|
|
.dio_p ({sm_fan_tach, // 47
|
2020-08-24 10:35:44 +00:00
|
|
|
reset_trx, // 46
|
|
|
|
mode, // 45
|
|
|
|
gp_int, // 44
|
|
|
|
dgpio_11, // 43
|
|
|
|
dgpio_10, // 42
|
|
|
|
dgpio_9, // 41
|
|
|
|
dgpio_8, // 40
|
|
|
|
dgpio_7, // 39
|
|
|
|
dgpio_6, // 38
|
|
|
|
dgpio_5, // 37
|
|
|
|
dgpio_4, // 36
|
|
|
|
dgpio_3, // 35
|
|
|
|
dgpio_2, // 34
|
|
|
|
dgpio_1, // 33
|
2020-06-02 16:56:17 +00:00
|
|
|
dgpio_0 })); // 32
|
|
|
|
|
2020-08-24 10:35:44 +00:00
|
|
|
assign gpio_rx1_enable_in = gpio_o[48];
|
|
|
|
assign gpio_rx2_enable_in = gpio_o[49];
|
|
|
|
assign gpio_tx1_enable_in = gpio_o[50];
|
|
|
|
assign gpio_tx2_enable_in = gpio_o[51];
|
|
|
|
|
2020-06-02 16:56:17 +00:00
|
|
|
assign gpio_i[ 7: 0] = gpio_o[ 7: 0];
|
|
|
|
assign gpio_i[20: 8] = gpio_bd_i;
|
|
|
|
assign gpio_bd_o = gpio_o[ 7: 0];
|
|
|
|
|
2020-08-24 10:35:44 +00:00
|
|
|
assign gpio_i[54:48] = gpio_o[54:48];
|
2020-08-26 14:17:55 +00:00
|
|
|
assign gpio_i[55] = vadj_err;
|
|
|
|
assign gpio_i[94:56] = gpio_o[94:56];
|
2020-06-02 16:56:17 +00:00
|
|
|
assign gpio_i[31:21] = gpio_o[31:21];
|
|
|
|
|
|
|
|
assign spi_en = spi_csn[0];
|
|
|
|
|
2020-09-11 12:14:33 +00:00
|
|
|
assign tdd_sync_loc = gpio_o[56];
|
|
|
|
|
|
|
|
// tdd_sync_loc - local sync signal from a GPIO or other source
|
2022-04-14 13:13:22 +00:00
|
|
|
// tdd_sync - external sync
|
2020-09-11 12:14:33 +00:00
|
|
|
|
|
|
|
assign tdd_sync_i = tdd_sync_cntr ? tdd_sync_loc : tdd_sync;
|
|
|
|
assign tdd_sync = tdd_sync_cntr ? tdd_sync_loc : 1'bz;
|
|
|
|
|
2020-06-02 16:56:17 +00:00
|
|
|
system_wrapper i_system_wrapper (
|
|
|
|
.ref_clk (fpga_ref_clk),
|
|
|
|
.mssi_sync (mssi_sync),
|
|
|
|
|
|
|
|
.tx_output_enable (1'b1),
|
|
|
|
|
2020-08-25 07:17:35 +00:00
|
|
|
.rx1_dclk_in_n (rx1_dclk_in_n),
|
|
|
|
.rx1_dclk_in_p (rx1_dclk_in_p),
|
|
|
|
.rx1_idata_in_n (rx1_idata_in_n),
|
|
|
|
.rx1_idata_in_p (rx1_idata_in_p),
|
|
|
|
.rx1_qdata_in_n (rx1_qdata_in_n),
|
|
|
|
.rx1_qdata_in_p (rx1_qdata_in_p),
|
|
|
|
.rx1_strobe_in_n (rx1_strobe_in_n),
|
|
|
|
.rx1_strobe_in_p (rx1_strobe_in_p),
|
|
|
|
|
|
|
|
.rx2_dclk_in_n (rx2_dclk_in_n),
|
|
|
|
.rx2_dclk_in_p (rx2_dclk_in_p),
|
|
|
|
.rx2_idata_in_n (rx2_idata_in_n),
|
|
|
|
.rx2_idata_in_p (rx2_idata_in_p),
|
|
|
|
.rx2_qdata_in_n (rx2_qdata_in_n),
|
|
|
|
.rx2_qdata_in_p (rx2_qdata_in_p),
|
|
|
|
.rx2_strobe_in_n (rx2_strobe_in_n),
|
|
|
|
.rx2_strobe_in_p (rx2_strobe_in_p),
|
|
|
|
|
|
|
|
.tx1_dclk_out_n (tx1_dclk_out_n),
|
|
|
|
.tx1_dclk_out_p (tx1_dclk_out_p),
|
|
|
|
.tx1_dclk_in_n (tx1_dclk_in_n),
|
|
|
|
.tx1_dclk_in_p (tx1_dclk_in_p),
|
|
|
|
.tx1_idata_out_n (tx1_idata_out_n),
|
|
|
|
.tx1_idata_out_p (tx1_idata_out_p),
|
|
|
|
.tx1_qdata_out_n (tx1_qdata_out_n),
|
|
|
|
.tx1_qdata_out_p (tx1_qdata_out_p),
|
|
|
|
.tx1_strobe_out_n (tx1_strobe_out_n),
|
|
|
|
.tx1_strobe_out_p (tx1_strobe_out_p),
|
|
|
|
|
|
|
|
.tx2_dclk_out_n (tx2_dclk_out_n),
|
|
|
|
.tx2_dclk_out_p (tx2_dclk_out_p),
|
|
|
|
.tx2_dclk_in_n (tx2_dclk_in_n),
|
|
|
|
.tx2_dclk_in_p (tx2_dclk_in_p),
|
|
|
|
.tx2_idata_out_n (tx2_idata_out_n),
|
|
|
|
.tx2_idata_out_p (tx2_idata_out_p),
|
|
|
|
.tx2_qdata_out_n (tx2_qdata_out_n),
|
|
|
|
.tx2_qdata_out_p (tx2_qdata_out_p),
|
|
|
|
.tx2_strobe_out_n (tx2_strobe_out_n),
|
|
|
|
.tx2_strobe_out_p (tx2_strobe_out_p),
|
2020-06-02 16:56:17 +00:00
|
|
|
|
2020-08-24 10:35:44 +00:00
|
|
|
.rx1_enable (rx1_enable),
|
|
|
|
.rx2_enable (rx2_enable),
|
|
|
|
.tx1_enable (tx1_enable),
|
|
|
|
.tx2_enable (tx2_enable),
|
|
|
|
|
|
|
|
.gpio_rx1_enable_in (gpio_rx1_enable_in),
|
|
|
|
.gpio_rx2_enable_in (gpio_rx2_enable_in),
|
|
|
|
.gpio_tx1_enable_in (gpio_tx1_enable_in),
|
|
|
|
.gpio_tx2_enable_in (gpio_tx2_enable_in),
|
|
|
|
|
2020-09-11 12:14:33 +00:00
|
|
|
.tdd_sync (tdd_sync_i),
|
|
|
|
.tdd_sync_cntr (tdd_sync_cntr),
|
|
|
|
|
2020-06-02 16:56:17 +00:00
|
|
|
.gpio_i (gpio_i),
|
|
|
|
.gpio_o (gpio_o),
|
|
|
|
.gpio_t (gpio_t),
|
|
|
|
.spi0_sclk (spi_clk),
|
|
|
|
.spi0_csn (spi_csn),
|
|
|
|
.spi0_miso (spi_do),
|
|
|
|
.spi0_mosi (spi_dio),
|
|
|
|
.spi1_sclk (),
|
|
|
|
.spi1_csn (),
|
|
|
|
.spi1_miso (1'b0),
|
2020-06-19 07:52:10 +00:00
|
|
|
.spi1_mosi (),
|
|
|
|
|
|
|
|
// debug
|
|
|
|
.adc1_div_clk (proto_hdr[0]),
|
|
|
|
.adc2_div_clk (proto_hdr[1]),
|
|
|
|
.dac1_div_clk (proto_hdr[2]),
|
2022-04-14 13:13:22 +00:00
|
|
|
.dac2_div_clk (proto_hdr[3]));
|
2020-06-19 07:52:10 +00:00
|
|
|
|
|
|
|
assign proto_hdr[9:4] = {'b0};
|
|
|
|
|
2020-06-02 16:56:17 +00:00
|
|
|
endmodule
|