\begin{tikzpicture}[circuit logic US, scale=0.8, ampersand replacement=\&]

  \cfsr{3}{1,0,1}

%%Kompatibilita mezi babel a TIKZ |-
%\shorthandoff{-}
%
%  \def\N{3}
%  \def\POLYNOM{1,0,1} %Prvni 1 se neuvadi
%
%  %Construct DFLOPS in row
%  \foreach \m in {1,...,\N}
%    \node [shape=dff] (DFF\m) at ( $ 4*(\m-1,0)$ ) {};
%
%  %Connect to shift register
%  \def\p{1}
%  \foreach \m in {2,...,\N}{
%    \draw [-] (DFF\p.Q) -- (DFF\m.D);
%    \global\let\p\m
%  }
%
%  % Clock port 
%  \path (DFF1) +(-3cm,-2.5cm) coordinate (temp)
%    node [anchor=east] {clock};
%  \foreach \m in {1,...,\N} {
%    \ifthenelse{\equal{\m}{\N}}{
%      \draw [-] (temp) -- ( $ (temp -| DFF\m.CLK) + (-5mm,0)$) |- (DFF\m.CLK);
%    }{
%      \draw [-] (temp) to [short,-*] ( $ (temp -| DFF\m.CLK) + (-5mm,0)$) |- (DFF\m.CLK);
%    }
%  }
%
%  %XOR
%  \def\XORINP{}
%  \foreach \m in \POLYNOM{
%    \ifthenelse{\equal{\m}{0}}{}{
%      \global\edef\XORINP{\XORINP{}n}
%    }
%  }
%  \def\XORINP{nnnn}
%  \node [xor gate,inputs={\XORINP} ,point left] (XOR) at (0,-4) {};
%
%  %Output XOR
%  \node [xor gate, inputs=nn, point left] (CFSR_XOR) at (-2, -4.25) {};
%  \draw [-] (XOR.output) -- ++ (left:5mm) |- (CFSR_XOR.input 2);
%
%  %OR gate
%  \node [nor gate, inputs=nn, point left] (OR) at (0, -6) {};
%  \foreach \m in {1,...,\numexpr\N-1\relax}
%    \draw [-]  (DFF\m.Q) to [short,-*] ++ (right:5mm) circle |- (OR.input \m);
%  \draw [-] (OR.output)  -- ++ (left:5mm) |- (CFSR_XOR.input 1); 
%
%  %XOR output
%  \draw [-] (CFSR_XOR.output) -- ++(left:2mm) |- (DFF1.D);
%
%
%  %Generate feedback connections
%%  \newcounter{cnt}
%  \setcounter{cnt}{0}
%%  \newcounter{inpcnt}
%  \setcounter{inpcnt}{0}
%
%  \foreach \m in \POLYNOM{
%    \addtocounter{cnt}{1}
%
%    \ifthenelse{\equal{\m}{0}}{}{
%      \addtocounter{inpcnt}{1}
%  
%      \ifthenelse{\equal{\thecnt}{\N}}{    
%        \draw [-] (DFF\thecnt.Q) --  ++(right:5mm) |- (XOR.input \theinpcnt);
%      }{
%        \draw [-] (DFF\thecnt.Q) to [short, -*]  ++(right:5mm) 
%                                 to [short, -*] ($ (XOR.input \theinpcnt -| DFF\thecnt.Q) + (5mm,0)$)
%                                 -- (XOR.input \theinpcnt);
%      }
%    }
%  }
\end{tikzpicture}
