OpenCores
URL https://opencores.org/ocsvn/present/present/trunk

Subversion Repositories present

[/] [present/] [trunk/] [Decode/] [doc/] [src/] [present_decode.tex] - Diff between revs 16 and 20

Show entire file | Details | Blame | View Log

Rev 16 Rev 20
Line 5... Line 5...
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
% Document variables
% Document variables
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
\docDate{ \today }
\docDate{ \today }
\docID{Present Decoder}
\docID{Present Decoder}
\docRevision{0.1}
\docRevision{0.2}
\docStatus{Draft}
\docStatus{Draft}
\docTitle{\mbox{Present Decoder}}
\docTitle{\mbox{Present Decoder}}
\authorName{\mbox{Krzysztof Gajewski} \\ and opencores.org}
\authorName{\mbox{Krzysztof Gajewski} \\ and opencores.org}
\authorURL{www.opencores.org}
\authorURL{www.opencores.org}
\authorAddress{\mbox{}}
\authorAddress{\mbox{}}
\authorEmail{gajos@opencores.org}
\authorEmail{gajos@opencores.org}
 
 
\revisionList{
\revisionList{
0.1 & all & 2014/05/25 & First draft & K. Gajewski \\
0.1 & all & 2014/05/25 & First draft & K. Gajewski \\
 
0.2 & all & 2014/09/16 & Some small corrections with the text, typos, etc. & K. Gajewski \\
}
}
 
 
\begin{document}
\begin{document}
 
 
\maketitle
\maketitle
Line 50... Line 51...
        Briefly block scheme of the PRESENT block cipher
        Briefly block scheme of the PRESENT block cipher
     }%
     }%
    \label{pAlgorithm}
    \label{pAlgorithm}
    \end{center}
    \end{center}
 \end{figure}
 \end{figure}
In subprojects \texttt{Pure} and \texttt{PureTesting} Present coder components was presented. In this project Present decoder was presented. Decoding key is firstly generated, basing on the key used for data coding. Next, input data are decoded (taking into account "inverse" direction to the presented in Fig. \ref{pAlgorithm}), and at last feeds the output. This core works with 80 bit key. Target was Xilinx\textsuperscript{\textregistered} Spartan 3E XC3S500E \cite{Spartan} on Spartan 3E  Starter Board \cite{Digilent} made by Digilent\textsuperscript{\textregistered}.
In subprojects \texttt{Pure} and \texttt{PureTesting} Present encoder components was presented. In this subproject Present decoder was presented. Decoding key is firstly generated, basing on the key used for data coding. Next, input data are decoded (taking into account "inverse" direction to the presented in Fig. \ref{pAlgorithm}), and at last feeds the output. This core works with 80 bit key. Target was Xilinx\textsuperscript{\textregistered} Spartan 3E XC3S500E \cite{Spartan} on Spartan 3E  Starter Board \cite{Digilent} made by Digilent\textsuperscript{\textregistered}.
 
 
\newpage
\newpage
 
 
\section{Interface}
\section{Interface}
 
 
Top level component of Present decoder was shown in Fig. \ref{pfdec}. All inputs and outputs are synchronous except \texttt{reset} signal and sampled at rising edge of the clock. Type for all signals is \texttt{STD\_LOGIC} or \texttt{STD\_LOGIC\_VECTOR}.
Top level component of the Present decoder was shown in Fig. \ref{pfdec}. All inputs and outputs are synchronous except \texttt{reset} signal and sampled at rising edge of the clock. Type for all signals is \texttt{STD\_LOGIC} or \texttt{STD\_LOGIC\_VECTOR}.
\begin{figure}[!ht]%
\begin{figure}[!ht]%
    \begin{center}
    \begin{center}
    \includegraphics[width=0.5\textwidth]{img/PresentFullDecoder.png}
    \includegraphics[width=0.5\textwidth]{img/PresentFullDecoder.png}
    \caption{%
    \caption{%
        Top level component of Present decoder
        Top level component of the Present decoder
     }%
     }%
    \label{pfdec}
    \label{pfdec}
    \end{center}
    \end{center}
 \end{figure}
 \end{figure}
 
 
\begin{tabularx}{\textwidth}{|p{30mm}|p{11mm}|p{11mm}|X|}
\begin{tabularx}{\textwidth}{|p{30mm}|p{11mm}|p{11mm}|X|}
  \hline \bf{Signal name} & \bf{Width} & \bf{In/Out} & \bf{Description}\\
  \hline \bf{Signal name} & \bf{Width} & \bf{In/Out} & \bf{Description}\\
  \hline \texttt{ciphertext}    & 64  &  in  & input data which have to be decoded. \\
  \hline \texttt{ciphertext}    & 64  &  in  & input data which have to be decoded. \\
  \hline \texttt{key}   & 80  &  in  & secret key used for input data decoding (the same which was used for data encoding). \\
  \hline \texttt{key}   & 80  &  in  & secret key used for input data decoding (the same which was used for data encoding). \\
  \hline \texttt{clk}   & 1  &  in  &  clock signal for the component\\
  \hline \texttt{clk}   & 1  &  in  &  clock signal for the component\\
  \hline \texttt{reset} & 1   &  in  & \emph{Asynchronous} reset signal.        \\
  \hline \texttt{reset} & 1   &  in  & \emph{asynchronous} reset signal.        \\
  \hline \texttt{start} & 1   &  in  & signal which starts decoding process. \\
  \hline \texttt{start} & 1   &  in  & signal which starts decoding process. \\
  \hline \texttt{plaintext} & 64   &  out  & decoded text output. \\
  \hline \texttt{plaintext} & 64   &  out  & decoded text output. \\
  \hline \texttt{ready} & 1   &  out  & signal informing about end of decoding process. \newline  "0" - wait until end of data decoding. \newline  "1" - data at the \texttt{ciphertext} output are valid, you can read them. \\
  \hline \texttt{ready} & 1   &  out  & signal informing about end of decoding process. \newline  "0" - wait until end of data decoding. \newline  "1" - data at the \texttt{ciphertext} output are valid, you can read them. \\
  \hline
  \hline
\end{tabularx}
\end{tabularx}
\captionof{table}{Input/Output signals of Present Decoder component}
\captionof{table}{Input/Output signals of the Present Decoder component}
 
 
\newpage
\newpage
 
 
\section{Internal structure and state machine workflow}
\section{Internal structure and state machine workflow}
 
 
\begin{figure}[!ht]%
\begin{figure}[!ht]%
    \begin{center}
    \begin{center}
    \includegraphics[width=0.8\textwidth]{img/internalStructure.png}
    \includegraphics[width=0.8\textwidth]{img/internalStructure.png}
    \caption{%
    \caption{%
        Internal datapath between main components in Present decoder.
        Internal datapath between main components in the Present decoder.
     }%
     }%
    \label{internalStructure}
    \label{internalStructure}
    \end{center}
    \end{center}
 \end{figure}
 \end{figure}
 
 
Line 114... Line 115...
     }%
     }%
    \label{presentDecSM}
    \label{presentDecSM}
    \end{center}
    \end{center}
 \end{figure}
 \end{figure}
 
 
State machine of the \texttt{PresentDec} component was shown in Fig. \ref{presentDecSM}. It consist of three states \texttt{NOP}, \texttt{SM\_START} and \texttt{READY}. The way of work of this state machine is the same as in the \texttt{Present} subproject, but the counter is counting down instead of counting up.
State machine of the \texttt{PresentDec} component was shown in Fig. \ref{presentDecSM}. It consists of three states \texttt{NOP}, \texttt{SM\_START} and \texttt{READY}. The way of work of this state machine is the same as in the \texttt{Present} subproject, but the counter is counting down instead of counting up.
 
 
\begin{figure}[!ht]%
\begin{figure}[!ht]%
    \begin{center}
    \begin{center}
    \includegraphics[width=0.5\textwidth]{img/FullDecoderSM.jpg}
    \includegraphics[width=0.5\textwidth]{img/FullDecoderSM.jpg}
    \caption{%
    \caption{%
Line 126... Line 127...
     }%
     }%
    \label{presentFullDecSM}
    \label{presentFullDecSM}
    \end{center}
    \end{center}
 \end{figure}
 \end{figure}
 
 
State machine of the \texttt{FullDecoderSM} component was shown in Fig. \ref{presentFullDecSM}. It consist of four states \texttt{NOP}, \texttt{KG\_START}, \texttt{DEC\_START} and \texttt{READY}. \texttt{NOP} is default state after resetting the core. This state is active as long as \texttt{full\_decoder\_start} = '0'.
State machine of the \texttt{FullDecoderSM} component was shown in Fig. \ref{presentFullDecSM}. It consists of four states \texttt{NOP}, \texttt{KG\_START}, \texttt{DEC\_START} and \texttt{READY}. \texttt{NOP} is the default state after resetting the core. This state is active as long as \texttt{full\_decoder\_start} = '0'.
 
 
When \texttt{full\_decoder\_start} = '1' key generation for the decoding process starts. Proper \texttt{key} and \texttt{ciphertext} must feed the input before. \texttt{KG\_START} state is active as long \texttt{PresentEncKeyGen} is generating the key. Key generation ends, when \texttt{PresentEncKeyGen} sets the \texttt{ready} signal to '1'. When the \texttt{ready} signal is set to '1', the state is changing.
When \texttt{full\_decoder\_start} = '1' key generation for the decoding process starts. Proper \texttt{key} and \texttt{ciphertext} must feed the input before. \texttt{KG\_START} state is active as long \texttt{PresentEncKeyGen} is generating the key. Key generation ends, when \texttt{PresentEncKeyGen} sets the \texttt{ready} signal to '1'. When the \texttt{ready} signal is set to '1', the state is changing.
 
 
During \texttt{DEC\_START} state decoding process appears. State machine is in this state until \texttt{PresentDec} ends its works. The end of decoding is signalled by setting the \texttt{ready} signal to '1' by the \texttt{PresentDec} component. Then, the state is changing.
During \texttt{DEC\_START} state decoding process appears. State machine is in this state until \texttt{PresentDec} ends its works. The end of decoding is signalled by setting the \texttt{ready} signal to '1' by the \texttt{PresentDec} component. Then, the state is changing.
 
 
\texttt{READY} sets the \texttt{ready} signal of the \texttt{PresentFullDecoder} to '1'. It is idle-like state, when the user can reads the output of the Present decoder. The state machine is in this state until the user sets the \texttt{full\_decoder\_start} to '0'.
\texttt{READY} state sets the \texttt{ready} signal of the \texttt{PresentFullDecoder} to '1'. It is idle-like state, when user can read the output of the Present decoder. The state machine is in this state until user sets the \texttt{full\_decoder\_start} to '0'.
 
 
\newpage
\newpage
 
 
\section{FPGA implementations}
\section{FPGA implementations}
 
 
Line 162... Line 163...
\captionof{table}{Synthesis results for Spartan 3E XC3S500E}
\captionof{table}{Synthesis results for Spartan 3E XC3S500E}
 
 
Possible change in used FPGA device may be possible in steps given below\footnotemark[1]:
Possible change in used FPGA device may be possible in steps given below\footnotemark[1]:
\begin{enumerate}
\begin{enumerate}
    \item Copy \texttt{./Decode/syn/XC3ES500/} directory to another one like \texttt{./Decode/syn/YOUR\_FPGA\_SYMBOL/}
    \item Copy \texttt{./Decode/syn/XC3ES500/} directory to another one like \texttt{./Decode/syn/YOUR\_FPGA\_SYMBOL/}
    \item Go to \texttt{./Decode/syn/XC3ES500/}  directory.
    \item Go to \texttt{./Decode/syn/YOUR\_FPGA\_SYMBOL/}  directory.
    \item In \texttt{PresentEnc.xst} file modify the line \texttt{-p xc3s500e-5-fg320} to \texttt{-p YOUR\_FPGA\_SYMBOL}
    \item In \texttt{PresentFullDecoder.xst} file modify the line \texttt{-p xc3s500e-5-fg320} to \texttt{-p YOUR\_FPGA\_CODE}
    \item In \texttt{Makefile} file modify the line \texttt{PLATFORM=xc3s500e-fg320-5} to \texttt{PLATFORM=YOUR\_FPGA\_SYMBOL}
    \item In \texttt{Makefile} file modify the line \texttt{PLATFORM=xc3s500e-fg320-5} to \texttt{PLATFORM=YOUR\_FPGA\_CODE}
\end{enumerate}
\end{enumerate}
 
 
\footnotetext[1]{This solution was not tested and is based on my own observations. Additional care should be taken with *.UCF files. You can make this modifications on your own risk}
\footnotetext[1]{This solution was not tested and is based on my own observations.}
 
 
 
 
\newpage
\newpage
 
 
\section{Simulation}
\section{Simulation}
 
 
Self-checking test bench were provided to the components used for Present encoder. They are stored in \texttt{./Decode/bench/vhdl} directory. Suitable configuration files and Makefile used for running test bench was stored in
Self-checking test bench were provided to the components used for the Present encoder. They are stored in \texttt{./Decode/bench/vhdl} directory. Suitable configuration files and Makefile used for running test bench was stored in
\texttt{./Decode/sim/rtl\_sim/bin} directory. Appropriate test vectors was taken from \cite{PRESENT}.
\texttt{./Decode/sim/rtl\_sim/bin} directory. Appropriate test vectors was taken from \cite{PRESENT}.
 
 
Makefile was prepared to make "manual run" of tests. If You want to perform it without gui, remove \texttt{-gui} option in Makefaile.
Makefile was prepared to make "manual run" of tests. If You want to perform it without gui, remove \texttt{-gui} option in Makefaile.
 
 
\newpage
\newpage

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.