1 | --
|
---|
2 | -- VHDL Architecture FACT_FTM_Boards.counter_dummy.beha
|
---|
3 | --
|
---|
4 | -- Created:
|
---|
5 | -- by - kai.users (tpkw.local.priv)
|
---|
6 | -- at - 15:37:00 04/13/11
|
---|
7 | --
|
---|
8 | -- using Mentor Graphics HDL Designer(TM) 2009.1 (Build 12)
|
---|
9 | --
|
---|
10 | LIBRARY ieee;
|
---|
11 | USE ieee.std_logic_1164.all;
|
---|
12 | USE ieee.std_logic_arith.all;
|
---|
13 | USE IEEE.STD_LOGIC_UNSIGNED.all;
|
---|
14 |
|
---|
15 | ENTITY counter_dummy IS
|
---|
16 | PORT(
|
---|
17 | clk : IN std_logic;
|
---|
18 | get_counter : IN std_logic;
|
---|
19 | get_counter_started : OUT std_logic := '0';
|
---|
20 | get_counter_ready : OUT std_logic := '0';
|
---|
21 | counter : OUT std_logic_vector (47 DOWNTO 0) := (others => '0')
|
---|
22 | );
|
---|
23 |
|
---|
24 | -- Declarations
|
---|
25 |
|
---|
26 | END counter_dummy ;
|
---|
27 |
|
---|
28 | --
|
---|
29 | ARCHITECTURE beha OF counter_dummy IS
|
---|
30 |
|
---|
31 | type state_counter_proc_type is (CP_INIT, CP_CONFIG, CP_IDLE, CP_CNT_START, CP_CNT_END);
|
---|
32 | signal state_counter_proc : state_counter_proc_type := CP_INIT;
|
---|
33 |
|
---|
34 | signal counter_int : std_logic_vector (47 DOWNTO 0) := (others => '0');
|
---|
35 |
|
---|
36 | BEGIN
|
---|
37 | counter_proc : process (clk)
|
---|
38 | begin
|
---|
39 | if rising_edge (clk) then
|
---|
40 | case state_counter_proc is
|
---|
41 |
|
---|
42 | when CP_INIT =>
|
---|
43 | state_counter_proc <= CP_CONFIG;
|
---|
44 |
|
---|
45 | when CP_CONFIG =>
|
---|
46 | state_counter_proc <= CP_IDLE;
|
---|
47 |
|
---|
48 | when CP_IDLE =>
|
---|
49 | if (get_counter = '1') then
|
---|
50 | counter_int <= counter_int + 1;
|
---|
51 | get_counter_started <= '1';
|
---|
52 | get_counter_ready <= '0';
|
---|
53 | state_counter_proc <= CP_CNT_START;
|
---|
54 | end if;
|
---|
55 |
|
---|
56 | when CP_CNT_START =>
|
---|
57 | counter <= counter_int;
|
---|
58 | state_counter_proc <= CP_CNT_END;
|
---|
59 |
|
---|
60 | when CP_CNT_END =>
|
---|
61 | if (get_counter = '0') then
|
---|
62 | get_counter_started <= '0';
|
---|
63 | get_counter_ready <= '1';
|
---|
64 | state_counter_proc <= CP_IDLE;
|
---|
65 | end if;
|
---|
66 |
|
---|
67 | end case;
|
---|
68 | end if;
|
---|
69 | end process counter_proc;
|
---|
70 |
|
---|
71 | END ARCHITECTURE beha;
|
---|
72 |
|
---|