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

Subversion Repositories ao68000

[/] [ao68000/] [trunk/] [doc/] [src/] [documentation.v] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 alfik
/*
2
 * Copyright 2010, Aleksander Osman, alfik@poczta.fm. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without modification, are
5
 * permitted provided that the following conditions are met:
6
 *
7
 *  1. Redistributions of source code must retain the above copyright notice, this list of
8
 *     conditions and the following disclaimer.
9
 *
10
 *  2. Redistributions in binary form must reproduce the above copyright notice, this list
11
 *     of conditions and the following disclaimer in the documentation and/or other materials
12
 *     provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
15
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 */
24
 
25
/* This file contains only Doxygen documentation.
26
*/
27
 
28
/*! \file documentation.v
29
 * \brief ao68000 Doxygen documentation.
30
 */
31
 
32
/*! \mainpage
33
 *                                                      <table border=0 width=100%><tr><td>
34
 * OpenCores ao68000 IP Core.
35
 * \author Aleksander Osman, <alfik@poczta.fm>
36
 * \date 11.12.2010
37
 * \version 1.1
38
 *                                                      </td><td>
39
 * \image html ./doc/img/opencores.jpg
40
 *                                                      </td></tr></table>
41
 *
42
 *                                                      <table border=0 width=100%><tr><td>
43
 * <b>Contents:</b>
44
 *   - <a href="./../../specification.pdf">Specification</a>, automatically generated from:
45
 *      - \subpage page_spec_revisions,
46
 *      - \subpage page_spec_introduction,
47
 *      - \subpage page_spec_architecture,
48
 *      - \subpage page_spec_operation,
49
 *      - \subpage page_spec_registers,
50
 *      - \subpage page_spec_clocks,
51
 *      - \subpage page_spec_ports,
52
 *      - \subpage page_spec_references.
53
 *   - \subpage page_directory,
54
 *   - \subpage page_tool,
55
 *   - \subpage page_verification,
56
 *   - \subpage page_mc68000,
57
 *   - \subpage page_old_notes,
58
 *   - \subpage page_microcode_compilation,
59
 *   - \subpage page_microcode_operations,
60
 *   - \subpage page_microcode,
61
 *   - \subpage page_soc_linux.
62
 *                                                      </td><td>
63
 * \image html ./doc/img/wishbone_compatible.png
64
 *                                                      </td></tr></table>
65
 *
66
 * <b>Structure Diagram:</b>
67
 * \image html structure.png
68
 *
69
 * <b>About the documentation:</b>
70
 * The ao68000 core documentation is generated by the Doxygen tool
71
 * (www.doxygen.org) with the doxverilog patch
72
 * (http://developer.berlios.de/projects/doxverilog/).
73
 */
74
 
75
/*! \page page_spec_revisions Revision History
76
 * <table width=100%>
77
 * <tr style="background: #CCCCCC; font-weight: bold;">
78
 *     <td>Rev.     </td><td>Date       </td><td>Author             </td><td>Description        </td></tr>
79
 * <tr><td>1.0      </td><td>28.03.2010 </td><td>Aleksander Osman   </td><td>First Draft        </td></tr>
80
 * <tr><td>1.1      </td><td>11.12.2010 </td><td>Aleksander Osman   </td><td>DBcc opcode microcode fix. Wishbone SEL signal fix. Project directory structure simplification.</td></tr>
81 13 alfik
 * <tr><td>1.2      </td><td>15.01.2011 </td><td>Aleksander Osman, Frederic Requin</td><td>Core area optimization: biggest gain in ALU multiplication and division reimplementation.</td></tr>
82 12 alfik
 * </table>
83
 */
84
 
85
/*! \page page_spec_introduction Introduction
86
 *
87
 * The OpenCores ao68000 IP Core is a Motorola MC68000 compatible processor.
88
 *
89
 * <h3>Features</h3>
90
 *  - CISC processor with microcode,
91
 *  - WISHBONE revision B.3 compatible MASTER interface,
92
 *  - Not cycle exact with the MC68000, some instructions take more cycles to complete, some less,
93 17 alfik
 *  - Uses about 4810 LE on Altera Cyclone II and about 45600 bits of RAM for microcode,
94 12 alfik
 *  - Tested against the WinUAE M68000 software emulator. Every 16-bit instruction was tested with random register contents and RAM contents
95
 *    (\ref page_verification). The result of execution was compared,
96
 *  - Contains a simple prefetch which is capable of holding up to 5 16-bit instruction words,
97
 *  - Documentation generated by Doxygen (www.doxygen.org) with doxverilog patch (http://developer.berlios.de/projects/doxverilog/). The specification
98
 *    is automatically extracted from the Doxygen HTML output.
99
 *
100
 * <h3>WISHBONE compatibility</h3>
101
 *  - Version: WISHBONE specification Revision B.3,
102
 *  - General description: 32-bit WISHBONE Master interface,
103
 *  - WISHBONE signals described in \ref page_spec_ports,
104
 *  - Supported cycles: Master Read/Write, Master Block Read/Write, Master Read-Modify-Write for TAS instruction,
105
 *    Register Feedback Bus Cycles as described in chapter 4 of the WISHBONE specification,
106
 *  - Use of ERR_I: on memory access – bus error, on interrupt acknowledge: spurious interrupt,
107
 *  - Use of RTY_I: on memory access – repeat access, on interrupt acknowledge: generate auto-vector,
108
 *  - WISHBONE data port size: 32-bit,
109
 *  - Data port granularity: 8-bits,
110
 *  - Data port maximum operand size: 32-bits,
111
 *  - Data transfer ordering: BIG ENDIAN,
112
 *  - Data transfer sequencing: UNDEFINED,
113 17 alfik
 *  - Constraints on <tt>CLK_I</tt> signal: described in \ref page_spec_clocks, maximum frequency: about 90 MHz.
114 12 alfik
 *
115
 * <h3>Use</h3>
116 13 alfik
 * - The ao68000 is used as the processor for the OpenCores aoOCS project - Wishbone Amiga OCS SoC(http://opencores.org/project,aoocs).
117
 * - It can also be used as a processor in a System-on-Chip booting Linux kernel version 2.6.33.1 up to <tt>init</tt> program lookup (\ref page_soc_linux).
118 12 alfik
 *
119
 * <h3>Similar projects</h3>
120
 * Other free soft-core implementations of M68000 microprocessor include:
121
 *  - OpenCores TG68 (http://www.opencores.org/project,tg68) - runs Amiga software, used as part of the Minimig Core,
122
 *  - Suska Atari VHDL WF_68K00_IP Core (http://www.experiment-s.de/en) - runs Atari software,
123
 *  - OpenCores K68 (http://www.opencores.org/project,k68) - no user and supervisor modes distinction, executes most instructions, but not all.
124
 *  - OpenCores ae68 (http://www.opencores.org/project,ae68) - no files uploaded as of 27.03.2010.
125
 *
126
 * <h3>Limitations</h3>
127
 *  - Microcode not optimized: some instructions take more cycles to execute than the original MC68000,
128
 *  - TRACE not tested,
129 13 alfik
 *  - The core is still large compared to other implementations.
130 12 alfik
 *
131
 * <h3>TODO</h3>
132 13 alfik
 *  - Optimize the desgin and microcode,
133
 *  - Count the exact cycle count for every instruction,
134 12 alfik
 *  - Test TRACE,
135 13 alfik
 *  - Write more documentation.
136 12 alfik
 *
137
 * <h3>Status</h3>
138 13 alfik
 *  - April 2010: Tested with WinUAE software MC68000 emulator,
139
 *  - April 2010: Booted Linux kernel up to <tt>init</tt> process lookup,
140
 *  - December 2010: Runs as a processor in OpenCores aoOCS project,
141
 *  - January 2011: Core area optimization by over 33% (Thanks to Frederic Requin).
142 12 alfik
 *
143
 * <h3>Requirements</h3>
144
 *  - Icarus Verilog simulator (http://www.icarus.com/eda/verilog/) is required to compile the <tt>tb_ao68000</tt> testbench/wrapper,
145
 *  - Access to Altera Quartus II instalation directory (directory eda/sim_lib/) is required to compile the <tt>tb_ao68000</tt> testbench/wrapper,
146
 *  - GCC (http://gcc.gnu.org) is required to compile the WinUAE MC68000 software emulator,
147
 *  - Java runtime (http://java.sun.com) is required to run the <tt>ao68000_tool</tt> (\ref page_tool),
148
 *  - Java SDK (http://java.sun.com) is required to compile the <tt>ao68000_tool</tt> (\ref page_tool),
149
 *  - Altera Quartus II synthesis tool (http://www.altera.com) is required to synthesise the <tt>soc_for_linux</tt> System-on-Chip
150
 *    (\ref page_soc_linux).
151
 *
152
 * <h3>Glossary</h3>
153
 *  - <b>ao68000</b> - the ao68000 IP Core processor,
154
 *  - <b>MC68000</b> - the original Motorola MC68000 processor.
155
 */
156
 
157
/*! \page page_spec_architecture Architecture
158
 *                                                          <table border=0 align=center>
159
 *                                                          <caption>
160
 * <b>Figure 1:</b> Simplified block diagram of ao68000 top module.
161
 *                                                          </caption> <tr><td>
162
 * \image html ./doc/img/architecture.png
163
 *                                                          </td></tr></table>
164
 * <h3>ao68000</h3>
165
 * \copydoc ao68000
166
 *
167
 * <h3>bus_control</h3>
168
 * \copydoc bus_control
169
 *
170
 * <h3>registers</h3>
171
 * \copydoc registers
172
 *
173
 * <h3>memory_registers</h3>
174
 * \copydoc memory_registers
175
 *
176
 * <h3>decoder</h3>
177
 * \copydoc decoder
178
 *
179
 * <h3>condition</h3>
180
 * \copydoc condition
181
 *
182
 * <h3>alu</h3>
183
 * \copydoc alu
184
 *
185
 * <h3>microcode_branch</h3>
186
 * \copydoc microcode_branch
187
 */
188
 
189
/*! \page page_directory Directory structure
190
 * The ao68000 project consists of the following directories:
191
 *
192
 * \verbinclude ./doc/src/directory.txt
193
 */
194
 
195
/*! \page page_tool ao68000_tool documentation
196
 *
197
 * The ao68000_tool is used to:
198
 * - generate a microcode operations Java file, which contains all available microcode operations (\ref page_microcode_operations):
199
 *   <tt>./sw/ao68000_tool/src/ao68000_tool/Parser.java</tt>. It is generated from <tt>./rtl/ao68000.v</tt>,
200
 * - generate microcode for ao680000 (\ref page_microcode_compilation) with microcode locations. The microcode
201
 *   is generated and stored into an Altera MIF format file located at:
202
 *   <tt>./rtl/ao68000_microcode.mif</tt>. The microcode locations are
203
 *   inserted into:<tt>./rtl/ao68000.v</tt>
204
 * - run and compare the results of ao68000 RTL simulation of
205
 *   <tt>./tests/compare_with_winuae/verilog/tb_ao68000</tt> with the software MC68000
206
 *   emulation of <tt>./tests/compare_with_winuae/winuae/ao</tt> (\ref page_verification),
207
 * - extract the specification contents from Doxygen HTML output, to generate the specification ODT file.
208
 *
209
 * The tool is located at: <tt>./sw/ao68000_tool.jar</tt>.
210
 */
211
 
212
/*! \page page_verification Processor verification
213
 * The ao68000 IP Core is verified with the WinUAE MC68000 software emulator.
214
 * The verification is based on the idea that given the same contents of:
215
 *  - every register in the processor,
216
 *  - all memory locations that are read during execution,
217
 *
218
 * the result of execution, that is the contents of:
219
 *  - every register in the processor,
220
 *  - all memory locations written during execution,
221
 *
222
 * should be the same for the IP Core and the software emulator.
223
 *
224
 * <h3>Verification procedure</h3>
225
 * The verification is performed in the following way:
226
 *  - the WinUAE MC68000 software emulator is compiled. The sources of the emulator are located at: <tt>./tests/compare_with_winuae/winuae/</tt>.
227
 *    The compiled binary is located at: <tt>./tmp/compare_with_winuae/winuae/ao</tt>.
228
 *  - the ao68000 testbench is compiled. The sources of the testbench are located at: <tt>./tests/compare_with_winuae/verilog/</tt>.
229
 *    The compiled Icarus Verilog script is located at: <tt>./tmp/compare_with_winuae/verilog/tb_ao68000</tt>.
230
 *  - Both of the above executable programs accept arguments that specify the values of:
231
 *      - memory locations that are read during execution,
232
 *      - the contents of every register in the processor.
233
 *  - The result of executing both of the programs is the contents of:
234
 *      - memory locations written during execution,
235
 *      - the contents of every register in the processor after execution.
236
 *  - The tool <tt>./sw/ao68000_tool/</tt> (\ref page_tool) is used to run both of the executable programs and
237
 *    compare the result of execution. The tool is capable of executing multiple concurrent simulations in order to utilize current
238
 *    multicore processors.
239
 *
240
 * The makefile with instructions to perform the above operations is located at: <tt>./Makefile</tt>.
241
 *
242
 * <h3>Requirements</h3>
243
 *  - Icarus Verilog simulator (http://www.icarus.com/eda/verilog/) is required to compile the <tt>tb_ao68000</tt> testbench/wrapper,
244
 *  - Access to Altera Quartus II instalation (directory eda/sim_lib/) is required to compile the <tt>tb_ao68000</tt> testbench/wrapper,
245
 *  - GCC (http://gcc.gnu.org) is required to compile the WinUAE MC68000 software emulator,
246
 *  - Java SDK (http://java.sun.com) is required to compile the <tt>ao68000_tool</tt> (\ref page_tool),
247
 *  - Java runtime (http://java.sun.com) is required to run the <tt>ao68000_tool</tt> (\ref page_tool).
248
 */
249
 
250
/*! \page page_mc68000 MC68000 notes
251
 * \verbinclude ./doc/src/mc68000.txt
252
 */
253
 
254
/*! \page page_old_notes Old ao68000 notes
255
 * \verbinclude ./doc/src/old_notes.txt
256
 */
257
 
258
/*! \page page_microcode_compilation Microcode compilation
259
 * The ao68000 microcode is represented as an Java program. Execution of this program results in generating the binary
260
 * microcode.
261
 *
262
 * <h3>Microcode operations</h3>
263
 * All possible microcode operations are described at the beginning of <tt>./rtl/ao68000.v</tt>.
264
 * The locations of:
265
 *  - each operation in the microcode word,
266
 *  - every procedure in the microcode
267
 *
268
 * are auto-generated and inserted to the same file. All the available operation are also represented as Java functions and
269
 * saved in an auto-generated file, located at <tt>./sw/ao68000_tool/Parser.java</tt> (\ref page_microcode_operations).
270
 * This auto-generated data is generated by the tool <tt>./sw/ao68000_tool/</tt> (\ref page_tool).
271
 *
272
 * <h3>Microcode compilation</h3>
273
 * The source for the microcode is located at <tt>./sw/ao68000_tool/Microcode.java</tt> (\ref page_microcode).
274
 *
275
 * The compiled microcode, in Altera MIF format, is located at <tt>./rtl/ao68000_microcode.mif</tt>.
276
 *
277
 * The tool <tt>./sw/ao68000_tool/</tt> (\ref page_tool) is used to compile the microcode source and transform it into a MIF file.
278
 * The makefile containing instructions for performing the compilation is located at <tt>./Makefile</tt>.
279
 */
280
 
281
 
282
/*! \page page_microcode_operations Microcode operations
283
 * The listing below represents operations available in the \ref page_microcode. It is taken from:
284
 * <tt>./sw/ao68000_tool/Parser.java</tt>. More information about the microcode structure and compilation is available at
285
 * \ref page_microcode_compilation.
286
 *
287
 * \include ./sw/ao68000_tool/Parser.java
288
 */
289
 
290
/*! \page page_microcode Microcode
291
 * The listing below represents the microcode.
292
 * It is taken from <tt>./sw/ao68000_tool/Microcode.java</tt>. More information about the microcode structure and
293
 * compilation is available at \ref page_microcode_compilation.
294
 *
295
 * \include ./sw/ao68000_tool/Microcode.java
296
 */
297
 
298
/*! \page page_spec_operation Operation
299
 * The ao68000 IP Core is designed to operate in a similar way as the original MC68000. The most import differences are:
300
 *  - the core IO ports are compatible with the WISHBONE specification,
301
 *  - the execution of instructions in the ao68000 core is not cycle-exact with the original MC68000 and usually takes a few cycles longer.
302
 *
303
 * <h3>Setting up the core</h3>
304
 * The ao68000 IP Core has an WISHBONE MASTER interface. All standard memory access bus cycles conform to the WISHBONE specification.
305
 * These cycles include:
306
 *  - instruction fetch,
307
 *  - data read,
308
 *  - data write.
309
 *
310
 * The cycles are either Single, Block or Read-Modify-Write (for the TAS instruction). When waiting to finish a bus cycle
311
 * the ao68000 reacts on the following input signals:
312
 *  - ACK_I: the cycle is completed successfully,
313
 *  - RTY_I: the cycle is immediately repeated, the processor does not continue its operation before the current bus cycle is finished.
314
 *    In case of the Read-Modify-Write cycle - only the current bus cycle is repeated: either the read or write.
315
 *  - ERR_I: the cycle is terminated and a bus error is processed. In case of double bus error the processor enters the blocked state.
316
 *
317
 * There is also a special bus cycle: the interrupt acknowledge cycle. This cycle is a reaction on receiving a external interrupt from
318
 * the ipl_i inputs. The processor only samples the ipl_i lines after processing an instruction, so the interrupt lines have to be asserted
319
 * for some time before the core reacts. The interrupt acknowledge cycle is performed in the following way:
320
 *  - ADR_O is set to { 27'b111_1111_1111_1111_1111_1111_1111, 3 bits indicating the interrupt priority level for this cycle },
321
 *  - SEL_O is set to 4'b1111,
322
 *  - fc_o is set to 3'b111 to indicate a CPU Cycle as in the original MC68000.
323
 *
324
 * The ao68000 reacts on the following signals when waiting to finish a interrupt acknowledge bus cycle:
325
 *  - ACK_I: the cycle is completed successfully and the interrupt vector is read from DAT_I[7:0],
326
 *  - RTY_I: the cycle is completed successfully and the processor generates a auto-vector internally,
327
 *  - ERR_I: the cycle is terminated and the processor starts processing a spurious interrupt exception.
328
 *
329
 * Every bus cycle is supplemented with output tags:
330
 *  - WISHBONE standard tags: SGL_O, BLK_O, RMW_O, CTI_O, BTE_O,
331
 *  - ao68000 custom tag: fc_o that operates like the Function Code of the original MC68000.
332
 *
333
 * The ao68000 core has two additional outputs that are used to indicate the state of the processor:
334
 *  - reset_o is a external device reset signal. It is asserted when processing the RESET instruction. It is asserted for 124 bus cycles.
335
 *    After that the processor returns to normal instruction processing.
336
 *  - blocked_o is an output that indicates that the processor is blocked after a double bus error. When this output line is asserted
337
 *    the processor is blocked and does not process any instructions. The only way to continue processing instructions is to reset
338
 *    the core.
339
 *
340
 * <h3>Resetting the core</h3>
341
 * The ao68000 core is reset with a asynchronous reset_n input. After deasserting the signal, the core starts its standard startup sequence,
342
 * which is similar to the one performed by the original MC68000:
343
 *  - the value of the SSP register is read from address 0,
344
 *  - the value of the PC is read from address 1.
345
 *
346
 * An identical sequence is performed when powering up the core for the first time.
347
 *
348
 * <h3>Processor modes</h3>
349
 * The ao68000 core has two modes of operation - exactly like the original MC68000:
350
 *  - Supervisor mode
351
 *  - User mode.
352
 *
353
 * Performing a privileged instruction when running in user mode results in a privilege exception, just like in MC68000.
354
 *
355
 * <h3>Processor states</h3>
356
 * The ao68000 core can be in one of the following states:
357
 *  - instruction processing, which includes group 2 exception processing,
358
 *  - group 0 and group 1 exception processing,
359
 *  - external device reset state when processing the RESET instruction,
360
 *  - blocked state after a double bus error.
361
 */
362
 
363
/*! \page page_spec_registers Registers
364
 * The ao68000 IP Core is a WISHBONE Master and does not contain any registers available for reading or writing from outside of the core.
365
 */
366
 
367
/*! \page page_spec_clocks Clocks
368
 * <table width=100%>
369
 * <caption><b>Table 1:</b> List of clocks.</caption>
370
 * <tr style="background: #CCCCCC; font-weight: bold;">
371
 *     <td rowspan=2>Name</td><td rowspan=2>Source</td><td colspan=3>Rates (MHz)</td><td rowspan=2>Remarks</td><td rowspan=2>Description</td></tr>
372
 * <tr style="background: #CCCCCC; font-weight: bold;">
373
 *     <td>Max</td><td>Min</td><td>Resolution</td></tr>
374
 *
375 17 alfik
 * <tr><td>CLK_I</td><td>Input Port</td><td>90</td><td>-</td><td>-</td><td>-</td><td>System clock.</td></tr>
376 12 alfik
 * </table>
377
 */
378
 
379
/*! \page page_spec_ports IO Ports
380
 * <h3>WISHBONE IO Ports</h3>
381
 * <table width=100%>
382
 * <caption><b>Table 1:</b> List of WISHBONE IO ports.</caption>
383
 * <tr style="background: #CCCCCC; font-weight: bold;">
384
 *     <td>Port     </td><td>Width  </td><td>Direction  </td><td>Description    </td></tr>
385
 * <tr><td>CLK_I    </td><td>1      </td><td>Input      </td><td>\copydoc CLK_I </td></tr>
386
 * <tr><td>reset_n  </td><td>1      </td><td>Input      </td><td>\copydoc reset_n </td></tr>
387
 * <tr><td>CYC_O    </td><td>1      </td><td>Output     </td><td>\copydoc CYC_O </td></tr>
388
 * <tr><td>ADR_O    </td><td>30     </td><td>Output     </td><td>\copydoc ADR_O </td></tr>
389
 * <tr><td>DAT_O    </td><td>32     </td><td>Output     </td><td>\copydoc DAT_O </td></tr>
390
 * <tr><td>DAT_I    </td><td>32     </td><td>Input      </td><td>\copydoc DAT_I </td></tr>
391
 * <tr><td>SEL_O    </td><td>4      </td><td>Output     </td><td>\copydoc SEL_O </td></tr>
392
 * <tr><td>STB_O    </td><td>1      </td><td>Output     </td><td>\copydoc STB_O </td></tr>
393
 * <tr><td>WE_O     </td><td>1      </td><td>Output     </td><td>\copydoc WE_O  </td></tr>
394
 * <tr><td>ACK_I    </td><td>1      </td><td>Input      </td><td>\copydoc ACK_I </td></tr>
395
 * <tr><td>ERR_I    </td><td>1      </td><td>Input      </td><td>\copydoc ERR_I </td></tr>
396
 * <tr><td>RTY_I    </td><td>1      </td><td>Input      </td><td>\copydoc RTY_I </td></tr>
397
 * <tr><td>SGL_O    </td><td>1      </td><td>Output     </td><td>\copydoc SGL_O </td></tr>
398
 * <tr><td>BLK_O    </td><td>1      </td><td>Output     </td><td>\copydoc BLK_O </td></tr>
399
 * <tr><td>RMW_O    </td><td>1      </td><td>Output     </td><td>\copydoc RMW_O </td></tr>
400
 * <tr><td>CTI_O    </td><td>3      </td><td>Output     </td><td>\copydoc CTI_O </td></tr>
401
 * <tr><td>BTE_O    </td><td>2      </td><td>Output     </td><td>\copydoc BTE_O </td></tr>
402
 * <tr><td>fc_o     </td><td>3      </td><td>Output     </td><td>\copydoc fc_o  </td></tr>
403
 * </table>
404
 *
405
 * <h3>Other IO Ports</h3>
406
 * <table width=100%>
407
 * <caption><b>Table 2:</b> List of Other IO ports.</caption>
408
 * <tr style="background: #CCCCCC; font-weight: bold;">
409
 *     <td>Port     </td><td>Width  </td><td>Direction  </td><td>Description        </td></tr>
410
 * <tr><td>ipl_i    </td><td>3      </td><td>Input      </td><td>\copydoc ipl_i     </td></tr>
411
 * <tr><td>reset_o  </td><td>1      </td><td>Output     </td><td>\copydoc reset_o   </td></tr>
412
 * <tr><td>blocked_o</td><td>1      </td><td>Output     </td><td>\copydoc blocked_o </td></tr>
413
 * </table>
414
 */
415
 
416
/*! \addtogroup CLK_I CLK_I Port
417
 * WISHBONE Clock Input
418
 */
419
/*! \addtogroup reset_n reset_n Port
420
 * Asynchronous Reset Input
421
 */
422
/*! \addtogroup CYC_O CYC_O Port
423
 * WISHBONE Master Cycle Output
424
 */
425
/*! \addtogroup ADR_O ADR_O Port
426
 * WISHBONE Master Address Output
427
 */
428
/*! \addtogroup DAT_O DAT_O Port
429
 * WISHBONE Master Data Output
430
 */
431
/*! \addtogroup DAT_I DAT_I Port
432
 * WISHBONE Master Data Input
433
 */
434
/*! \addtogroup SEL_O SEL_O Port
435
 * WISHBONE Master Byte Select
436
 */
437
/*! \addtogroup STB_O STB_O Port
438
 * WISHBONE Master Strobe Output
439
 */
440
/*! \addtogroup WE_O WE_O Port
441
 * WISHBONE Master Write Enable Output
442
 */
443
/*! \addtogroup ACK_I ACK_I Port
444
 * WISHBONE Master Acknowledge Input:
445
 *  - on normal cycle: acknowledge,
446
 *  - on interrupt acknowledge cycle: external vector provided on DAT_I[7:0].
447
 */
448
/*! \addtogroup ERR_I ERR_I Port
449
 * WISHBONE Master Error Input
450
 *  - on normal cycle: bus error,
451
 *  - on interrupt acknowledge cycle: spurious interrupt.
452
 */
453
/*! \addtogroup RTY_I RTY_I Port
454
 * WISHBONE Master Retry Input
455
 *  - on normal cycle: retry bus cycle,
456
 *  - on interrupt acknowledge: use auto-vector.
457
 */
458
/*! \addtogroup SGL_O SGL_O Port
459
 * WISHBONE Cycle Tag, TAG_TYPE: TGC_O, Single Bus Cycle.
460
 */
461
/*! \addtogroup BLK_O BLK_O Port
462
 * WISHBONE Cycle Tag, TAG_TYPE: TGC_O, Block Bus Cycle.
463
 */
464
/*! \addtogroup RMW_O RMW_O Port
465
 * WISHBONE Cycle Tag, TAG_TYPE: TGC_O, Read-Modify-Write Cycle.
466
 */
467
/*! \addtogroup CTI_O CTI_O Port
468
 * WISHBONE Address Tag, TAG_TYPE: TGA_O, Cycle Type Identifier,
469
 * Incrementing Bus Cycle or End-of-Burst Cycle.
470
 */
471
/*! \addtogroup BTE_O BTE_O Port
472
 * WISHBONE Address Tag, TAG_TYPE: TGA_O, Burst Type Extension,
473
 * always Linear Burst.
474
 */
475
/*! \addtogroup fc_o fc_o Port
476
 * Custom TAG_TYPE: TGC_O, Cycle Tag,
477
 * Processor Function Code:
478
 *  - 1 - user data,
479
 *  - 2 - user program,
480
 *  - 5 - supervisor data : all exception vector entries except reset,
481
 *  - 6 - supervisor program : exception vector for reset,
482
 *  - 7 - cpu space: interrupt acknowledge.
483
 */
484
/*! \addtogroup ipl_i ipl_i Port
485
 * Interrupt Priority Level
486
 * Interrupt acknowledge cycle:
487
 *  - ACK_I: interrupt vector on DAT_I[7:0],
488
 *  - ERR_I: spurious interrupt,
489
 *  - RTY_I: auto-vector.
490
 */
491
/*! \addtogroup reset_o reset_o Port
492
 * External device reset. Output high when processing the RESET instruction.
493
 */
494
/*! \addtogroup blocked_o blocked_o Port
495
 * Processor blocked indicator. The processor is blocked after a double bus error.
496
 */
497
 
498
/*! \page page_spec_references References
499
 *                                                                      <ol><li>
500
 * <em>Specification for the: WISHBONE System-on-Chip (SoC) Interconnection Architecture for Portable IP Cores.</em><br/>
501
 * Revision: B.3.<br/>
502
 * Released: September 7, 2002.<br/>
503
 * Available from: http://www.opencores.org. <br/>&nbsp;
504
 *                                                                      </li><li>
505
 * <em>M68000 8-/16-/32-Bit Microprocessors User’s Manual.</em><br/>
506
 * Ninth Edition.<br/>
507
 * Freescale Semiconductor, Inc.<br/>
508
 * Available from: http://www.freescale.com. <br/>&nbsp;
509
 *                                                                      </li><li>
510
 * <em>MOTOROLA M68000 FAMILY Programmer’s Reference Manual (Includes CPU32 Instructions).</em><br/>
511
 * MOTOROLA INC., 1992. M68000PM/AD REV.1.<br/>
512
 * Available form: http://www.freescale.com. <br/>&nbsp;
513
 *                                                                      </li><li>
514
 * <em>ao68000 Doxygen(Design) Documentation.</em><br/>&nbsp;
515
 *                                                                      </li></ol>
516
 */
517
 
518
/*! \page page_soc_linux System-on-Chip example with ao68000 running Linux
519
 * The ao68000 IP Core is capable of booting the Linux kernel (http://www.kernel.org) up to the <tt>init</tt> program search.
520
 *
521
 * <h3>Requirements</h3>
522
 *  - Linux kernel sources (http://www.kernel.org), tested with version 2.6.33.1,
523
 *  - a MC68000 toolchain (http://www.gnu.org), tested with binutils-2.20 and gcc-core-4.4.3,
524
 *  - a development board to run the system, tested with Terasic DE2-70 board (http://www.terasic.com.tw),
525
 *  - a SDHC card,
526
 *  - a serial cable to view the output of kernel execution on a serial terminal program.
527
 *
528
 * <h3>System-on-Chip</h3>
529
 * In order to test the ao68000 processor by booting the Linux kernel, a System-on-Chip is prepared and located at:
530
 * <tt>./tests/soc_for_linux_on_terasic_de2_70/verilog/</tt>. The system consists of:
531
 *  - an early boot state machine: early_boot.v,
532
 *  - a SDHC card controller: sd.v,
533
 *  - a serial line transmitter: serial_txd.v,
534
 *  - a SSRAM controller: ssram.v,
535
 *  - a simple timer: timer.v,
536
 *  - a top level module, that instantiates the above modules and the ao68000 processor: soc_for_linux.v.
537
 *
538
 * <h3>Step-by-step instruction to prepare the system</h3>
539
 *  - download the Linux kernel (linux-2.6.33.1.tar.bz2),
540
 *  - download the toolchain (binutils-2.20.tar.bz2, gcc-core-4.4.3.tar.bz2),
541
 *  - configure and make Binutils: <br/>
542
 *    <code>./configure --prefix=(build prefix) --target=m68knommu-none-linux</code> <br/>
543
 *    <code>make</code> <br/>
544
 *    <code>make install</code> <br/>
545
 *  - configure and make GCC:
546
 *    <code>./../gcc-4.4.3/configure --prefix=(build prefix) --target=m68knommu-none-linux
547
 *          --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libiberty --disable-zlib --disable-libgomp</code>
548
 *          <br/>
549
 *    <code>make</code> <br/>
550
 *    <code>make install</code> <br/>
551
 *  - patch the Linux kernel sources by copying the contents of the directory <tt>./tests/soc_for_linux_on_terasic_de2_70/software/linux-2.6.33.1-ao68000/</tt> into the Linux kernel
552
 *    sources directory,
553
 *  - configure and make the Linux kernel: <br/>
554
 *    <code>make menuconfig ARCH=m68knommu CROSS_COMPILE=(build prefix)/bin/m68knommu-none-linux-</code> <br/>
555
 *    <code>make ARCH=m68knommu CROSS_COMPILE=(build prefix)/bin/m68knommu-none-linux-</code> <br/>
556
 *  - convert the Linux kernel binary in ELF format into a flat binary format:
557
 *    <code>(build prefix)//bin/m68knommu-none-linux-objcopy -O binary vmlinux vmlinux.bin</code> <br/>
558
 *  - synthesise the <tt>soc_for_linux</tt> with the Altera Quartus II tool. The instructions to perform the synthesis are located in the makefile
559
 *    located at: <tt>./Makefile</tt>,
560
 *  - prepare a SDHC card with the software:
561
 *      - copy the first 8 bytes of memory form the file <tt>./tests/soc_for_linux_on_terasic_de2_70/sd_card/sector0.dat</tt>: <br/>
562
 *        <code>dd if=sector0.dat of=/dev/(SD card device)</code>
563
 *        This file contains the SSP and PC values read by the ao68000 processor after booting.
564
 *      - copy the Linux kernel flat binary, at offset 1024: <br/>
565
 *        <code>dd if=vmlinux.bin of=/dev/(SD card device) bs=1024 seek=1</code> <br/>
566
 *  - insert the SDHC card into the reader in the Terasic DE2-70 board,
567
 *  - load the synthesised SOF file into the FPGA
568
 *  - look at the output of the kernel console by opening a serial terminal application and reading the output of the board.
569
 *
570
 * <h3>Notes</h3>
571
 *  - the SLOB allocator and not the default SLAB allocator had to be selected because of a problem in the kernel sources
572
 *    (in_interrupt() check before enabling the interrupts (at in ./kernel/slab.c:2109)),
573
 *  - the source file in the Linux kernel: <tt>./init/initramfs.c</tt> compiled with the GCC option <tt>-m68000</tt> contains illegal code
574
 *    to execute on a MC68000 (copy a long word from an unaligned address). Even after correcting this problem, the kernel did not want to boot
575
 *    reliably (sometimes it booted and found the init program, sometimes not).
576
 *
577
 * <h3>Linux console output</h3>
578
 * The output of the running kernel is presented below:
579
 * \verbinclude ./doc/src/linux_booting.txt
580
 */
581
 

powered by: WebSVN 2.1.0

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