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

Subversion Repositories present

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

Go to most recent revision | 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
\docRevision{0.1}
11
\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
}
21
 
22
\begin{document}
23
 
24
\maketitle
25
 
26
\newpage
27
 
28
\revisionTable
29
 
30
\newpage
31
 
32
\tableofcontents
33
\newpage
34
 
35
\section{Introduction}
36
 
37
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.
38
This cipher consists of 32 rounds, during which:
39
\begin{itemize}
40
    \item round key is added to plaintext
41
    \item plaintext goues through sBoxes (substitution boxes)
42
    \item plaintext after sBoxes goes through pLayer (permutation layer)
43
    \item round key is updated
44
\end{itemize}
45
After that, ciphertext feeds out the output. Briefly algorithm was shown in Fig. \ref{pAlgorithm}
46
\begin{figure}[!ht]%
47
    \begin{center}
48
    \includegraphics[width=0.66\textwidth]{img/presentAlgorithm.png}
49
    \caption{%
50
        Briefly block scheme of the PRESENT block cipher
51
     }%
52
    \label{pAlgorithm}
53
    \end{center}
54
 \end{figure}
55
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}.
56
 
57
\newpage
58
 
59
\section{Interface}
60
 
61
Top level component of present 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}.
62
\begin{figure}[!ht]%
63
    \begin{center}
64
    \includegraphics[width=0.5\textwidth]{img/PresentEnc.png}
65
    \caption{%
66
        Top level component of Present component
67
     }%
68
    \label{penc}
69
    \end{center}
70
 \end{figure}
71
 
72
\begin{tabularx}{\textwidth}{|p{30mm}|p{11mm}|p{11mm}|X|}
73
  \hline \bf{Signal name} & \bf{Width} & \bf{In/Out} & \bf{Description}\\
74
  \hline \texttt{key}   & 80  &  in  & secret key used for input data encoding. \\
75
  \hline \texttt{plaintext}     & 64  &  in  & input data which have to be encoded. \\
76
  \hline \texttt{clk}   & 1  &  in  &  clock signal for the component\\
77
  \hline \texttt{reset} & 1   &  in  & \emph{Asynchronous} reset signal.        \\
78
  \hline \texttt{start} & 1   &  in  & signal which starts encoding process. \\
79
  \hline \texttt{ciphertext} & 64   &  out  & encoded text output. \\
80
  \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. \\
81
  \hline
82
\end{tabularx}
83
\captionof{table}{Input/Output signals of Present component}
84
 
85
\newpage
86
 
87
\section{State machine workflow}
88
 
89
Overall internal structure of Present component is similar to the structure shown in \cite{PRESENT}. Suitable control logic was added in state machine added
90
to the core. It was shown in Fig. \ref{presentSM}.
91
 
92
\begin{figure}[!ht]%
93
    \begin{center}
94
    \includegraphics[width=0.5\textwidth]{img/SM.jpg}
95
    \caption{%
96
        State machine of the Present component
97
     }%
98
    \label{presentSM}
99
    \end{center}
100
 \end{figure}
101
 
102
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'.
103
 
104
When \texttt{START} = '1' encoding process starts. Proper \texttt{key} and \texttt{plaintext} must fed 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.
105
 
106
After 32 clock cycles (counter reach \texttt{'11111'} value), when encoding process is ended, 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 readed by user. This state are active as long as \texttt{START} = '1'. Change this signal to '0', change state machine to \texttt{NOP} state. Core is ready for next data encoding.
107
 
108
\newpage
109
 
110
\section{FPGA implementations}
111
 
112
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 use of ISE Project Navigator, but Makefile scripts was also written. Suitable files was stored in \texttt{./Pure/syn/XC3ES500/}  directory.
113
Implementation in FPGA device was done in another subproject called \texttt{PureTesting}.
114
Makefile was tested in Windows 8 with use of Cygwin for 64-bit Windows.
115
 
116
Synthesis results was given in Fig. \ref{SynResults}
117
 
118
\begin{tabularx}{\textwidth}{|p{45mm}|p{30mm}|p{30mm}|X|}
119
  \hline \multicolumn{4}{|c|}{Xilinx \textregistered Spartan 3E XC3S500E FPGA in FG320 package} \\
120
  \hline \bf{Parameter} & \bf{Used} & \bf{Available} & \bf{Utilization}\\
121
  \hline Number of Slices & 248 & 4656 & 5\% \\
122
  \hline Number of Slice Flip Flops & 151 & 9312 & 1\% \\
123
  \hline Number of 4 input LUTs & 296 & 9312 & 3\% \\
124
  \hline Number of bonded IOBs & 212 & 232 & 91\% \\
125
  \hline Number of GCLKs & 1 & 24 & 4\%\\
126
  \hline Minimum period & 5.035ns & - & - \\
127
  \hline Maximum Frequency & 198 MHz & - & - \\
128
  \hline
129
\end{tabularx}
130
\label{SynResults}
131
\captionof{table}{Synthesis results for Spartan 3E XC3S500E}
132
 
133
Possible change in used FPGA device may be possible in steps given below\footnotemark[1]:
134
\begin{enumerate}
135
    \item Copy \texttt{./Pure/syn/XC3ES500/} directory to another one like \texttt{./Pure/syn/YOUR\_FPGA\_SYMBOL/}
136
    \item Go to \texttt{./Pure/syn/XC3ES500/}  directory.
137
    \item In \texttt{PresentEnc.xst} file modify the line \texttt{-p xc3s500e-5-fg320} to \texttt{-p YOUR\_FPGA\_SYMBOL}
138
    \item In \texttt{Makefile} file modify the line \texttt{PLATFORM=xc3s500e-fg320-5} to \texttt{PLATFORM=YOUR\_FPGA\_SYMBOL}
139
\end{enumerate}
140
 
141
\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}
142
 
143
 
144
\newpage
145
 
146
\section{Simulation}
147
 
148
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
149
\texttt{.Pure/sim/rtl\_sim/bin} directory. Appropriate test vectors was taken from \cite{PRESENT}.
150
 
151
Makefile was prepared to make "manual run" of tests. If You want to perform it without gui, remove \texttt{-gui} option in Makefaile.
152
 
153
\newpage
154
 
155
\section{Troubleshooting}
156
 
157
During work with Windows 8 64-bit and and Xilinx\textsuperscript{\textregistered} ISE 64-bit some problems may occur:
158
 
159
\begin{enumerate}
160
    \item Xilinx may be unable to open projects in Project Navigator.
161
    \item When you run \texttt{make} in Cygwin and perform testbench it would be unable to open ISIM gui.
162
    \item When you run ISIM gui  (*.exe test bench file) it hangs out or anti virus protection opens.
163
\end{enumerate}
164
 
165
To solve problems listed above you have to perform steps listed below:
166
\begin{enumerate}
167
    \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/})
168
    \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})
169
    \item Temporary switch off anti virus protection.
170
\end{enumerate}
171
 
172
\newpage
173
 
174
\section{License and Liability}
175
 
176
Copyright \textcopyright  2013 Authors and OPENCORES.ORG
177
 
178
This source file may be used and distributed without
179
restriction provided that this copyright statement is not
180
removed from the file and that any derivative work contains
181
the original copyright notice and the associated disclaimer.
182
 
183
This source file is free software; you can redistribute it
184
and-or modify it under the terms of the GNU Lesser General
185
Public License as published by the Free Software Foundation;
186
either version 2.1 of the License, or (at your option) any
187
later version.
188
 
189
This source is distributed in the hope that it will be
190
useful, but WITHOUT ANY WARRANTY; without even the implied
191
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
192
PURPOSE. See the GNU Lesser General Public License for more
193
details.
194
 
195
You should have received a copy of the GNU Lesser General
196
Public License along with this source; if not, download it
197
from \href{http://www.opencores.org/lgpl.shtml}{http://www.opencores.org/lgpl.shtml}
198
 
199
Xilinx, Spartan3E is registered trademark of Xilinx Inc. 2100 Logic Drive, San Jose CA USA
200
 
201
\newpage
202
 
203
\bibliography{bibliography}
204
 
205
\end{document}

powered by: WebSVN 2.1.0

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