source: firmware/FAD/doc/memory_manager.tex @ 10150

Last change on this file since 10150 was 10150, checked in by neise, 9 years ago
added Xilinx device DNA to Eventpackage Header - doc
  • Property svn:executable set to *
File size: 12.4 KB
Line 
1\documentclass[a4paper,twoside]{article}
2
3\setlength{\topmargin}{0mm}  %1 inch is always there!
4\setlength{\oddsidemargin}{0mm}  %1 inch is always there!
5\setlength{\evensidemargin}{0mm}  %1 inch is always there!
6
7\setlength{\textwidth}{16cm} 
8\setlength{\textheight}{25cm} 
9
10
11\setlength{\headheight}{0mm} 
12\setlength{\headsep}{0mm}
13 
14\usepackage[T1]{fontenc}
15\usepackage[utf8]{inputenc}
16
17\usepackage{graphicx} % for pictures
18\usepackage{float} % for figures (english)
19\restylefloat{figure}
20\restylefloat{table}
21
22\usepackage{arydshln}
23
24\title{FAD Data Generation}
25\author{D. Neise}
26\date{08.02.2011}
27
28\begin{document}
29
30\maketitle
31\tableofcontents
32\newpage
33
34
35\section{data order in 64bit address space}
36
37When data is input into Data-RAM by the DataGenerator, the data is fed in as words of 64bit.
38
39Each Event constists of an EventHeader, the so called ChannelData, and a small EventFooter.
40Figure (\ref{64bitRAM}) shows how the data is stored as 64bit words in the DataRAM.
41Assume the Event Start-Address beeing {\tt 0x2000} and each package of ChannelData consists 100 samples.
42\\ \\
43%\emph{Erklaeren, dass auch wenn nur ein channel kleiner ist, die selbe Anzahl Daten versendet wird.}
44
45
46\begin{table}[htbp]
47\begin{tabular}{||l||l|l|l|l||l||} 
48\hline
49address & word 3 & word 2 & word 1 & word 0 & description \\
50\hline
510x2000  & 0x0000 & version      & length & 0xFB01       & Header        \\ 
520x2001  & 0x0000 & TRG ID 45    & EVT cntr 10   & EVT cntr 32   & Externl trigger ID\\
530x2002  & 0x0000 & TRG ID 45    & EVT cntr 10   & EVT cntr 32   & Internal trigger ID\\
540x2003  & 0x0000        & 0x0000        & 0x0000        & 0x0(cid)8(bid)        & Board ID      \\
550x2004  & Temp 3        & Temp 2        & Temp 1        & Temp 0        & Temperatures \\
560x2005  & DAC 3 & DAC 2 & DAC 1 & DAC 0 & DAC values part 1     \\
570x2006  & DAC 7 & DAC 6 & DAC 5 & DAC 4 & DAC values part 2     \\
58\hline
590x2007  & 0x0030        & 0x0020        & 0x0010        & 0x0000        & chip-n-channel ID (group 0) \\
600x2008  & trg pos 3     & trg pos 2     & trg pos 1     & trg pos 0     & DRS stop positions \\
610x2009  & ROI 3 & ROI 2 & ROI 1 & ROI 0 & width of region of interest \\
620x200A  & data adc3     & data adc2     & data adc1     & data adc0     & ADC Data start of ROI \\
630x20..  &&&&& ... \\
640x206D  & data adc3     & data adc2     & data adc1     & data adc0     & ADC Data end of ROI \\
65\hline
660x206E  & 0x0031        & 0x0021        & 0x0011        & 0x0001        & chip-n-channel ID (group 1) \\
670x206F  & trg pos 3     & trg pos 2     & trg pos 1     & trg pos 0     & DRS stop positions \\
680x2070  & ROI 3 & ROI 2 & ROI 1 & ROI 0 & width of region of interest \\
690x2071  & data adc3     & data adc2     & data adc1     & data adc0     & ADC Data start of ROI \\
700x20..  &&&&& ... \\
710x20D4  & data adc3     & data adc2     & data adc1     & data adc0     & ADC Data end of ROI \\
72\hline
730x20..  &&&&& ... \\
74\hline
750x233F  & 0x0039        & 0x0029        & 0x0019        & 0x0009        & chip-n-channel ID (group 9) \\
760x2340  & trg pos 3     & trg pos 2     & trg pos 1     & trg pos 0     & DRS stop positions \\
770x2341  & ROI 3 & ROI 2 & ROI 1 & ROI 0 & width of region of interest \\
780x2342  & data adc3     & data adc2     & data adc1     & data adc0     & ADC Data start of ROI \\
790x23..  &&&&& ... \\
800x23A5  & data adc3     & data adc2     & data adc1     & data adc0     & ADC Data end of ROI \\
81\hline
820x23A6  & 0x0000        & 0x0000        & 0x04FE        & 0x4242        & FOOTER \\
83\hline
84\end {tabular}
85
86\caption{word order of event in Data RAM. 64bit addressing. As of 08.02.2011}
87\label{64bitRAM}
88\end{table}
89
90
91During DRS readout and data digitzation, the Trigger ID is coming in through RS485 interface from FTM board.
92The Trigger ID reciption takes about $40 {\mu}$s. Therefor the 2 words containing Trigger information in the EventHeader are
93left empty in the first place. The digitazed analog data is read in as quickly as possible. Only after finishing the Readout,
94the Trigger ID is filled into the EventHeader.
95Then the EventFooter is added and the Readout is finished.
96
97\newpage
98\section{data order in 16bit address space}
99
100After an Event is stored in data RAM, is is ready to be read out by {\tt w5300 modul.vhd}.
101Since the FIFOs of FADs W5300 ethernet controller are of 16bit width, data is read out of the dataRAM
102as 16bit words. Empty 16bit words are left out.
103
104The following table shows how the data is ordered inside data RAM, when accessed in 16bit address space
105
106\begin{table}[htbp]
107\begin{tabular}{|l|l|l|}
108\hline
109address & 16bit word & description \\
110\hline
1110x8000  & 0xFB01        & Start Flag - fix value \\
1120x8001  & 0xllll        & package length in 16bit words \\
1130x8002  & 0xvvvv        & version - deduced from SVN revision number \\
1140x8004  & EVT cntr 32 & trigger ID upper word \\
1150x8005  & EVT cntr 10 & trigger ID lower word \\
1160x8006  & 0xAA55 & trigger type and CRC-fake \\
1170x8008  & EVT cntr 32 & trigger ID upper word \\
1180x8009  & EVT cntr 10 & trigger ID lower word \\
1190x800A  & 0xAA55 & trigger type and CRC-fake \\
1200x800C  & 0x0(cid)8(bid) & Board ID \\
1210x8010  & 0xttt0        & temperature sensor next to DRS 0 \\
1220x8011  & 0xttt1        & temperature sensor next to DRS 1 \\
1230x8012  & 0xttt2        & temperature sensor next to DRS 2 \\
1240x8013  & 0xttt3        & temperature sensor next to DRS 3 \\
1250x8014  & 0xdac0        & setting of DAC channel A \\
1260x8015  & 0xdac1        & setting of DAC channel B \\
1270x8016  & 0xdac2        & setting of DAC channel C \\
1280x8017  & 0xdac3        & setting of DAC channel D \\
1290x8018  & 0xdac4        & setting of DAC channel E \\
1300x8019  & 0xdac5        & setting of DAC channel F \\
1310x801A  & 0xdac6        & setting of DAC channel G \\
1320x801B  & 0xdac7        & setting of DAC channel H \\
133\hline
1340x801C  & 0x0000 & DRS 0 - channel 0 \\
1350x8020  & trg pos 0     & DRS 0 stop position \\
1360x8024  & ROI 00        & ROI width of this channel \\
1370x8028  & adc data 0& ADC data start \\
1380x8...  & ...           & ...data ... \\
1390x81B4  & adc data ROI-1 &      ADC data stop\\
140\hline
1410x801D  & 0x0010 & DRS 1 - channel 0 \\
1420x8021  & trg pos 1     & DRS 1 stop position \\
1430x8025  & ROI 10        & ROI width of this channel \\
1440x8029  & adc data 0& ADC data start \\
1450x8...  & ...           & ...data ... \\
1460x81B5  & adc data ROI-1 &      ADC data stop\\
147\hline
1480x8...  & ...           & ...data ... \\
149\hline
1500x8CFC  & 0x0039 & DRS 3 - channel 9 \\
1510x8D03  & trg pos 3     & DRS 3 stop position \\
1520x8D07  & ROI 39        & ROI width of this channel \\
1530x8D0B  & adc data 0& ADC data start \\
1540x8...  & ...           & ...data ... \\
1550x8E97  & adc data ROI-1 &      ADC data stop\\
156\hline
1570x8E98  & 0x4242                & packet CRC-fake \\
1580x8E99  & 0x04FE                & End Flag \\
159\hline
160\end {tabular}
161
162\caption{word order of event in Data RAM. 16bit addressing. As of 08.02.2011}
163\label{16bitRAM}
164\end{table}
165
166As one can see, the way of reading out of the RAM changes, from header to data section and again when data section ends.
167When reading the header, the addresses are increased by 1 usually and only jumps, when empty words show up in the RAM.
168One can picture it as if reading the words in each line from right to left, sometimes jumping over zeroes.
169When reading out the data sections, the words are read out as columns, i.e. addresses are incremented by 4 usually. One column is read until the data of a channel is completely read out, then either the next DRS chip is read out, which means to decrease the address or, if one group of channels was finished, the next group starts, which means address is increased by 1 only.
170The footer consisting of the CRC-16 (when finally implemented) and the end package flag is again read out by reading each word from right to left.
171
172
173\newpage
174\section{NEW data order}
175
176Some data is going to be added to the Event header changing the data order like this.
177
178\begin{table}[htbp]
179\begin{tabular}{||l||l|l|l|l||} 
180\hline
181address & word 3 & word 2 & word 1 & word 0 \\
182\hline
1830x2000  & 12bit status + PLLLOCK & version      & length & 0xFB01       \\ 
1840x2001  & 0xT1T0 & 0xT3T2       & 0xT5T4 & 0x00T6       \\
1850x2002  & REFCLK cntr 10 & REFCLK cntr 32 & EVT cntr 10 & EVT cntr 32   \\
1860x2003  & TRG-GEN-DIV   & TRG-GEN-No    & DCM-PS-STATUS         & 0x0(cid)8(bid)        \\
1870x2004  & DNA10                 & DNA32                 & DNA54                         & 0x00DNA6      \\
1880x2005  & more status   & more status   & time10        & time32        \\
1890x2006  & Temp 3        & Temp 2        & Temp 1        & Temp 0        \\
1900x2007  & DAC 3 & DAC 2 & DAC 1 & DAC 0 \\
1910x2008  & DAC 7 & DAC 6 & DAC 5 & DAC 4 \\
192\hline
1930x2009  & 0x0030        & 0x0020        & 0x0010        & 0x0000        \\
1940x200A  & trg pos 3     & trg pos 2     & trg pos 1     & trg pos 0     \\
1950x200B  & ROI 3 & ROI 2 & ROI 1 & ROI 0 \\
1960x200C  & data adc3     & data adc2     & data adc1     & data adc0     \\
1970x20..  &&&& ... \\
1980x206F  & data adc3     & data adc2     & data adc1     & data adc0     \\
199\hline
2000x20..  &&&& ... \\
201\hline
2020x23??  & 0x0039        & 0x0029        & 0x0019        & 0x0009        \\
2030x23??  & trg pos 3     & trg pos 2     & trg pos 1     & trg pos 0     \\
2040x23??  & ROI 3         & ROI 2         & ROI 1         & ROI 0 \\
2050x23??  & data adc3     & data adc2     & data adc1     & data adc0     \\
2060x23..  &&&& ... \\
2070x23??  & data adc3     & data adc2     & data adc1     & data adc0     \\
208\hline
2090x23??  & 0x0000        & 0x0000        & 0x04FE        & 0x4242\\
210\hline
211\end {tabular}
212\caption{NEW word order of event in Data RAM. 64bit addressing. As of > 08.02.2011}
213\label{new64bitRAM}
214\end{table}
215
216A detailed description is given after, next table.\\
217
218\newpage
219Which in turn changes the the word order in the 16bit address space like this
220\begin{table}[htbp]
221\begin{tabular}{|l|l|l|}
222\hline
223address & 16bit word & description \\
224\hline
2250x8000  & 0xFB01        & Start Flag - fix value: "FB01" \\
2260x8001  & 0xllll        & package length in 16bit words \\
2270x8002  & 0xvvvv        & version - deduced from SVN revision number \\
2280x8003  & 0xsssP        & 12 bits for status - TBD - 4 bit showing PLLLCK status \\ 
229\hdashline
2300x8004  & 0x00T6        & FTM trigger ID byte 6 : CRC \\
2310x8005  & 0xT5T4        & ... bytes 5 and 4 : Type 2 and Type 1\\
2320x8006  & 0xT3T2        & ... bytes 3 and 2     : TRG number high word \\
2330x8007  & 0xT1T0        & ... bytes 1 and 0 : TRG number low word \\ 
234\hdashline
2350x8008  & 0xev32        & FAD event counter high word \\
2360x8009  & 0xev10        & FAD event counter low word -- should be equal to T3T2T1T0\\
2370x800A  & 0xRC32        & REFCLK counter high word \\
2380x800B  & 0xRC10        & REFCLK counter low word \\ 
239\hdashline
2400x800C  & 0x0(cid)8(bid) & Board ID \\
2410x800D  & DCM-PS        & status of ADC clock phase shifter , value and locked-bit\\
2420x800E  & TRG-GEN-No& Number of Triggers to generare, when 'trigger continous' issued \\
2430x800F  & TRG-GEN-DIV& continous trigger generator clock prescaler \\ 
244\hdashline
2450x8010  & 0x00 DNA6     & MSB of DNA \\
2460x8011  & DNA54         & ... DNA ... \\
2470x8012  & DNA32         & ... DNA ... \\
2480x8013  & DNA10         & LSB of DNA \\
249\hdashline
2500x8014  & timer32       & timer high word \\
2510x8015  & timer10       & timer low word \\
2520x8016  & more status1 & reserved for status info; high word \\
2530x8017  & more status0 & reserved for status info; low word \\ 
254\hdashline
2550x8018  & 0xttt0        & temperature sensor next to DRS 0 \\
2560x8019  & 0xttt1        & temperature sensor next to DRS 1 \\
2570x801A  & 0xttt2        & temperature sensor next to DRS 2 \\
2580x801B  & 0xttt3        & temperature sensor next to DRS 3 \\ 
259\hdashline
2600x801C  & 0xdac0        & setting of DAC channel A \\
2610x801D  & 0xdac1        & setting of DAC channel B \\
2620x801E  & 0xdac2        & setting of DAC channel C \\
2630x801F  & 0xdac3        & setting of DAC channel D \\ 
264\hdashline
2650x8020  & 0xdac4        & setting of DAC channel E \\
2660x8021  & 0xdac5        & setting of DAC channel F \\
2670x8022  & 0xdac6        & setting of DAC channel G \\
2680x8023  & 0xdac7        & setting of DAC channel H \\ 
269\hline
2700x8...  & ...           & ...data ... \\
271\hline
272
273\end {tabular}
274\caption{word order of event in Data RAM. 16bit addressing. As of > 08.02.2011}
275\label{16bitRAM}
276\end{table}
277This new order has several advantages apart from the additional information included.
278All data may be treated as 64bit aligned. And the data readout process does not need jump over words during data sending.
279
280
281\newpage
282\subsection{new {\tt FADFormat.h}}
283
284\begin{verbatim}
285typedef struct {
286        // ------------------------------
287        unsigned short start_package_flag;
288        unsigned short package_length;
289        unsigned short version_no;
290        unsinged short PLLLCK;
291        // ------------------------------
292        unsigned short trigger_crc;
293        unsigned short tigger_type;
294        unsigned long trigger_id;
295        // ------------------------------
296        unsigned long fad_evt_counter;
297        unsigned long REFCLK_frequency;
298        // ------------------------------
299        unsigned short board_id;
300        unsigned short adc_clock_phase_shift;
301        unsgined short number_of_triggers_to_generate;
302        unsigned short trigger_generator_prescaler;
303        // ------------------------------
304        unsigned char reserved;
305        unsigned char DNA[7];   // '1' & 55 unique bits of Xilinx DNA   
306        // ------------------------------
307        unsigned long time;
308        unsigned long fad_status;
309        // ------------------------------
310        short drs_temperature[NTemp];
311        // ------------------------------       
312        unsigned short dac[NDAC];
313        // ------------------------------
314}  __attribute__((__packed__)) PEVNT_HEADER;
315
316typedef struct {
317        unsigned short id;
318        unsigned short start_cell;
319        unsigned short roi;
320        unsigned short adc_data[];
321}  __attribute__((__packed__)) PCHANNEL;
322
323typedef struct {
324        unsigned short package_crc;
325        unsigned short end_package_flag;
326}  __attribute__((__packed__)) PEVNT_FOOTER;
327\end{verbatim} 
328
329
330\end{document}
Note: See TracBrowser for help on using the repository browser.