ROD firmware  1.0.5
ATLAS l1-calo - ROD_eFEX and ROD_jFEX firmware for the L1Calo ROD board

Back to ROD documentation
reset_count.vhd
1 ----------------------------------------------------------------------------------
2 -- Company:
3 -- Engineer:
4 --
5 -- Create Date: 19.02.2019 13:36:52
6 -- Design Name:
7 -- Module Name: reset_count - RTL
8 -- Project Name:
9 -- Target Devices:
10 -- Tool Versions:
11 -- Description:
12 --
13 -- Dependencies:
14 --
15 -- Revision:
16 -- Revision 0.01 - File Created
17 -- Additional Comments:
18 --
19 ----------------------------------------------------------------------------------
20 
21 
22 library IEEE;
23 use IEEE.STD_LOGIC_1164.ALL;
24 use IEEE.STD_LOGIC_UNSIGNED.ALL;
25 
26 -- Uncomment the following library declaration if using
27 -- arithmetic functions with Signed or Unsigned values
28 --use IEEE.NUMERIC_STD.ALL;
29 
30 -- Uncomment the following library declaration if instantiating
31 -- any Xilinx leaf cells in this code.
32 --library UNISIM;
33 --use UNISIM.VComponents.all;
34 
35 entity reset_count is
36  generic
37 (
38  COUNTER_WIDTH : integer := 5
39 
40 );
41 
42  Port (
43  clock : in STD_LOGIC;
44  power_down_b: out STD_LOGIC
45  );
46 end reset_count;
47 
48 architecture RTL of reset_count is
49 
50 signal counter : std_logic_vector(counter_width-1 downto 0) := (others => '0');
51 signal count_max : STD_LOGIC_VECTOR (counter_width-1 downto 0) := (others => '1');
52 signal done : std_logic := '0';
53 
54 begin
55 
56 count_max <= (others => '1');
57 
58 process (clock) begin
59  if rising_edge (clock) then
60  if counter = count_max then
61  counter <= counter;
62  done <='1';
63  else
64  counter <= counter +1;
65  end if;
66  end if;
67 end process;
68 
69 power_down_b <= done;
70 
71 
72 end RTL;
73