Ignore:
Timestamp:
05/23/11 15:00:19 (14 years ago)
Author:
weitzel
Message:
some changes in FTM Timing_counter
File:
1 edited

Legend:

Unmodified
Added
Removed
  • firmware/FTM/Timing_counters/Timing_counter.vhd

    r10760 r10779  
    2323--
    2424-- 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--
    2533----------------------------------------------------------------------------------
    2634
     
    4048USE ftm_definitions.ftm_array_types.all;
    4149USE ftm_definitions.ftm_constants.all;
    42 
    4350
    4451
     
    6471
    6572
    66 
    6773architecture Behavioral of Timing_counter is
    6874
     
    7884--  counting
    7985-------------------------------------------------------------------------------
    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   
    95102  end process count;
    96 
    97103
    98104-- read counter
    99105-------------------------------------------------------------------------------
    100   readout_counter : process (clk, read_counter)
     106  readout_counter : process (clk)
    101107  begin
    102108    if rising_edge(clk) then
     
    131137
    132138end Behavioral;
    133 
    134 
Note: See TracChangeset for help on using the changeset viewer.