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

Subversion Repositories present

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

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

powered by: WebSVN 2.1.0

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