source: firmware/FTU/test_firmware/FTU_test2/FTU_test2_upcnt16.vhd@ 18086

Last change on this file since 18086 was 236, checked in by qweitzel, 14 years ago
second test for FTU added
File size: 876 bytes
Line 
1library IEEE;
2use IEEE.std_logic_1164.all;
3use IEEE.std_logic_arith.all;
4
5entity FTU_test2_upcnt16 is
6 port(
7 full : out STD_LOGIC;
8 clr : in STD_LOGIC;
9 reset : in STD_Logic;
10 clk : in STD_LOGIC
11 );
12
13end FTU_test2_upcnt16;
14
15architecture DEFINITION of upcnt16 is
16
17 constant RESET_ACTIVE : std_logic := '0';
18 constant Cnt_full : Unsigned (15 DOWNTO 0) :="1111111111111111";
19
20 signal q : Unsigned (15 DOWNTO 0);
21
22begin
23
24 process(clk, reset, clr)
25 begin
26 -- Clear output register
27 if ((reset OR clr)='1') then
28 q <= (others => '0');
29 -- On rising edge of clock count
30 elsif (clk'event) and clk = '1' and (not(q = Cnt_full)) then
31 q <= q + 1;
32 end if;
33 end process;
34
35 process(q)
36 begin
37 if (q = Cnt_full) then
38 full <= '1';
39 else
40 full <= '0';
41 end if;
42 end process;
43
44end DEFINITION;
Note: See TracBrowser for help on using the repository browser.