source: firmware/FTM/test_firmware/counter_dummy/counter_dummy_beha.vhd@ 14259

Last change on this file since 14259 was 10441, checked in by weitzel, 14 years ago
new FTM firmware featuring e.g. start/stop run commands and new header
File size: 1.9 KB
Line 
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--
10LIBRARY ieee;
11USE ieee.std_logic_1164.all;
12USE ieee.std_logic_arith.all;
13USE IEEE.STD_LOGIC_UNSIGNED.all;
14
15ENTITY 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
26END counter_dummy ;
27
28--
29ARCHITECTURE 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
36BEGIN
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
71END ARCHITECTURE beha;
72
Note: See TracBrowser for help on using the repository browser.