AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
 All Classes Variables
amc_gtx5gpd_common_reset.vhd
1 --------------------------------------------------------------------------------
2 -- ____ ____
3 -- / /\/ /
4 -- /___/ \ / Vendor: Xilinx
5 -- \ \ \/ Version : 3.6
6 -- \ \ Application : 7 Series FPGAs Transceivers Wizard
7 -- / / Filename : amc_gtx5gpd_common_reset.vhd
8 -- /___/ /\
9 -- \ \ / \
10 -- \___\/\___\
11 --
12 --
13 -- Description : This module performs TX reset and initialization.
14 --
15 --
16 --
17 -- Module amc_gtx5Gpd_common_reset
18 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
19 --
20 --
21 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
22 --
23 -- This file contains confidential and proprietary information
24 -- of Xilinx, Inc. and is protected under U.S. and
25 -- international copyright and other intellectual property
26 -- laws.
27 --
28 -- DISCLAIMER
29 -- This disclaimer is not a license and does not grant any
30 -- rights to the materials distributed herewith. Except as
31 -- otherwise provided in a valid license issued to you by
32 -- Xilinx, and to the maximum extent permitted by applicable
33 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
34 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
35 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
36 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
37 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
38 -- (2) Xilinx shall not be liable (whether in contract or tort,
39 -- including negligence, or under any other theory of
40 -- liability) for any loss or damage of any kind or nature
41 -- related to, arising under or in connection with these
42 -- materials, including for any direct, or any indirect,
43 -- special, incidental, or consequential loss or damage
44 -- (including loss of data, profits, goodwill, or any type of
45 -- loss or damage suffered as a result of any action brought
46 -- by a third party) even if such damage or loss was
47 -- reasonably foreseeable or Xilinx had been advised of the
48 -- possibility of the same.
49 --
50 -- CRITICAL APPLICATIONS
51 -- Xilinx products are not designed or intended to be fail-
52 -- safe, or for use in any application requiring fail-safe
53 -- performance, such as life-support or safety devices or
54 -- systems, Class III medical devices, nuclear facilities,
55 -- applications related to the deployment of airbags, or any
56 -- other applications that could lead to death, personal
57 -- injury, or severe property or environmental damage
58 -- (individually and collectively, "Critical
59 -- Applications"). Customer assumes the sole risk and
60 -- liability of any use of Xilinx products in Critical
61 -- Applications, subject only to applicable laws and
62 -- regulations governing limitations on product liability.
63 --
64 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
65 -- PART OF THIS FILE AT ALL TIMES.
66 
67 
68 --*****************************************************************************
69 library ieee;
70 use ieee.std_logic_1164.all;
71 use ieee.numeric_std.all;
72 use ieee.std_logic_unsigned.all;
73 use std.textio.all;
74 use ieee.std_logic_textio.all;
75 library UNISIM;
76 use UNISIM.VCOMPONENTS.ALL;
77 
79 generic
80 (
81  STABLE_CLOCK_PERIOD : integer := 8 -- Period of the stable clock driving this state-machine, unit is [ns]
82  );
83 port
84  (
85  STABLE_CLOCK : in std_logic; --Stable Clock, either a stable clock from the PCB
86  SOFT_RESET : in std_logic; --User Reset, can be pulled any time
87  COMMON_RESET : out std_logic:= '0' --Reset QPLL
88  );
89 end amc_gtx5Gpd_common_reset;
90 
91 architecture RTL of amc_gtx5Gpd_common_reset is
92 
93 
94  constant STARTUP_DELAY : integer := 500;--AR43482: Transceiver needs to wait for 500 ns after configuration
95  constant WAIT_CYCLES : integer := STARTUP_DELAY / STABLE_CLOCK_PERIOD; -- Number of Clock-Cycles to wait after configuration
96  constant WAIT_MAX : integer := WAIT_CYCLES + 10; -- 500 ns plus some additional margin
97 
98 
99  signal init_wait_count : std_logic_vector(7 downto 0) :=(others => '0');
100  signal init_wait_done : std_logic :='0';
101  signal common_reset_asserted : std_logic :='0';
102  signal common_reset_i : std_logic ;
103 
104  type rst_type is(
105  INIT, ASSERT_COMMON_RESET);
106 
107  signal state : rst_type := INIT;
108 
109 begin
110  process(STABLE_CLOCK)
111  begin
112  if rising_edge(STABLE_CLOCK) then
113  -- The counter starts running when configuration has finished and
114  -- the clock is stable. When its maximum count-value has been reached,
115  -- the 500 ns from Answer Record 43482 have been passed.
116  if init_wait_count = WAIT_MAX then
117  init_wait_done <= '1';
118  else
119  init_wait_count <= init_wait_count + 1;
120  end if;
121  end if;
122  end process;
123 
124  process(STABLE_CLOCK)
125  begin
126  if rising_edge(STABLE_CLOCK) then
127  if(SOFT_RESET = '1') then
128  state <= INIT;
129  common_reset_asserted <= '0';
130  COMMON_RESET <= '0';
131  else
132 
133  case state is
134  when INIT =>
135  if init_wait_done = '1' then
136  state <= ASSERT_COMMON_RESET;
137  end if;
138 
139  when ASSERT_COMMON_RESET =>
140  if common_reset_asserted = '0' then
141  COMMON_RESET <= '1';
142  common_reset_asserted <= '1';
143  else
144  COMMON_RESET <= '0';
145  end if;
146  when OTHERS =>
147  state <= INIT;
148  end case;
149  end if;
150  end if;
151  end process;
152 
153 
154 end RTL;