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

Subversion Repositories present

[/] [present/] [trunk/] [Pure/] [doc/] [src/] [present_pure.tex] - Blame information for rev 20

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 gajos
\documentclass{gajewski}
2
 
3
\bibliographystyle{IEEEtran}
4
 
5
%%%%%%%%%%%%%%%%%
6
% Document variables
7
%%%%%%%%%%%%%%%%%
8
\docDate{ \today }
9
\docID{Present cipher}
10 20 gajos
\docRevision{0.2}
11 14 gajos
\docStatus{Draft}
12
\docTitle{\mbox{Present Cipher}}
13
\authorName{\mbox{Krzysztof Gajewski} \\ and opencores.org}
14
\authorURL{www.opencores.org}
15
\authorAddress{\mbox{}}
16
\authorEmail{gajos@opencores.org}
17
 
18
\revisionList{
19
0.1 & all & 2014/02/01 & First draft & K. Gajewski \\
20 20 gajos
0.2 & all & 2014/09/16 & Some small corrections with the text, typos, etc. & K. Gajewski \\
21 14 gajos
}
22
 
23
\begin{document}
24
 
25
\maketitle
26
 
27
\newpage
28
 
29
\revisionTable
30
 
31
\newpage
32
 
33
\tableofcontents
34
\newpage
35
 
36
\section{Introduction}
37
 
38
Present is \textgravedbl ultra-lightweight\textacutedbl \space block cipher developed by A. Bogdanov et al. and proposed in 2007 \cite{PRESENT}. It uses 64 bit data block and 80 bit or 128 bit key.
39
This cipher consists of 32 rounds, during which:
40
\begin{itemize}
41
    \item round key is added to plaintext
42 20 gajos
    \item plaintext goes through sBoxes (substitution boxes)
43 14 gajos
    \item plaintext after sBoxes goes through pLayer (permutation layer)
44
    \item round key is updated
45
\end{itemize}
46 20 gajos
After that, ciphertext feeds out the output. Briefly algorithm was shown in Fig. \ref{pAlgorithm}.
47 14 gajos
\begin{figure}[!ht]%
48
    \begin{center}
49
    \includegraphics[width=0.66\textwidth]{img/presentAlgorithm.png}
50
    \caption{%
51
        Briefly block scheme of the PRESENT block cipher
52
     }%
53
    \label{pAlgorithm}
54
    \end{center}
55
 \end{figure}
56
In this project Present block cipher 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}.
57
 
58
\newpage
59
 
60
\section{Interface}
61
 
62 20 gajos
Top level component of the Present encoder was shown in Fig. \ref{penc}. 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}.
63 14 gajos
\begin{figure}[!ht]%
64
    \begin{center}
65
    \includegraphics[width=0.5\textwidth]{img/PresentEnc.png}
66
    \caption{%
67 20 gajos
        Top level component of the Present encoder
68 14 gajos
     }%
69
    \label{penc}
70
    \end{center}
71
 \end{figure}
72
 
73
\begin{tabularx}{\textwidth}{|p{30mm}|p{11mm}|p{11mm}|X|}
74
  \hline \bf{Signal name} & \bf{Width} & \bf{In/Out} & \bf{Description}\\
75
  \hline \texttt{key}   & 80  &  in  & secret key used for input data encoding. \\
76
  \hline \texttt{plaintext}     & 64  &  in  & input data which have to be encoded. \\
77
  \hline \texttt{clk}   & 1  &  in  &  clock signal for the component\\
78 20 gajos
  \hline \texttt{reset} & 1   &  in  & \emph{asynchronous} reset signal.        \\
79 14 gajos
  \hline \texttt{start} & 1   &  in  & signal which starts encoding process. \\
80
  \hline \texttt{ciphertext} & 64   &  out  & encoded text output. \\
81
  \hline \texttt{ready} & 1   &  out  & signal informing about end of encoding process. \newline  "0" - wait until end of data encoding. \newline  "1" - data at the \texttt{ciphertext} output are valid, you can read them. \\
82
  \hline
83
\end{tabularx}
84 20 gajos
\captionof{table}{Input/Output signals of the Present encoder }
85 14 gajos
 
86
\newpage
87
 
88
\section{State machine workflow}
89
 
90 20 gajos
Overall internal structure of the Present component is similar to the structure shown in \cite{PRESENT}. Suitable control logic was added in state machine added
91 14 gajos
to the core. It was shown in Fig. \ref{presentSM}.
92
 
93
\begin{figure}[!ht]%
94
    \begin{center}
95
    \includegraphics[width=0.5\textwidth]{img/SM.jpg}
96
    \caption{%
97
        State machine of the Present component
98
     }%
99
    \label{presentSM}
100
    \end{center}
101
 \end{figure}
102
 
103
State machine consist of three states \texttt{NOP}, \texttt{SM\_START} and \texttt{READY}. Some control signal of used multiplexers, registers and counter was omitted. \texttt{NOP} is default state after resetting the core. This state is active as long as \texttt{START} = '0'.
104
 
105 20 gajos
When \texttt{START} = '1' encoding process starts. Proper \texttt{key} and \texttt{plaintext} must feed the input before start encoding. \texttt{SM\_START} state is active as long as \texttt{START} = '1'. Change of this signal to '0' automatically stops encoding process.
106 14 gajos
 
107 20 gajos
After 32 clock cycles (counter reach \texttt{'11111'} value), when the encoding process is ends, state machine automatically change its state to \texttt{READY}. This informs user by setting \texttt{READY} output to '1'. Then \texttt{ciphertext} output contains proper data, which can be read by user. This state is active as long as \texttt{START} = '1'. Change this signal to '0', turns the state machine to \texttt{NOP} state. Core is ready for the next data encoding.
108 14 gajos
 
109
\newpage
110
 
111
\section{FPGA implementations}
112
 
113 20 gajos
The  component  has  only  been  verified on a Xilinx\textsuperscript{\textregistered} Spartan 3E XC3S500E FPGA in FG320 package and synthesized  with  Xilinx  ISE  14.2.  Appropriate setup files was prepared with the use of ISE Project Navigator, but Makefile scripts was also written. Suitable files was stored in \texttt{./Pure/syn/XC3ES500/}  directory.
114 14 gajos
Implementation in FPGA device was done in another subproject called \texttt{PureTesting}.
115
Makefile was tested in Windows 8 with use of Cygwin for 64-bit Windows.
116
 
117
Synthesis results was given in Fig. \ref{SynResults}
118
 
119
\begin{tabularx}{\textwidth}{|p{45mm}|p{30mm}|p{30mm}|X|}
120
  \hline \multicolumn{4}{|c|}{Xilinx \textregistered Spartan 3E XC3S500E FPGA in FG320 package} \\
121
  \hline \bf{Parameter} & \bf{Used} & \bf{Available} & \bf{Utilization}\\
122
  \hline Number of Slices & 248 & 4656 & 5\% \\
123
  \hline Number of Slice Flip Flops & 151 & 9312 & 1\% \\
124
  \hline Number of 4 input LUTs & 296 & 9312 & 3\% \\
125
  \hline Number of bonded IOBs & 212 & 232 & 91\% \\
126
  \hline Number of GCLKs & 1 & 24 & 4\%\\
127
  \hline Minimum period & 5.035ns & - & - \\
128
  \hline Maximum Frequency & 198 MHz & - & - \\
129
  \hline
130
\end{tabularx}
131
\label{SynResults}
132
\captionof{table}{Synthesis results for Spartan 3E XC3S500E}
133
 
134
Possible change in used FPGA device may be possible in steps given below\footnotemark[1]:
135
\begin{enumerate}
136
    \item Copy \texttt{./Pure/syn/XC3ES500/} directory to another one like \texttt{./Pure/syn/YOUR\_FPGA\_SYMBOL/}
137 20 gajos
    \item Go to \texttt{./Pure/syn/YOUR\_FPGA\_SYMBOL/}  directory.
138
    \item In \texttt{PresentEnc.xst} file modify the line \texttt{-p xc3s500e-5-fg320} to \texttt{-p YOUR\_FPGA\_CODE}
139
    \item In \texttt{Makefile} file modify the line \texttt{PLATFORM=xc3s500e-fg320-5} to \texttt{PLATFORM=YOUR\_FPGA\_CODE}
140 14 gajos
\end{enumerate}
141
 
142 20 gajos
\footnotetext[1]{This solution was not tested and is based on my own observations.}
143 14 gajos
 
144
 
145
\newpage
146
 
147
\section{Simulation}
148
 
149
Self-checking test bench were provided to the components used for Present encoder. They are stored in \texttt{./Pure/bench/vhdl} directory. Suitable configuration files and Makefile used for running test bench was stored in
150
\texttt{.Pure/sim/rtl\_sim/bin} directory. Appropriate test vectors was taken from \cite{PRESENT}.
151
 
152
Makefile was prepared to make "manual run" of tests. If You want to perform it without gui, remove \texttt{-gui} option in Makefaile.
153
 
154
\newpage
155
 
156
\section{Troubleshooting}
157
 
158
During work with Windows 8 64-bit and and Xilinx\textsuperscript{\textregistered} ISE 64-bit some problems may occur:
159
 
160
\begin{enumerate}
161
    \item Xilinx may be unable to open projects in Project Navigator.
162
    \item When you run \texttt{make} in Cygwin and perform testbench it would be unable to open ISIM gui.
163
    \item When you run ISIM gui  (*.exe test bench file) it hangs out or anti virus protection opens.
164
\end{enumerate}
165
 
166
To solve problems listed above you have to perform steps listed below:
167
\begin{enumerate}
168
    \item You have to rename libraries \texttt{libPortabilityNOSH.dll} to \texttt{libPortability.dll} from \texttt{nt64} directories (\href{http://www.gadgetfactory.net/2013/09/having-problems-installing-xilinx-ise-on-windows-8-64bit-here-is-a-fix-video-included/}{http://www.gadgetfactory.net/2013/09/having-problems-installing-xilinx-ise-on-windows-8-64bit-here-is-a-fix-video-included/})
169
    \item Firstly, install Cygwin X11 (\href{http://stackoverflow.com/questions/9393462/cannot-launch-git-gui-using-cygwin-on-windows}{http://stackoverflow.com/questions/9393462/cannot-launch-git-gui-using-cygwin-on-windows})
170
    \item Temporary switch off anti virus protection.
171
\end{enumerate}
172
 
173
\newpage
174
 
175
\section{License and Liability}
176
 
177
Copyright \textcopyright  2013 Authors and OPENCORES.ORG
178
 
179
This source file may be used and distributed without
180
restriction provided that this copyright statement is not
181
removed from the file and that any derivative work contains
182
the original copyright notice and the associated disclaimer.
183
 
184
This source file is free software; you can redistribute it
185
and-or modify it under the terms of the GNU Lesser General
186
Public License as published by the Free Software Foundation;
187
either version 2.1 of the License, or (at your option) any
188
later version.
189
 
190
This source is distributed in the hope that it will be
191
useful, but WITHOUT ANY WARRANTY; without even the implied
192
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
193
PURPOSE. See the GNU Lesser General Public License for more
194
details.
195
 
196
You should have received a copy of the GNU Lesser General
197
Public License along with this source; if not, download it
198
from \href{http://www.opencores.org/lgpl.shtml}{http://www.opencores.org/lgpl.shtml}
199
 
200
Xilinx, Spartan3E is registered trademark of Xilinx Inc. 2100 Logic Drive, San Jose CA USA
201
 
202
\newpage
203
 
204
\bibliography{bibliography}
205
 
206
\end{document}

powered by: WebSVN 2.1.0

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