| 1 |
87 |
JonasDC |
\chapter{AXI4-Lite interface}
|
| 2 |
|
|
\section{Structure}
|
| 3 |
|
|
The AXI4-Lite interface for this core acts as a slave to the AXI bus. It only supports the AXI-Lite procotol since there
|
| 4 |
|
|
is no ID reflection of the data transfer and only a 32-bit wide bus is supported. The AXI4-Lite IPcore block contains the
|
| 5 |
|
|
exponentiation core and a control register for the core its control inputs and outputs.
|
| 6 |
|
|
|
| 7 |
|
|
\section{Parameters}
|
| 8 |
|
|
This section describes the parameters used to configure the core, only the relevant parameters are discussed. AXI
|
| 9 |
|
|
specific parameters are left to the user to configure. The IP core specific parameters and their respective use are
|
| 10 |
|
|
listed in the table below.
|
| 11 |
|
|
\begin{center}
|
| 12 |
|
|
\begin{tabular}{|l|p{6.5cm}|c|l|}
|
| 13 |
|
|
\hline
|
| 14 |
|
|
\rowcolor{Gray}
|
| 15 |
|
|
\textbf{Name} & \textbf{Description} & \textbf{VHDL Type} &\textbf{Default Value} \bigstrut\\
|
| 16 |
|
|
\hline
|
| 17 |
|
|
\multicolumn{4}{|l|}{\textit{\textbf{Memory configuration}}} \\
|
| 18 |
|
|
\hline
|
| 19 |
|
|
\verb|C_FIFO_DEPTH| & depth of the generic FIFO, only applicable if \verb|C_MEM_STYLE| = \verb|"generic"| or \verb|"asym"| & integer & 32 \bigstrut\\
|
| 20 |
|
|
\hline
|
| 21 |
|
|
\verb|C_MEM_STYLE| & the memory structure to use for the RAM, choice between 3 options: & string & \verb|"generic"| \bigstrut\\
|
| 22 |
|
|
& \verb|"xil_prim"| : use xilinx primitives & & \\
|
| 23 |
|
|
& \verb|"generic"| : use general 32-bit RAMs & & \\
|
| 24 |
|
|
& \verb|"asym"| : use asymmetric RAMs & & \\
|
| 25 |
|
|
& (For more information see \ref{subsec:RAM_and_FIFO}) & & \bigstrut[b] \\
|
| 26 |
|
|
\hline
|
| 27 |
|
|
\verb|C_FPGA_MAN| & device manufacturer: & string & \verb|"xilinx"| \\
|
| 28 |
|
|
& \verb|"xilinx"| or \verb|"altera"| & & \bigstrut\\
|
| 29 |
|
|
\hline
|
| 30 |
|
|
\verb|C_BASEADDR| & base address for the IP core's memory space & std\_logic\_vector & X"FFFFFFFF" \bigstrut\\
|
| 31 |
|
|
\hline
|
| 32 |
|
|
\verb|C_HIGHADDR| & high address for the IP core's memory space & std\_logic\_vector & X"00000000" \bigstrut\\
|
| 33 |
|
|
\hline
|
| 34 |
|
|
\multicolumn{4}{|l|}{\textit{\textbf{Multiplier configuration}}} \\
|
| 35 |
|
|
\hline
|
| 36 |
|
|
\verb|C_NR_BITS_TOTAL| & total width of the multiplier in bits & integer & 1536\bigstrut\\
|
| 37 |
|
|
\hline
|
| 38 |
|
|
\verb|C_NR_STAGES_TOTAL| & total number of stages in the pipeline & integer & 96\bigstrut\\
|
| 39 |
|
|
\hline
|
| 40 |
|
|
\verb|C_NR_STAGES_LOW| & number of lower stages in the pipeline, defines the bit-width of the lower pipeline part & integer & 32 \bigstrut\\
|
| 41 |
|
|
\hline
|
| 42 |
|
|
\verb|C_SPLIT_PIPELINE| & option to split the pipeline in 2 parts & boolean & true \bigstrut\\
|
| 43 |
|
|
\hline
|
| 44 |
|
|
\end{tabular}%
|
| 45 |
|
|
\end{center}
|
| 46 |
|
|
%\newline
|
| 47 |
|
|
\newpage
|
| 48 |
|
|
The IP core's memory space is organised in a fixed structure as show in Figure~\ref{AXImemstructure}. Only the upper 17
|
| 49 |
|
|
bits (31:15) of the base address can be chosen freely, the lower bits must be 0. So the \verb|C_BASEADDR| parameter must end
|
| 50 |
|
|
in 0xXXXX0000 or 0xXXXX8000 in hexadecimal representation. The core's memory space must have a minimum width of 28K byte for
|
| 51 |
|
|
all registers to be accessible.
|
| 52 |
|
|
\begin{figure}[H]
|
| 53 |
|
|
\centering
|
| 54 |
|
|
\includegraphics[trim=1.2cm 1.2cm 1.2cm 1.2cm, width=5cm]{pictures/axi_mem.pdf}
|
| 55 |
|
|
\caption{AXI4-Lite IP core memory structure}
|
| 56 |
|
|
\label{AXImemstructure}
|
| 57 |
|
|
\end{figure}
|
| 58 |
|
|
|
| 59 |
|
|
There are 4 parameters to configure the multiplier. These values define the width of the multiplier operands and the
|
| 60 |
|
|
number of pipeline stages. If \verb|C_SPLIT_PIPELINE| is false, only operands with a width of\\\verb|C_NR_BITS_TOTAL| are
|
| 61 |
|
|
valid. Else if \verb|C_SPLIT_PIPELINE| is true, 3 operand widths can be supported:
|
| 62 |
|
|
\begin{itemize}
|
| 63 |
|
|
\item the length of the full pipeline ($C\_NR\_BITS\_TOTAL$)
|
| 64 |
|
|
\item the length of the lower pipeline ($\frac{C\_NR\_BITS\_TOTAL}{C\_NR\_STAGES\_TOTAL} \cdot C\_NR\_STAGES\_LOW $)
|
| 65 |
|
|
\item the length of the higher pipeline ($\frac{C\_NR\_BITS\_TOTAL}{C\_NR\_STAGES\_TOTAL} \cdot (C\_NR\_STAGES\_TOTAL - C\_NR\_STAGES\_LOW$)
|
| 66 |
|
|
\end{itemize}
|
| 67 |
|
|
|
| 68 |
|
|
\section{IO ports}
|
| 69 |
|
|
\begin{tabular}{|l|c|c|l|}
|
| 70 |
|
|
\hline
|
| 71 |
|
|
\rowcolor{Gray}
|
| 72 |
|
|
\textbf{Port} & \textbf{Width} & \textbf{Direction} & \textbf{Description} \\
|
| 73 |
|
|
\hline
|
| 74 |
|
|
\multicolumn{4}{|l|}{\textit{\textbf{AXI4-Lite bus connections}}} \\
|
| 75 |
|
|
\hline
|
| 76 |
|
|
\verb|S_AXI_ACLK| & 1 & in & see note 1 \\
|
| 77 |
|
|
\hline
|
| 78 |
|
|
\verb|S_AXI_ARESETN| & 1 & in & see note 1 \\
|
| 79 |
|
|
\hline
|
| 80 |
|
|
\verb|S_AXI_AWADDR| & 32 & in & see note 1 \\
|
| 81 |
|
|
\hline
|
| 82 |
|
|
\verb|S_AXI_AWVALID| & 1 & in & see note 1 \\
|
| 83 |
|
|
\hline
|
| 84 |
|
|
\verb|S_AXI_AWREADY| & 1 & out & see note 1 \\
|
| 85 |
|
|
\hline
|
| 86 |
|
|
\verb|S_AXI_WDATA| & 32 & in & see note 1 \\
|
| 87 |
|
|
\hline
|
| 88 |
|
|
\verb|S_AXI_WVALID| & 1 & in & see note 1 \\
|
| 89 |
|
|
\hline
|
| 90 |
|
|
\verb|S_AXI_WREADY| & 1 & out & see note 1 \\
|
| 91 |
|
|
\hline
|
| 92 |
|
|
\verb|S_AXI_WSTRB| & 4 & in & see note 1 \\
|
| 93 |
|
|
\hline
|
| 94 |
|
|
\verb|S_AXI_BVALID| & 1 & out & see note 1 \\
|
| 95 |
|
|
\hline
|
| 96 |
|
|
\verb|S_AXI_BREADY| & 1 & in & see note 1 \\
|
| 97 |
|
|
\hline
|
| 98 |
|
|
\verb|S_AXI_BRESP| & 2 & out & see note 1 \\
|
| 99 |
|
|
\hline
|
| 100 |
|
|
\verb|S_AXI_ARADDR| & 32 & in & see note 1 \\
|
| 101 |
|
|
\hline
|
| 102 |
|
|
\verb|S_AXI_ARVALID| & 1 & in & see note 1 \\
|
| 103 |
|
|
\hline
|
| 104 |
|
|
\verb|S_AXI_ARREADY| & 1 & out & see note 1 \\
|
| 105 |
|
|
\hline
|
| 106 |
|
|
\verb|S_AXI_RDATA| & 32 & out & see note 1 \\
|
| 107 |
|
|
\hline
|
| 108 |
|
|
\verb|S_AXI_RVALID| & 1 & out & see note 1 \\
|
| 109 |
|
|
\hline
|
| 110 |
|
|
\verb|S_AXI_RREADY| & 1 & in & see note 1 \\
|
| 111 |
|
|
\hline
|
| 112 |
|
|
\verb|S_AXI_RRESP| & 2 & out & see note 1 \\
|
| 113 |
|
|
\hline
|
| 114 |
|
|
\multicolumn{4}{|l|}{\textit{\textbf{Core signals}}} \\
|
| 115 |
|
|
\hline
|
| 116 |
|
|
\verb|IntrEvent| & 1 & out & core interrupt signal \\
|
| 117 |
|
|
\hline
|
| 118 |
|
|
\verb|calc_time| & 1 & out & is high when core is performing a multiplication, for monitoring \\
|
| 119 |
|
|
\hline
|
| 120 |
|
|
\end{tabular}%
|
| 121 |
|
|
\newline \newline
|
| 122 |
|
|
\textbf{Note 1:} The function and timing of this signal is defined in the AMBA\textsuperscript{\textregistered} AXI Protocol Version: 2.0 Specification.
|
| 123 |
|
|
|
| 124 |
|
|
\section{Registers}
|
| 125 |
|
|
This section specifies the IP core internal registers as seen from the software. These registers allow to control and
|
| 126 |
|
|
configure the modular exponentiation core and to read out its state. All addresses given in this table are relative to the
|
| 127 |
|
|
IP core's base address.\\
|
| 128 |
|
|
\newline
|
| 129 |
|
|
% Table generated by Excel2LaTeX
|
| 130 |
|
|
\begin{tabular}{|l|c|c|c|l|}
|
| 131 |
|
|
\hline
|
| 132 |
|
|
\rowcolor{Gray}
|
| 133 |
|
|
\textbf{Name} & \textbf{Width} & \textbf{Address} & \textbf{Access} & \textbf{Description} \bigstrut\\
|
| 134 |
|
|
\hline
|
| 135 |
|
|
control register & 32 & 0x6000 & RW & multiplier core control signals and \bigstrut[t]\\
|
| 136 |
|
|
& & & & interrupt flags register\bigstrut[b]\\
|
| 137 |
|
|
\hline
|
| 138 |
|
|
\end{tabular}%
|
| 139 |
|
|
\newpage
|
| 140 |
|
|
\subsection{Control register (offset = 0x6000)}
|
| 141 |
|
|
This registers holds the control inputs to the multiplier core and the interrupt flags.\\
|
| 142 |
|
|
\begin{figure}[H]
|
| 143 |
|
|
\centering
|
| 144 |
|
|
\includegraphics[trim=1.2cm 1.2cm 1.2cm 1.2cm, width=15cm]{pictures/axi_control_reg.pdf}
|
| 145 |
|
|
\caption{control register}
|
| 146 |
|
|
\end{figure}
|
| 147 |
|
|
|
| 148 |
|
|
\begin{tabular}{ll}
|
| 149 |
|
|
bits 31-30 & P\_SEL : selects which pipeline part to be active\\
|
| 150 |
|
|
& $\bullet$ "01" lower pipeline part\\
|
| 151 |
|
|
& $\bullet$ "10" higher pipeline part\\
|
| 152 |
|
|
& $\bullet$ "11" full pipeline\\
|
| 153 |
|
|
& $\bullet$ "00" invalid selection\\
|
| 154 |
|
|
&\\
|
| 155 |
|
|
bits 29-28 & DEST\_OP : selects the operand (0-3) to store the result in for a single\\
|
| 156 |
|
|
& Montgomery multiplication\footnotemark\\
|
| 157 |
|
|
&\\
|
| 158 |
|
|
bits 27-26 & X\_OP : selects the x operand (0-3) for a single Montgomery multiplication\footnotemark[\value{footnote}]\\
|
| 159 |
|
|
&\\
|
| 160 |
|
|
bits 25-24 & Y\_OP : selects the y operand (0-3) for a single Montgomery multiplication\footnotemark[\value{footnote}]\\
|
| 161 |
|
|
&\\
|
| 162 |
|
|
bit 23 & START : starts the multiplication/exponentiation\\
|
| 163 |
|
|
&\\
|
| 164 |
|
|
bit 22 & EXP/M : selects the operating mode\\
|
| 165 |
|
|
& $\bullet$ "0" single Montgomery multiplications\\
|
| 166 |
|
|
& $\bullet$ "1" simultaneous exponentiations\\
|
| 167 |
|
|
&\\
|
| 168 |
|
|
bit 21 & RESET : active high reset for the core\footnotemark[2]\\
|
| 169 |
|
|
&\\
|
| 170 |
|
|
bits 20-16 & unimplemented\\
|
| 171 |
|
|
&\\
|
| 172 |
|
|
bit 15 & READY : ready flag, "1" when multiplication is done\\
|
| 173 |
|
|
& must be cleared in software\\
|
| 174 |
|
|
&\\
|
| 175 |
|
|
bit 14 & MEM\_ERR : memory collision error flag, "1" when write error occurred\\
|
| 176 |
|
|
& must be cleared in software\\
|
| 177 |
|
|
&\\
|
| 178 |
|
|
bit 13 & FIFO\_FULL : FIFO full error flag, "1" when FIFO is full\\
|
| 179 |
|
|
& must be cleared in software\\
|
| 180 |
|
|
&\\
|
| 181 |
|
|
bit 12 & FIFO\_ERR : FIFO write/push error flag, "1" when push error occurred\\
|
| 182 |
|
|
& must be cleared in software\\
|
| 183 |
|
|
&\\
|
| 184 |
|
|
bits 11-0 & unimplemented\\
|
| 185 |
|
|
&\\
|
| 186 |
|
|
\end{tabular}
|
| 187 |
|
|
\newline
|
| 188 |
|
|
\newline
|
| 189 |
|
|
\footnotetext[1]{when the core is running in exponentiation mode, the parameters DEST\_OP, X\_OP and Y\_OP have no effect.}
|
| 190 |
|
|
\footnotetext[2]{The reset affects the full IP core, thus resetting the control register, interrupt controller,
|
| 191 |
|
|
the multiplier pipeline, FIFO and control logic of the core.}
|
| 192 |
|
|
\newpage
|
| 193 |
|
|
\section{Interfacing the core's RAM}
|
| 194 |
|
|
Special attention must be taken when writing data to the operands and modulus. The least significant bit of the data has be on the lowest
|
| 195 |
|
|
address and the most significant bit on the highest address. A write to the RAM has to happen 1 word at a time, byte writes are not
|
| 196 |
|
|
supported due to the structure of the RAM.
|
| 197 |
|
|
|
| 198 |
|
|
\section{Handling interrupts}
|
| 199 |
|
|
When the embedded processor receives an interrupt signal from this core, it is up to the controlling software to
|
| 200 |
|
|
determine the source of the interrupt by reading out the interrupt flag of the control register.
|