Line | |
---|
1 | library IEEE;
|
---|
2 | use IEEE.std_logic_1164.all;
|
---|
3 | use IEEE.std_logic_arith.all;
|
---|
4 |
|
---|
5 | entity 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 |
|
---|
13 | end FTU_test2_upcnt16;
|
---|
14 |
|
---|
15 | architecture 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 |
|
---|
22 | begin
|
---|
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 |
|
---|
44 | end DEFINITION;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.