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

Back to ROD documentation
watermark.vhd
1 ----------------------------------------------------------------------------------
2 -- Company:
3 -- Engineer:
4 --
5 -- Create Date: 16.10.2019 10:08:37
6 -- Design Name:
7 -- Module Name: watermark - 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 watermark is
36  generic (
37  watermark_width : integer := 4
38  );
39  Port (
40  clock : in STD_LOGIC;
41  level : in STD_LOGIC_VECTOR (watermark_width-1 downto 0);
42  reset : in STD_LOGIC;
43  watermark: out STD_LOGIC_VECTOR (watermark_width-1 downto 0)
44 
45  );
46 
47 end watermark;
48 
49 architecture RTL of watermark is
50 
51 signal watermark_i : STD_LOGIC_VECTOR (watermark_width-1 downto 0);
52 
53 begin
54 
55 process(clock, reset)
56  begin
57  if reset = '1' then -- async (p)reset -> put 'reset in sensitivity list
58  watermark_i <= (others => '0');
59  elsif rising_edge(clock) then
60  if (level > watermark_i) then
61  watermark_i <= level;
62  else
63  watermark_i <= watermark_i;
64  end if;
65  end if;
66  end process;
67 
68 watermark <= watermark_i;
69 
70 end RTL;