Changeset 9911 for firmware/FTU/counter
- Timestamp:
- 08/30/10 16:01:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FTU/counter/FTU_rate_counter.vhd
r9890 r9911 75 75 begin 76 76 77 if rising_edge(cntr_reset) then 78 79 --formula to calculate counting period from prescaling value 80 if (prescaling = "00000000") then 81 counting_period <= COUNTER_FREQUENCY / (2 * CNTR_FREQ_DIVIDER); 82 else 83 counting_period <= ((conv_integer(unsigned(prescaling)) + 1) / 2) * (COUNTER_FREQUENCY / CNTR_FREQ_DIVIDER); 84 end if; 85 77 if cntr_reset = '1' then 78 86 79 clk_cntr := 0; 87 80 period_finished <= '1'; … … 91 84 92 85 elsif rising_edge(clk_1M_sig) then 86 93 87 if (clk_cntr < counting_period - 1) then 94 88 clk_cntr := clk_cntr + 1; … … 107 101 process(trigger, period_finished) 108 102 begin 109 if rising_edge(period_finished)then103 if period_finished = '1' then 110 104 trigger_counts <= 0; 111 105 overflow_sig <= '0'; … … 118 112 overflow_sig <= '1'; 119 113 end if; 114 end if; 115 end if; 116 end process; 117 118 process(cntr_reset, prescaling) 119 begin 120 if rising_edge(cntr_reset) then 121 --formula to calculate counting period from prescaling value 122 if (prescaling = "00000000") then 123 counting_period <= COUNTER_FREQUENCY / (2 * CNTR_FREQ_DIVIDER); 124 else 125 counting_period <= ((conv_integer(unsigned(prescaling)) + 1) / 2) * (COUNTER_FREQUENCY / CNTR_FREQ_DIVIDER); 120 126 end if; 121 127 end if;
Note:
See TracChangeset
for help on using the changeset viewer.