1 |
2 |
dgisselq |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2 |
|
|
%%
|
3 |
|
|
%% Filename: spec.tex
|
4 |
|
|
%%
|
5 |
|
|
%% Project: Wishbone to ICAPE2 interface conversion
|
6 |
|
|
%%
|
7 |
|
|
%% Purpose: This LaTeX file contains all of the documentation/description
|
8 |
|
|
%% currently provided with this FPGA Real-time Clock Core.
|
9 |
|
|
%% It's not nearly as interesting as the PDF file it creates,
|
10 |
|
|
%% so I'd recommend reading that before diving into this file.
|
11 |
|
|
%% You should be able to find the PDF file in the SVN distribution
|
12 |
|
|
%% together with this PDF file and a copy of the GPL-3.0 license
|
13 |
|
|
%% this file is distributed under. If not, just type 'make'
|
14 |
|
|
%% in the doc directory and it (should) build without a problem.
|
15 |
|
|
%%
|
16 |
|
|
%%
|
17 |
|
|
%% Creator: Dan Gisselquist
|
18 |
|
|
%% Gisselquist Technology, LLC
|
19 |
|
|
%%
|
20 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
21 |
|
|
%%
|
22 |
|
|
%% Copyright (C) 2015, Gisselquist Technology, LLC
|
23 |
|
|
%%
|
24 |
|
|
%% This program is free software (firmware): you can redistribute it and/or
|
25 |
|
|
%% modify it under the terms of the GNU General Public License as published
|
26 |
|
|
%% by the Free Software Foundation, either version 3 of the License, or (at
|
27 |
|
|
%% your option) any later version.
|
28 |
|
|
%%
|
29 |
|
|
%% This program is distributed in the hope that it will be useful, but WITHOUT
|
30 |
|
|
%% ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
31 |
|
|
%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
32 |
|
|
%% for more details.
|
33 |
|
|
%%
|
34 |
|
|
%% You should have received a copy of the GNU General Public License along
|
35 |
|
|
%% with this program. (It's in the $(ROOT)/doc directory, run make with no
|
36 |
|
|
%% target there if the PDF file isn't present.) If not, see
|
37 |
|
|
%% <http://www.gnu.org/licenses/> for a copy.
|
38 |
|
|
%%
|
39 |
|
|
%% License: GPL, v3, as defined and found on www.gnu.org,
|
40 |
|
|
%% http://www.gnu.org/licenses/gpl.html
|
41 |
|
|
%%
|
42 |
|
|
%%
|
43 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
44 |
|
|
\documentclass{gqtekspec}
|
45 |
5 |
dgisselq |
\project{ICAPE2 Access via Wishbone}
|
46 |
2 |
dgisselq |
\title{Specification}
|
47 |
|
|
\author{Dan Gisselquist, Ph.D.}
|
48 |
3 |
dgisselq |
\email{dgisselq (at) opencores.org}
|
49 |
2 |
dgisselq |
\revision{Rev.~0.1}
|
50 |
|
|
\begin{document}
|
51 |
|
|
\pagestyle{gqtekspecplain}
|
52 |
|
|
\titlepage
|
53 |
|
|
\begin{license}
|
54 |
|
|
Copyright (C) \theyear\today, Gisselquist Technology, LLC
|
55 |
|
|
|
56 |
|
|
This project is free software (firmware): you can redistribute it and/or
|
57 |
|
|
modify it under the terms of the GNU General Public License as published
|
58 |
|
|
by the Free Software Foundation, either version 3 of the License, or (at
|
59 |
|
|
your option) any later version.
|
60 |
|
|
|
61 |
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
62 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
63 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
64 |
|
|
for more details.
|
65 |
|
|
|
66 |
|
|
You should have received a copy of the GNU General Public License along
|
67 |
|
|
with this program. If not, see \hbox{<http://www.gnu.org/licenses/>} for a
|
68 |
|
|
copy.
|
69 |
|
|
\end{license}
|
70 |
|
|
\begin{revisionhistory}
|
71 |
5 |
dgisselq |
0.2 & 4/22/2016 & Gisselquist & Minor Updates \\\hline
|
72 |
2 |
dgisselq |
0.1 & 5/25/2015 & Gisselquist & First Draft \\\hline
|
73 |
|
|
\end{revisionhistory}
|
74 |
|
|
% Revision History
|
75 |
|
|
% Table of Contents, named Contents
|
76 |
|
|
\tableofcontents
|
77 |
|
|
% \listoffigures
|
78 |
|
|
\listoftables
|
79 |
|
|
\begin{preface}
|
80 |
5 |
dgisselq |
My thanks to those helpers on the Xilinx Forum who helped me through the final
|
81 |
|
|
step in getting this working.
|
82 |
2 |
dgisselq |
\end{preface}
|
83 |
|
|
|
84 |
|
|
\chapter{Introduction}
|
85 |
|
|
\pagenumbering{arabic}
|
86 |
|
|
\setcounter{page}{1}
|
87 |
|
|
|
88 |
|
|
This core makes the ICAPE2 FPGA configuration registers available to be read
|
89 |
5 |
dgisselq |
or written from a wishbone bus. As Xilinx's documentation of this capability
|
90 |
|
|
leaves a bit to be desired, I have put this file together to help document
|
91 |
2 |
dgisselq |
what works.
|
92 |
|
|
|
93 |
|
|
The interface itself is very valuable for a couple of purposes---from my humble
|
94 |
|
|
and personal perspective. The first is the user configurable watchdog timer
|
95 |
|
|
which can be used to automatically reset an FPGA after it locks up. The second
|
96 |
|
|
is the warm boot start capability, which makes it possible to create a fall
|
97 |
|
|
back configuration image and test it without compromising the ability of the
|
98 |
|
|
FPGA to be started in a known good image. The third valuable capability is that
|
99 |
|
|
of commanding a reconfiguration. All of these capabilities are available
|
100 |
5 |
dgisselq |
through this interface. Further details are available from Xilinx's ``7-Series
|
101 |
|
|
FPGAs Configuration'' User Guide\footnote{For the Spartan, further details are
|
102 |
|
|
available in the ``Spartan--6 FPGA Coniguration'' User Guide}.
|
103 |
2 |
dgisselq |
|
104 |
|
|
This introduction is the first chapter. Beyond this introduction, most
|
105 |
|
|
of the capabilities are documented elsewhere. Hence, the register chapter
|
106 |
|
|
will be omitted and the reader will be gently pointed to the User's Guide.
|
107 |
|
|
This leaves the Wishbone chapter and the I/O Port's chapter which follow.
|
108 |
|
|
|
109 |
|
|
As always, write me if you have any questions or problems.
|
110 |
|
|
|
111 |
|
|
\chapter{Architecture}\label{chap:arch}
|
112 |
|
|
|
113 |
|
|
If I understand correctly, every one of Xilinx's 7--Series FPGA's contains
|
114 |
|
|
two ICAPE2 interface modules. These modules allow user logic to communicate
|
115 |
|
|
with the configuration interface of the chip. This interface, however, isn't
|
116 |
|
|
well documented. According to the User's Guide, it matches the SelectMAP
|
117 |
5 |
dgisselq |
interface, yet in practice \ldots it doesn't. It may come close, but the
|
118 |
|
|
timing and interface requirements of the SelectMAP aren't really the same as the
|
119 |
|
|
ICAPE2 port.
|
120 |
2 |
dgisselq |
|
121 |
|
|
This core encapsulates the difficulty of matching that interface. Register
|
122 |
|
|
addresses match those in the User's Guide, as do register definitions.
|
123 |
|
|
|
124 |
|
|
\chapter{Operation}\label{chap:ops}
|
125 |
|
|
|
126 |
5 |
dgisselq |
Realistically, this is better documented by Xilinx than anything you will find
|
127 |
|
|
here. Still, two examples might be worthwhile.
|
128 |
2 |
dgisselq |
|
129 |
5 |
dgisselq |
First, consider the warm boot reload operation. To do this, write the address
|
130 |
|
|
in configuration memory of an FPGA image to the warm boot start address
|
131 |
|
|
(WBSTAR). In this case, that is address 5'h10 within this interface. A second
|
132 |
|
|
write to the configuration command address (CMD), 5'h4 in this interface, will
|
133 |
|
|
issue the IPROG command to the FPGA and cause it to configure itself from the
|
134 |
|
|
address you just gave it. You can see this from C pseudo code in
|
135 |
|
|
Fig.~\ref{fig:warmboot}.
|
136 |
|
|
\begin{figure}\begin{center}\begin{tabbing}
|
137 |
|
|
{\tt warmboot(uint32 address) \{} \\
|
138 |
|
|
\hbox to 0.25in{}\={\tt uint32\_t *icape = (volatile uint32\_t *)0x{\em <ICAPE port address>};}\\
|
139 |
|
|
\>{\tt icape[16] = address};\\
|
140 |
|
|
\>{\tt icape[4] = 15};\\
|
141 |
|
|
\>{\em // FPGA is now reconfiguring itself from the new address}\\
|
142 |
|
|
\>{\em // If executed on an FPGA, this routine will never return.}\\
|
143 |
|
|
{\tt \}}
|
144 |
|
|
\end{tabbing}
|
145 |
|
|
\caption{Series--7 ICAPE2 Usage}\label{fig:warmboot}
|
146 |
|
|
\end{center}\end{figure}
|
147 |
|
|
|
148 |
2 |
dgisselq |
There, wasn't that simple?
|
149 |
|
|
|
150 |
5 |
dgisselq |
We could do it for the Spartan--6 as well, as shown in Fig.~\ref{fig:sp6boot}.
|
151 |
|
|
\begin{figure}\begin{center}\begin{tabbing}
|
152 |
|
|
{\tt warmboot(uint32 address) \{} \\
|
153 |
|
|
\hbox to 0.25in{}\={\tt uint32\_t *icape6 = (volatile uint32\_t *)0x{\em <ICAPE port address>};}\\
|
154 |
|
|
\>{\tt icape6[13] = (address<<2)\&0x0ffff;}\\
|
155 |
|
|
\>{\tt icape6[14] = ((address>>14)\&0x0ff)|((0x03)<<8);}\\
|
156 |
|
|
\>{\tt icape6[4] = 14;}\\
|
157 |
|
|
\>{\em // The Spartan--6 is now reconfiguring itself from the new address.}\\
|
158 |
|
|
\>{\em // If executed from a softcore internal to a Spartan--6, this routine}\\
|
159 |
|
|
\>{\em // will never return.}\\
|
160 |
|
|
{\tt \}}
|
161 |
|
|
\end{tabbing}
|
162 |
|
|
\caption{Spartan--6 ICAPE Usage}\label{fig:sp6boot}
|
163 |
|
|
\end{center}\end{figure}
|
164 |
|
|
|
165 |
2 |
dgisselq |
Now I can, from the comfort of my home, reconfigure an FPGA in my office without
|
166 |
|
|
needing to press the power button or connect to a JTAG cable. Not bad, no?
|
167 |
|
|
|
168 |
5 |
dgisselq |
\iffalse
|
169 |
|
|
\chapter{Configuration Registers}\label{chap:registers}
|
170 |
|
|
% Tbl.~\ref{tbl:wishbone}
|
171 |
|
|
|
172 |
|
|
% 7 Series
|
173 |
|
|
\begin{table}[htbp]\begin{center}\hline
|
174 |
|
|
\begin{tabular}{|p{0.75in}|p{0.75in}|p{0.5in}|p{2.875in}|}\hline
|
175 |
|
|
\rowcolor[gray]{0.85} Name & Address & Access & Description \\\hline\hline
|
176 |
|
|
CRC & {\tt 0x00} & R/W & CRC Register \\\hline
|
177 |
|
|
FAR & {\tt 0x01} & R/W & Frame Address Register\\\hline
|
178 |
|
|
FDRI & {\tt 0x02} & W & Frame Data Register, Input Register (write configuration data)\\\hline
|
179 |
|
|
FDRO & {\tt 0x03} & R & Frame Data Register, Output Register (read configuration data)\\\hline
|
180 |
|
|
CMD & {\tt 0x04} & R/W & Command Register\\\hline
|
181 |
|
|
CTL0 & {\tt 0x05} & R/W & Control Register 0\\\hline
|
182 |
|
|
MASK & {\tt 0x06} & R/W & Masking Register for CTL0 and CTL1\\\hline
|
183 |
|
|
STAT & {\tt 0x07} & R & Status Register\\\hline
|
184 |
|
|
LOUT & {\tt 0x08} & W & Legacy Output Register for Daisy Chain\\\hline
|
185 |
|
|
COR0 & {\tt 0x09} & R/W & Configuration Option Register 0\\\hline
|
186 |
|
|
MFWR & {\tt 0x0a} & W & Multiple Frame Write Register \\\hline
|
187 |
|
|
CBC & {\tt 0x0b} & W & Initial CBC Value Register \\\hline
|
188 |
|
|
IDCODE & {\tt 0x0c} & R/W & Device ID Register\\\hline
|
189 |
|
|
AXSS & {\tt 0x0d} & R/W & User Access Register \\\hline
|
190 |
|
|
COR1 & {\tt 0x0e} & R/W & Configuration Options Register 1\\\hline
|
191 |
|
|
WBSTAR & {\tt 0x10} & R/W & Warm boot Start Addres Register \\\hline
|
192 |
|
|
TIMER & {\tt 0x11} & R/W & Watchdog Timer Register\\\hline
|
193 |
|
|
BOOTSTS & {\tt 0x16} & R & Boot History Status Register \\\hline
|
194 |
|
|
CTL1 & {\tt 0x18} & R/W & Control Register 1 \\\hline
|
195 |
|
|
BSPI & {\tt 0x1f} & R/W & BPI/SPI Configuration Options Register\\\hline
|
196 |
|
|
\end{tabular}
|
197 |
|
|
\caption{7--Series Configuration Register Addresses}\label{tbl:7addrs}
|
198 |
|
|
\end{center}\end{table}
|
199 |
|
|
|
200 |
|
|
% SPARTAN-6 series
|
201 |
|
|
\begin{table}[htbp]\begin{center}\hline
|
202 |
|
|
\begin{tabular}
|
203 |
|
|
\begin{tabular}{|p{0.75in}|p{0.75in}|p{0.5in}|p{2.875in}|}\hline
|
204 |
|
|
\rowcolor[gray]{0.85} Name & Address & Access & Description \\\hline\hline
|
205 |
|
|
CRC & {\tt 0x00} & W & Cyclic Redundancy Check\\\hline
|
206 |
|
|
FAR\_MAJ & {\tt 0x01} & W & Frame Address Register Block and Major\\\hline
|
207 |
|
|
FAR\_MIN & {\tt 0x02} & W & Frame Address Register Minor\\\hline
|
208 |
|
|
FDRI & {\tt 0x03} & W & Frame Data Input\\\hline
|
209 |
|
|
FDRO & {\tt 0x04} & R & Frame Data Output\\\hline
|
210 |
|
|
CMD & {\tt 0x05} & R/W & Command \\\hline
|
211 |
|
|
CTL & {\tt 0x06} & R/W & Control \\\hline
|
212 |
|
|
MASK & {\tt 0x07} & R/W & Control Mask\\\hline
|
213 |
|
|
STAT & {\tt 0x08} & R & Status \\\hline
|
214 |
|
|
LOUT & {\tt 0x09} & W & Legacy Output for Daisy Chain\\\hline
|
215 |
|
|
COR1 & {\tt 0x0a} & R/W & Configuration Option 1\\\hline
|
216 |
|
|
COR2 & {\tt 0x0b} & R/W & Configuration Option 2\\\hline
|
217 |
|
|
PWRDN\_REG & {\tt 0x0c} & R/W & Power Down Option Register\\\hline
|
218 |
|
|
FLR & {\tt 0x0d} & W & Frame Length Register\\\hline
|
219 |
|
|
IDCODE & {\tt 0x0e} & R/W & Product IDCODE\\\hline
|
220 |
|
|
CWDT & {\tt 0x0f} & R/W & Configuration Watchdog Timer\\\hline
|
221 |
|
|
HC\_OPT\_REG & {\tt 0x10} & R/W & House Clean Option Register\\\hline
|
222 |
|
|
CSBO & {\tt 0x12} & W & CSB Output for Parallel Daisy Chaining\\\hline
|
223 |
|
|
GENERAL1 & {\tt 0x13} & R/W & Power up Self-Test or Loadable Program Address\\\hline
|
224 |
|
|
GENERAL2 & {\tt 0x14} & R/W & Power up Self-Test or Loadable Program Address and new SPI opcode\\\hline
|
225 |
|
|
GENERAL3 & {\tt 0x15} & R/W & Golden Bitstream Address\\\hline
|
226 |
|
|
GENERAL4 & {\tt 0x16} & R/W & Golden Bitstream Address and new SPI Opcode\\\hline
|
227 |
|
|
GENERAL5 & {\tt 0x17} & R/W & User-defined register for fail-safe scheme\\\hline
|
228 |
|
|
MODE\_REG & {\tt 0x18} & R/W & Reboot mode\\\hline
|
229 |
|
|
PU\_GWE & {\tt 0x19} & W & GWE cycle during wake-up from suspend\\\hline
|
230 |
|
|
PU\_GTS & {\tt 0x1a} & W & GTS cycle during wake-up from suspend\\\hline
|
231 |
|
|
MFWR & {\tt 0x1b} & W & Multi-frame write register\\\hline
|
232 |
|
|
CCLK\_FREQ & {\tt 0x1c} & W & CCLK frequency select for master mode\\\hline
|
233 |
|
|
SEU\_OPT & {\tt 0x1d} & R/W & SEU frequency, enable and status\\\hline
|
234 |
|
|
EXP\_SIGN & {\tt 0x1e} & R/W & Expected readback signature for SEU detection\\\hline
|
235 |
|
|
RDBK\_SIGN & {\tt 0x1f} & W & Readback signature for readback command and SEU\\\hline
|
236 |
|
|
BOOTSTS & {\tt 0x20} & R & Boot History Register\\\hline
|
237 |
|
|
EYE\_MASK & {\tt 0x21} & R/W & Mask pins for Multi--Pin Wake-up\\\hline
|
238 |
|
|
CBC\_REG & {\tt 0x22} & W & Initial CBC Value Register\\\hline
|
239 |
|
|
\end{tabular}
|
240 |
|
|
\caption{Spartan--6 Configuration Register Addresses}\label{tbl:6addrs}
|
241 |
|
|
\end{center}\end{table}
|
242 |
|
|
|
243 |
|
|
% icape->general1 = (fpgaddr<<2);
|
244 |
|
|
% icape->general2 = ((fpgaddr>>14)&0x0ff)|((0x03)<<8);
|
245 |
|
|
% icape->cmd = 0x0e // IPROG
|
246 |
|
|
\fi
|
247 |
|
|
|
248 |
2 |
dgisselq |
\chapter{Wishbone Datasheet}\label{chap:wishbone}
|
249 |
|
|
Tbl.~\ref{tbl:wishbone}
|
250 |
|
|
\begin{table}[htbp]
|
251 |
|
|
\begin{center}
|
252 |
|
|
\begin{wishboneds}
|
253 |
|
|
Revision level of wishbone & WB B4 spec \\\hline
|
254 |
|
|
Type of interface & Slave, Read/Write \\\hline
|
255 |
|
|
Port size & 32--bit \\\hline
|
256 |
|
|
Port granularity & 32--bit \\\hline
|
257 |
|
|
Maximum Operand Size & 32--bit \\\hline
|
258 |
|
|
Data transfer ordering & (Irrelevant) \\\hline
|
259 |
|
|
Clock constraints & See the Datasheet for your part\\\hline
|
260 |
|
|
Signal Names & \begin{tabular}{ll}
|
261 |
|
|
Signal Name & Wishbone Equivalent \\\hline
|
262 |
|
|
{\tt i\_clk} & {\tt CLK\_I} \\
|
263 |
|
|
{\tt i\_wb\_cyc} & {\tt CYC\_I} \\
|
264 |
|
|
{\tt i\_wb\_stb} & {\tt STB\_I} \\
|
265 |
|
|
{\tt i\_wb\_we} & {\tt WE\_I} \\
|
266 |
|
|
{\tt i\_wb\_addr} & {\tt ADR\_I} \\
|
267 |
|
|
{\tt i\_wb\_data} & {\tt DAT\_I} \\
|
268 |
|
|
{\tt o\_wb\_ack} & {\tt ACK\_O} \\
|
269 |
|
|
{\tt o\_wb\_stall} & {\tt STALL\_O} \\
|
270 |
|
|
{\tt o\_wb\_data} & {\tt DAT\_O}
|
271 |
|
|
\end{tabular}\\\hline
|
272 |
|
|
\end{wishboneds}
|
273 |
|
|
\caption{Wishbone Datasheet}\label{tbl:wishbone}
|
274 |
|
|
\end{center}\end{table}
|
275 |
|
|
is required by the wishbone specification, and so
|
276 |
|
|
it is included here. The big thing to notice is that this ICAPE2 interface
|
277 |
|
|
acts as a wishbone slave, and that all accesses to the ICAPE2 registers become
|
278 |
|
|
32--bit reads and writes to this interface. Bit ordering is the normal
|
279 |
|
|
ordering where bit~31 is the most significant bit and so forth. (Bit reversal
|
280 |
|
|
is accomplished internally to match Xilinx's definition.) The {\tt o\_stall}
|
281 |
|
|
and {\tt o\_ack} lines are necessarily used to deal with the fact that
|
282 |
|
|
operations to the device take many clocks to complete (14 for writes, 21 for
|
283 |
|
|
reads), so be prepared to wait a couple of clocks for your access to complete.
|
284 |
|
|
Further, the {\tt o\_ack} line will go high while the bus is stalled in many
|
285 |
|
|
cases, indicating that the operation is complete but that the core is not
|
286 |
|
|
yet ready to handle a subsequent request.
|
287 |
|
|
|
288 |
|
|
\chapter{I/O Ports}\label{chap:ioports}
|
289 |
|
|
This core offers no I/O ports beyond those of the wishbone discussed in
|
290 |
|
|
Chapt.~\ref{chap:wishbone}. The I/O ports associated with the ICAPE2 interface
|
291 |
|
|
are captured internally, and not brought to the output of this core.
|
292 |
|
|
|
293 |
|
|
% Appendices
|
294 |
|
|
% Index
|
295 |
|
|
\end{document}
|
296 |
|
|
|
297 |
|
|
|