% TEXINPUTS=.:$HOME/git/bvtex: latexmk  -pdf <main>.tex
\documentclass[xcolor=dvipsnames]{beamer}

\input{defaults}
\input{beamer/preamble}

\setbeamertemplate{navigation symbols}{}
% \setbeamertemplate{background}[grid][step=1cm]

\usepackage{siunitx}
\usepackage{xmpmulti}
\usepackage[export]{adjustbox}
\usepackage{ulem}
\usepackage[outline]{contour}
\usepackage{pdfpages}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{positioning}

\definecolor{bvtitlecolor}{rgb}{0.98, 0.92, 0.84}
\definecolor{bvoutline}{rgb}{0.1, 0.1, 0.1}

\renewcommand{\bvtitleauthor}{Brett Viren}
\renewcommand{\bvtit}{title}
\renewcommand{\bvtitle}{\LARGE FELIX Firmware Needs for Trigger Primitives on CPU}
\renewcommand{\bvevent}{{\small BNL DAQ WS -- July 2018}}
\renewcommand{\bvdate}{19 July 2018}
\renewcommand{\bvbeamerbackground}{}

\def\Put(#1,#2)#3{\leavevmode\makebox(0,0){\put(#1,#2){#3}}}

\begin{document}
\input{beamer/title.tex}
%\input{beamer/toc.tex}

\begin{frame}
  \frametitle{Overview}

  What extra/novel FELIX firmware is needed to support trigger
  primitive production on Front-End Computer (FEC) CPU?

  \vfill

  Note, FELIX F/W to support DPM will be covered during dedicated DPM
  sessions.

  \vfill

  \begin{itemize}
  \item<2>[] This topic here is not complete.
  \end{itemize}

\end{frame}

\begin{frame}
  \frametitle{Basic f/w requirements for FELIX}
  \includegraphics[width=\textwidth]{fec2.pdf}

  \begin{itemize}\footnotesize
  \item Receive data from WIBs
  \item DMA transfer two data streams to host PC RAM
    \begin{description}\footnotesize
    \item[trigger stream] collection channels only (3/8 of total).
    \item[buffer stream] all channels.
    \end{description}
  \end{itemize}
\end{frame}


\begin{frame}
  \frametitle{Trigger Stream F/W Requirements}
  \begin{itemize}
  \item Included in FELIX+CPU and FELIX+DPM \textbf{nominal} designs.
  \item Only collection channels (3/8 of total).
  \item Includes some data preparation by FELIX firmware.
  \item Channel-major per-tick vectors,
  \item Channel-order matching the wire order along the APA face.
  \item One stream of 480 channel vectors for each APA face.
  \item 12 bit $\to$ 16 bit inflation and 32 bit alignment in RAM
    (to be AVX2-friendly)
  \item Likely could have FELIX f/w apply the rolling baseline
    subtraction.
  \end{itemize}
\end{frame}


\begin{frame}
  \frametitle{Buffer Stream F/W Requirements}
  \begin{itemize}
  \item Nominally just for FELIX+CPU, but maybe consider a hybrid
    where DPM does full-time compression on this stream?
  \item Full-stream data with WIB's 10b/8b encoding removed.
  \item No processing needed.
  \item No RAM alignment requirements.
  \item Except data must be placed in RAM to allow it to be
    tick-addressable.
    \begin{itemize}\footnotesize
    \item[o] Channel-major per-tick vectors.    
    \end{itemize}

  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Stretch goals for FELIX (or DPM) FPGA?}
  Can we do more of trigger processing on FPGA?

  \vfill

  The basic pipeline, in order:

  \begin{enumerate}
  \item Rolling baseline calculation and subtraction.
  \item \textbf{Excess noise removal.}
  \item Rolling noise level calculation (RMS) 
  \item Per-channel ADC and time over threshold accumulators.
  \end{enumerate}

  \vfill

  \footnotesize
  The problem with pushing this onto FPGA (as I see it) \textbf{excess
    noise removal} will require non-trivial and time/space varying
  algorithms which make firmware implementation too difficult.

\end{frame}

\begin{frame}
  \frametitle{Timing Sync and Other Checks}
  Not related to trigger primitives on CPU, per se:
  \begin{itemize}
  \item What checks can/should be done in FELIX firmware to peek at
    the WIB streams to check they are as expected?

  \item Eg, to check for, eg the protoDUNE inter-WIB timing issue.

  \item What about TPC vs PDS timing?
    
  \item Is it enough to do this with a one-time offline data check
    during commissioning?

  \item Are there fixed patterns emitted from FEMB and WIBs that
    should be checked by FELIX?
  \end{itemize}
\end{frame}


\end{document}


%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
