Changeset 10779 for firmware/FTM/Timing_counters
- Timestamp:
- 05/23/11 15:00:19 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FTM/Timing_counters/Timing_counter.vhd
r10760 r10779 23 23 -- 24 24 -- May 18 2011 by Patrick Vogler 25 -- 26 -- May 20, 2011, by Q. Weitzel 27 -- counting was wrong by one clock cycle (1 us) 28 -- 29 -- May 23, 2011, by Q. Weitzel 30 -- counter reset changed from async to sync reset 31 -- reset, enable and read_counter removed from sensitity lists 32 -- 25 33 ---------------------------------------------------------------------------------- 26 34 … … 40 48 USE ftm_definitions.ftm_array_types.all; 41 49 USE ftm_definitions.ftm_constants.all; 42 43 50 44 51 … … 64 71 65 72 66 67 73 architecture Behavioral of Timing_counter is 68 74 … … 78 84 -- counting 79 85 ------------------------------------------------------------------------------- 80 count : process (clk, reset, enable) 81 begin 82 if reset = '1' then 83 counting <= (others => '0'); 84 precounting <= (others => '0'); 85 86 elsif rising_edge(clk) then 87 if enable = '1' then 88 precounting <= precounting + 1; 89 if (precounting = (PRECOUNT_DIVIDER - 1)) then 90 counting <= counting + 1; 91 precounting <= (others => '0'); 92 end if; 93 end if; 94 end if; 86 count : process (clk) 87 begin 88 89 if rising_edge(clk) then 90 if (reset = '1') then 91 counting <= (others => '0'); 92 precounting <= (others => '0'); 93 elsif enable = '1' then 94 precounting <= precounting + 1; 95 if (precounting = (PRECOUNT_DIVIDER - 1)) then 96 counting <= counting + 1; 97 precounting <= (others => '0'); 98 end if; 99 end if; 100 end if; 101 95 102 end process count; 96 97 103 98 104 -- read counter 99 105 ------------------------------------------------------------------------------- 100 readout_counter : process (clk , read_counter)106 readout_counter : process (clk) 101 107 begin 102 108 if rising_edge(clk) then … … 131 137 132 138 end Behavioral; 133 134
Note:
See TracChangeset
for help on using the changeset viewer.