<!-- Top level of Readout structure  -->
<!-- version: 1.6.2     sha: 8f38057 -->

<node id="efex_Readout" fwinfo="endpoint">

  <!-- Test Control Register inside readout block -->
  <node id="test_control_reg"   address="0x0" permission="rw" fwinfo="endpoint;width=0" description="Control Register for Testing" >
    <node id="read_raw_all"      mask="0x00000001"  description="Read all the RAW data channels" />
  </node>

  <!-- Pulse Register inside readout block -->
  <node id="rdout_pulse_reg"    address="0x1" permission="rw" fwinfo="endpoint;width=0" description="Pulse register inside the readout block" >
    <node id="l1a_id_rst_pulse"       mask="0x00000002" description="L1A ID reset Pulse by software command" />
    <node id="raw_fifo_rst_pulse"     mask="0x00000004" description="RAW Readout FIFO reset Pulse by software command" />
    <node id="tob_fifo_rst_pulse"     mask="0x00000008" description="TOB Readout FIFO reset Pulse by software command" />
    <node id="rst_spy_mem_wr_addr_pulse"  mask="0x00000020" description="SPY mem write address counter reset Pulse by software command" />
    <node id="busy_counter_rst_pulse"     mask="0x00000040" description="BUSY counter reset for RAW and TOB data" />
    <node id="rst_ECR_dbg_cntr"     mask="0x00000080" description="Reset ECR Debug Counter" />
    <node id="rst_L1A_dbg_cntr"     mask="0x00000100" description="Reset L1A Debug Counter" />
    <node id="busy_counter_latch"   mask="0x00000200" description="Latch BUSY Counters" />
  </node>

  <node id="top_level_counters" address="0x10" description="Top Level Counters"  fwinfo="endpoint;width=3">
   <node id="busy_raw_counter"	address="0x0" permission="r" description="Number of RAW Readout BUSY assertions"/>
   <node id="busy_tob_counter"	address="0x1" permission="r" description="Number of TOB Readout BUSY assertions"/>
   <node id="busy_raw_duration_counter"	address="0x2" permission="r" description="Number of 40M clocks RAW Readout BUSY is asserted"/>
   <node id="busy_tob_duration_counter"	address="0x3" permission="r" description="Number of 40M clocks TOB Readout BUSY is asserted"/>
   <node id="ecr_debug_counter"		address="0x4" permission="r" description="Number of ECR assertions"/>
   <node id="l1a_debug_counter"		address="0x5" permission="r" description="Number of L1A assertions"/>
   <node id="real_time_40m_counter" address="0x6" permission="r" description="Number of 40M clocks"/>
   <node id="tob_double_word_counter" address="0x7" permission="r" description="Number of identical TOB double words"/>
  </node>

  <node id="ttc_parity_l1a_bcn" address="0x20" permission="r" description="Outputs debug signals regarding parity for L1A and BCN ID between control/processor FPGA" fwinfo="endpoint;width=4">
	  <node id="ttc_err_history" address="0x0" permission="r" description="History of last 8 errors on incoming TTC signals">
       <node id="l1id_0_mismatch"       mask="0x00000001" description="L1ID mismatch" />
       <node id="l1id_0_parity"       mask="0x00000002" description="L1ID parity error" />
       <node id="bcn_0_mismatch"       mask="0x00000004" description="BCN mismatch" />
       <node id="bcn_0_parity"       mask="0x00000008" description="BCN parity error" />
       <node id="l1id_1_mismatch"       mask="0x00000010" description="L1ID mismatch" />
       <node id="l1id_1_parity"       mask="0x00000020" description="L1ID parity error" />
       <node id="bcn_1_mismatch"       mask="0x00000040" description="BCN mismatch" />
       <node id="bcn_1_parity"       mask="0x00000080" description="BCN parity error" />
       <node id="l1id_2_mismatch"       mask="0x00000100" description="L1ID mismatch" />
       <node id="l1id_2_parity"       mask="0x00000200" description="L1ID parity error" />
       <node id="bcn_2_mismatch"       mask="0x00000400" description="BCN mismatch" />
       <node id="bcn_2_parity"       mask="0x00000800" description="BCN parity error" />
       <node id="l1id_3_mismatch"       mask="0x00001000" description="L1ID mismatch" />
       <node id="l1id_3_parity"       mask="0x00002000" description="L1ID parity error" />
       <node id="bcn_3_mismatch"       mask="0x00004000" description="BCN mismatch" />
       <node id="bcn_3_parity"       mask="0x00008000" description="BCN parity error" />
       <node id="l1id_4_mismatch"       mask="0x00010000" description="L1ID mismatch" />
       <node id="l1id_4_parity"       mask="0x00020000" description="L1ID parity error" />
       <node id="bcn_4_mismatch"       mask="0x00040000" description="BCN mismatch" />
       <node id="bcn_4_parity"       mask="0x00080000" description="BCN parity error" />
       <node id="l1id_5_mismatch"       mask="0x00100000" description="L1ID mismatch" />
       <node id="l1id_5_parity"       mask="0x00200000" description="L1ID parity error" />
       <node id="bcn_5_mismatch"       mask="0x00400000" description="BCN mismatch" />
       <node id="bcn_5_parity"       mask="0x00800000" description="BCN parity error" />
       <node id="l1id_6_mismatch"       mask="0x01000000" description="L1ID mismatch" />
       <node id="l1id_6_parity"       mask="0x02000000" description="L1ID parity error" />
       <node id="bcn_6_mismatch"       mask="0x04000000" description="BCN mismatch" />
       <node id="bcn_6_parity"       mask="0x08000000" description="BCN parity error" />
       <node id="l1id_7_mismatch"       mask="0x10000000" description="L1ID mismatch" />
       <node id="l1id_7_parity"       mask="0x20000000" description="L1ID parity error" />
       <node id="bcn_7_mismatch"       mask="0x40000000" description="BCN mismatch" />
       <node id="bcn_7_parity"       mask="0x80000000" description="BCN parity error" />
      </node>
	  <node id="l1id_good" address="0x1" permission="r" description="Latest good L1ID"/>
	  <node id="l1id_err" 	address="0x2" permission="r" description="Last incoming L1ID with parity/mismatch error"/>
	  <node id="l1id_expected" address="0x3" permission="r" description="Last expected L1ID with parity/mismatch error"/>
	  <node id="bcn_err_expected" address="0x4" permission="r" description="Last BCN with parity/mismatch error">
       <node id="bcn_incoming"       mask="0x00000FFF" description="Incoming BCN" />
       <node id="bcn_expected"       mask="0x0FFF0000" description="Expected BCN" />
       <node id="bcn_mismatch"       mask="0x40000000" description="BCN mismatch" />
       <node id="bcn_error"       mask="0x80000000" description="BCN parity error" />
      </node>
	  <node id="l1id_parity_err_cnt" 	address="0x5" permission="r" description="L1ID parity error count"/>
	  <node id="l1id_mismatch_cnt" address="0x6" permission="r" description="L1ID mismatch count"/>
	  <node id="bcn_parity_err_cnt" address="0x7" permission="r" description="BCN parity error count"/>
	  <node id="bcn_mismatch_cnt" address="0x8" permission="r" description="BCN mismatch count"/>
  </node>

  <node id="tob" module="file://efex_tob_readout.xml" address="0x2000"/>

  <node id="raw" module="file://efex_raw_readout.xml" address="0x4000"/>

</node>
