Skip to content
Snippets Groups Projects
Commit 6585b386 authored by BRONES Romain's avatar BRONES Romain
Browse files

Add Reset Helper to handle the reset sequence

parent 4edf8968
Branches
Tags
No related merge requests found
...@@ -14,9 +14,11 @@ hdlpkgsrc := ...@@ -14,9 +14,11 @@ hdlpkgsrc :=
rdlsrc := $(shell ls rdl/*.rdl) rdlsrc := $(shell ls rdl/*.rdl)
rdltarget := $(rdlsrc:rdl/%.rdl=hdl/%.vhd) rdltarget := $(rdlsrc:rdl/%.rdl=hdl/%.vhd)
hdlsrc := $(shell ls hdl/*.vhd) $(rdltarget) $(hdlpkgsrc) hdlsrc := $(shell ls hdl/*.vhd) $(rdltarget) $(hdlpkgsrc)
vlogsrc := $(shell ls hdl/*.v)
# TODO: depends on the configuration # TODO: depends on the configuration
tcl/sources.tcl: tcl/sources.tcl:
echo read_vhdl {$(hdlsrc)} > $@ echo read_vhdl {$(hdlsrc)} > $@
echo read_verilog {$(vlogsrc)} >> $@
############################################################################### ###############################################################################
# Compute interface from rdl files # Compute interface from rdl files
......
// ------------------------------------------------------------------------------
// (c) Copyright 2020-2021 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant any
// rights to the materials distributed herewith. Except as
// otherwise provided in a valid license issued to you by
// Xilinx, and to the maximum extent permitted by applicable
// law: (1) THESE MATERIALS ARE MADE AVAILABLE \"AS IS\" AND
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
// (2) Xilinx shall not be liable (whether in contract or tort,
// including negligence, or under any other theory of
// liability) for any loss or damage of any kind or nature
// related to, arising under or in connection with these
// materials, including for any direct, or any indirect,
// special, incidental, or consequential loss or damage
// (including loss of data, profits, goodwill, or any type of
// loss or damage suffered as a result of any action brought
// by a third party) even if such damage or loss was
// reasonably foreseeable or Xilinx had been advised of the
// possibility of the same.
//
// CRITICAL APPLICATIONS
// Xilinx products are not designed or intended to be fail-
// safe, or for use in any application requiring fail-safe
// performance, such as life-support or safety devices or
// systems, Class III medical devices, nuclear facilities,
// applications related to the deployment of airbags, or any
// other applications that could lead to death, personal
// injury, or severe property or environmental damage
// (individually and collectively, \"Critical
// Applications\"). Customer assumes the sole risk and
// liability of any use of Xilinx products in Critical
// Applications, subject only to applicable laws and
// regulations governing limitations on product liability.
//
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
// PART OF THIS FILE AT ALL TIMES.
//
//
//
// Owner:
// Revision: $Id: $
// $Author: $
// $DateTime: $
// $Change: $
// Description:
//
//
////------------------------------------------------------------------------------
`timescale 1ps / 1ps
(* DowngradeIPIdentifiedWarnings="yes" *)
module comcellnode_ethernet_reset_wrapper
(
input wire sys_reset,
input wire dclk,
input wire s_axi_aclk,
input wire ctl_gt_reset_all,
input wire ctl_gt_tx_reset,
input wire ctl_gt_rx_reset,
input wire gtwiz_reset_tx_datapath,
input wire gtwiz_reset_rx_datapath,
input wire gt_txusrclk2,
input wire gt_rxusrclk2,
input wire rx_core_clk,
input wire gt_tx_reset_in,
input wire gt_rx_reset_in,
input wire tx_core_reset_in,
input wire rx_core_reset_in,
output wire tx_core_reset_out,
output wire rx_core_reset_out,
output wire rx_serdes_reset_out,
output wire usr_tx_reset,
output wire usr_rx_reset,
output wire gtwiz_reset_all,
output wire gtwiz_reset_tx_datapath_out,
output wire gtwiz_reset_rx_datapath_out
);
wire gt_tx_reset_in_sync;
wire gt_tx_reset_in_sync_inv;
wire tx_reset_done_async;
wire gt_rx_reset_in_sync;
wire gt_rx_reset_in_sync_inv;
wire rx_reset_done_async;
wire rx_serdes_reset_done;
reg rx_reset_done_async_r;
wire rx_reset_done;
reg ctl_gt_reset_all_r;
wire ctl_gt_reset_all_sync;
always @( posedge s_axi_aclk)
begin
ctl_gt_reset_all_r <= ctl_gt_reset_all;
end
comcellnode_ethernet_reset_wrapper_cdc_sync i_comcellnode_ethernet_core_cdc_sync_axi_gt_resetall
(
.clk (dclk),
.signal_in (ctl_gt_reset_all_r),
.signal_out (ctl_gt_reset_all_sync)
);
reg ctl_gt_tx_reset_r;
wire ctl_gt_tx_reset_sync;
always @( posedge s_axi_aclk)
begin
ctl_gt_tx_reset_r <= ctl_gt_tx_reset;
end
comcellnode_ethernet_reset_wrapper_cdc_sync i_comcellnode_ethernet_core_cdc_sync_axi_ctl_gt_tx_reset
(
.clk (dclk),
.signal_in (ctl_gt_tx_reset_r),
.signal_out (ctl_gt_tx_reset_sync)
);
reg ctl_gt_rx_reset_r;
wire ctl_gt_rx_reset_sync;
always @( posedge s_axi_aclk)
begin
ctl_gt_rx_reset_r <= ctl_gt_rx_reset;
end
comcellnode_ethernet_reset_wrapper_cdc_sync i_comcellnode_ethernet_core_cdc_sync_axi_ctl_gt_rx_reset
(
.clk (dclk),
.signal_in (ctl_gt_rx_reset_r),
.signal_out (ctl_gt_rx_reset_sync)
);
assign gtwiz_reset_tx_datapath_out = gtwiz_reset_tx_datapath | ctl_gt_tx_reset_sync;
assign gtwiz_reset_rx_datapath_out = gtwiz_reset_rx_datapath | ctl_gt_rx_reset_sync;
assign gtwiz_reset_all = sys_reset | ctl_gt_reset_all_sync;
comcellnode_ethernet_reset_wrapper_cdc_sync i_comcellnode_ethernet_cdc_sync_gt_tx_resetdone
(
.clk (gt_txusrclk2),
.signal_in (gt_tx_reset_in),
.signal_out (gt_tx_reset_in_sync)
);
assign gt_tx_reset_in_sync_inv = ~(gt_tx_reset_in_sync);
assign tx_reset_done_async = gt_tx_reset_in_sync_inv | tx_core_reset_in;
assign usr_tx_reset = tx_reset_done_async;
assign tx_core_reset_out = tx_reset_done_async;
comcellnode_ethernet_reset_wrapper_cdc_sync i_comcellnode_ethernet_cdc_sync_gt_rx_resetdone
(
.clk (gt_txusrclk2),
.signal_in (gt_rx_reset_in),
.signal_out (gt_rx_reset_in_sync)
);
assign gt_rx_reset_in_sync_inv = ~(gt_rx_reset_in_sync);
assign rx_reset_done_async = gt_rx_reset_in_sync_inv | rx_core_reset_in;
always @( posedge gt_txusrclk2)
begin
rx_reset_done_async_r <= rx_reset_done_async;
end
comcellnode_ethernet_reset_wrapper_cdc_sync i_comcellnode_ethernet_cdc_sync_gt_rx_serdes_resetdone
(
.clk (gt_rxusrclk2),
.signal_in (rx_reset_done_async_r),
.signal_out (rx_serdes_reset_done)
);
comcellnode_ethernet_reset_wrapper_cdc_sync i_comcellnode_ethernet_cdc_sync_gt_rx_resetdone_rx_core_clk
(
.clk (rx_core_clk),
.signal_in (rx_reset_done_async_r),
.signal_out (rx_reset_done)
);
assign rx_serdes_reset_out = rx_serdes_reset_done;
assign rx_core_reset_out = rx_reset_done;
assign usr_rx_reset = rx_reset_done;
endmodule
(* DowngradeIPIdentifiedWarnings="yes" *)
module comcellnode_ethernet_reset_wrapper_cdc_sync (
input clk,
input signal_in,
output wire signal_out
);
wire sig_in_cdc_from ;
(* ASYNC_REG = "TRUE" *) reg s_out_d2_cdc_to;
(* ASYNC_REG = "TRUE" *) reg s_out_d3;
(* ASYNC_REG = "TRUE" *) reg s_out_d4;
// synthesis translate_off
initial s_out_d2_cdc_to = 1'b0;
initial s_out_d3 = 1'b0;
initial s_out_d4 = 1'b0;
// synthesis translate_on
assign sig_in_cdc_from = signal_in;
assign signal_out = s_out_d4;
always @(posedge clk)
begin
s_out_d2_cdc_to <= sig_in_cdc_from;
s_out_d3 <= s_out_d2_cdc_to;
s_out_d4 <= s_out_d3;
end
endmodule
...@@ -13,6 +13,13 @@ entity top_comcellnode is ...@@ -13,6 +13,13 @@ entity top_comcellnode is
qpll0lock_in : in std_logic; qpll0lock_in : in std_logic;
qpll0reset_out : out std_logic; qpll0reset_out : out std_logic;
tx_clk_rst : in std_logic;
rx_clk_rst : in std_logic;
tx_data_rst : in std_logic;
rx_data_rst : in std_logic;
tx_rst : in std_logic;
rx_rst : in std_logic;
-- SFP signals -- SFP signals
sfp_rxn : in std_logic; sfp_rxn : in std_logic;
sfp_rxp : in std_logic; sfp_rxp : in std_logic;
...@@ -30,6 +37,7 @@ entity top_comcellnode is ...@@ -30,6 +37,7 @@ entity top_comcellnode is
cdr_stable : out std_logic; cdr_stable : out std_logic;
rx_los : out std_logic; rx_los : out std_logic;
mod_abs : out std_logic; mod_abs : out std_logic;
tx_fault : out std_logic;
-- AXIS -- AXIS
rx_axis_tvalid : OUT STD_LOGIC; rx_axis_tvalid : OUT STD_LOGIC;
...@@ -284,22 +292,33 @@ architecture struct of top_comcellnode is ...@@ -284,22 +292,33 @@ architecture struct of top_comcellnode is
------------------------ ------------------------
-- SIGNAL DECLARATION -- -- SIGNAL DECLARATION --
------------------------ ------------------------
signal rst : std_logic;
signal rxgearboxslip : std_logic; signal rxgearboxslip : std_logic;
signal rxdatavalid : std_logic_vector(1 downto 0); signal rxdatavalid : std_logic_vector(1 downto 0);
signal rxheader : std_logic_vector(5 downto 0); signal rxheader : std_logic_vector(5 downto 0);
signal txheader : std_logic_vector(5 downto 0); signal txheader : std_logic_vector(5 downto 0);
signal rxheadervalid : std_logic_vector(1 downto 0); signal rxheadervalid : std_logic_vector(1 downto 0);
signal gt_rst_all : std_logic; signal gt_rst_all : std_logic;
signal gt_rst_tx : std_logic; signal gt_rst_tx : std_logic;
signal gt_rst_rx : std_logic; signal gt_rst_rx : std_logic;
signal gtwiz_reset_all : std_logic;
signal rx_serdes_rst : std_logic;
signal gtwiz_rst_tx_datapath : std_logic;
signal gtwiz_rst_rx_datapath : std_logic;
signal gtwiz_tx_rst_done : std_logic;
signal gtwiz_rx_rst_done : std_logic;
signal rx_rst_core : std_logic;
signal tx_rst_core : std_logic;
signal rxusrclk2 : std_logic; signal rxusrclk2 : std_logic;
signal main_clk : std_logic; signal main_clk : std_logic;
signal txdata : std_logic_vector(127 downto 0); signal txdata : std_logic_vector(127 downto 0);
signal rxdata : std_logic_vector(127 downto 0); signal rxdata : std_logic_vector(127 downto 0);
signal rxrstdone : std_logic;
signal txrstdone : std_logic;
signal rxrstdone_n : std_logic;
signal txrstdone_n : std_logic;
signal gtloopback : std_logic; signal gtloopback : std_logic;
signal txunderflow : std_logic; signal txunderflow : std_logic;
...@@ -307,24 +326,26 @@ architecture struct of top_comcellnode is ...@@ -307,24 +326,26 @@ architecture struct of top_comcellnode is
begin begin
rxrstdone_n <= not rxrstdone; rst <= not rst_n;
txrstdone_n <= not txrstdone;
sfp_tx_disable <= '0'; sfp_tx_disable <= '0';
rx_los <= sfp_rx_los; rx_los <= sfp_rx_los;
mod_abs <= sfp_mod_abs; mod_abs <= sfp_mod_abs;
tx_fault <= sfp_tx_fault;
axis_clk <= main_clk; axis_clk <= main_clk;
inst_gtwizard:comcellnode_gtwizard inst_gtwizard:comcellnode_gtwizard
PORT map( PORT map(
-- Async Reset -- Reset
gtwiz_reset_all_in(0) => gt_rst_all, gtwiz_reset_all_in(0) => gtwiz_reset_all,
gtwiz_userclk_rx_reset_in(0) => gt_rst_rx, gtwiz_userclk_rx_reset_in(0) => rx_clk_rst,
gtwiz_userclk_tx_reset_in(0) => gt_rst_tx, gtwiz_userclk_tx_reset_in(0) => tx_clk_rst,
gtwiz_reset_rx_done_out(0) => rxrstdone, gtwiz_reset_tx_done_out(0) => gtwiz_tx_rst_done,
gtwiz_reset_tx_done_out(0) => txrstdone, gtwiz_reset_rx_done_out(0) => gtwiz_rx_rst_done,
gtwiz_reset_tx_datapath_in(0) => gtwiz_rst_tx_datapath,
gtwiz_reset_rx_datapath_in => gtwiz_rst_rx_datapath,
-- Clocks -- Clocks
gtwiz_userclk_rx_usrclk2_out(0) => rxusrclk2, gtwiz_userclk_rx_usrclk2_out(0) => rxusrclk2,
...@@ -368,9 +389,7 @@ begin ...@@ -368,9 +389,7 @@ begin
-- Not used -- Not used
txsequence_in => (others => '0'), txsequence_in => (others => '0'),
gtwiz_reset_tx_pll_and_datapath_in => "0", gtwiz_reset_tx_pll_and_datapath_in => "0",
gtwiz_reset_tx_datapath_in => "0",
gtwiz_reset_rx_pll_and_datapath_in => "0", gtwiz_reset_rx_pll_and_datapath_in => "0",
gtwiz_reset_rx_datapath_in => "0",
qpll1clk_in => "0", qpll1clk_in => "0",
qpll1refclk_in => "0", qpll1refclk_in => "0",
gtwiz_userclk_tx_srcclk_out => open, gtwiz_userclk_tx_srcclk_out => open,
...@@ -389,14 +408,14 @@ begin ...@@ -389,14 +408,14 @@ begin
s_axi_aresetn_0 => rst_n, s_axi_aresetn_0 => rst_n,
-- GT reset -- GT reset
rx_reset_0 => rxrstdone_n, rx_reset_0 => rx_rst_core,
tx_reset_0 => txrstdone_n, tx_reset_0 => tx_rst_core,
gtwiz_reset_tx_done_0 => txrstdone, gtwiz_reset_tx_done_0 => gtwiz_tx_rst_done,
gtwiz_reset_rx_done_0 => rxrstdone, gtwiz_reset_rx_done_0 => gtwiz_rx_rst_done,
ctl_gt_reset_all_0 => gt_rst_all, ctl_gt_reset_all_0 => gt_rst_all,
ctl_gt_tx_reset_0 => gt_rst_tx, ctl_gt_tx_reset_0 => gt_rst_tx,
ctl_gt_rx_reset_0 => gt_rst_rx, ctl_gt_rx_reset_0 => gt_rst_rx,
rx_serdes_reset_0 => rxrstdone_n, rx_serdes_reset_0 => rx_serdes_rst,
-- Clocks -- Clocks
rx_serdes_clk_0 => rxusrclk2, rx_serdes_clk_0 => rxusrclk2,
...@@ -537,4 +556,31 @@ begin ...@@ -537,4 +556,31 @@ begin
stat_tx_frame_error_0 => open stat_tx_frame_error_0 => open
); );
inst_reset_helper: entity work.comcellnode_ethernet_reset_wrapper
port map(
sys_reset => rst,
dclk => free_100_clk,
s_axi_aclk => axi_clk,
ctl_gt_reset_all => gt_rst_all,
ctl_gt_tx_reset => gt_rst_tx,
ctl_gt_rx_reset => gt_rst_rx,
gtwiz_reset_tx_datapath => tx_data_rst,
gtwiz_reset_rx_datapath => rx_data_rst,
gt_txusrclk2 => main_clk,
gt_rxusrclk2 => rxusrclk2,
rx_core_clk => main_clk,
gt_tx_reset_in => gtwiz_tx_rst_done,
gt_rx_reset_in => gtwiz_rx_rst_done,
tx_core_reset_in => tx_rst,
rx_core_reset_in => rx_rst,
tx_core_reset_out => tx_rst_core,
rx_core_reset_out => rx_rst_core,
rx_serdes_reset_out => rx_serdes_rst,
usr_tx_reset => open,
usr_rx_reset => open,
gtwiz_reset_all => gtwiz_reset_all,
gtwiz_reset_tx_datapath_out => gtwiz_rst_tx_datapath,
gtwiz_reset_rx_datapath_out => gtwiz_rst_rx_datapath
);
end architecture struct; end architecture struct;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment