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

Subversion Repositories present

[/] [present/] [trunk/] [32BitIO/] [doc/] [src/] [present_32bitIO.tex] - Blame information for rev 18

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 18 gajos
\documentclass{gajewski}
2
 
3
\bibliographystyle{IEEEtran}
4
 
5
%%%%%%%%%%%%%%%%%
6
% Document variables
7
%%%%%%%%%%%%%%%%%
8
\docDate{ \today }
9
\docID{Present cipher (32 bit input)}
10
\docRevision{0.1}
11
\docStatus{Draft}
12
\docTitle{\mbox{Present Cipher (32 bit input)}}
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/09/05 & 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}. In comparison with "plain" Present cipher projecy, this core was modified to take 32 bit word at input (plus control word). Output is also 32 bit.
56
 
57
\textbf{NOTE:}
58
 
59
This is rather "historical" project and is not recommended for future use.
60
 
61
\newpage
62
 
63
\section{Interface}
64
 
65
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}.
66
\begin{figure}[!ht]%
67
    \begin{center}
68
    \includegraphics[width=0.5\textwidth]{img/PresentEnc.png}
69
    \caption{%
70
        Top level component of Present component
71
     }%
72
    \label{penc}
73
    \end{center}
74
 \end{figure}
75
 
76
\begin{tabularx}{\textwidth}{|p{30mm}|p{11mm}|p{11mm}|X|}
77
  \hline \bf{Signal name} & \bf{Width} & \bf{In/Out} & \bf{Description}\\
78
  \hline \texttt{input} & 32  &  in  & input data - both key and plaintext. \\
79
  \hline \texttt{ctrl}  & 4  &  in  & control bus for sending commands to the core. \\
80
  \hline \texttt{clk}   & 1  &  in  &  clock signal for the component\\
81
  \hline \texttt{reset} & 1   &  in  & \emph{Asynchronous} reset signal.        \\
82
  \hline \texttt{output} & 32   &  out  & output data - ciphertext. \\
83
  \hline \texttt{ready} & 1   &  out  & signal informing about end of encoding process. \newline  "0" - wait until end of data encoding. \newline  "1" - end of the encoding process, output data available. \\
84
  \hline
85
\end{tabularx}
86
\captionof{table}{Input/Output signals of Present component}
87
 
88
\newpage
89
 
90
\section{State machine workflow}
91
 
92
Overall internal structure of Present component is similar to the structure shown in \cite{PRESENT}. To conform 64 bit plaintext, 80 bit key and 32 bit output data, multiplexer-like blocks was added to fit data. Additionally, control logic was added in the state machine. It was shown in Fig. \ref{presentSM}.
93
 
94
\begin{figure}[!ht]%
95
    \begin{center}
96
    \includegraphics[width=0.5\textwidth]{img/SM.jpg}
97
    \caption{%
98
        State machine of the Present component
99
     }%
100
    \label{presentSM}
101
    \end{center}
102
 \end{figure}
103
 
104
State machine consist of nine states \texttt{NOP}, \texttt{RDK1}, \texttt{RDK2}, \texttt{RDK3}, \texttt{RDT1}, \texttt{RDT2}, \texttt{COD}, \texttt{CTO1}, \texttt{CTO2}. \texttt{NOP} is default state after resetting the core. This state is active as long as control bus (\texttt{ctrl}) don't have \texttt{crdk1} command at the input.
105
 
106
\texttt{RDKx} states are responsible for reading the key from the input. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to \texttt{NOP} state. When command are left constant, given state is not changing.
107
 
108
\texttt{RDTx} states are responsible for reading the plaintext from the input. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to \texttt{NOP} state. When command are left constant, given state is not changing.
109
 
110
During \texttt{COD} state encoding process start. If encoding process ends (after 32 clock cycles, \texttt{info = "00"} signal from the counter), state machine automaticly goes to \texttt{CTO1} state. When commands another than \texttt{ccod} appear, the state is changing to \texttt{NOP} state. When command are left constant encoding process is working.
111
 
112
\texttt{CTOx} states are responsible for sending the ciphertext to the output. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to \texttt{NOP} state. When command are left constant, given state is not changing.
113
 
114
\newpage
115
 
116
\section{FPGA implementations}
117
 
118
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{./32BitIO/syn/XC3ES500/} directory. Implementation in FPGA device \textbf{was not} in this project (due to rather historical issues and nonconventional build of these core). Makefile was tested in Windows 8 with use of Cygwin for 64-bit Windows.
119
 
120
Synthesis results was given in Fig. \ref{SynResults}
121
 
122
\begin{tabularx}{\textwidth}{|p{45mm}|p{30mm}|p{30mm}|X|}
123
  \hline \multicolumn{4}{|c|}{Xilinx \textregistered Spartan 3E XC3S500E FPGA in FG320 package} \\
124
  \hline \bf{Parameter} & \bf{Used} & \bf{Available} & \bf{Utilization}\\
125
  \hline Number of Slices & 313 & 4656 & 6\% \\
126
  \hline Number of Slice Flip Flops & 262 & 9312 & 2\% \\
127
  \hline Number of 4 input LUTs & 460 & 9312 & 4\% \\
128
  \hline Number of bonded IOBs & 71 & 232 & 30\% \\
129
  \hline Number of GCLKs & 1 & 24 & 4\%\\
130
  \hline Minimum period & 4.250 ns & - & - \\
131
  \hline Maximum Frequency & 235.311 MHz & - & - \\
132
  \hline
133
\end{tabularx}
134
\label{SynResults}
135
\captionof{table}{Synthesis results for Spartan 3E XC3S500E}
136
 
137
Possible change in used FPGA device may be possible in steps given below\footnotemark[1]:
138
\begin{enumerate}
139
    \item Copy \texttt{./32BitIO/syn/XC3ES500/} directory to another one like \texttt{./32BitIO/syn/YOUR\_FPGA\_SYMBOL/}
140
    \item Go to \texttt{./32BitIO/syn/YOUR\_FPGA\_SYMBOL/}  directory.
141
    \item In \texttt{PresentEnc.xst} file modify the line \texttt{-p xc3s500e-5-fg320} to \texttt{-p YOUR\_FPGA\_CODE}
142
    \item In \texttt{Makefile} file modify the line \texttt{PLATFORM=xc3s500e-fg320-5} to \texttt{PLATFORM=YOUR\_FPGA\_CODE}
143
\end{enumerate}
144
 
145
\footnotetext[1]{This solution was not tested and is based on my own observations.}
146
 
147
\newpage
148
 
149
\section{Simulation}
150
 
151
Self-checking test bench were provided to the components used for Present encoder. In case of whole Present encoder this test bench was not self-checking. This is due to historical character of this project. They are stored in \texttt{./32BitIO/bench/vhdl} directory. Suitable configuration files and Makefile used for running test bench was stored in
152
\texttt{./32BitIO/sim/rtl\_sim/bin} directory. Appropriate test vectors was taken from \cite{PRESENT}.
153
 
154
Makefile was prepared to make "manual run" of tests. If You want to perform it without gui, remove \texttt{-gui} option in Makefaile.
155
 
156
\newpage
157
 
158
\section{Troubleshooting}
159
 
160
During work with Windows 8 64-bit and and Xilinx\textsuperscript{\textregistered} ISE 64-bit some problems may occur:
161
 
162
\begin{enumerate}
163
    \item Xilinx may be unable to open projects in Project Navigator.
164
    \item When you run \texttt{make} in Cygwin and perform testbench it would be unable to open ISIM gui.
165
    \item When you run ISIM gui  (*.exe test bench file) it hangs out or anti virus protection opens.
166
\end{enumerate}
167
 
168
To solve problems listed above you have to perform steps listed below:
169
\begin{enumerate}
170
    \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/})
171
    \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})
172
    \item Temporary switch off anti virus protection.
173
\end{enumerate}
174
 
175
\newpage
176
 
177
\section{License and Liability}
178
 
179
Copyright \textcopyright  2013 Authors and OPENCORES.ORG
180
 
181
This source file may be used and distributed without
182
restriction provided that this copyright statement is not
183
removed from the file and that any derivative work contains
184
the original copyright notice and the associated disclaimer.
185
 
186
This source file is free software; you can redistribute it
187
and-or modify it under the terms of the GNU Lesser General
188
Public License as published by the Free Software Foundation;
189
either version 2.1 of the License, or (at your option) any
190
later version.
191
 
192
This source is distributed in the hope that it will be
193
useful, but WITHOUT ANY WARRANTY; without even the implied
194
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
195
PURPOSE. See the GNU Lesser General Public License for more
196
details.
197
 
198
You should have received a copy of the GNU Lesser General
199
Public License along with this source; if not, download it
200
from \href{http://www.opencores.org/lgpl.shtml}{http://www.opencores.org/lgpl.shtml}
201
 
202
Xilinx, Spartan3E is registered trademark of Xilinx Inc. 2100 Logic Drive, San Jose CA USA
203
 
204
\newpage
205
 
206
\bibliography{bibliography}
207
 
208
\end{document}

powered by: WebSVN 2.1.0

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