19-- This module takes data from the project and puts it into a small statistic packet no more than 64 bits long. This packet will then be sent along with
20-- all the other burst data to the controll software on the computer. The statistic packet will monitor the fifo overflow signals as well as the number
21-- of pulses sent every statistic period. The statistic period should probably be controlled with a user-set register that will come sometime.
22-- In order to have this work, I am going to have to be able to insert this packet into the normal flow of data coming from the adc without blocking
23-- the adc data. This will probably have to be accomplished with a multiplexer and will nessessitate that the stat data be only 64 bits long.
24-- otherwise, the stat pakcet might be split up because of the more important adc data.
78if(ethernet_fifo_in_en='0')then --TODO if PeakFinder is currently triggered and sending data, wait until a better time. Else, go ahead and send the packet.
79new_stat_sig<='1';
80stat_ethernet_fifo_in_en<='1';
81timer<=(others=>'0');
82stat_sent<='1';
83else
84sendReady<='1';
85endif;
86endif;
87
88if(sendReady='1'andethernet_fifo_in_en='0'andstat_sent='0')then --A send is due and PeakFinder is not Triggered.
89new_stat_sig<='1';
90stat_ethernet_fifo_in_en<='1';
91timer<=(others=>'0');
92sendReady<='0';
93stat_sent<='1';
94endif;
95
96if(stat_sent='1')then --Reset the fifo overflow latches and trigger count.
97stat_sent<='0';
98triggers<=(others=>'0');
99adc_fifo_overflow_lat_res<='1';
100ethernet_fifo_overflow_lat_res<='1';
101reset_lat<='1';
102new_stat_sig<='0';
103stat_ethernet_fifo_in_en<='0';
104endif;
105
106if(reset_lat='1')then --Reset the latch resets after one clock to pulse the reset and allow them to work agian.