bcm_rod_formatter.bcm_rod_formatter_arc Architecture Reference

ROD formatter main FSM. More...

Inheritance diagram for bcm_rod_formatter.bcm_rod_formatter_arc:

Inheritance graph
[legend]
Collaboration diagram for bcm_rod_formatter.bcm_rod_formatter_arc:

Collaboration graph
[legend]

List of all members.


Processes

RAM_reader  ( CLK , SCLR )
formatter_fsm  ( CLK , SCLR )

Components

bcm_rod_slink  <Entity bcm_rod_slink>
 S-Link interface.

Types

bcm_rod_formatter_fsm_state_typedef  ( formatter_idle , formatter_begin_of_fragment , formatter_header , formatter_header_size , formatter_format_version , formatter_source_ID , formatter_run_number , formatter_Level1_ID , formatter_BC_ID , formatter_trigger_type , formatter_detector_event_type , formatter_data , formatter_last_data , formatter_status_word_1 , formatter_status_word_2 , formatter_status_block_words , formatter_data_block_words , formatter_status_block_position , formatter_end_of_fragment )
 enum for formatter FSM

Signals

fsm_state  bcm_rod_formatter_fsm_state_typedef
 ROD formatter FSM states.
formatter_data_valid  std_logic
formatter_data_in  std_logic_vector ( 31 downto 0 ) := ( others = > ' 0 ' )
lvlid_i  std_logic_vector ( 31 downto 0 ) := ( others = > ' 0 ' )
formatter_control_word_flag  std_logic
formatter_stop_transfer  std_logic
intern_slink_data_out  std_logic
reset_n  std_logic
data_counter  std_logic_vector ( 11 downto 0 ) := ( others = > ' 0 ' )
buffer_data  std_logic_vector ( 223 downto 0 ) := ( others = > ' 0 ' )
buffer_counter  std_logic_vector ( 7 downto 0 ) := ( others = > ' 0 ' )
buffer_eof  std_logic_vector ( 6 downto 0 ) := ( others = > ' 0 ' )
last_data_next  std_logic
buffer_data_next  std_logic
last_data_available  std_logic
last_data_available_i  std_logic
LinkBusy  std_logic
FSMBusy  std_logic

Component Instantiations

output_interface bcm_rod_slink <Entity bcm_rod_slink>
 S-Link interface.


Detailed Description

ROD formatter main FSM.

Definition at line 87 of file bcm_rod_formatter.vhd.


Member Function Documentation

[Process]
formatter_fsm ( CLK ,
SCLR )

formatter FSM, steps through raw event format fragment and reads data from shift reg accordingly

Definition at line 297 of file bcm_rod_formatter.vhd.

00297   formatter_fsm : process (CLK, SCLR)
00298   begin
00299     if (SCLR = '1') then
00300       fsm_state                   <= formatter_idle;
00301       formatter_data_valid        <= '0';
00302       formatter_control_word_flag <= '1';
00303       formatter_data_in           <= ROD_EMPTY;
00304       data_counter                <= X"000";
00305       lvlid_i                     <= (others => '0');
00306     elsif (CLK'event and CLK = '1') then
00307       if (formatter_stop_transfer = '1') then
00308         fsm_state                   <= fsm_state;
00309         formatter_data_valid        <= formatter_data_valid;
00310         formatter_control_word_flag <= formatter_control_word_flag;
00311         formatter_data_in           <= formatter_data_in;
00312         data_counter                <= data_counter;
00313       else
00314         if ((fsm_state = formatter_end_of_fragment or fsm_state = formatter_idle) and (buffer_counter = "000")) then
00315           formatter_data_valid <= '0';
00316         else
00317           formatter_data_valid <= '1';
00318         end if;
00319         if ((fsm_state = formatter_status_block_position) or
00320             (fsm_state = formatter_end_of_fragment and (not (buffer_counter = "000"))) or
00321             (fsm_state = formatter_idle and (not (buffer_counter = "000")))) then
00322           formatter_control_word_flag <= '0';
00323         else
00324           formatter_control_word_flag <= '1';
00325         end if;
00326         data_counter <= data_counter;
00327         case fsm_state is
00328           when formatter_idle =>
00329             if (not (buffer_counter = "0000")) then
00330               fsm_state         <= formatter_begin_of_fragment;
00331               formatter_data_in <= SLINK_BEGIN_OF_FRAGMENT;
00332             else
00333               fsm_state         <= formatter_idle;
00334               formatter_data_in <= ROD_EMPTY;
00335             end if;
00336           when formatter_begin_of_fragment =>
00337             fsm_state         <= formatter_header;
00338             formatter_data_in <= ROD_HEADER;
00339           when formatter_header =>
00340             fsm_state         <= formatter_header_size;
00341             formatter_data_in <= ROD_HEADER_WORDS;
00342           when formatter_header_size =>
00343             fsm_state         <= formatter_format_version;
00344             formatter_data_in <= rod_format_version;
00345           when formatter_format_version =>
00346             fsm_state         <= formatter_source_ID;
00347             formatter_data_in <= rod_source_ID;
00348           when formatter_source_ID =>
00349             fsm_state         <= formatter_run_number;
00350             formatter_data_in <= rod_run_number;
00351             lvlid_i           <= buffer_data(31 downto 0);
00352           when formatter_run_number =>
00353             fsm_state         <= formatter_Level1_ID;
00354             formatter_data_in <= lvlid_i;
00355           when formatter_Level1_ID =>
00356             fsm_state         <= formatter_BC_ID;
00357             formatter_data_in <= x"00000" & buffer_data(31 downto 20);
00358           when formatter_BC_ID =>
00359             fsm_state         <= formatter_trigger_type;
00360             formatter_data_in <= rod_CTP_trigger_type;
00361           when formatter_trigger_type =>
00362             fsm_state         <= formatter_detector_event_type;
00363             formatter_data_in <= rod_detector_event_type;
00364           when formatter_detector_event_type =>
00365             fsm_state         <= formatter_data;
00366             formatter_data_in <= buffer_data(31 downto 0);
00367             data_counter      <= (data_counter + "01");
00368           when formatter_data =>
00369             data_counter      <= (data_counter + "01");
00370             formatter_data_in <= buffer_data(31 downto 0);
00371             if (data_counter = MAX_FRAGMENT_SIZE or buffer_eof(0) = '1') then
00372               fsm_state <= formatter_last_data;
00373             else
00374               fsm_state <= formatter_data;
00375             end if;
00376           when formatter_last_data =>
00377             fsm_state         <= formatter_status_word_1;
00378             formatter_data_in <= ROD_STATUS_BLOCK_WORD1;
00379           when formatter_status_word_1 =>
00380             fsm_state         <= formatter_status_word_2;
00381             formatter_data_in <= ROD_STATUS_BLOCK_WORD2;
00382           when formatter_status_word_2 =>
00383             fsm_state         <= formatter_status_block_words;
00384             formatter_data_in <= ROD_STATUS_BLOCK_WORDS;
00385           when formatter_status_block_words =>
00386             fsm_state         <= formatter_data_block_words;
00387             formatter_data_in <= X"00000" & data_counter;
00388           when formatter_data_block_words =>
00389             fsm_state         <= formatter_status_block_position;
00390             formatter_data_in <= ROD_STATUS_BLOCK_AFTER_DATA;
00391             data_counter      <= X"000";
00392           when formatter_status_block_position =>
00393             fsm_state         <= formatter_end_of_fragment;
00394             formatter_data_in <= SLINK_END_OF_FRAGMENT;
00395           when formatter_end_of_fragment =>
00396             if buffer_counter /= 0 then
00397               fsm_state         <= formatter_begin_of_fragment;
00398               formatter_data_in <= SLINK_BEGIN_OF_FRAGMENT;
00399             else
00400               fsm_state         <= formatter_idle;
00401               formatter_data_in <= ROD_EMPTY;
00402             end if;
00403           when others => null;
00404         end case;
00405       end if;
00406     end if;
00407   end process;

[Process]
RAM_reader ( CLK ,
SCLR )

read data from RAM and write it into shift register. SR has 3 modes:

  • shift out & fill in
  • shift out
  • fill in

Definition at line 191 of file bcm_rod_formatter.vhd.

00191   RAM_reader : process (CLK, SCLR)
00192   begin
00193     if SCLR = '1' then
00194       rod_data_next         <= '0';
00195       buffer_data_next      <= '0';
00196       last_data_available   <= '0';
00197       last_data_available_i <= '0';
00198       last_data_next        <= '0';
00199       buffer_counter        <= (others => '0');
00200       buffer_eof            <= (others => '0');
00201       buffer_data           <= (others => '0');
00202     elsif (CLK'event and CLK = '1') then
00203       if rod_data_available = '1' then
00204         rod_data_next    <= '1';
00205         buffer_data_next <= '1';
00206       else
00207         rod_data_next    <= '0';
00208         buffer_data_next <= '0';
00209       end if;
00210       -- shift data out
00211       if (formatter_stop_transfer = '0') and (fsm_state = formatter_detector_event_type or
00212                                               fsm_state = formatter_data or
00213                                               fsm_state = formatter_source_ID) then
00214         if fsm_state = formatter_source_ID then
00215           rod_data_next <= '0';
00216         end if;
00217         if (rod_data_vld and (last_data_available or last_data_available_i)) = '1' then  -- fill and shift out
00218           case buffer_counter is
00219             when "00000001" =>
00220               buffer_data <= X"000000000000000000000000000000000000000000000000" & rod_input_data;
00221               buffer_eof  <= "000000" & rod_fragment_end;
00222             when "00000010" =>
00223               buffer_data <= X"0000000000000000000000000000000000000000" & rod_input_data & buffer_data(63 downto 32);
00224               buffer_eof  <= "00000" & rod_fragment_end & buffer_eof(1);
00225             when "00000011" =>
00226               buffer_data <= X"00000000000000000000000000000000" & rod_input_data & buffer_data(95 downto 32);
00227               buffer_eof  <= "0000" & rod_fragment_end & buffer_eof(2 downto 1);
00228             when "00000100" =>
00229               buffer_data <= X"000000000000000000000000" & rod_input_data & buffer_data(127 downto 32);
00230               buffer_eof  <= "000" & rod_fragment_end & buffer_eof(3 downto 1);
00231             when "00000101" =>
00232               buffer_data <= X"0000000000000000" & rod_input_data & buffer_data(159 downto 32);
00233               buffer_eof  <= "00" & rod_fragment_end & buffer_eof(4 downto 1);
00234             when "00000110" =>
00235               buffer_data <= X"00000000" & rod_input_data & buffer_data(191 downto 32);
00236               buffer_eof  <= '0' & rod_fragment_end & buffer_eof(5 downto 1);
00237             when "00000111" =>
00238               buffer_data <= rod_input_data & buffer_data(223 downto 32);
00239               buffer_eof  <= rod_fragment_end & buffer_eof(6 downto 1);
00240             when others =>
00241               buffer_data <= rod_input_data & buffer_data(223 downto 32);
00242               buffer_eof  <= rod_fragment_end & buffer_eof(6 downto 1);
00243           end case;
00244           buffer_counter <= buffer_counter;
00245         elsif buffer_counter /= "00000000" then  -- just shift out
00246           buffer_data    <= rod_input_data & buffer_data(223 downto 32);
00247           buffer_eof     <= rod_fragment_end & buffer_eof(6 downto 1);
00248           buffer_counter <= buffer_counter - "01";  
00249         end if;
00250       else                              -- nothing to shift
00251         if (rod_data_vld and (last_data_available or last_data_available_i)) = '1' then  -- fill
00252           case buffer_counter is
00253             when "00000000" =>
00254               buffer_data <= X"000000000000000000000000000000000000000000000000" & rod_input_data;
00255               buffer_eof  <= "000000" & rod_fragment_end;
00256             when "00000001" =>
00257               buffer_data <= X"0000000000000000000000000000000000000000" & rod_input_data & buffer_data(31 downto 0);
00258               buffer_eof  <= "00000" & rod_fragment_end & buffer_eof(0);
00259             when "00000010" =>
00260               buffer_data <= X"00000000000000000000000000000000" & rod_input_data & buffer_data(63 downto 0);
00261               buffer_eof  <= "0000" & rod_fragment_end & buffer_eof(1 downto 0);
00262             when "00000011" =>
00263               buffer_data <= X"000000000000000000000000" & rod_input_data & buffer_data(95 downto 0);
00264               buffer_eof  <= "000" & rod_fragment_end & buffer_eof(2 downto 0);
00265             when "00000100" =>
00266               buffer_data <= X"0000000000000000" & rod_input_data & buffer_data(127 downto 0);
00267               buffer_eof  <= "00" & rod_fragment_end & buffer_eof(3 downto 0);
00268             when "00000101" =>
00269               buffer_data   <= X"00000000" & rod_input_data & buffer_data(159 downto 0);
00270               buffer_eof    <= '0' & rod_fragment_end & buffer_eof(4 downto 0);
00271               rod_data_next <= '0';
00272             when "00000110" =>
00273               buffer_data   <= rod_input_data & buffer_data(191 downto 0);
00274               buffer_eof    <= rod_fragment_end & buffer_eof(5 downto 0);
00275               rod_data_next <= '0';
00276             when "00000111" =>
00277               buffer_data   <= buffer_data;
00278               buffer_eof    <= buffer_eof;
00279               rod_data_next <= '0';
00280             when others =>
00281               buffer_data <= rod_input_data & buffer_data(223 downto 32);
00282               buffer_eof  <= rod_fragment_end & buffer_eof(6 downto 1);
00283           end case;
00284           buffer_counter <= buffer_counter + "01";
00285         elsif buffer_counter /= "00000000" then
00286           rod_data_next <= '0';
00287         end if;
00288       end if;
00289       last_data_next        <= buffer_data_next;
00290       last_data_available   <= rod_data_available;
00291       last_data_available_i <= last_data_available;
00292     end if;
00293   end process;


Member Data Documentation

bcm_rod_formatter_fsm_state_typedef ( formatter_idle , formatter_begin_of_fragment , formatter_header , formatter_header_size , formatter_format_version , formatter_source_ID , formatter_run_number , formatter_Level1_ID , formatter_BC_ID , formatter_trigger_type , formatter_detector_event_type , formatter_data , formatter_last_data , formatter_status_word_1 , formatter_status_word_2 , formatter_status_block_words , formatter_data_block_words , formatter_status_block_position , formatter_end_of_fragment ) [Type]

enum for formatter FSM

Definition at line 115 of file bcm_rod_formatter.vhd.

bcm_rod_slink [Component]

S-Link interface.

Definition at line 90 of file bcm_rod_formatter.vhd.

ROD formatter FSM states.

Definition at line 137 of file bcm_rod_formatter.vhd.

output_interface bcm_rod_slink [Component Instantiation]

S-Link interface.

Definition at line 162 of file bcm_rod_formatter.vhd.


The documentation for this class was generated from the following file:

Author: M.Niegl
Generated on Tue Nov 4 00:48:50 2008 for BCM-AAA by doxygen 1.5.7.1-20081012