Index: firmware/FAD/doc/memory_manager.tex
===================================================================
--- firmware/FAD/doc/memory_manager.tex	(revision 10155)
+++ firmware/FAD/doc/memory_manager.tex	(revision 10156)
@@ -179,35 +179,35 @@
 \begin{tabular}{||l||l|l|l|l||} 
 \hline
-address & word 3 & word 2 & word 1 & word 0 \\
-\hline
-0x2000 	& 12bit status + PLLLOCK & version	& length & 0xFB01	\\  
-0x2001	& 0xT1T0 & 0xT3T2 	& 0xT5T4 & 0x00T6 	\\
-0x2002	& REFCLK cntr 10 & REFCLK cntr 32 & EVT cntr 10	& EVT cntr 32	\\
-0x2003	& TRG-GEN-DIV	& TRG-GEN-No	& DCM-PS-STATUS 	& 0x0(cid)8(bid)	\\
-0x2004	& DNA10			& DNA32			& DNA54				& 0x00DNA6	\\
-0x2005	& more status	& more status	& time10	& time32 	\\
-0x2006	& Temp 3	& Temp 2	& Temp 1	& Temp 0	\\
-0x2007	& DAC 3	& DAC 2	& DAC 1	& DAC 0	\\
-0x2008	& DAC 7	& DAC 6	& DAC 5	& DAC 4	\\
-\hline
-0x2009	& 0x0030	& 0x0020	& 0x0010	& 0x0000	\\
-0x200A	& trg pos 3	& trg pos 2	& trg pos 1	& trg pos 0	\\
-0x200B	& ROI 3	& ROI 2	& ROI 1	& ROI 0	\\
-0x200C	& -fill- & -fill- & -fill- & -fill-  \\
-0x200D	& data adc3	& data adc2	& data adc1	& data adc0	\\
-0x20..  &&&& ... \\
-0x2070	& data adc3	& data adc2	& data adc1	& data adc0	\\
-\hline
-0x20..  &&&& ... \\
-\hline
-0x23??	& 0x0039	& 0x0029	& 0x0019	& 0x0009	\\
-0x23??	& trg pos 3	& trg pos 2	& trg pos 1	& trg pos 0	\\
-0x23??	& ROI 3		& ROI 2		& ROI 1		& ROI 0	\\
-0x23??	& -fill- & -fill- & -fill- & -fill-  \\
-0x23??	& data adc3	& data adc2	& data adc1	& data adc0	\\
-0x23..  &&&& ... \\
-0x23??	& data adc3	& data adc2	& data adc1	& data adc0	\\
-\hline
-0x23??	& 0x0000	& 0x0000	& 0x04FE	& 0x4242\\
+address & word 3					& word 2				& word 1			& word 0			\\
+\hline
+0x2000 	& 12bit status + PLLLOCK 	& version				& length			& 0xFB01			\\
+0x2001	& 0xT1T0 					& 0xT3T2 				& 0xT5T4			& 0x00T6 			\\
+0x2002	& REFCLK cntr 10 			& REFCLK cntr 32		& EVT cntr 10		& EVT cntr 32		\\
+0x2003	& TRG-GEN-DIV				& TRG-GEN-No			& DCM-PS-STATUS 	& 0x0(cid)8(bid)	\\
+0x2004	& DNA10						& DNA32					& DNA54				& 0x00DNA6			\\
+0x2005	& more status				& more status			& time10			& time32 			\\
+0x2006	& Temp 3					& Temp 2				& Temp 1			& Temp 0			\\
+0x2007	& DAC 3						& DAC 2					& DAC 1				& DAC 0				\\
+0x2008	& DAC 7						& DAC 6					& DAC 5				& DAC 4				\\
+\hline			
+0x2009	& 0x0030					& 0x0020				& 0x0010			& 0x0000			\\
+0x200A	& trg pos 3					& trg pos 2				& trg pos 1			& trg pos 0			\\
+0x200B	& ROI 3						& ROI 2					& ROI 1				& ROI 0				\\
+0x200C	& -fill- 					& -fill-				& -fill-			& -fill-			\\
+0x200D	& data adc3					& data adc2				& data adc1			& data adc0			\\
+0x20..  & ...						& ...					& ...				& ... 				\\
+0x2070	& data adc3					& data adc2				& data adc1			& data adc0			\\
+\hline			
+0x20..  & ...						& ...					& ...				& ... 				\\
+\hline			
+0x23??	& 0x0039					& 0x0029				& 0x0019			& 0x0009			\\
+0x23??	& trg pos 3					& trg pos 2				& trg pos 1			& trg pos 0			\\
+0x23??	& ROI 3						& ROI 2					& ROI 1				& ROI 0				\\
+0x23??	& -fill-					& -fill-				& -fill-			& -fill-			\\
+0x23??	& data adc3					& data adc2				& data adc1			& data adc0			\\
+0x23..  & ...						& ...					& ...				& ... 				\\
+0x23??	& data adc3					& data adc2				& data adc1			& data adc0			\\
+\hline			
+0x23??	& 0x0000					& 0x0000				& 0x04FE			& 0x4242			\\
 \hline
 \end {tabular}
@@ -357,7 +357,45 @@
 channels in the W5300 FIFO. The header is included into the group of channels 0, while the package footer is included into group of channels 9.
 
-In the next state called FIFO CALC. Here 
-
-
+\subsubsection{state: MM CONFIG}
+Here all local variables are reset to zero. Let me shortly explain the meaning of each of them:
+\begin{table}[htbp]
+\begin{tabular}{lll} 
+	roi\_max\_array 		& array (0 to 8) of integer range 0 to 1024 					& maximum for each channel group\\
+	channel\_size			& array (0 to 8) of integer range 0 to W5300\_TX\_FIFO\_SIZE 	& size of each channel group in 16b words \\
+	fifo\_write\_length		& array (0 to 8) of integer range 0 to W5300\_TX\_FIFO\_SIZE	& similar ??? \\
+	fifo\_channels\_array	& array (0 to 8) of integer range 0 to 9						& ??? \\
+	\hline \\
+	event_size				& integer range 0 to RAM\_SIZE\_16B								& ???\\
+	event_size_ram			& integer range 0 to RAM\_SIZE\_16B								& ???\\
+	event_size_ram_64b		& integer range 0 to RAM\_SIZE\_64B								& ??? \\
+\end {tabular}
+\caption{ -no caption- -no label-}
+%\label{}
+\end{table}
+
+The input is only:
+\begin{table}[htbp]
+\begin{tabular}{lll} 
+	roi\_array		 		& array (0 to 35) of integer range 0 to 1024 					& ROI of each channel\\
+\end {tabular}
+\caption{ -no caption- -no label-}
+%\label{}
+\end{table}
+
+\subsubsection{states: MAX ROI\bf{n} and state: FIFO\_CALC} 
+\begin{itemize}
+\item find maxium in roi\_array for each channel and store it as the maximum roi of each channel group inside roi\_max\_array.
+\item calculate channel\_size(n) as $sum_{drs=0}^{3} \left( roi_{drs,n} + CHANNEL\_HEADER\_SIZE \right)$. 
+For $n=0$ the size of the package header is added and for $n=8$ the size of the package footer is added to the channel\_size.
+So channel\_size(n) stores the number of 16bit words, which will be transmitted over ethernet for this particular group of channels n. \\
+Note: this is not the number of 16bit words, which will be stored inside the internal data RAM, since this number is defined by the maximum roi of each channel group.
+\item calculate into how many pieces the package need to be devided. fifo\_write\_length(m) contains a certain sum of channel\_sizes. So again
+fifo\_write\_length is a size measures in 16bit words, which will actually be transmitted over ethernet. 
+\end{itemize}
+
+
+\subsubsection{states: RAM\_CALC\bf{n}}
+Here we need to know how many of these packages will fit into our data RAM. 
+There 		
 
 \end{document}
