Difference: AMC13DataUnpacking (1 vs. 4)

Revision 402 Jun 2014 - EricHazen

Line: 1 to 1
 
META TOPICPARENT name="AMC13CommonFirmwareProposal"
From CMS firmware 0x202 and onward the new event builder seems to be working.
Line: 27 to 27
 The last block can be identified by noticing that the bits (M,S)=(0,1) in the AMC information words in the block header.
Changed:
<
<
Here are Wu's instructions for unpacking the data.
>
>
Here are Wu's instructions for unpacking the data:

Data decoding

The first word of an event always has the MSB byte as 0x51 or 0x52
The next word is the start of block word. Nibble 53-50 gives number of AMC modules with data in this
block.(nAMC)
Following the start of block word are nAMC words of AMC summary. If bit 61 of the AMC summary word
(M bit) is not set, bit 55-32 has the actual number of words this AMC module in the block. If M bit
is set, number of words is always 4096 64 bit words. Summing them up gives the AMC payload size.
If none of the M bit is set, this is the last block of the event.
For a single block event, the event size is payload size + nAMC + 4
For a multi block event, the event size of the first block is payload size + nAMC + 3
For a multi block event, the event size of the block in the middle is payload size + nAMC + 2
For a multi block event, the event size of the last block is payload size + nAMC + 3
nAMC is given in the start of block word and could be different for blocks in the same event.
Bit 63-32 of the end of block word is the CRC of the block. CRC used is the Ethernet CRC-32
Please note that CRC calculation does not include the CDF end of event word.
To check the CRC of a block, first initialize the CRC to all 0.
CRC calculation is from bit 0 upwards to bit 63. The first 4 bytes of data use their 1's complement
(invert) in the CRC calculation, the rest of data will be used as is. CRC attached to the block(bit
63-32 of the block trailer) will also be included in the CRC check calculation. The final CRC value
must be 0xc704dd7b, otherwise there is an error in the block.
The polynomial is 
1 + x + x^2 + x^4 + x^5 + x^7 + x^8 + x^10 + x^11 + x^12 + x^16 +x^22 + x^23 +x^26 +x^32

How to get the total length of the event: (this requires every AMC has its length in the header)

1. get nAMC(number of AMC modules in the event) from bit 53-50 of the second word(first block header)
2. read nAMC words of AMC summary to get length(i) of each AMC and do the following calculation:
   Nblock(i) = intger((length(i)-1023)/4096) + 1
3. find the biggest Nblock(i) NblockMax = max(Nblock(i))
4. TotalLength = sum(length(i)) + sum(Nblock(i)) + NblockMax*2 + 2
  -- EricHazen - 26 May 2014 \ No newline at end of file

Revision 329 May 2014 - EricHazen

Line: 1 to 1
 
META TOPICPARENT name="AMC13CommonFirmwareProposal"
From CMS firmware 0x202 and onward the new event builder seems to be working.
Line: 27 to 27
 The last block can be identified by noticing that the bits (M,S)=(0,1) in the AMC information words in the block header.
Changed:
<
<
Here are Wu's instructions for unpacking the data.
>
>
Here are Wu's instructions for unpacking the data.
  -- EricHazen - 26 May 2014

Revision 227 May 2014 - EricHazen

Line: 1 to 1
 
META TOPICPARENT name="AMC13CommonFirmwareProposal"
From CMS firmware 0x202 and onward the new event builder seems to be working.
Line: 27 to 27
 The last block can be identified by noticing that the bits (M,S)=(0,1) in the AMC information words in the block header.
Changed:
<
<
>
>
Here are Wu's instructions for unpacking the data.
  -- EricHazen - 26 May 2014 \ No newline at end of file

Revision 126 May 2014 - EricHazen

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="AMC13CommonFirmwareProposal"
From CMS firmware 0x202 and onward the new event builder seems to be working.

Here is an example of how to generate a fake multi-block event and unpack it.

To initialize the AMC13 for internal triggers, TTC loop-back and fake data, with two AMC inputs enabled:

  AMC13Tool:
    i 0-1 f l t            initialize
    wv 0x18 0x3800         set fake event size to 0x3800 64-bit words
    lt 1                   generate one trigger

Fake events contain 0x3800 64-bit words of data plus 3 extra words (two header and one trailer) generated by the AMC13. The block size is 0x1000 words, so these events will require 3 blocks.

To read data from the AMC13, first read the word count from Kintex offset 0xd (in 32-bit words). Then read that many words from the buffer at offset 0x20000. Then write any data to offset 0xc, which advances to the next page of the buffer.

Currently each block of a multi-block event is in one SDRAM page. The last block can be identified by noticing that the bits (M,S)=(0,1) in the AMC information words in the block header.

-- EricHazen - 26 May 2014

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback