1 |
47 |
JonasDC |
\chapter{PLB interface}
|
2 |
|
|
\section{Structure}
|
3 |
|
|
The Processor Local Bus interface for this core is structured as in Figure~\ref{PLBstructure}. The core acts as a slave
|
4 |
|
|
to the PLB bus. The PLB v4.6 Slave\cite{XilinxPLB} logic translates the interface to a lower level IP Interconnect
|
5 |
|
|
Interface (IPIC).
|
6 |
|
|
This is then used to connect the core internal components to. The user logic contains the exponentiation core and the
|
7 |
|
|
control register for the core its control inputs and outputs. An internal interrupt controller\cite{XilinxIntr} handles
|
8 |
|
|
the outgoing interrupt requests and a software reset module is provided to be able to reset the IP core at runtime. This
|
9 |
|
|
bus interface is created using the ``Create or Import Peripheral'' wizard from Xilinx Platform Studio.\\
|
10 |
|
|
\begin{figure}[H]
|
11 |
|
|
\centering
|
12 |
|
|
\includegraphics[trim=1.2cm 1.2cm 1.2cm 1.2cm, width=7cm]{pictures/plb_interface.pdf}
|
13 |
|
|
\caption{PLB IP core structure}
|
14 |
|
|
\label{PLBstructure}
|
15 |
|
|
\end{figure}
|
16 |
|
|
|
17 |
|
|
\newpage
|
18 |
|
|
\section{Parameters}
|
19 |
|
|
This section describes the parameters used to configure the core, only the relevant parameters are discussed. PLB
|
20 |
|
|
specific parameters are left to the user to configure. The IP core specific parameters and their respective use are
|
21 |
|
|
listed in the table below.
|
22 |
|
|
\begin{center}
|
23 |
|
|
\begin{tabular}{|l|p{6.5cm}|c|l|}
|
24 |
|
|
\hline
|
25 |
|
|
\rowcolor{Gray}
|
26 |
|
|
\textbf{Name} & \textbf{Description} & \textbf{VHDL Type} &\textbf{Default Value} \bigstrut\\
|
27 |
|
|
\hline
|
28 |
78 |
JonasDC |
\multicolumn{4}{|l|}{\textit{\textbf{Memory configuration}}} \\
|
29 |
47 |
JonasDC |
\hline
|
30 |
78 |
JonasDC |
\verb|C_FIFO_DEPTH| & depth of the generic FIFO, only applicable if \verb|C_MEM_STYLE| = \verb|"generic"| or \verb|"asym"| & integer & 32 \bigstrut\\
|
31 |
|
|
\hline
|
32 |
|
|
\verb|C_MEM_STYLE| & the memory structure to use for the RAM, choice between 3 options: & string & \verb|"generic"| \bigstrut\\
|
33 |
|
|
& \verb|"xil_prim"| : use xilinx primitives & & \\
|
34 |
|
|
& \verb|"generic"| : use general 32-bit RAMs & & \\
|
35 |
|
|
& \verb|"asym"| : use asymmetric RAMs & & \\
|
36 |
|
|
& (For more information see \ref{subsec:RAM_and_FIFO}) & & \bigstrut[b] \\
|
37 |
|
|
\hline
|
38 |
87 |
JonasDC |
\verb|C_FPGA_MAN| & device manufacturer: & string & \verb|"xilinx"| \\
|
39 |
78 |
JonasDC |
& \verb|"xilinx"| or \verb|"altera"| & & \bigstrut\\
|
40 |
|
|
\hline
|
41 |
47 |
JonasDC |
\verb|C_BASEADDR| & base address for the IP core's memory space & std\_logic\_vector & X"FFFFFFFF" \bigstrut\\
|
42 |
|
|
\hline
|
43 |
|
|
\verb|C_HIGHADDR| & high address for the IP core's memory space & std\_logic\_vector & X"00000000" \bigstrut\\
|
44 |
|
|
\hline
|
45 |
|
|
\verb|C_M_BASEADDR| & base address for the modulus memory space & std\_logic\_vector & X"FFFFFFFF" \bigstrut\\
|
46 |
|
|
\hline
|
47 |
|
|
\verb|C_M_HIGHADDR| & high address for the modulus memory space & std\_logic\_vector & X"00000000" \bigstrut\\
|
48 |
|
|
\hline
|
49 |
|
|
\verb|C_OP0_BASEADDR| & base address for the operand 0 memory space & std\_logic\_vector & X"FFFFFFFF" \bigstrut\\
|
50 |
|
|
\hline
|
51 |
|
|
\verb|C_OP0_HIGHADDR| & high address for the operand 0 memory space & std\_logic\_vector & X"00000000" \bigstrut\\
|
52 |
|
|
\hline
|
53 |
|
|
\verb|C_OP1_BASEADDR| & base address for the operand 1 memory space & std\_logic\_vector & X"FFFFFFFF" \bigstrut\\
|
54 |
|
|
\hline
|
55 |
|
|
\verb|C_OP1_HIGHADDR| & high address for the operand 1 memory space & std\_logic\_vector & X"00000000" \bigstrut\\
|
56 |
|
|
\hline
|
57 |
|
|
\verb|C_OP2_BASEADDR| & base address for the operand 2 memory space & std\_logic\_vector & X"FFFFFFFF" \bigstrut\\
|
58 |
|
|
\hline
|
59 |
|
|
\verb|C_OP2_HIGHADDR| & high address for the operand 2 memory space & std\_logic\_vector & X"00000000" \bigstrut\\
|
60 |
|
|
\hline
|
61 |
|
|
\verb|C_OP3_BASEADDR| & base address for the operand 3 memory space & std\_logic\_vector & X"FFFFFFFF" \bigstrut\\
|
62 |
|
|
\hline
|
63 |
|
|
\verb|C_OP3_HIGHADDR| & high address for the operand 3 memory space & std\_logic\_vector & X"00000000" \bigstrut\\
|
64 |
|
|
\hline
|
65 |
|
|
\verb|C_FIFO_BASEADDR| & base address for the FIFO memory space & std\_logic\_vector & X"FFFFFFFF" \bigstrut\\
|
66 |
|
|
\hline
|
67 |
|
|
\verb|C_FIFO_HIGHADDR| & high address for the FIFO memory space & std\_logic\_vector & X"00000000" \bigstrut\\
|
68 |
|
|
\hline
|
69 |
|
|
\multicolumn{4}{|l|}{\textit{\textbf{Multiplier configuration}}} \\
|
70 |
|
|
\hline
|
71 |
|
|
\verb|C_NR_BITS_TOTAL| & total width of the multiplier in bits & integer & 1536\bigstrut\\
|
72 |
|
|
\hline
|
73 |
|
|
\verb|C_NR_STAGES_TOTAL| & total number of stages in the pipeline & integer & 96\bigstrut\\
|
74 |
|
|
\hline
|
75 |
|
|
\verb|C_NR_STAGES_LOW| & number of lower stages in the pipeline, defines the bit-width of the lower pipeline part & integer & 32 \bigstrut\\
|
76 |
|
|
\hline
|
77 |
|
|
\verb|C_SPLIT_PIPELINE| & option to split the pipeline in 2 parts & boolean & true \bigstrut\\
|
78 |
|
|
\hline
|
79 |
|
|
\end{tabular}%
|
80 |
|
|
\end{center}
|
81 |
|
|
%\newline
|
82 |
|
|
|
83 |
|
|
The complete IP core's memory space can be controlled. As can be seen, the operand, modulus and FIFO memory space can be
|
84 |
|
|
chosen separately from the IP core's memory space which hold the registers for control, software reset and interrupt
|
85 |
|
|
control. The core's memory space must have a minimum width of 1K byte for all registers to be accessible. For the FIFO
|
86 |
|
|
memory space, a minimum width of 4 byte is needed, since the FIFO is only 32 bit wide. The memory space width for the
|
87 |
|
|
operands and the modulus need a minimum width equal to the total multiplier width.\\
|
88 |
|
|
|
89 |
|
|
There are 4 parameters to configure the multiplier. These values define the width of the multiplier operands and the
|
90 |
|
|
number of pipeline stages. If \verb|C_SPLIT_PIPELINE| is false, only operands with a width of\\\verb|C_NR_BITS_TOTAL| are
|
91 |
|
|
valid. Else if \verb|C_SPLIT_PIPELINE| is true, 3 operand widths can be supported:
|
92 |
|
|
\begin{itemize}
|
93 |
|
|
\item the length of the full pipeline ($C\_NR\_BITS\_TOTAL$)
|
94 |
|
|
\item the length of the lower pipeline ($\frac{C\_NR\_BITS\_TOTAL}{C\_NR\_STAGES\_TOTAL} \cdot C\_NR\_STAGES\_LOW $)
|
95 |
|
|
\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$)
|
96 |
|
|
\end{itemize}
|
97 |
|
|
|
98 |
|
|
\section{IO ports}
|
99 |
|
|
\begin{tabular}{|l|c|c|l|}
|
100 |
|
|
\hline
|
101 |
|
|
\rowcolor{Gray}
|
102 |
|
|
\textbf{Port} & \textbf{Width} & \textbf{Direction} & \textbf{Description} \\
|
103 |
|
|
\hline
|
104 |
|
|
\multicolumn{4}{|l|}{\textit{\textbf{PLB bus connections}}} \\
|
105 |
|
|
\hline
|
106 |
|
|
\verb|SPLB_Clk| & 1 & in & see note 1 \\
|
107 |
|
|
\hline
|
108 |
|
|
\verb|SPLB_Rst| & 1 & in & see note 1 \\
|
109 |
|
|
\hline
|
110 |
|
|
\verb|PLB_ABus| & 32 & in & see note 1 \\
|
111 |
|
|
\hline
|
112 |
|
|
\verb|PLB_PAValid| & 1 & in & see note 1 \\
|
113 |
|
|
\hline
|
114 |
|
|
\verb|PLB_masterID| & 3 & in & see note 1 \\
|
115 |
|
|
\hline
|
116 |
|
|
\verb|PLB_RNW| & 1 & in & see note 1 \\
|
117 |
|
|
\hline
|
118 |
|
|
\verb|PLB_BE| & 4 & in & see note 1 \\
|
119 |
|
|
\hline
|
120 |
|
|
\verb|PLB_size| & 4 & in & see note 1 \\
|
121 |
|
|
\hline
|
122 |
|
|
\verb|PLB_type| & 3 & in & see note 1 \\
|
123 |
|
|
\hline
|
124 |
|
|
\verb|PLB_wrDBus| & 32 & in & see note 1 \\
|
125 |
|
|
\hline
|
126 |
|
|
\verb|Sl_addrAck| & 1 & out & see note 1 \\
|
127 |
|
|
\hline
|
128 |
|
|
\verb|Sl_SSize| & 2 & out & see note 1 \\
|
129 |
|
|
\hline
|
130 |
|
|
\verb|Sl_wait| & 1 & out & see note 1 \\
|
131 |
|
|
\hline
|
132 |
|
|
\verb|Sl_rearbitrate| & 1 & out & see note 1 \\
|
133 |
|
|
\hline
|
134 |
|
|
\verb|Sl_wrDack| & 1 & out & see note 1 \\
|
135 |
|
|
\hline
|
136 |
|
|
\verb|Sl_wrComp| & 1 & out & see note 1 \\
|
137 |
|
|
\hline
|
138 |
|
|
\verb|Sl_rdBus| & 32 & out & see note 1 \\
|
139 |
|
|
\hline
|
140 |
|
|
\verb|Sl_MBusy| & 8 & out & see note 1 \\
|
141 |
|
|
\hline
|
142 |
|
|
\verb|Sl_MWrErr| & 8 & out & see note 1 \\
|
143 |
|
|
\hline
|
144 |
|
|
\verb|Sl_MRdErr| & 8 & out & see note 1 \\
|
145 |
|
|
\hline
|
146 |
|
|
\multicolumn{4}{|l|}{\textit{\textbf{unused PLB signals}}} \\
|
147 |
|
|
\hline
|
148 |
|
|
\verb|PLB_UABus| & 32 & in & see note 1 \\
|
149 |
|
|
\hline
|
150 |
|
|
\verb|PLB_SAValid| & 1 & in & see note 1 \\
|
151 |
|
|
\hline
|
152 |
|
|
\verb|PLB_rdPrim| & 1 & in & see note 1 \\
|
153 |
|
|
\hline
|
154 |
|
|
\verb|PLB_wrPrim| & 1 & in & see note 1 \\
|
155 |
|
|
\hline
|
156 |
|
|
\verb|PLB_abort| & 1 & in & see note 1 \\
|
157 |
|
|
\hline
|
158 |
|
|
\verb|PLB_busLock| & 1 & in & see note 1 \\
|
159 |
|
|
\hline
|
160 |
|
|
\verb|PLB_MSize| & 2 & in & see note 1 \\
|
161 |
|
|
\hline
|
162 |
|
|
\verb|PLB_TAttribute| & 16 & in & see note 1 \\
|
163 |
|
|
\hline
|
164 |
|
|
\verb|PLB_lockerr| & 1 & in & see note 1 \\
|
165 |
|
|
\hline
|
166 |
|
|
\verb|PLB_wrBurst| & 1 & in & see note 1 \\
|
167 |
|
|
\hline
|
168 |
|
|
\verb|PLB_rdBurst| & 1 & in & see note 1 \\
|
169 |
|
|
\hline
|
170 |
|
|
\verb|PLB_wrPendReq| & 1 & in & see note 1 \\
|
171 |
|
|
\hline
|
172 |
|
|
\verb|PLB_rdPendReq| & 1 & in & see note 1 \\
|
173 |
|
|
\hline
|
174 |
|
|
\verb|PLB_rdPendPri| & 2 & in & see note 1 \\
|
175 |
|
|
\hline
|
176 |
|
|
\verb|PLB_wrPendPri| & 2 & in & see note 1 \\
|
177 |
|
|
\hline
|
178 |
|
|
\verb|PLB_reqPri| & 2 & in & see note 1 \\
|
179 |
|
|
\hline
|
180 |
|
|
\verb|Sl_wrBTerm| & 1 & out & see note 1 \\
|
181 |
|
|
\hline
|
182 |
|
|
\verb|Sl_rdWdAddr| & 4 & out & see note 1 \\
|
183 |
|
|
\hline
|
184 |
|
|
\verb|Sl_rdBTerm| & 1 & out & see note 1 \\
|
185 |
|
|
\hline
|
186 |
|
|
\verb|Sl_MIRQ| & 8 & out & see note 1 \\
|
187 |
|
|
\hline
|
188 |
|
|
\multicolumn{4}{|l|}{\textit{\textbf{Core signals}}} \\
|
189 |
|
|
\hline
|
190 |
|
|
\verb|IP2INTC_Irpt| & 1 & out & core interrupt signal \\
|
191 |
|
|
\hline
|
192 |
|
|
\verb|calc_time| & 1 & out & is high when core is performing a multiplication, for monitoring \\
|
193 |
|
|
\hline
|
194 |
|
|
\end{tabular}%
|
195 |
|
|
\newline \newline
|
196 |
|
|
\textbf{Note 1:} The function and timing of this signal is defined in the IBM\textsuperscript{\textregistered} 128-Bit Processor Local Bus Architecture Specification
|
197 |
|
|
Version 4.6.
|
198 |
|
|
|
199 |
|
|
\section{Registers}
|
200 |
|
|
This section specifies the IP core internal registers as seen from the software. These registers allow to control and
|
201 |
|
|
configure the modular exponentiation core and to read out its state. All addresses given in this table are relative to the
|
202 |
|
|
IP core's base address.\\
|
203 |
|
|
\newline
|
204 |
|
|
% Table generated by Excel2LaTeX
|
205 |
|
|
\begin{tabular}{|l|c|c|c|l|}
|
206 |
|
|
\hline
|
207 |
|
|
\rowcolor{Gray}
|
208 |
|
|
\textbf{Name} & \textbf{Width} & \textbf{Address} & \textbf{Access} & \textbf{Description} \bigstrut\\
|
209 |
|
|
\hline
|
210 |
|
|
control register & 32 & 0x0000 & RW & multiplier core control signals and \bigstrut[t]\\
|
211 |
|
|
& & & & interrupt flags register\bigstrut[b]\\
|
212 |
|
|
\hline
|
213 |
|
|
software reset & 32 & 0x0100 & W & soft reset for the IP core \bigstrut\\
|
214 |
|
|
\hline
|
215 |
|
|
\multicolumn{5}{|l|}{\textbf{\textit{Interrupt controller registers}}} \bigstrut\\
|
216 |
|
|
\hline
|
217 |
|
|
global interrupt enable register & 32 & 0x021C & RW & global interrupt enable for the IP core \bigstrut[t]\\
|
218 |
|
|
interrupt status register & 32 & 0x0220 & R & register for interrupt status flags\\
|
219 |
|
|
interrupt enable register & 32 & 0x0228 & RW & register to enable individual IP core interrupts \bigstrut[b]\\
|
220 |
|
|
\hline
|
221 |
|
|
\end{tabular}%
|
222 |
|
|
|
223 |
|
|
\newpage
|
224 |
|
|
\subsection{Control register (offset = 0x0000)}
|
225 |
|
|
This registers holds the control inputs to the multiplier core and the interrupt flags.\\
|
226 |
|
|
\begin{figure}[H]
|
227 |
|
|
\centering
|
228 |
|
|
\includegraphics[trim=1.2cm 1.2cm 1.2cm 1.2cm, width=15cm]{pictures/plb_control_reg.pdf}
|
229 |
|
|
\caption{control register}
|
230 |
|
|
\end{figure}
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
\begin{tabular}{ll}
|
234 |
|
|
bits 0-1 & P\_SEL : selects which pipeline part to be active\\
|
235 |
|
|
& $\bullet$ "01" lower pipeline part\\
|
236 |
|
|
& $\bullet$ "10" higher pipeline part\\
|
237 |
|
|
& $\bullet$ "11" full pipeline\\
|
238 |
|
|
& $\bullet$ "00" invalid selection\\
|
239 |
|
|
&\\
|
240 |
|
|
bits 2-3 & DEST\_OP : selects the operand (0-3) to store the result in for a single\\
|
241 |
|
|
& Montgomery multiplication\footnotemark\\
|
242 |
|
|
&\\
|
243 |
|
|
bits 4-5 & X\_OP : selects the x operand (0-3) for a single Montgomery multiplication\footnotemark[\value{footnote}]\\
|
244 |
|
|
&\\
|
245 |
|
|
bits 6-7 & Y\_OP : selects the y operand (0-3) for a single Montgomery multiplication\footnotemark[\value{footnote}]\\
|
246 |
|
|
&\\
|
247 |
|
|
bit 8 & START : starts the multiplication/exponentiation\\
|
248 |
|
|
&\\
|
249 |
|
|
bit 9 & EXP/M : selects the operating mode\\
|
250 |
|
|
& $\bullet$ "0" single Montgomery multiplications\\
|
251 |
|
|
& $\bullet$ "1" simultaneous exponentiations\\
|
252 |
|
|
&\\
|
253 |
|
|
bits 10-15 & unimplemented\\
|
254 |
|
|
&\\
|
255 |
|
|
bit 16 & READY : ready flag, "1" when multiplication is done\\
|
256 |
|
|
& must be cleared in software\\
|
257 |
|
|
&\\
|
258 |
|
|
bit 17 & MEM\_ERR : memory collision error flag, "1" when write error occurred\\
|
259 |
|
|
& must be cleared in software\\
|
260 |
|
|
&\\
|
261 |
|
|
bit 18 & FIFO\_FULL : FIFO full error flag, "1" when FIFO is full\\
|
262 |
|
|
& must be cleared in software\\
|
263 |
|
|
&\\
|
264 |
|
|
bit 19 & FIFO\_ERR : FIFO write/push error flag, "1" when push error occurred\\
|
265 |
|
|
& must be cleared in software\\
|
266 |
|
|
&\\
|
267 |
|
|
bits 20-31 & unimplemented\\
|
268 |
|
|
&\\
|
269 |
|
|
\end{tabular}
|
270 |
|
|
\newline
|
271 |
|
|
\newline
|
272 |
|
|
\footnotetext{when the core is running in exponentiation mode, the parameters DEST\_OP, X\_OP and Y\_OP have no effect.}
|
273 |
|
|
|
274 |
|
|
\newpage
|
275 |
|
|
\subsection{Software reset register (offset = 0x0100)}
|
276 |
|
|
This is a register with write only access, and provides the possibility to reset the IP core from software by writing
|
277 |
|
|
0x0000000A to this address. The reset affects the full IP core, thus resetting the control register, interrupt controller,
|
278 |
|
|
the multiplier pipeline, FIFO and control logic of the core.
|
279 |
|
|
|
280 |
|
|
\subsection{Global interrupt enable register (offset = 0x021C)}
|
281 |
|
|
This register contains a single defined bit in the high-order position. The GIE bit enables or disables all interrupts
|
282 |
|
|
form the IP core.\\
|
283 |
|
|
\begin{figure}[H]
|
284 |
|
|
\centering
|
285 |
|
|
\includegraphics[trim=1.2cm 1.2cm 1.2cm 1.2cm, width=15cm]{pictures/plb_gie_reg.pdf}
|
286 |
|
|
\caption{Global interrupt enable register}
|
287 |
|
|
\end{figure}
|
288 |
|
|
|
289 |
|
|
\begin{tabular}{ll}
|
290 |
|
|
bit 0 & GIE : Global interrupt enable\\
|
291 |
|
|
& $\bullet$ "0" disables all core interrupts\\
|
292 |
|
|
& $\bullet$ "1" enables all core interrupts\\
|
293 |
|
|
&\\
|
294 |
|
|
bits 1-31 & unimplemented\\
|
295 |
|
|
&\\
|
296 |
|
|
\end{tabular}
|
297 |
|
|
|
298 |
|
|
\subsection{Interrupt status register (offset = 0x0220)}
|
299 |
|
|
Read-only register that contains the status of the core interrupts. Currently there is only one common interrupt from
|
300 |
|
|
the core that is asserted when a multiplication/exponentiation is done, FIFO is full, on FIFO push error or memory write
|
301 |
|
|
collision.\\
|
302 |
|
|
\begin{figure}[H]
|
303 |
|
|
\centering
|
304 |
|
|
\includegraphics[trim=1.2cm 1.2cm 1.2cm 1.2cm, width=15cm]{pictures/plb_is_reg.pdf}
|
305 |
|
|
\caption{Interrupt status register}
|
306 |
|
|
\end{figure}
|
307 |
|
|
|
308 |
|
|
\begin{tabular}{ll}
|
309 |
|
|
bits 0-30 & unimplemented\\
|
310 |
|
|
&\\
|
311 |
|
|
bit 31 & CIS : Core interrupt status\\
|
312 |
|
|
& is high when interrupt is requested from core\\
|
313 |
|
|
&\\
|
314 |
|
|
\end{tabular}
|
315 |
|
|
|
316 |
|
|
\subsection{interrupt enable register (offset = 0x0228)}
|
317 |
|
|
This register contains the interrupt enable bits for the respective interrupt bits of the interrupt status register.\\
|
318 |
|
|
\begin{figure}[H]
|
319 |
|
|
\centering
|
320 |
|
|
\includegraphics[trim=1.2cm 1.2cm 1.2cm 1.2cm, width=15cm]{pictures/plb_ie_reg.pdf}
|
321 |
|
|
\caption{Interrupt enable register}
|
322 |
|
|
\end{figure}
|
323 |
|
|
\begin{tabular}{ll}
|
324 |
|
|
bits 0-30 & unimplemented\\
|
325 |
|
|
&\\
|
326 |
|
|
bit 31 & CIE : Core interrupt enable\\
|
327 |
|
|
& $\bullet$ "0" disable core interrupt\\
|
328 |
|
|
& $\bullet$ "1" enable core interrupt\\
|
329 |
|
|
&\\
|
330 |
|
|
\end{tabular}
|
331 |
|
|
|
332 |
|
|
\section{Interfacing the core's RAM}
|
333 |
|
|
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
|
334 |
|
|
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
|
335 |
|
|
supported due to the structure of the RAM.
|
336 |
|
|
|
337 |
|
|
\section{Handling interrupts}
|
338 |
|
|
When the embedded processor receives an interrupt signal from this core, it is up to the controlling software to
|
339 |
|
|
determine the source of the interrupt by reading out the interrupt flag of the control register.
|