2015-06-26 09:04:19 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2023-07-06 13:54:40 +00:00
|
|
|
// Copyright (C) 2014-2023 Analog Devices, Inc. All rights reserved.
|
2016-09-16 08:35:29 +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-16 08:35:29 +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-16 08:35:29 +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
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2016-09-15 17:33:55 +00:00
|
|
|
// serial data output interface: serdes(x8)
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
`timescale 1ps/1ps
|
|
|
|
|
2016-09-15 17:33:55 +00:00
|
|
|
module ad_serdes_out #(
|
2015-06-26 09:04:19 +00:00
|
|
|
|
2019-01-11 08:54:16 +00:00
|
|
|
parameter FPGA_TECHNOLOGY = 0,
|
2020-05-07 04:25:00 +00:00
|
|
|
parameter CMOS_LVDS_N = 0,
|
2016-09-15 17:33:55 +00:00
|
|
|
parameter DDR_OR_SDR_N = 1,
|
|
|
|
parameter SERDES_FACTOR = 8,
|
2022-04-08 10:21:52 +00:00
|
|
|
parameter DATA_WIDTH = 16
|
|
|
|
) (
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
// reset and clocks
|
|
|
|
|
2016-09-16 08:35:29 +00:00
|
|
|
input rst,
|
|
|
|
input clk,
|
|
|
|
input div_clk,
|
2015-06-26 09:04:19 +00:00
|
|
|
|
|
|
|
// data interface
|
2019-07-19 09:15:06 +00:00
|
|
|
input data_oe,
|
2019-07-12 07:42:11 +00:00
|
|
|
input [(DATA_WIDTH-1):0] data_s0, // 1st bit to be transmitted
|
2016-09-16 08:35:29 +00:00
|
|
|
input [(DATA_WIDTH-1):0] data_s1,
|
|
|
|
input [(DATA_WIDTH-1):0] data_s2,
|
|
|
|
input [(DATA_WIDTH-1):0] data_s3,
|
|
|
|
input [(DATA_WIDTH-1):0] data_s4,
|
|
|
|
input [(DATA_WIDTH-1):0] data_s5,
|
|
|
|
input [(DATA_WIDTH-1):0] data_s6,
|
2019-07-12 07:42:11 +00:00
|
|
|
input [(DATA_WIDTH-1):0] data_s7, // last bit to be transmitted
|
2017-03-29 07:25:54 +00:00
|
|
|
output [(DATA_WIDTH-1):0] data_out_se,
|
2016-09-16 08:35:29 +00:00
|
|
|
output [(DATA_WIDTH-1):0] data_out_p,
|
2022-04-08 10:21:52 +00:00
|
|
|
output [(DATA_WIDTH-1):0] data_out_n
|
|
|
|
);
|
2016-09-16 08:35:29 +00:00
|
|
|
|
2019-01-11 08:54:16 +00:00
|
|
|
localparam SEVEN_SERIES = 1;
|
|
|
|
localparam ULTRASCALE = 2;
|
|
|
|
localparam ULTRASCALE_PLUS = 3;
|
2017-03-29 07:25:54 +00:00
|
|
|
localparam DR_OQ_DDR = DDR_OR_SDR_N == 1'b1 ? "DDR": "SDR";
|
2015-06-26 09:04:19 +00:00
|
|
|
|
2019-07-12 07:42:11 +00:00
|
|
|
localparam SIM_DEVICE = FPGA_TECHNOLOGY == SEVEN_SERIES ? "7SERIES" :
|
|
|
|
FPGA_TECHNOLOGY == ULTRASCALE ? "ULTRASCALE" :
|
|
|
|
FPGA_TECHNOLOGY == ULTRASCALE_PLUS ? "ULTRASCALE_PLUS" :
|
|
|
|
"UNSUPPORTED";
|
|
|
|
|
2022-12-13 13:23:24 +00:00
|
|
|
// internal registers
|
2015-06-26 09:04:19 +00:00
|
|
|
|
2022-12-13 13:23:24 +00:00
|
|
|
reg [6:0] serdes_rst_seq;
|
2016-09-15 17:33:55 +00:00
|
|
|
|
2022-12-13 13:23:24 +00:00
|
|
|
// internal signals
|
|
|
|
|
|
|
|
wire [(DATA_WIDTH-1):0] data_out_s;
|
|
|
|
wire [(DATA_WIDTH-1):0] serdes_shift1_s;
|
|
|
|
wire [(DATA_WIDTH-1):0] serdes_shift2_s;
|
|
|
|
wire [(DATA_WIDTH-1):0] data_t;
|
|
|
|
wire buffer_disable;
|
|
|
|
wire serdes_rst = serdes_rst_seq[6];
|
2017-03-29 07:25:54 +00:00
|
|
|
|
2015-06-26 09:04:19 +00:00
|
|
|
// instantiations
|
|
|
|
|
2022-12-13 13:23:24 +00:00
|
|
|
assign data_out_se = data_out_s;
|
|
|
|
assign buffer_disable = ~data_oe;
|
2021-06-30 22:15:42 +00:00
|
|
|
|
2022-12-13 13:23:24 +00:00
|
|
|
always @ (posedge div_clk) begin
|
|
|
|
if (rst) begin
|
|
|
|
serdes_rst_seq [6:0] <= 7'b0001110;
|
|
|
|
end else begin
|
|
|
|
serdes_rst_seq [6:0] <= {serdes_rst_seq [5:0], 1'b0};
|
|
|
|
end
|
2021-06-30 22:15:42 +00:00
|
|
|
end
|
|
|
|
|
2022-10-05 08:11:57 +00:00
|
|
|
// transmit data path: oserdes -> obuf
|
|
|
|
|
2015-06-26 09:04:19 +00:00
|
|
|
genvar l_inst;
|
|
|
|
generate
|
2016-09-15 17:33:55 +00:00
|
|
|
for (l_inst = 0; l_inst <= (DATA_WIDTH-1); l_inst = l_inst + 1) begin: g_data
|
2015-06-26 09:04:19 +00:00
|
|
|
|
2022-10-05 08:11:57 +00:00
|
|
|
// oserdes
|
|
|
|
|
2019-01-11 08:54:16 +00:00
|
|
|
if (FPGA_TECHNOLOGY == SEVEN_SERIES) begin
|
2022-12-13 13:23:24 +00:00
|
|
|
OSERDESE2 #(
|
2017-03-29 07:25:54 +00:00
|
|
|
.DATA_RATE_OQ (DR_OQ_DDR),
|
2016-09-16 08:35:29 +00:00
|
|
|
.DATA_RATE_TQ ("SDR"),
|
2016-10-10 13:38:42 +00:00
|
|
|
.DATA_WIDTH (SERDES_FACTOR),
|
2016-09-16 08:35:29 +00:00
|
|
|
.TRISTATE_WIDTH (1),
|
2022-04-08 10:21:52 +00:00
|
|
|
.SERDES_MODE ("MASTER")
|
|
|
|
) i_serdes (
|
2016-09-16 08:35:29 +00:00
|
|
|
.D1 (data_s0[l_inst]),
|
|
|
|
.D2 (data_s1[l_inst]),
|
|
|
|
.D3 (data_s2[l_inst]),
|
|
|
|
.D4 (data_s3[l_inst]),
|
|
|
|
.D5 (data_s4[l_inst]),
|
|
|
|
.D6 (data_s5[l_inst]),
|
|
|
|
.D7 (data_s6[l_inst]),
|
|
|
|
.D8 (data_s7[l_inst]),
|
2019-07-19 09:15:06 +00:00
|
|
|
.T1 (buffer_disable),
|
|
|
|
.T2 (buffer_disable),
|
|
|
|
.T3 (buffer_disable),
|
|
|
|
.T4 (buffer_disable),
|
2016-09-16 08:35:29 +00:00
|
|
|
.SHIFTIN1 (1'b0),
|
|
|
|
.SHIFTIN2 (1'b0),
|
|
|
|
.SHIFTOUT1 (),
|
|
|
|
.SHIFTOUT2 (),
|
|
|
|
.OCE (1'b1),
|
|
|
|
.CLK (clk),
|
|
|
|
.CLKDIV (div_clk),
|
|
|
|
.OQ (data_out_s[l_inst]),
|
2019-07-19 09:15:06 +00:00
|
|
|
.TQ (data_t[l_inst]),
|
2016-09-16 08:35:29 +00:00
|
|
|
.OFB (),
|
|
|
|
.TFB (),
|
|
|
|
.TBYTEIN (1'b0),
|
|
|
|
.TBYTEOUT (),
|
2019-07-19 09:15:06 +00:00
|
|
|
.TCE (1'b1),
|
2021-06-30 22:15:42 +00:00
|
|
|
.RST (serdes_rst));
|
2016-09-16 08:35:29 +00:00
|
|
|
end
|
|
|
|
|
2019-07-12 07:42:11 +00:00
|
|
|
if (FPGA_TECHNOLOGY == ULTRASCALE || FPGA_TECHNOLOGY == ULTRASCALE_PLUS) begin
|
2022-12-13 13:23:24 +00:00
|
|
|
OSERDESE3 #(
|
2019-07-12 07:42:11 +00:00
|
|
|
.DATA_WIDTH (SERDES_FACTOR),
|
2022-04-08 10:21:52 +00:00
|
|
|
.SIM_DEVICE (SIM_DEVICE)
|
|
|
|
) i_serdes (
|
2019-07-12 07:42:11 +00:00
|
|
|
.D ({data_s7[l_inst],
|
|
|
|
data_s6[l_inst],
|
|
|
|
data_s5[l_inst],
|
|
|
|
data_s4[l_inst],
|
|
|
|
data_s3[l_inst],
|
|
|
|
data_s2[l_inst],
|
|
|
|
data_s1[l_inst],
|
|
|
|
data_s0[l_inst]}),
|
2019-07-19 09:15:06 +00:00
|
|
|
.T (buffer_disable),
|
2019-07-12 07:42:11 +00:00
|
|
|
.CLK (clk),
|
|
|
|
.CLKDIV (div_clk),
|
|
|
|
.OQ (data_out_s[l_inst]),
|
2019-07-19 09:15:06 +00:00
|
|
|
.T_OUT (data_t[l_inst]),
|
2021-06-30 22:15:42 +00:00
|
|
|
.RST (serdes_rst));
|
2019-07-12 07:42:11 +00:00
|
|
|
end
|
|
|
|
|
2022-10-05 08:11:57 +00:00
|
|
|
// obuf
|
2020-05-07 04:25:00 +00:00
|
|
|
|
2022-10-05 08:11:57 +00:00
|
|
|
if (CMOS_LVDS_N == 0) begin
|
|
|
|
OBUFTDS i_obuftds (
|
2020-05-07 04:25:00 +00:00
|
|
|
.T (data_t[l_inst]),
|
|
|
|
.I (data_out_s[l_inst]),
|
|
|
|
.O (data_out_p[l_inst]),
|
|
|
|
.OB (data_out_n[l_inst]));
|
|
|
|
end else begin
|
|
|
|
OBUFT i_obuf (
|
|
|
|
.T (data_t[l_inst]),
|
|
|
|
.I (data_out_s[l_inst]),
|
|
|
|
.O (data_out_p[l_inst]));
|
|
|
|
end
|
2015-06-26 09:04:19 +00:00
|
|
|
end
|
|
|
|
endgenerate
|
|
|
|
endmodule
|