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

Subversion Repositories ao68000

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

Go to most recent revision | 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
 * </table>
82
 */
83
 
84
/*! \page page_spec_introduction Introduction
85
 *
86
 * The OpenCores ao68000 IP Core is a Motorola MC68000 compatible processor.
87
 *
88
 * <h3>Features</h3>
89
 *  - CISC processor with microcode,
90
 *  - WISHBONE revision B.3 compatible MASTER interface,
91
 *  - Not cycle exact with the MC68000, some instructions take more cycles to complete, some less,
92
 *  - Uses about 7500 LE on Altera Cyclone II and about 45000 bits of RAM for microcode,
93
 *  - Tested against the WinUAE M68000 software emulator. Every 16-bit instruction was tested with random register contents and RAM contents
94
 *    (\ref page_verification). The result of execution was compared,
95
 *  - Runs Linux kernel version 2.6.33.1 up to init process lookup (\ref page_soc_linux),
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
 *  - Constraints on <tt>CLK_I</tt> signal: described in \ref page_spec_clocks, maximum frequency: about 70 MHz.
114
 *
115
 * <h3>Use</h3>
116
 * The ao68000 can be used as an processor in a System-on-Chip booting Linux kernel up to <tt>init</tt> program lookup (\ref page_soc_linux).
117
 *
118
 * <h3>Similar projects</h3>
119
 * Other free soft-core implementations of M68000 microprocessor include:
120
 *  - OpenCores TG68 (http://www.opencores.org/project,tg68) - runs Amiga software, used as part of the Minimig Core,
121
 *  - Suska Atari VHDL WF_68K00_IP Core (http://www.experiment-s.de/en) - runs Atari software,
122
 *  - OpenCores K68 (http://www.opencores.org/project,k68) - no user and supervisor modes distinction, executes most instructions, but not all.
123
 *  - OpenCores ae68 (http://www.opencores.org/project,ae68) - no files uploaded as of 27.03.2010.
124
 *
125
 * <h3>Limitations</h3>
126
 *  - Microcode not optimized: some instructions take more cycles to execute than the original MC68000,
127
 *  - TRACE not tested,
128
 *  - The core is large compared to other implementations.
129
 *
130
 * <h3>TODO</h3>
131
 *  - Optimize the microcode and count the exact cycle count for every instruction,
132
 *  - Test TRACE,
133
 *  - Run WISHBONE verification models,
134
 *  - More documentation of the ao68000 module: signal description, operation, FSM in <tt>bus_control</tt>,
135
 *  - Describe changes done in WinUAE sources (copy from ao.c),
136
 *  - Describe microcode words and subprocedures,
137
 *  - Document the <tt>soc_for_linux</tt> modules,
138
 *  - Prepare scripts for VATS: run_sim -r -> regresion test,
139
 *  - Use memories from OpenCore common.
140
 *
141
 * <h3>Status</h3>
142
 *  - Tested with WinUAE software MC68000 emulator,
143
 *  - Booted Linux kernel up to <tt>init</tt> process lookup.
144
 *
145
 * <h3>Requirements</h3>
146
 *  - Icarus Verilog simulator (http://www.icarus.com/eda/verilog/) is required to compile the <tt>tb_ao68000</tt> testbench/wrapper,
147
 *  - Access to Altera Quartus II instalation directory (directory eda/sim_lib/) is required to compile the <tt>tb_ao68000</tt> testbench/wrapper,
148
 *  - GCC (http://gcc.gnu.org) is required to compile the WinUAE MC68000 software emulator,
149
 *  - Java runtime (http://java.sun.com) is required to run the <tt>ao68000_tool</tt> (\ref page_tool),
150
 *  - Java SDK (http://java.sun.com) is required to compile the <tt>ao68000_tool</tt> (\ref page_tool),
151
 *  - Altera Quartus II synthesis tool (http://www.altera.com) is required to synthesise the <tt>soc_for_linux</tt> System-on-Chip
152
 *    (\ref page_soc_linux).
153
 *
154
 * <h3>Glossary</h3>
155
 *  - <b>ao68000</b> - the ao68000 IP Core processor,
156
 *  - <b>MC68000</b> - the original Motorola MC68000 processor.
157
 */
158
 
159
/*! \page page_spec_architecture Architecture
160
 *                                                          <table border=0 align=center>
161
 *                                                          <caption>
162
 * <b>Figure 1:</b> Simplified block diagram of ao68000 top module.
163
 *                                                          </caption> <tr><td>
164
 * \image html ./doc/img/architecture.png
165
 *                                                          </td></tr></table>
166
 * <h3>ao68000</h3>
167
 * \copydoc ao68000
168
 *
169
 * <h3>bus_control</h3>
170
 * \copydoc bus_control
171
 *
172
 * <h3>registers</h3>
173
 * \copydoc registers
174
 *
175
 * <h3>memory_registers</h3>
176
 * \copydoc memory_registers
177
 *
178
 * <h3>decoder</h3>
179
 * \copydoc decoder
180
 *
181
 * <h3>condition</h3>
182
 * \copydoc condition
183
 *
184
 * <h3>alu</h3>
185
 * \copydoc alu
186
 *
187
 * <h3>microcode_branch</h3>
188
 * \copydoc microcode_branch
189
 */
190
 
191
/*! \page page_directory Directory structure
192
 * The ao68000 project consists of the following directories:
193
 *
194
 * \verbinclude ./doc/src/directory.txt
195
 */
196
 
197
/*! \page page_tool ao68000_tool documentation
198
 *
199
 * The ao68000_tool is used to:
200
 * - generate a microcode operations Java file, which contains all available microcode operations (\ref page_microcode_operations):
201
 *   <tt>./sw/ao68000_tool/src/ao68000_tool/Parser.java</tt>. It is generated from <tt>./rtl/ao68000.v</tt>,
202
 * - generate microcode for ao680000 (\ref page_microcode_compilation) with microcode locations. The microcode
203
 *   is generated and stored into an Altera MIF format file located at:
204
 *   <tt>./rtl/ao68000_microcode.mif</tt>. The microcode locations are
205
 *   inserted into:<tt>./rtl/ao68000.v</tt>
206
 * - run and compare the results of ao68000 RTL simulation of
207
 *   <tt>./tests/compare_with_winuae/verilog/tb_ao68000</tt> with the software MC68000
208
 *   emulation of <tt>./tests/compare_with_winuae/winuae/ao</tt> (\ref page_verification),
209
 * - extract the specification contents from Doxygen HTML output, to generate the specification ODT file.
210
 *
211
 * The tool is located at: <tt>./sw/ao68000_tool.jar</tt>.
212
 */
213
 
214
/*! \page page_verification Processor verification
215
 * The ao68000 IP Core is verified with the WinUAE MC68000 software emulator.
216
 * The verification is based on the idea that given the same contents of:
217
 *  - every register in the processor,
218
 *  - all memory locations that are read during execution,
219
 *
220
 * the result of execution, that is the contents of:
221
 *  - every register in the processor,
222
 *  - all memory locations written during execution,
223
 *
224
 * should be the same for the IP Core and the software emulator.
225
 *
226
 * <h3>Verification procedure</h3>
227
 * The verification is performed in the following way:
228
 *  - the WinUAE MC68000 software emulator is compiled. The sources of the emulator are located at: <tt>./tests/compare_with_winuae/winuae/</tt>.
229
 *    The compiled binary is located at: <tt>./tmp/compare_with_winuae/winuae/ao</tt>.
230
 *  - the ao68000 testbench is compiled. The sources of the testbench are located at: <tt>./tests/compare_with_winuae/verilog/</tt>.
231
 *    The compiled Icarus Verilog script is located at: <tt>./tmp/compare_with_winuae/verilog/tb_ao68000</tt>.
232
 *  - Both of the above executable programs accept arguments that specify the values of:
233
 *      - memory locations that are read during execution,
234
 *      - the contents of every register in the processor.
235
 *  - The result of executing both of the programs is the contents of:
236
 *      - memory locations written during execution,
237
 *      - the contents of every register in the processor after execution.
238
 *  - The tool <tt>./sw/ao68000_tool/</tt> (\ref page_tool) is used to run both of the executable programs and
239
 *    compare the result of execution. The tool is capable of executing multiple concurrent simulations in order to utilize current
240
 *    multicore processors.
241
 *
242
 * The makefile with instructions to perform the above operations is located at: <tt>./Makefile</tt>.
243
 *
244
 * <h3>Requirements</h3>
245
 *  - Icarus Verilog simulator (http://www.icarus.com/eda/verilog/) is required to compile the <tt>tb_ao68000</tt> testbench/wrapper,
246
 *  - Access to Altera Quartus II instalation (directory eda/sim_lib/) is required to compile the <tt>tb_ao68000</tt> testbench/wrapper,
247
 *  - GCC (http://gcc.gnu.org) is required to compile the WinUAE MC68000 software emulator,
248
 *  - Java SDK (http://java.sun.com) is required to compile the <tt>ao68000_tool</tt> (\ref page_tool),
249
 *  - Java runtime (http://java.sun.com) is required to run the <tt>ao68000_tool</tt> (\ref page_tool).
250
 */
251
 
252
/*! \page page_mc68000 MC68000 notes
253
 * \verbinclude ./doc/src/mc68000.txt
254
 */
255
 
256
/*! \page page_old_notes Old ao68000 notes
257
 * \verbinclude ./doc/src/old_notes.txt
258
 */
259
 
260
/*! \page page_microcode_compilation Microcode compilation
261
 * The ao68000 microcode is represented as an Java program. Execution of this program results in generating the binary
262
 * microcode.
263
 *
264
 * <h3>Microcode operations</h3>
265
 * All possible microcode operations are described at the beginning of <tt>./rtl/ao68000.v</tt>.
266
 * The locations of:
267
 *  - each operation in the microcode word,
268
 *  - every procedure in the microcode
269
 *
270
 * are auto-generated and inserted to the same file. All the available operation are also represented as Java functions and
271
 * saved in an auto-generated file, located at <tt>./sw/ao68000_tool/Parser.java</tt> (\ref page_microcode_operations).
272
 * This auto-generated data is generated by the tool <tt>./sw/ao68000_tool/</tt> (\ref page_tool).
273
 *
274
 * <h3>Microcode compilation</h3>
275
 * The source for the microcode is located at <tt>./sw/ao68000_tool/Microcode.java</tt> (\ref page_microcode).
276
 *
277
 * The compiled microcode, in Altera MIF format, is located at <tt>./rtl/ao68000_microcode.mif</tt>.
278
 *
279
 * The tool <tt>./sw/ao68000_tool/</tt> (\ref page_tool) is used to compile the microcode source and transform it into a MIF file.
280
 * The makefile containing instructions for performing the compilation is located at <tt>./Makefile</tt>.
281
 */
282
 
283
 
284
/*! \page page_microcode_operations Microcode operations
285
 * The listing below represents operations available in the \ref page_microcode. It is taken from:
286
 * <tt>./sw/ao68000_tool/Parser.java</tt>. More information about the microcode structure and compilation is available at
287
 * \ref page_microcode_compilation.
288
 *
289
 * \include ./sw/ao68000_tool/Parser.java
290
 */
291
 
292
/*! \page page_microcode Microcode
293
 * The listing below represents the microcode.
294
 * It is taken from <tt>./sw/ao68000_tool/Microcode.java</tt>. More information about the microcode structure and
295
 * compilation is available at \ref page_microcode_compilation.
296
 *
297
 * \include ./sw/ao68000_tool/Microcode.java
298
 */
299
 
300
/*! \page page_spec_operation Operation
301
 * The ao68000 IP Core is designed to operate in a similar way as the original MC68000. The most import differences are:
302
 *  - the core IO ports are compatible with the WISHBONE specification,
303
 *  - the execution of instructions in the ao68000 core is not cycle-exact with the original MC68000 and usually takes a few cycles longer.
304
 *
305
 * <h3>Setting up the core</h3>
306
 * The ao68000 IP Core has an WISHBONE MASTER interface. All standard memory access bus cycles conform to the WISHBONE specification.
307
 * These cycles include:
308
 *  - instruction fetch,
309
 *  - data read,
310
 *  - data write.
311
 *
312
 * The cycles are either Single, Block or Read-Modify-Write (for the TAS instruction). When waiting to finish a bus cycle
313
 * the ao68000 reacts on the following input signals:
314
 *  - ACK_I: the cycle is completed successfully,
315
 *  - RTY_I: the cycle is immediately repeated, the processor does not continue its operation before the current bus cycle is finished.
316
 *    In case of the Read-Modify-Write cycle - only the current bus cycle is repeated: either the read or write.
317
 *  - ERR_I: the cycle is terminated and a bus error is processed. In case of double bus error the processor enters the blocked state.
318
 *
319
 * There is also a special bus cycle: the interrupt acknowledge cycle. This cycle is a reaction on receiving a external interrupt from
320
 * the ipl_i inputs. The processor only samples the ipl_i lines after processing an instruction, so the interrupt lines have to be asserted
321
 * for some time before the core reacts. The interrupt acknowledge cycle is performed in the following way:
322
 *  - ADR_O is set to { 27'b111_1111_1111_1111_1111_1111_1111, 3 bits indicating the interrupt priority level for this cycle },
323
 *  - SEL_O is set to 4'b1111,
324
 *  - fc_o is set to 3'b111 to indicate a CPU Cycle as in the original MC68000.
325
 *
326
 * The ao68000 reacts on the following signals when waiting to finish a interrupt acknowledge bus cycle:
327
 *  - ACK_I: the cycle is completed successfully and the interrupt vector is read from DAT_I[7:0],
328
 *  - RTY_I: the cycle is completed successfully and the processor generates a auto-vector internally,
329
 *  - ERR_I: the cycle is terminated and the processor starts processing a spurious interrupt exception.
330
 *
331
 * Every bus cycle is supplemented with output tags:
332
 *  - WISHBONE standard tags: SGL_O, BLK_O, RMW_O, CTI_O, BTE_O,
333
 *  - ao68000 custom tag: fc_o that operates like the Function Code of the original MC68000.
334
 *
335
 * The ao68000 core has two additional outputs that are used to indicate the state of the processor:
336
 *  - reset_o is a external device reset signal. It is asserted when processing the RESET instruction. It is asserted for 124 bus cycles.
337
 *    After that the processor returns to normal instruction processing.
338
 *  - blocked_o is an output that indicates that the processor is blocked after a double bus error. When this output line is asserted
339
 *    the processor is blocked and does not process any instructions. The only way to continue processing instructions is to reset
340
 *    the core.
341
 *
342
 * <h3>Resetting the core</h3>
343
 * The ao68000 core is reset with a asynchronous reset_n input. After deasserting the signal, the core starts its standard startup sequence,
344
 * which is similar to the one performed by the original MC68000:
345
 *  - the value of the SSP register is read from address 0,
346
 *  - the value of the PC is read from address 1.
347
 *
348
 * An identical sequence is performed when powering up the core for the first time.
349
 *
350
 * <h3>Processor modes</h3>
351
 * The ao68000 core has two modes of operation - exactly like the original MC68000:
352
 *  - Supervisor mode
353
 *  - User mode.
354
 *
355
 * Performing a privileged instruction when running in user mode results in a privilege exception, just like in MC68000.
356
 *
357
 * <h3>Processor states</h3>
358
 * The ao68000 core can be in one of the following states:
359
 *  - instruction processing, which includes group 2 exception processing,
360
 *  - group 0 and group 1 exception processing,
361
 *  - external device reset state when processing the RESET instruction,
362
 *  - blocked state after a double bus error.
363
 */
364
 
365
/*! \page page_spec_registers Registers
366
 * The ao68000 IP Core is a WISHBONE Master and does not contain any registers available for reading or writing from outside of the core.
367
 */
368
 
369
/*! \page page_spec_clocks Clocks
370
 * <table width=100%>
371
 * <caption><b>Table 1:</b> List of clocks.</caption>
372
 * <tr style="background: #CCCCCC; font-weight: bold;">
373
 *     <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>
374
 * <tr style="background: #CCCCCC; font-weight: bold;">
375
 *     <td>Max</td><td>Min</td><td>Resolution</td></tr>
376
 *
377
 * <tr><td>CLK_I</td><td>Input Port</td><td>70</td><td>-</td><td>-</td><td>-</td><td>System clock.</td></tr>
378
 * </table>
379
 */
380
 
381
/*! \page page_spec_ports IO Ports
382
 * <h3>WISHBONE IO Ports</h3>
383
 * <table width=100%>
384
 * <caption><b>Table 1:</b> List of WISHBONE IO ports.</caption>
385
 * <tr style="background: #CCCCCC; font-weight: bold;">
386
 *     <td>Port     </td><td>Width  </td><td>Direction  </td><td>Description    </td></tr>
387
 * <tr><td>CLK_I    </td><td>1      </td><td>Input      </td><td>\copydoc CLK_I </td></tr>
388
 * <tr><td>reset_n  </td><td>1      </td><td>Input      </td><td>\copydoc reset_n </td></tr>
389
 * <tr><td>CYC_O    </td><td>1      </td><td>Output     </td><td>\copydoc CYC_O </td></tr>
390
 * <tr><td>ADR_O    </td><td>30     </td><td>Output     </td><td>\copydoc ADR_O </td></tr>
391
 * <tr><td>DAT_O    </td><td>32     </td><td>Output     </td><td>\copydoc DAT_O </td></tr>
392
 * <tr><td>DAT_I    </td><td>32     </td><td>Input      </td><td>\copydoc DAT_I </td></tr>
393
 * <tr><td>SEL_O    </td><td>4      </td><td>Output     </td><td>\copydoc SEL_O </td></tr>
394
 * <tr><td>STB_O    </td><td>1      </td><td>Output     </td><td>\copydoc STB_O </td></tr>
395
 * <tr><td>WE_O     </td><td>1      </td><td>Output     </td><td>\copydoc WE_O  </td></tr>
396
 * <tr><td>ACK_I    </td><td>1      </td><td>Input      </td><td>\copydoc ACK_I </td></tr>
397
 * <tr><td>ERR_I    </td><td>1      </td><td>Input      </td><td>\copydoc ERR_I </td></tr>
398
 * <tr><td>RTY_I    </td><td>1      </td><td>Input      </td><td>\copydoc RTY_I </td></tr>
399
 * <tr><td>SGL_O    </td><td>1      </td><td>Output     </td><td>\copydoc SGL_O </td></tr>
400
 * <tr><td>BLK_O    </td><td>1      </td><td>Output     </td><td>\copydoc BLK_O </td></tr>
401
 * <tr><td>RMW_O    </td><td>1      </td><td>Output     </td><td>\copydoc RMW_O </td></tr>
402
 * <tr><td>CTI_O    </td><td>3      </td><td>Output     </td><td>\copydoc CTI_O </td></tr>
403
 * <tr><td>BTE_O    </td><td>2      </td><td>Output     </td><td>\copydoc BTE_O </td></tr>
404
 * <tr><td>fc_o     </td><td>3      </td><td>Output     </td><td>\copydoc fc_o  </td></tr>
405
 * </table>
406
 *
407
 * <h3>Other IO Ports</h3>
408
 * <table width=100%>
409
 * <caption><b>Table 2:</b> List of Other IO ports.</caption>
410
 * <tr style="background: #CCCCCC; font-weight: bold;">
411
 *     <td>Port     </td><td>Width  </td><td>Direction  </td><td>Description        </td></tr>
412
 * <tr><td>ipl_i    </td><td>3      </td><td>Input      </td><td>\copydoc ipl_i     </td></tr>
413
 * <tr><td>reset_o  </td><td>1      </td><td>Output     </td><td>\copydoc reset_o   </td></tr>
414
 * <tr><td>blocked_o</td><td>1      </td><td>Output     </td><td>\copydoc blocked_o </td></tr>
415
 * </table>
416
 */
417
 
418
/*! \addtogroup CLK_I CLK_I Port
419
 * WISHBONE Clock Input
420
 */
421
/*! \addtogroup reset_n reset_n Port
422
 * Asynchronous Reset Input
423
 */
424
/*! \addtogroup CYC_O CYC_O Port
425
 * WISHBONE Master Cycle Output
426
 */
427
/*! \addtogroup ADR_O ADR_O Port
428
 * WISHBONE Master Address Output
429
 */
430
/*! \addtogroup DAT_O DAT_O Port
431
 * WISHBONE Master Data Output
432
 */
433
/*! \addtogroup DAT_I DAT_I Port
434
 * WISHBONE Master Data Input
435
 */
436
/*! \addtogroup SEL_O SEL_O Port
437
 * WISHBONE Master Byte Select
438
 */
439
/*! \addtogroup STB_O STB_O Port
440
 * WISHBONE Master Strobe Output
441
 */
442
/*! \addtogroup WE_O WE_O Port
443
 * WISHBONE Master Write Enable Output
444
 */
445
/*! \addtogroup ACK_I ACK_I Port
446
 * WISHBONE Master Acknowledge Input:
447
 *  - on normal cycle: acknowledge,
448
 *  - on interrupt acknowledge cycle: external vector provided on DAT_I[7:0].
449
 */
450
/*! \addtogroup ERR_I ERR_I Port
451
 * WISHBONE Master Error Input
452
 *  - on normal cycle: bus error,
453
 *  - on interrupt acknowledge cycle: spurious interrupt.
454
 */
455
/*! \addtogroup RTY_I RTY_I Port
456
 * WISHBONE Master Retry Input
457
 *  - on normal cycle: retry bus cycle,
458
 *  - on interrupt acknowledge: use auto-vector.
459
 */
460
/*! \addtogroup SGL_O SGL_O Port
461
 * WISHBONE Cycle Tag, TAG_TYPE: TGC_O, Single Bus Cycle.
462
 */
463
/*! \addtogroup BLK_O BLK_O Port
464
 * WISHBONE Cycle Tag, TAG_TYPE: TGC_O, Block Bus Cycle.
465
 */
466
/*! \addtogroup RMW_O RMW_O Port
467
 * WISHBONE Cycle Tag, TAG_TYPE: TGC_O, Read-Modify-Write Cycle.
468
 */
469
/*! \addtogroup CTI_O CTI_O Port
470
 * WISHBONE Address Tag, TAG_TYPE: TGA_O, Cycle Type Identifier,
471
 * Incrementing Bus Cycle or End-of-Burst Cycle.
472
 */
473
/*! \addtogroup BTE_O BTE_O Port
474
 * WISHBONE Address Tag, TAG_TYPE: TGA_O, Burst Type Extension,
475
 * always Linear Burst.
476
 */
477
/*! \addtogroup fc_o fc_o Port
478
 * Custom TAG_TYPE: TGC_O, Cycle Tag,
479
 * Processor Function Code:
480
 *  - 1 - user data,
481
 *  - 2 - user program,
482
 *  - 5 - supervisor data : all exception vector entries except reset,
483
 *  - 6 - supervisor program : exception vector for reset,
484
 *  - 7 - cpu space: interrupt acknowledge.
485
 */
486
/*! \addtogroup ipl_i ipl_i Port
487
 * Interrupt Priority Level
488
 * Interrupt acknowledge cycle:
489
 *  - ACK_I: interrupt vector on DAT_I[7:0],
490
 *  - ERR_I: spurious interrupt,
491
 *  - RTY_I: auto-vector.
492
 */
493
/*! \addtogroup reset_o reset_o Port
494
 * External device reset. Output high when processing the RESET instruction.
495
 */
496
/*! \addtogroup blocked_o blocked_o Port
497
 * Processor blocked indicator. The processor is blocked after a double bus error.
498
 */
499
 
500
/*! \page page_spec_references References
501
 *                                                                      <ol><li>
502
 * <em>Specification for the: WISHBONE System-on-Chip (SoC) Interconnection Architecture for Portable IP Cores.</em><br/>
503
 * Revision: B.3.<br/>
504
 * Released: September 7, 2002.<br/>
505
 * Available from: http://www.opencores.org. <br/>&nbsp;
506
 *                                                                      </li><li>
507
 * <em>M68000 8-/16-/32-Bit Microprocessors User’s Manual.</em><br/>
508
 * Ninth Edition.<br/>
509
 * Freescale Semiconductor, Inc.<br/>
510
 * Available from: http://www.freescale.com. <br/>&nbsp;
511
 *                                                                      </li><li>
512
 * <em>MOTOROLA M68000 FAMILY Programmer’s Reference Manual (Includes CPU32 Instructions).</em><br/>
513
 * MOTOROLA INC., 1992. M68000PM/AD REV.1.<br/>
514
 * Available form: http://www.freescale.com. <br/>&nbsp;
515
 *                                                                      </li><li>
516
 * <em>ao68000 Doxygen(Design) Documentation.</em><br/>&nbsp;
517
 *                                                                      </li></ol>
518
 */
519
 
520
/*! \page page_soc_linux System-on-Chip example with ao68000 running Linux
521
 * The ao68000 IP Core is capable of booting the Linux kernel (http://www.kernel.org) up to the <tt>init</tt> program search.
522
 *
523
 * <h3>Requirements</h3>
524
 *  - Linux kernel sources (http://www.kernel.org), tested with version 2.6.33.1,
525
 *  - a MC68000 toolchain (http://www.gnu.org), tested with binutils-2.20 and gcc-core-4.4.3,
526
 *  - a development board to run the system, tested with Terasic DE2-70 board (http://www.terasic.com.tw),
527
 *  - a SDHC card,
528
 *  - a serial cable to view the output of kernel execution on a serial terminal program.
529
 *
530
 * <h3>System-on-Chip</h3>
531
 * In order to test the ao68000 processor by booting the Linux kernel, a System-on-Chip is prepared and located at:
532
 * <tt>./tests/soc_for_linux_on_terasic_de2_70/verilog/</tt>. The system consists of:
533
 *  - an early boot state machine: early_boot.v,
534
 *  - a SDHC card controller: sd.v,
535
 *  - a serial line transmitter: serial_txd.v,
536
 *  - a SSRAM controller: ssram.v,
537
 *  - a simple timer: timer.v,
538
 *  - a top level module, that instantiates the above modules and the ao68000 processor: soc_for_linux.v.
539
 *
540
 * <h3>Step-by-step instruction to prepare the system</h3>
541
 *  - download the Linux kernel (linux-2.6.33.1.tar.bz2),
542
 *  - download the toolchain (binutils-2.20.tar.bz2, gcc-core-4.4.3.tar.bz2),
543
 *  - configure and make Binutils: <br/>
544
 *    <code>./configure --prefix=(build prefix) --target=m68knommu-none-linux</code> <br/>
545
 *    <code>make</code> <br/>
546
 *    <code>make install</code> <br/>
547
 *  - configure and make GCC:
548
 *    <code>./../gcc-4.4.3/configure --prefix=(build prefix) --target=m68knommu-none-linux
549
 *          --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libiberty --disable-zlib --disable-libgomp</code>
550
 *          <br/>
551
 *    <code>make</code> <br/>
552
 *    <code>make install</code> <br/>
553
 *  - 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
554
 *    sources directory,
555
 *  - configure and make the Linux kernel: <br/>
556
 *    <code>make menuconfig ARCH=m68knommu CROSS_COMPILE=(build prefix)/bin/m68knommu-none-linux-</code> <br/>
557
 *    <code>make ARCH=m68knommu CROSS_COMPILE=(build prefix)/bin/m68knommu-none-linux-</code> <br/>
558
 *  - convert the Linux kernel binary in ELF format into a flat binary format:
559
 *    <code>(build prefix)//bin/m68knommu-none-linux-objcopy -O binary vmlinux vmlinux.bin</code> <br/>
560
 *  - synthesise the <tt>soc_for_linux</tt> with the Altera Quartus II tool. The instructions to perform the synthesis are located in the makefile
561
 *    located at: <tt>./Makefile</tt>,
562
 *  - prepare a SDHC card with the software:
563
 *      - 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/>
564
 *        <code>dd if=sector0.dat of=/dev/(SD card device)</code>
565
 *        This file contains the SSP and PC values read by the ao68000 processor after booting.
566
 *      - copy the Linux kernel flat binary, at offset 1024: <br/>
567
 *        <code>dd if=vmlinux.bin of=/dev/(SD card device) bs=1024 seek=1</code> <br/>
568
 *  - insert the SDHC card into the reader in the Terasic DE2-70 board,
569
 *  - load the synthesised SOF file into the FPGA
570
 *  - look at the output of the kernel console by opening a serial terminal application and reading the output of the board.
571
 *
572
 * <h3>Notes</h3>
573
 *  - the SLOB allocator and not the default SLAB allocator had to be selected because of a problem in the kernel sources
574
 *    (in_interrupt() check before enabling the interrupts (at in ./kernel/slab.c:2109)),
575
 *  - the source file in the Linux kernel: <tt>./init/initramfs.c</tt> compiled with the GCC option <tt>-m68000</tt> contains illegal code
576
 *    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
577
 *    reliably (sometimes it booted and found the init program, sometimes not).
578
 *
579
 * <h3>Linux console output</h3>
580
 * The output of the running kernel is presented below:
581
 * \verbinclude ./doc/src/linux_booting.txt
582
 */
583
 

powered by: WebSVN 2.1.0

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