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

Subversion Repositories avs_aes

[/] [avs_aes/] [trunk/] [doc/] [manual/] [src/] [avs_aes.tex] - Blame information for rev 18

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 ruschi
\documentclass{ruschidoc}
2
 
3
\usepackage[
4
        bookmarks,
5
        plainpages={false}]{hyperref}
6
 
7
\usepackage[
8
        style=altlist,
9 18 ruschi
        toc=true,
10
        acronym=true]{glossaries}
11 11 ruschi
\usepackage{capt-of}
12
 
13
%%% Water mark
14
%\usepackage{draftwatermark}
15
%\SetWatermarkText{\shortstack{DRAFT}}
16
%\SetWatermarkScale{0.9}
17
%\SetWatermarkLightness{0.85}
18
 
19 18 ruschi
 
20
\makeglossaries
21 11 ruschi
\input{glossary}
22
\bibliographystyle{IEEEtran}
23
 
24
%%%%%%%%%%%%%%%%%
25
% Document variables
26
%%%%%%%%%%%%%%%%%
27
\docDate{ \today }
28
\docID{avs\_aes\_doc}
29 18 ruschi
\docRevision{0.8}
30 11 ruschi
\docStatus{Final}
31
\docTitle{\mbox{AES 128/192/256 (ECB)}  \mbox{Avalon\rtm-MM Slave}}
32
\keywords{Avalon, bus, slave, cryptography, AES, ecb, IP core }
33
 
34
\authorName{\mbox{Thomas Ruschival} \\ and opencores.org}
35
\authorURL{www.opencores.org}
36
\authorAddress{\mbox{}}
37
\authorEmail{ruschi@opencores.org}
38
 
39
 
40
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41
% FORMAT: Rev | Chapter |  Description | Date | Reviewer \\
42
\revisionList{
43
0.1 & all & initial document & 2009/02/01  & T. Ruschival \\
44
0.2 & all & added interrupt  & 2009/03/25  & T. Ruschival \\
45
0.3 & all & added generics  & 2009/04/20  & T. Ruschival \\
46
0.4 & all & cleanup for opencores.org  & 2009/05/20  & T. Ruschival \\
47
0.5 & all & final release  & 2010/03/07  & T. Ruschival \\
48
0.6 & 3,6 & fixed memory map, added testbench description  & 2010/04/02  & T. Ruschival \\
49 16 ruschi
0.7 & 3,6 & fixed typos  & 2010/04/03  & T. Ruschival \\
50 18 ruschi
0.8 & 6 & corrected key schedule  & 2011/05/15  & T. Ruschival \\
51 11 ruschi
}
52
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53
 
54
 
55
\begin{document}
56
\maketitle
57
\newpage
58
\tableofcontents
59
\newpage
60
 
61
\section{Introduction}
62 18 ruschi
\label{sec:intro} The \gls{AES} is a symmetric block cipher operating on fixed block sizes
63 11 ruschi
of 128 Bit and is specified for key sizes of 128, 192 and 256 Bit designed by Joan
64 18 ruschi
Daemen and Vincent Rijmen. The algorithm was standardized by \gls{NIST}. For more
65 11 ruschi
information on the algorithm see \cite{NIST:Fips197}.\\
66 18 ruschi
This component implements an AES encryption decryption data path in \gls{ECB} mode with
67 16 ruschi
either 128,192 or 256 Bit keys.  The key length is determined by generics at compile
68
time. Also the decryption data path can be disabled by generics if it is not needed
69 11 ruschi
for the application.\\
70
The component provides an Avalon\rtm\ Memory Mapped (Avalon-MM) slave interface to
71
connect to an Altera\rtm\ Avalon\rtm\ switch fabric. The Avalon\rtm\ interface is
72
implemented in a way that it can also be used to connect to a Whishbone master if the
73
signals are correctly mapped, see \cite{Wiki:AvWb}. For further information about the
74
Whishbone bus refer to \cite{OC:WBspec}. \\
75
 
76
\section{Interface}
77
\label{sec:interface}
78
The AES core is accessed by the interface described in this section. An Avalon\rtm\
79
interface was chosen for its simplicity and compatibility with wishbone.  Furthermore
80
Avalon\rtm\ defines interrupt request signals for slaves which would be separate
81
signals in a Wishbone implementation.The component can be used both in polling
82
mode or can provide an interrupt for signalling. \\
83
Unfortunately Avalon\rtm\ is an Altera\rtm\ proprietary technology. The actual AES
84 18 ruschi
core however is a self contained entity and can be embedded into other \gls{SoC} bus
85 16 ruschi
interfaces as well or used independently.
86 11 ruschi
 
87
\subsection{Configuration Generics}
88
\label{sec:generics}
89
The AES core can be configured by generics shown in table \ref{tab:generics},
90
consequently they are provided by the Avalon\rtm\ interface.
91
 
92
\begin{tabularx}{\textwidth}{|p{33mm}|p{25mm}|X|}
93
  \hline
94
  \bf{Generic name} & \bf{type} & \bf{Description}\\ \hline
95 16 ruschi
  \texttt{KEYLENGTH}  \label{gen:keylength}     & NATURAL   & Size of initial user key. Must be 128, 192 or 256 \footnotemark[1] . \\ \hline
96
  \texttt{DECRYPTION} \label{gen:decryption}  & BOOLEAN  & Enables the instantiation of the decrypt data path if true. \\
97 11 ruschi
\hline
98
\end{tabularx}
99
\footnotetext[1]{All other values raise a compilation failure}
100
\captionof{table}{Component generics}
101
\label{tab:generics}
102
Note: \texttt{KEYLENGTH} of 192 fail synthesis with Xilinx ISE \rtm\ because of division by 6 in key schedule that cannot be mapped to shift operations (\texttt{keyexpansion.vhd}).
103
 
104
\subsection{Signals}
105
\label{sec:signals}
106
The Avalon\rtm\-MM Slave interface is described in \cite{Altera:Avalon}, the component
107
implements the signals shown in table \ref{tab:signals}. All signals are synchronous,
108
sampled at the rising edge of the clock. The type for all signals is \texttt{IEEE1164
109
    std\_logic} or \texttt{std\_logic\_vector}. For signals wider that 1 Bit the range
110 18 ruschi
is \gls{MSB} \texttt{downto} \gls{LSB}. \\
111 11 ruschi
This components has only output signals driven by registers no input signals are directly combinatorially connected to the
112
output signals, thus combinational loops are avoided.  All signals are active
113
high. This component does not support burst transfers.
114
 
115
\begin{tabularx}{\textwidth}{|p{30mm}|p{11mm}|p{11mm}|X|}
116
  \hline
117
  \bf{Signal name} & \bf{Width} & \bf{In/Out} & \bf{Description}\\ \hline
118
  \texttt{clk}  \label{sig:clk} & 1  &  in  & Avalon\rtm\ bus clock, also used to drive the core. \\ \hline
119
  \texttt{reset} \label{sig:reset}& 1   &  in  & \emph{Synchronous} reset signal for Avalon\rtm\ bus interface.
120
  The core itself is designed without need for reset signals.
121
        \\ \hline
122
  \texttt{writedata} \label{sig:writedata} & 32 &  in  & Input data to write to location designated by \texttt{address}. Bit 31 is most significant Bit.
123
        \\  \hline
124
  \texttt{address}   \label{sig:address}    & 5   &  in & Word offset to the components base address. The memory map of the component for the
125 16 ruschi
  respective offset is described in \ref{sec:memmap}. Only full 32-Bit words can be addressed no byte addressing is implemented.
126 11 ruschi
        \\  \hline
127
  \texttt{write}\footnotemark[1] \label{sig:write}  & 1 &  in  & If asserted enable write of data at \texttt{writedata} to location designated by \texttt{address}.
128
        \\  \hline
129
  \texttt{read}\footnotemark[1] \label{sig:read}   & 1 &  in  & If asserted output data at location designated by \texttt{address} to \texttt{readdata}.
130
        \\  \hline
131
  \texttt{readdata} \label{sig:readdata}  & 32  &  out & Data output port for reading data at the location defined by \texttt{address}. Bit 31 is most significant Bit.
132
        \\  \hline
133
 \texttt{waitrequest} \label{sig:waitrequest}  & 1  &  out & Asserted if writedata was not accepted, this is the case if the keyexpansion is
134
         not yet complete and a new is written to the \texttt{KEY} address range without previous deassertion of  the \texttt{KEY\_VALID} Bit
135
        \\  \hline
136 16 ruschi
  \texttt{irq}\label{sig:irq}   & 1 &  out & If Interrupt behavior is enabled \texttt{IRQ}
137 11 ruschi
  will be asserted when the operation has terminated. For use of interrupt see \ref{sec:irq}
138
        \\ \hline
139
\end{tabularx}
140 16 ruschi
\footnotetext[1]{\texttt{read} and \texttt{write} are mutually exclusive and must not be asserted simultaneously.}
141 11 ruschi
\label{tab:signals}
142
\captionof{table}{Avalon\rtm\ Bus interface signals}
143
 
144
 
145
\section{Memory Map}
146
\label{sec:memmap}
147 16 ruschi
The AES core Avalon\rtm\ slave has an address space of 31 words accessible through the
148 11 ruschi
offset described by the signal \texttt{address}, see \ref{sig:address}. This address
149 16 ruschi
space is divided into three main sections for the 4-word input data, the 4-word
150
result of the operation and the user key. The actual length of the user key can vary
151 11 ruschi
between 4, 6 and 8 words depending on the keysize. For control signals and status
152
information of the component and a control word is provided. The memory mapping is
153 16 ruschi
described in table \ref{tab:memmap}.\\
154 11 ruschi
 
155
\begin{tabularx}{\textwidth}{|p{18mm}|p{14mm} |X|}
156
  \hline
157
  \bf{Offset}     & \bf{Name} & \bf{Description}\\ \hline
158
  \texttt{0x00-0x07} & \texttt{KEY}  & Initial user key that will be used for encryption and decryption.
159
        The most significant word is written to offset \texttt{0x00}. This memory section is \emph{write-only} to the Avalon\rtm\ interface.\\
160
\hline
161
  \texttt{0x08-0x0B} & \texttt{DATA} & Input data, can be either interpreted as cyphertext for decryption or plain text for encryption.
162
        The most significant word shall be written to offset \texttt{0x08}. This memory section is \emph{write-only} to the Avalon\rtm\ interface. \\
163
\hline
164
  \texttt{0x10-0x13} & \texttt{RESULT} & Result of the operation. The most significant word of the result at offset \texttt{0x10}.
165
        This memory section is \emph{read-only} to the Avalon\rtm\ Interface.  \\
166
\hline
167
   \texttt{0x14-0x1E} & --- &  reserved  \\ \hline
168
 \texttt{0x1F} & \texttt{CTRL} & Control and status word of the component can be read and written. Detailed description see \ref{sec:ctrl}\\
169
\hline
170
\end{tabularx}
171
\label{tab:memmap}
172
\captionof{table}{Memory map of the AES core Avalon\rtm\ slave}
173
 
174
\subsection{Control Register}
175
\label{sec:ctrl}
176
The AES Core offers the register \texttt{CTRL} to control the function of the core
177
and poll its status. The control register can be accessed in read and write mode.
178 16 ruschi
 When writing to the register reserved Bits shall be assigned a value of \texttt{0}.
179
 Individual Bits have following functionality described in table \ref{tab:ctrlreg}. \\
180 11 ruschi
In case of a Avalon\rtm\ Bus reset this register is set to \texttt{0x00000000} thus
181
invalidating all previously written keys and resetting the AES core.
182
 
183
\begin{tabularx}{\textwidth}{|p{13mm}|p{18mm} |X|}
184
  \hline
185
  \bf{Offset}     & \bf{Name} & \bf{Description}\\ \hline
186
  \texttt{31-8} & --- & reserved \\ \hline
187 16 ruschi
  \texttt{7}     &\texttt{KEY\_VALID} &If asserted key data in the \texttt{KEY} memory range is regarded valid and will be expanded to round keys.
188 11 ruschi
        When deasserted all keys are invalidated and the current operation of the core is aborted. It must be asserted as long as the key shall be
189 16 ruschi
        used for either encryption or decryption. This bit must be cleared for one clock cycle to load a new key. \\ \hline
190 11 ruschi
  \texttt{6}   & \texttt{IRQ\_ENA}  & Enable use of the interrupt request signal. If asserted the component will set \texttt{IRQ} after
191
                                        completing an operation. If not set the component operates in polling mode only.\\ \hline
192
  \texttt{5-2}   & --- &reserved  \\ \hline
193
  \texttt{1}    &  \texttt{DEC} \footnotemark[1] &  If asserted memory content of the \texttt{DATA} range is regarded to be valid and will be
194
        \emph{decrypted}. This Bit shall only be deasserted externally if a running AES operation is aborted by deasserting \texttt{KEY\_VALID}. 1
195
        It will be set \texttt{0} by the core to signal completion of the operation.\\ \hline
196
  \texttt{0}    &  \texttt{ENC} \footnotemark[1] & If asserted memory content of the \texttt{DATA} range is regarded to be valid and will be
197
        \emph{encrypted}. This Bit shall only be deasserted externally if a running AES operation is aborted by deasserting \texttt{KEY\_VALID}.
198
         It will be set \texttt{0} by the core to signal completion of the operation. \\ \hline
199
\end{tabularx}
200 16 ruschi
\footnotetext[1]{\texttt{ENC} and \texttt{DEC} are mutually exclusive and must not be asserted simultaneously.}
201 11 ruschi
\label{tab:ctrlreg}
202
\captionof{table}{Bits in the control register}
203
 
204
 
205
\section{Protocol Sequence}
206
\label{sec:usage}
207
The AES component appears as memory mapped peripheral. All writes are fundamental slave write transfers, see \cite{Altera:Avalon} and take one
208
clock cycle of the Avalon\rtm\ bus clock \texttt{clk}. It is not necessary to write all words of a input parameter successively or in one transfer.
209
Bursts are not supported.\\
210
\\
211 16 ruschi
Before any AES operation can be started the initial user key has to be written to
212 11 ruschi
\texttt{KEY} segment of the memory map.After the user key is transferred
213
to the component the \texttt{KEY\_VALID} Bit must be set to start the key
214 16 ruschi
expansion. This Bit can be set simultaneously with \texttt{DEC} or \texttt{ENC} Bit of
215 11 ruschi
the control register. To invalidate the previous key and use another key the
216
\texttt{KEY\_VALID} must be deasserted for at least one Avalon\rtm\ bus clock cycle
217
During this cycle the new key can already be transferred.\\
218
\\
219
Once a key is passed and marked valid data blocks can be transferred to the
220
\texttt{DATA} segment of the memory map.
221
The AES operation is started by asserting the \texttt{ENC} Bit for
222
encryption or \texttt{DEC} Bit for decryption.
223
While asserting \texttt{ENC} or \texttt{DEC} the \texttt{KEY\_VALID} Bit must be
224
kept asserted.\\
225
The \texttt{ENC} or \texttt{DEC} Bit respectively is deasserted by the component
226
after completing the requested operation.
227
The result of the operation can be read from the \texttt{RESULT} area of the memory
228
and is not cleared. It will be overwritten by succeeding operations.
229
 
230 18 ruschi
The underlying AES core uses the \gls{FSM} shown in \ref{fig:aesFSM} for processing of
231 11 ruschi
the data. The signals \texttt{data\_stable} and \texttt{key\_stable} are accessible
232
over the control status word \texttt{CTRL} \ref{sec:ctrl}. \texttt{key\_ready} is a
233 16 ruschi
signal driven by the key generator when all keys are expanded. The signal
234 11 ruschi
\texttt{round\_index} is the counter for the rounds and the address to select a
235 16 ruschi
round key. \\
236 11 ruschi
\texttt{NO\_ROUNDS} is the total number of rounds the processing takes, a constant
237
defined by the generic \texttt{KEYLENGTH} \ref{sec:generics}. The AES standard
238
in\cite{NIST:Fips197} defines 10 rounds for 128 Bit key, 12 rounds for a 192 Bit key
239
and 14 rounds for a 265 Bit key.\\
240 16 ruschi
Thus depending on the key length the processing of a data block needs at maximum 15
241
clock cycles from \texttt{data\_stable=1} to completion, if the key is already expanded.
242 11 ruschi
 
243
\begin{figure}[!ht]
244
  \centering
245
  \includegraphics[width=100mm]{encrypt_FSM}
246
  \caption{Finite State Machine of encryption and decryption process}
247
  \label{fig:aesFSM}
248
\end{figure}
249
 
250
 
251 16 ruschi
\subsection{Interrupt Behavior}
252 11 ruschi
\label{sec:irq}
253
By setting \texttt{IRQ\_ENA} in the control register \ref{sec:ctrl} the
254
component is configured to issue interrupt requests.
255
If \texttt{IRQ\_ENA} is asserted the interrupt request \texttt{IRQ} \ref{sig:irq} will be set when the
256
computation has completed in addition to clearing the \texttt{ENC} or \texttt{DEC}
257
Bit.
258
The \texttt{IRQ} \ref{sig:irq}  signal will remain set until clearing \texttt{IRQ\_ENA}
259
or a read operation on the \texttt{RESULT} area of the components address range.
260
 
261 16 ruschi
\section{The Inner Core}
262
\label{sec:core}
263
The algorithmic core is divided into two separate data paths one for encryption and a
264
second for decryption operation. The two data paths are independent, however they
265
share the keyexpansion component which provides decrypt and encrypt keys (which are
266 18 ruschi
the same only in opposite order). Each data path is controlled by its own \gls{FSM}.  If
267 16 ruschi
configured by the generic \texttt{DECRYPTION} \ref{gen:decryption} the decryption
268
data path is included and some multiplexers are generated for the shared signals,
269
e.g. \texttt{result} or \texttt{roundkey\_index}.\\
270
For reference the encryption data path of \texttt{aes\_core.vhd} is given in figure
271
\ref{fig:aescore}. The decryption data path is left for the reader or any other author
272
of this document.
273
\newpage
274
\begin{figure}[!ht]
275
  \centering
276
  \includegraphics[width=0.9\textwidth]{CoreEncDP}
277
  \caption{Encrypt data path of the AES core as implemented in aes\_core.vhd}
278
  \label{fig:aescore}
279
\end{figure}
280
\newpage
281
\section{Throughput Calculation}
282
\label{sec:throughput}
283
The Avalon\rtm\ interface communicates a 32-Bit DWORD per clock cycle. Therefore a key is transmitted in 4 to 8 cycles
284
plus one cycle to activate keyexpansion with the control word \ref{sec:ctrl}. A payload data block or the result consist
285
always of 4 DWORDs, thus it takes 4 cycles to send data to the core, one cycle to activate the computation with the
286 11 ruschi
control register \ref{sec:ctrl} and 4 cycles to retrieve the data.
287
 
288 18 ruschi
The keyexpansion component computes one column of a roundkey in two clock cycles. In
289
the first cycle the column is substituted throught the s-box, in the second cycle the
290
shift-operation is executed. AES specifies \cite{NIST:Fips197}, depending on the key length $ N_{roundkeys}=\{10,12,14\} $
291
roundkeys with 4 columns each. The \gls{FSM} of the keyexpansion module adds o clockcycle for the ``DONE'' state.
292
\begin{equation}
293
  T_{keyexpansion}(N_{roundkeys}) = 2 \cdot 4 \cdot N_{roundkeys} +1
294
\label{eqn:keyexp}
295
\end{equation}
296
The keyexpansion therefore takes 81, 97 or 115 clockcycles until the encryption or decryption can start. The
297
roundkeys are stored until invalidated, see \ref{sec:usage} thus this step is is only needed once after power-up until the key changes.
298 11 ruschi
 
299 16 ruschi
The AES core computes one iteration (round) of the Rijndael-Algorithm each clock cycle, thus a 128 Bit data block is
300
encrypted or decrypted in 10, 12 or 14 cycles plus an initial round.
301 11 ruschi
 
302 16 ruschi
The maximum throughput $T_{max}[Bits]$ depends on the maximum operation frequency $f_{max}$ and the key length which
303 11 ruschi
influences the number of rounds $N_{rnd} \epsilon \lbrace 10,12,14 \rbrace $.
304
\begin{equation}
305
  T_{max}=\frac{ (1+N_{rnd}) \cdot 128 Bit}{f_{max}}
306
\label{eqn:tmax}
307
\end{equation}
308
 
309
Note: Equation \ref{eqn:tmax} assumes that the roundkeys are already generated and does not include the constant of 4+1+4
310 16 ruschi
Avalon\rtm\ bus cycles for transmission of data, activation and result retrieval.
311
\newpage
312
\section{FPGA implementations}
313
\label{sec:fpga}
314
The component has only be implemented and tested on an Altera\rtm\ Cyclone-II EP2C35
315
FPGA. For this setup a Makefile is provided in \texttt{./sys/Altera\_Quartus9.1}.  All
316 11 ruschi
other values in the table are only results of synthesis\footnotemark[0] and are not
317
verified on actual hardware.
318
 
319 16 ruschi
\footnotetext[0]{Synthesized with Altera\rtm\ Quartus-II\rtm\ Web edition Version 9.1 or Xilinx\rtm\ ISE 9.1 Webpack}
320 11 ruschi
 
321 16 ruschi
The design is kept vendor independent in generic VHDL.
322
AES SubByte component is specially designed using M4K block RAM as dual-port ROM. For
323 11 ruschi
non-Altera\rtm\ FPGAs a second VHDL architecture exists also trying to make use of
324
ROM functions of the target chips however the success varies on RTL compiler
325 16 ruschi
capabilities. Later versions of  Altera\rtm\ Quartus-II\rtm\ show the same results whether M4K blocks are used or the generic version in selected.
326 11 ruschi
 
327
\begin{tabularx}{\textwidth}{|p{30mm}|X|p{20mm}|p{30mm}|p{18mm}|}
328
  \hline
329
  \bf{Configuration} & \bf{Target FPGA}\footnotemark[1] & \bf{LE / Slices} & \bf{HW RAM} & $\mathbf{f_{max}[Mhz]}$  \\ \hline
330
        \multirow{4}{30mm}{256 Bit Key, encrypt + decrypt} & \mbox{Xilinx\rtm\ Spartan3A} XC3S1400A-5FG484 &  - / 1609 & 18 RAMB16BWE & 91 \\ \cline{2-5}
331
        & \mbox{Xilinx\rtm\ Virtex5}   XC5VLX30-3FF324 &  - / 297 & \mbox{18 18k-Blocks}  \mbox{4 36k-Blocks} & 224 \\ \cline{2-5}
332 16 ruschi
        & \mbox{Altera\rtm\ Cyclone-II} EP2C35F484C8 & 1937 / - &  \mbox{39912 Bits} in  \mbox{22 M4K-Blocks} & 65 \\ \cline{2-5}
333 11 ruschi
        & \mbox{Altera\rtm\ StratixII} EP2S30F484C5 & 585 / - &  \mbox{39912 Bits} in  \mbox{22 M4K-Blocks} & 103  \\
334
        \hline
335
%%%%%%
336
        \multirow{2}{30mm}{128 Bit Key, encrypt + decrypt} & \mbox{Xilinx\rtm\ Spartan3A} XC3S1400A-5FG484 &  - / 1523 & 18 RAMB16BWE & 91 \\ \cline{2-5}
337 16 ruschi
                & \mbox{Altera\rtm\ Cyclone-II} EP2C35F484C8 & 1776 / - &  \mbox{39912 Bits} in  \mbox{22 M4K-Blocks} & 65 \\
338 11 ruschi
        \hline
339
%%%%%%
340
        \multirow{4}{30mm}{256 Bit Key, encrypt} & \mbox{Xilinx\rtm\ Spartan3A}  XC3S1400A-5FG484 &  - / 680 & 14 RAMB16BWE & 159 \\ \cline{2-5}
341
        & \mbox{Xilinx\rtm\ Virtex5}   XC5VLX30-3FF324 &  - / 297 & \mbox{10 18k-Blocks}  \mbox{4 36k-Blocks} & 268 \\ \cline{2-5}
342 16 ruschi
        & \mbox{Altera\rtm\ Cyclone-II} EP2C35F484C8 & 969 / - &  \mbox{22528 Bits} in  \mbox{14 M4K} & 97 \\ \cline{2-5}
343 11 ruschi
        & \mbox{Altera\rtm\ StratixII} EP2S30F484C5 & 524 / - &  \mbox{22528 Bits} in \mbox{ 14 M4K} & 145  \\
344
        \hline
345
%%%%%%
346
        \multirow{2}{30mm}{128 Bit Key, encrypt} & \mbox{Xilinx\rtm\ Spartan3A}  XC3S1400A-5FG484 &  - / 594 & 14 RAMB16BWE & 159 \\ \cline{2-5}
347 16 ruschi
        & \mbox{Altera\rtm\ Cyclone-II} EP2C35F484C8 & 797 / - & \mbox{22528 Bits} in  \mbox{ 14 M4K} & 95  \\ \cline{2-5}
348 11 ruschi
        \hline
349
\end{tabularx}
350
\footnotetext[1]{This table is not meant to be a benchmark between FPGAs of different vendors, it is only a rough
351
  estimation for the user of the core.
352
        The FPGA families cannot  be compared easily, see also \cite{Xilinx:wp284} and \cite{Altera:01007}for further details. }
353
\label{tab:ressources}
354
\captionof{table}{ressource usage on different targets and configuration}
355
 
356 16 ruschi
All configurations in table \ref{tab:ressources} use hardware key
357 11 ruschi
expansion. Downloading of software generated roundkeys is not yet supported. The
358 16 ruschi
decryption and encryption data paths share a common keyexpansion block, multiplexing
359 11 ruschi
the address signals is one of the main reasons for regression of the maximum
360
frequency $f_{max}$ of the configuration compared to encryption only versions.
361
 
362 16 ruschi
\section{Simulation}
363 11 ruschi
\subsection{Testbench}
364
\label{sec:testbench}
365 16 ruschi
In \texttt{./bench/VHDL/} a ``self-checking testbench'' is provided which runs tests
366 11 ruschi
for a default \texttt{TESTKEYSIZE} is 256 Bit . For different key lengths the
367
constant \texttt{TESTKEYSIZE} has to be changed appropriately. Expected results for
368 16 ruschi
all test cases and key lengths are included. The expected results were generated by
369 11 ruschi
AES Calculator applet, written by Lawrie Brown from ADFA, Canberra Australia \cite{LaBr05}.  The
370
testbench consists of a sequence of 5 test cases:
371
\begin{enumerate}
372
\item load key1, load data1, encrypt : (basic encryption test)
373
\item key1, data1, decrypt: (basic decryption test)
374
\item key1, data1, encrypt: (test if internal state was changed)
375
\item key1, data2, encrypt: (encryption test with new data)
376
\item key2, data2, encrypt: (encryption test with new key)
377
\end{enumerate}
378
 
379 16 ruschi
\subsection{Simulation}
380 11 ruschi
\label{sec:simulation}
381
The component library is ``\texttt{avs\_aes\_lib}''. All files are expected to be
382
compiled into this library as all files depend at least on the package
383
\texttt{avs\_aes\_lib.avs\_aes\_pkg}. \\
384
A Makefile for Mentor Graphics\rtm\ Modelsim\rtm\ is given in \texttt{./sim/}. The
385
default make target \texttt{simaes} will create the library
386
``\texttt{avs\_aes\_lib}'' and a ``\texttt{work}'' library, compile all files and run
387
a testbench. \\
388
 
389 16 ruschi
\section{Software Driver}
390 11 ruschi
\label{sec:software}
391
This AES Core Avalon\rtm\ slave was also tested on a NiosII\rtm\ processor.  To use
392
it in software a simple driver is provided in \texttt{./sw/} among with an example
393 16 ruschi
program of the basic usage.
394
The driver consist of the two files \texttt{avs\_aes.c} and \texttt{avs\_aes.h}.
395
Find more detailed description in the doxygen documentation in \texttt{./doc/sw/html}.
396
 
397
\subsection{Configuration}
398 11 ruschi
To be adapted to different address mappings and key sizes two macros are use in \texttt{avs\_aes.h}:
399
 \begin{tabularx}{\textwidth}{|p{25mm}|p{25mm} |X|}
400
  \hline
401
  \bf{define}     &  \bf{default} & \bf{Description}\\ \hline
402
  \texttt{KEYWORDS} & \texttt{8}  & Key size in 32 Bit words \\
403
\hline
404 16 ruschi
  \texttt{AES\_BASEADDR} & \texttt{0x40000} & Base address at which the AES Core is mapped to the Avalon\rtm\ switch-fabric \\
405 11 ruschi
\hline
406
\end{tabularx}
407
\label{tab:macros}
408
\captionof{table}{user changeable macros in header}
409
 
410
 
411
\newpage
412
\section{License and Liability}
413
\label{sec:license}
414
The ``AES 128/192/256 (ECB) Avalon\rtm-MM Slave'' component, all its subcomponents
415
and documentation (like this document you are reading) are published under following
416
license:\\
417
 
418
Copyright (c) 2009, Thomas Ruschival - All rights reserved.
419
 
420
Redistribution and use in source and binary forms, with or without modification, are
421
permitted provided that the following conditions are met:
422
\begin{itemize}
423
\item Redistributions of source code must retain the above copyright notice, this
424
  list of conditions and the following disclaimer.
425
\item Redistributions in binary form must reproduce the above copyright notice, this
426
  list of conditions and the following disclaimer in the documentation and/or other
427
  materials provided with the distribution.
428
\item Neither the name of the organization nor the names of its contributors may be
429
  used to endorse or promote products derived from this software without specific
430
  prior written permission.
431
\end{itemize}
432
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
433
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
434
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
435
 ARE DISCLAIMED. \\
436
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
437
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
438
 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
439
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
440
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
441
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
442
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
443
 THE POSSIBILITY OF SUCH DAMAGE\\
444
 
445
 Note: The term ``SOFTWARE'' in the above licence applies in this case not only to
446
 software as executable code but also to documentation, hardware description or
447
 compiled netlists for actual target hardware. As Chips generally don't just
448
 reproduce ``the above copyright notice, this list of conditions and the following
449
 disclaimer in the documentation and/or other materials provided with the
450 16 ruschi
 distribution'' the data sheet of the product must also contain it.\\
451 11 ruschi
 
452 16 ruschi
 Altera, Cyclone-II, Stratix-II, Quartus, NIOS and Avalon are registered trademarks of the Altera
453 11 ruschi
 Corporation
454
 101 Innovation Drive, San Jose CA USA \\
455
 Xilinx, Spartan3A and Virtex5 are registered trademarks of Xilinx Inc. 2100 Logic Drive, San Jose CA USA \\
456
 Mentor Graphics and ModelSim are registered trademarks of Mentor Graphics
457
 Corporation 8005 SW Boeckman Road, Wilsonville OR USA \newpage
458
 
459 18 ruschi
\printglossaries
460 11 ruschi
 
461
\bibliography{cited}
462
\revisionTable
463
 
464
\end{document}

powered by: WebSVN 2.1.0

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