OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [orpsocv2/] [doc/] [orpsoc.texi] - Blame information for rev 575

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 397 julius
\input texinfo   @c -*-texinfo-*-
2
@c %**start of header
3
@setfilename orpsoc.info
4
@settitle ORPSoC manual 0.1
5
@include config.texi
6
@c %**end of header
7
 
8
@copying
9
This file documents the OpenRISC Reference Platform SoC, @value{ORPSOC}.
10
 
11 468 julius
Copyright @copyright{} 2010,2011 OpenCores
12 397 julius
 
13
@quotation
14
Permission is granted to copy, distribute and/or modify this document
15
under the terms of the GNU Free Documentation License, Version 1.2 or
16
any later version published by the Free Software Foundation; with no
17
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
18
Texts.  A copy of the license is included in the section entitled ``GNU
19
Free Documentation License''.
20
@end quotation
21
@end copying
22
 
23
@setchapternewpage on
24
@settitle @value{ORPSOC} User Guide
25
 
26
@syncodeindex fn cp
27
@syncodeindex vr cp
28
 
29
@titlepage
30
@title @value{ORPSOC} User Guide
31
@c @subtitle subtitle-if-any
32
@c @subtitle second-subtitle
33
@author Julius Baxter
34
@author OpenCores
35 568 julius
@author Issue 2 for @value{ORPSOC}
36 397 julius
 
37
@c  The following two commands
38
@c  start the copyright page.
39
@page
40
@vskip 0pt plus 1filll
41
@insertcopying
42
 
43
Published by OpenCores
44
@end titlepage
45
 
46
@c So the toc is printed at the start.
47
@contents
48
 
49
@ifnottex
50
@node Top
51
@top Scope of this Document
52
 
53
This document is the user guide for @value{ORPSOC}, the OpenRISC Reference Platform System on Chip project.
54
 
55
@end ifnottex
56
 
57
@menu
58
* Introduction::
59
* Project Organisation::
60
* Getting Started::
61
* Reference Design::
62
* Board Designs::
63 408 julius
* ORDB1A3PE1500::
64 415 julius
* ML501::
65 568 julius
* S3ADSP1800::
66 485 julius
* Generic Designs::
67 468 julius
* Software::
68 397 julius
* GNU Free Documentation License::  The license for this documentation
69
* Index::
70
@end menu
71
 
72 408 julius
@node Document Introduction
73 397 julius
@chapter Introduction
74
 
75
@cindex introduction to this @value{ORPSOC}
76
 
77 560 julius
@value{ORPSOC} is intended to be a reference implementation of processors in the OpenRISC family. It provides a smallest-possible reference system, primarily for testing of the processors. It also provides systems intended to be synthesized and programmed on physical hardware.
78 397 julius
 
79 560 julius
The reference system is the least complex implementation and consists of just enough to test the processor's functionality. The board-targeted builds typically include many additional peripherals.
80 397 julius
 
81 425 julius
The next section in this document outlines the organisation and structure of the project. The section ``@emph{Getting Started}'' goes through getting the project source and setting up any necessary tools. Each following section outlines a particular implementation of an OpenRISC-based system, beginning with the reference system. Each implementation section has an overview of the structure of the project (which probably won't vary much between the implementations), a section on setting up the required tools, running simulation, and if applicable, backend and debugging steps. There may be additional sections on modifying or customising each implementation system.
82 397 julius
 
83
@c ****************************************************************************
84
@c Project Organisation
85
@c ****************************************************************************
86
 
87
@node Project Organisation
88
@chapter Project Organisation
89
@cindex organisation of @value{ORPSOC} project
90
 
91
@menu
92
* Overview::
93
* Software::
94
* RTL::
95
* Testbenches::
96
* Reference And Board Designs::
97
@end menu
98
 
99 408 julius
@node Organisation Overview
100
@section Organisation Overview
101 397 julius
 
102 425 julius
The @value{ORPSOC} project is intended to serve dual purposes. One is to act as a development platform for OpenRISC processors, and as a development platform of OpenRISC-based SoCs targeted at specific hardware.
103 397 julius
 
104 530 julius
Organising a single project to satisfy these requirements can lead to some overlap and redundancy. This section is intended to make the organisation of the project clear.
105 397 julius
 
106 530 julius
The reference implementation based in the root (base directory) of the project contains enough components to create a simple OpenRISC-based SoC. Each board build is intended to implement as fully-featured a system as possible, depending on the targeted hardware.
107 425 julius
 
108
The project is organised in such a way that each board build can use both the reference implementation's RTL modules and software, as well as its own set of RTL and software. The reference implementation is limited to what is available in the RTL and software directories in the root of the project, and is not technology dependent.
109
 
110 397 julius
The following sections outline the organisation of the software, RTL, and board designs.
111
 
112 408 julius
@node Software Organisation
113 397 julius
@section Software
114
 
115 530 julius
The @code{sw} path contains primarily target software (code intended for cross-compilation and execution on an OpenRISC processor.) There is also a path, @code{sw/utils} containing custom tools, intended to be run on the host, for manipulation of binary software images.
116 397 julius
 
117 530 julius
Driver software, implementing access functions for hardware modules, are found under @code{sw/drivers}.
118 397 julius
 
119 425 julius
There is a minimal support library under the @code{sw/lib} path. Both drivers and support library are compiled together to create a library called @code{liborpsoc} which is placed in @code{sw/lib}.
120
 
121
All CPU-related functions are made available through the file @code{cpu-utils.h} which is located in @code{sw/lib/include} and depending on the CPU being used, can be used to switch between different CPU driver functions. All CPU drivers are under the @code{sw/drivers} path.
122
 
123 530 julius
@emph{Note:} It is expected in the future that the OpenRISC toolchain based on newlib will provide all of the necessary support software provided in this CPU-specific driver path. When the first release of the newlib-based toolchain occurs it is expected the software in ORPSoC will be changed to use this toolchain instead.
124
 
125 397 julius
Test software is found under @code{sw/tests}. Typically, each is for a specific module, or for a particular capability (eg. tests for the UART capability are under @code{sw/tests/uart}, rather than @code{sw/tests/uart16550} which.) There are no specific rules here.
126
 
127 530 julius
Under each test directory are two directories, @code{board} and @code{sim}, containing appropriate test software. Code for simulation will produce less printfs and aim to execute within realistic timeframes for RTL simulation. Board targeted test software is obviously written with the opposite considerations in mind and be more verbose and perhaps run orders of magnitudes more tests.
128 397 julius
 
129 425 julius
@node Software Test Naming
130 397 julius
 
131 425 julius
The rules for naming software tests are important to adhere to, so the automation scripts can locate them. The test directory name must be a single word (potentially with underscores), and then the tests must be in files of the format @emph{testdirname}-@emph{testname}.extension, eg. @code{uart-simple.c} or @code{or1200-fp.S}.
132
 
133 468 julius
@xref{Software} for further details.
134
 
135 408 julius
@node RTL Organisation
136 397 julius
@section RTL
137
 
138
The HDL code layout conforms to those outlined in the OpenCores.org coding guidelines. http://cdn.opencores.org/downloads/opencores_coding_guidelines.pdf
139
 
140 425 julius
There are, however, some naming restrictions for this project.
141 397 julius
 
142 530 julius
The directory name (presumably the name of the module, something like @code{uart16550}) should also be the name of the top level file, eg. @code{uart16550.v}, and the top level module should also be simply this name, eg. @code{module uart16550 (...);}.
143 425 julius
 
144
This will avoid confusion and help the scripts locate modules.
145
 
146
@subsection Verilog HDL
147
 
148
All RTL included in the project at this point is Verilog HDL, although it would be fine to add VHDL to a board build.
149
 
150 408 julius
@node Testbench Organisation
151
@section Testbench
152 397 julius
 
153 425 julius
For each design in @value{ORPSOC} there will be a testbench instantiating the top level, and any required peripherals.
154 397 julius
 
155 425 julius
Despite this being far from a thorough verification platform, it is considered useful to be able to perform enough simulation to ensure that the fundamental system is correctly assembled and can communicate with the peripherals.
156 397 julius
 
157 530 julius
It is expected that by running the command @code{make rtl-test} in each board's simulation run path, a basic simulation of the system initialising should be run.
158
 
159 408 julius
@node Organisation of Reference And Board Designs
160 397 julius
@section Reference And Board Designs
161
 
162
The goal of the reference design is to provide an environment to develop and test OpenRISC processors (also, potentially, basic components.) The goal of the various board-targeted designs is to provide ready-to-go implementations for hardware.
163
 
164 425 julius
@subsection Module Selection
165 397 julius
 
166 425 julius
Typically, a board-targeted design will wish to reuse common components (processor, debug interface, Wishbone arbiters, UART etc.)
167 397 julius
 
168 564 olof
The project has been configured so a board build will use modules in the ``common'' RTL path (@code{rtl/verilog/}) @emph{unless} there is a copy in the board's ``local'' RTL path ( @code{boards/vendor/boardname/rtl/verilog}) or the board includes an external module in @code{boards/vendor/boardname/modules}.
169 397 julius
 
170 425 julius
For example, in the event that modification to a module in the common RTL set is required for it to function correctly in a board build, it's advisable to copy that module to the board's @emph{local} RTL path and modify it there. Simulation and backend scripts should then use this board-specific version instead of the one in the common RTL path.
171
 
172
 
173
 
174 397 julius
@c ****************************************************************************
175
@c Getting started
176
@c ****************************************************************************
177
 
178
@node Getting Started
179
@chapter Getting Started
180
@cindex source files for @value{ORPSOC}, downloading
181
 
182
@menu
183
* Supported Platforms::
184
* Obtaining Project Source::
185
* Required Tools::
186
@end menu
187
 
188 408 julius
@node Getting Started Supported Platforms
189 425 julius
@section Supported Host Platforms
190
@cindex host platforms supported by the @value{ORPSOC} project
191 397 julius
 
192
At present the majority of  @value{ORPSOC}'s development occurs with tools that run under the GNU/Linux operating system. All of the tools required to run the basic implementation are free, open source, and easily installable in any modern GNU/Linux distribution.
193
 
194 425 julius
Unless indicated otherwise, support for the project under Cygwin on Microsoft Windows platforms cannot be assumed.
195 397 julius
 
196 408 julius
@node Getting Started Obtaining Project Source
197 397 julius
@section Obtaining Project Source
198
@cindex getting a copy of the @value{ORPSOC} project
199
 
200
The source for @value{ORPSOC} can be obtained from the OpenCores subversion (SVN) server.
201
 
202
@example
203
@kbd{svn export http://opencores.org/ocsvn/openrisc/openrisc/trunk/orpsocv2}
204
@end example
205
 
206 408 julius
@node Getting Started Required Tools
207 397 julius
@section Required Tools
208
@cindex tools and utilities required for @value{ORPSOC}
209
 
210
 
211
Performing the installation of tools required to design, simulate, verify, compile and debug a SoC is not for the faint hearted. The various sets of tools must be first installed, and the user's environment configured to allow them to run correctly.
212
 
213 415 julius
First the host system must be capable of building and running development tools, next the various compilers, simulators and utilities must be installed, and finally, if required, additional tools to interact with the built design are installed. Once complete, the set up rarely needs to be touched, and results in greatly improved productivity.
214 397 julius
 
215
The required tools can be divided into four groups.
216
 
217
@itemize @bullet
218
@item
219
Host system tools - things like gcc, make, texinfo.
220
 
221
@item
222 530 julius
Target system toolchain and software - the OpenRISC GNU toolchain, with gcc cross-compiler, support libraries, the GNU debugger (gdb), OpenRISC port of various OSes and RTOS, etc.
223 397 julius
 
224
@item
225
Electronic design automation (EDA) tools - preprocessors, simulators, FPGA tool suites, etc.
226
 
227
@item
228
Debug tools - tools providing control over the system on target
229
@end itemize
230
 
231
The first two items are likely to be the same for most of the designs included in @value{ORPSOC}, however the final two can vary greatly depending on the FPGA vendor, part and configuration, and the application of the SoC design.
232
 
233
There will be a section on the tools for each design in @value{ORPSOC}. This section is intended to provide a list of tools required for each particular build. Any lengthy instructions on installing a particular tool will be attached as an appendix, which can be references by several build prerequisite lists in order to save repetition of information.
234
 
235
Anyone implementing their own board port is encouraged to document, as best they can, any problematic tool installations and contribute them to this document.
236
 
237
 
238
 
239
@c ****************************************************************************
240
@c Reference Design chapter
241
@c ****************************************************************************
242
 
243
@node Reference Design
244
@chapter Reference Design
245
@cindex reference design
246
 
247
@menu
248
* Overview::
249
* Structure::
250
* Tools::
251
* Simulation::
252
* Synthesis::
253
@end menu
254
 
255 408 julius
@node Reference Design Overview
256 468 julius
@section Overview
257 397 julius
 
258 425 julius
The reference design included in @value{ORPSOC} is intended to be the minimal implementation (or thereabouts) of a SoC required to exercise an OpenRISC processor. Very little apart from the processor, memory, debug interface and interconnect modules are instantiated.
259 397 julius
 
260 415 julius
The primary role for this design is to implement a system that an OpenRISC processor can be instantiated in for for development purposes. The automated testing mechanism, capable of compiling, executing and checking software on the design, is used as a method of regression testing for the processor as it is developed. After features are added or modified in the processor, new software tests can be added to the existing suite, checking for the expected functionality and ensuring legacy behavior is also unchanged.
261 397 julius
 
262
The design can be simulated two ways. The first uses the standard event-driven simulators such as Icarus Verilog and Mentor Graphics' Modelsim. The second method involves creating a cycle accurate (C or SystemC) model from the Verilog HDL description using the Verilator tool.
263
 
264
The simulations begin with the desired software image preloaded in memory. For debugging the design, the models provide an interface to the system allowing the GNU debugger to control the target processor in a manner similar to that of physical hardware.
265
 
266
The design is not intended for implementation on an FPGA or ASIC, rather purely for development and testing in simulation environments. The board targeted builds in the @value{ORPSOC} project, however, are intended for implementation on hardware.
267
 
268 408 julius
@node Reference Design Structure
269 468 julius
@section Structure
270 397 julius
 
271
@menu
272
* Overview::
273
* RTL::
274
* Software::
275
* Simulation::
276
@end menu
277
 
278 408 julius
@node Reference Design Overview
279 468 julius
@subsection Overview
280 397 julius
 
281
The reference design's paths are all based in the root directory of @value{ORPSOC}. This is different from the board-targeted builds, which are based in their specific board paths.
282
 
283
As synthesis and physical implementation is not intended for the reference design there are no @code{syn} or @code{backend} paths in the root directory of @value{ORPSOC}.
284
 
285 408 julius
@node Reference Design RTL
286 468 julius
@subsection RTL
287 397 julius
 
288
At present only Verilog HDL is included in the reference implementation of @value{ORPSOC}, as the open source tools intended to simulate the design do not support VHDL.
289
 
290
The directory structure consists of an @code{rtl} directory in the root, and a @code{verilog} path under that. Within the @code{rtl/verilog} path, each module has its own directory.
291
 
292 564 olof
External modules using the OpenCores structure can be put under each boards @code{modules} directory. The scripts will the look for verilog files under @code{modules/<module_name>/rtl/verilog}.
293
 
294 397 julius
A common Verilog include path, @code{rtl/verilog/include} directory is used. The Verilog HDL include files for each module should be moved here. This allows each @value{ORPSOC} implementation (board design) to maintain their own include path, and thus configure the modules for their specific implementation.
295
 
296 408 julius
@node Reference Design Software
297 468 julius
@subsection Software
298 397 julius
 
299
The software run on the reference design is found in the @value{ORPSOC} root directory, under the @code{sw} path.
300
 
301
The test software for the or1200 processor is found under @code{sw/tests/or1200/sim}.
302
 
303
A minimal set of drivers is built into @code{liborpsoc}, and they are found under @code{sw/tests/drivers}.
304
 
305
In addition to these drivers, a set of support C functions is build into @code{liborpsoc}, which are found in the @code{sw/lib} path.
306
 
307 408 julius
@node Reference Design Simulation
308 468 julius
@subsection Simulation
309 397 julius
 
310
The simulation of the reference design is run from the @code{sim/run} path.
311
 
312
The script controlling simulation is the file @code{sim/bin/Makefile}.
313
 
314
The generated output is kept in the @code{sim/out} path, and is cleared away when @kbd{make clean} is run.
315
 
316
When the Verilator-processed cycle accurate model is built, it is done in the @code{sim/vlt} path, which is also cleaned away when @kbd{make clean} is run.
317
 
318 408 julius
@node Reference Design Tools
319 468 julius
@section Tools
320 397 julius
 
321
@menu
322
* Host Tools::
323
* Target System Tools::
324
* EDA Tools::
325
* Debug Tools::
326
@end menu
327
 
328 408 julius
@node Reference Design Host Tools
329 468 julius
@subsection Host Tools
330 397 julius
@cindex host tools required
331
 
332
Standard development suite of tools: gcc, make, etc.
333
 
334 408 julius
@node Reference Design Target System Tools
335 468 julius
@subsection Target System Tools
336 397 julius
@cindex target system tools required
337
 
338
OpenRISC GNU toolchain. For installation, see OpenRISC GNU toolchain page on OpenCores.org.
339
 
340 408 julius
@node Reference Design EDA Tools
341 468 julius
@subsection EDA Tools
342 397 julius
@cindex EDA tools required
343
 
344
RTL simulation: Icarus Verilog (also compatible with Mentor Graphics' Modelsim)
345
Cycle Accurate Simulation: Verilator, Verilog-Perl, System-Perl, SystemC
346
 
347 408 julius
@node Reference Design Debug Tools
348 468 julius
@subsection Debug Tools
349 397 julius
@cindex Debug tools required
350
 
351
None. The target is purely simulation, no extra utilities are required to debug.
352
 
353
 
354 408 julius
@node Reference Design Simulation
355 468 julius
@section Simulation
356 397 julius
 
357
@menu
358
* RTL::
359
* Cycle Accurate::
360
* Results::
361
@end menu
362
 
363 408 julius
@node Reference Design RTL
364 468 julius
@subsection RTL
365 397 julius
@cindex rtl simulation of reference design
366
 
367
All simulations of the reference design are run from the @code{sim/run} path.
368
 
369 468 julius
@subheading Running RTL Regression Test
370 397 julius
 
371
The simplest way of starting a run through the regression test, using the default RTL simulator, Icarus Verilog, can be done with:
372
 
373
@example
374
@kbd{make rtl-tests}
375
@end example
376
 
377 408 julius
This will compile the software and RTL, and run a new simulation for each software test. Defining which tests are run is the variable @code{TESTS}, set by default in the @code{sw/bin/Makefile} script. Other default options are that a processor execution log is generated (in @code{sim/out/@emph{testname}-executed.log}), but VCDs are not.
378 397 julius
 
379 468 julius
@subheading Running An Individual Test
380 397 julius
 
381
An individual test can be run, by specifying the test name through the @code{TEST} environment variable (which must correspond to a file in @code{sw/tests/@emph{module}/sim/} where @code{@emph{module}} is the name of the module to be tested. In the following example the test @emph{or1200-basic} is run.
382
 
383
@example
384
@kbd{make rtl-test TEST=or1200-basic}
385
@end example
386
 
387 408 julius
@node Running A Set Of Specific Reference Design RTL Tests
388 468 julius
@subheading Running A Set Of Specific Tests
389 397 julius
 
390
A specific set of tests can be run in the same fashion as the regression tests but with the actual tests to run set in the @code{TESTS} environment variable.
391
 
392
@example
393
@kbd{make rtl-tests TESTS="sdram-rows uart-simple or1200-mmu or1200-fp"}
394
@end example
395
 
396 468 julius
@node Providing A Precompiled ELF Executable
397
@subheading Providing A Precompiled ELF Executable
398
 
399
It's possible to specify the path to an OR32 ELF executable to be run in simulation instead of test software. Use the @code{USER_ELF} environment variable to specify the path to the ELF to run.
400
 
401
@example
402
@kbd{make rtl-test USER_ELF=/path/to/myapp.elf}
403
@end example
404
 
405
The ELF will be converted to binary format, and then converted to a VMEM to be
406
loaded into the model for execution at runtime.
407
 
408
@node Providing A Custom VMEM Image
409
@subheading Providing A Custom VMEM Image
410
 
411
It's possible to specify the path to a pre-existing VMEM image to be run in simulation instead of test software. Use the @code{USER_VMEM} environment variable to specify the path to the VMEM image to be run.
412
 
413
@example
414
@kbd{make rtl-test USER_VMEM=/path/to/myapp.vmem}
415
@end example
416
 
417
This VMEM file will be copied into the working directory, and renamed according to what the simulated memory expects.
418
 
419 408 julius
@node Options For Reference Design RTL Tests
420 468 julius
@subheading Options For RTL Tests
421 397 julius
 
422
There are some options, which can be specified through shell environment variables when running the test.
423
 
424
@table @code
425
 
426
@item VCD
427 408 julius
Set to '1' to enable @emph{value change dump} (VCD) creation in @code{sim/out/@emph{testname}.vcd}
428 397 julius
 
429
@item VCD_DELAY
430
Delay VCD creation start time by this number of timesteps (used as a Verilog @code{#delay} in the testbench.)
431
 
432
@item VCD_DELAY_INSNS
433
Delay VCD creation start time until this number of instructions has been executed by the processor. Useful for creating a dump just before a bug exhibited and correlated to an instruction number (from execution trace file.)
434
 
435
@item END_TIME
436
Force simulation end (@code{$finish}) at this time.
437
 
438
@item DISABLE_PROCESSOR_LOGS
439
Turn off processor monitor's execution trace generation. This helps speed up the simulation (less time writing to files) and avoids creating very large execution logs (in the GBs) for very long simulations.
440
 
441
@item SIMULATOR
442
Specify simulator to use. Default is Icarus Verilog, can be set to @code{modelsim} to use Mentor Graphics' Modelsim. No others are supported right now.
443
 
444 485 julius
@item MGC_NO_VOPT
445
When using Modelsim (specifying @code{SIMULATOR=modelsim}), if the version does not include the individual @code{vopt} executable, specify @code{MGC_NO_VOPT=1} when compiling.
446
 
447 492 julius
@item VPI
448 530 julius
Pass @code{VPI=1} to have the an external JTAG debug module stall the processor just after bootup, and then provide a GDB stub (interacting with the Verilog sim via the VPI) to allow control of the system in a similar fashion to that of a physical target controlled over JTAG via a debug proxy application. The port for GDB is hard-coded to 50002. See the code in @code{bench/verilog/vpi/c} for more details.
449 492 julius
If running with Modelsim, ensure the path @code{MGC_PATH} is set and points to a directory containing a path named @code{modeltech}, which should be the Modelsim install.
450
 
451 397 julius
@end table
452
 
453
 
454
 
455 485 julius
 
456
 
457 408 julius
@node Reference Design Cycle Accurate
458 468 julius
@subsection Cycle Accurate
459 397 julius
@cindex cycle accurate simulation of reference design
460
 
461 468 julius
@subheading Running Cycle Accurate Regression Test
462 397 julius
 
463
The simplest way of starting a run through the regression test using the cycle accurate model can be done with:
464
 
465
@example
466
@kbd{make vlt-tests}
467
@end example
468
 
469
This will build the cycle accurate model and run a new simulation for each software test. Defining which tests are run is the variable @code{TESTS}, set by default in the @code{sw/bin/Makefile} script.
470
 
471 468 julius
@subheading Running An Individual Test
472 397 julius
 
473
An individual test can be run, by specifying the test name through the @code{TEST} environment variable (which must correspond to a file in @code{sw/tests/@emph{module}/sim/} where @code{@emph{module}} is the name of the module to be tested. In the following example the test @emph{or1200-basic} is run.
474
 
475
@example
476
@kbd{make vlt-test TEST=or1200-basic}
477
@end example
478
 
479 468 julius
@subheading Generating Cycle Accurate Simulator Executable
480 397 julius
 
481
The cycle accurate model is somewhat similar to the OpenRISC architectural simulator, in that it can be run as a standalone application, although it is not as configurable at runtime. The standalone application can be built with the following command from the @code{sim/run} path.
482
 
483
@example
484
@kbd{make prepare-vlt}
485
@end example
486
 
487
The resulting executable will be @emph{Vorpsoc_top} in the @code{sim/vlt} path. Run it with the @emph{-h} option for usage instructions.
488
 
489 468 julius
@subheading Generating Automatically Profiled Cycle Accurate Simulator Executable
490 397 julius
 
491
An automatic profiling and compilation set of commands in the script can be used to create a higher performance cycle accurate model. The following make target will first compile the cycle accurate design to generate profiling outputs, run some software, and recompile using the profiling information.
492
 
493
@example
494
@kbd{make prepare-vlt-profiled}
495
@end example
496
 
497 468 julius
@subheading Cycle Accurate Model Executable Usage
498 397 julius
 
499
The executable generated by running any of the above commands is in the @code{sim/vlt} path. The usage options can be listed by running it with the @code{--help} switch.
500
 
501
@example
502
@kbd{Vorpsoc_top --help}
503
@end example
504
 
505
A short list of options is given here.
506
 
507
@table @code
508
 
509
@item -f @var{file}
510
@itemx --program @var{file}
511
@cindex @code{-f}
512
@cindex @code{--program}
513
Load software from OR32 ELF image @var{file}
514
 
515
If unspecified, model attempts to load VMEM file @code{sram.vmem}
516
 
517
@item -v
518
@itemx --vcd
519
@cindex @code{-v}
520
@cindex @code{--vcd}
521
Dump VCD file
522
 
523
@item -e @var{value}
524
@itemx --endtime @var{value}
525
@cindex @code{-e}
526
@cindex @code{--endtime}
527
End simulation after @var{value} simulated ns
528
 
529
@item -l @var{file}
530
@itemx --log @var{file}
531
@cindex @code{-l}
532
@cindex @code{--log}
533
Log processor execution trace to @var{file}
534
 
535
@end table
536
 
537 408 julius
@node Reference Design Results
538 468 julius
@subsection Results
539 397 julius
@cindex output from simulation of reference design
540
 
541 415 julius
The following files are generated from the event driven simulation. For output options of the cycle accurate model, see the section on Cycle Accurate Model Executable Usage.
542 397 julius
 
543 468 julius
@subheading Processor Execution Trace
544 397 julius
 
545
A trace of the processor after each executed instruction is generated by both the event and cycle accurate models.
546
 
547
In the event driven simulations, the log is created by default, and is stored in @code{sim/out} and will be named @code{@emph{test-name}-executed.log}.
548
 
549 468 julius
@subheading Processor SPR Access Log
550 397 julius
 
551
A list of processor special purpose registers (SPR) accesses is created when processor logging is enabled.
552
 
553
These values are logged to a file in @code{sim/out} named @code{@emph{test-name}-sprs.log}.
554
 
555 468 julius
@subheading Processor Instruction Excecution Time Log
556 397 julius
 
557
A list of when each instruction was executed is generated when processor execution logging is enabled.
558
 
559
This is useful when debugging with VCD, and detecting at what time the problematic instructions were executed.
560
 
561
These values are logged to a file in @code{sim/out} named @code{@emph{test-name}-lookup.log}.
562
 
563 468 julius
@subheading Processor Report Mechanism Log
564 397 julius
 
565
The use of the processor's report mechanism is commonplace in the test software, as it allows for the checking of intermediate values after simulation.
566
 
567
These values are logged to a file in @code{sim/out} named @code{@emph{test-name}-general.log}. This is not optional.
568
 
569 468 julius
@subheading Value Change Dump (VCD)
570 397 julius
 
571
When VCD files are generated they are placed in the @code{sim/out} path, and are named @code{@emph{test-name}.vcd}. They should be viewable with programs like @emph{GTKWave}.
572
 
573
 
574 408 julius
@node Reference Design Synthesis
575 468 julius
@section Synthesis
576 397 julius
 
577
The reference design is not intended to be synthesised, and thus no backend scripts are provided. See the sections on the board-specific builds.
578
 
579
 
580
@c ****************************************************************************
581 408 julius
@c ORDB1A3PE1500 board build chapter
582 397 julius
@c ****************************************************************************
583
 
584 408 julius
@node ORDB1A3PE1500
585
@chapter ORDB1A3PE1500
586
@cindex ORDB1A3PE1500 board build information
587 397 julius
 
588
@menu
589
* Overview::
590
* Structure::
591
* Tools::
592
* Simulating::
593 408 julius
* Synthesis and Backend::
594
* Programming File Generation::
595
* Customising::
596 397 julius
@end menu
597
 
598 408 julius
@node ORDB1A3PE1500 Overview
599 468 julius
@section Overview
600 397 julius
 
601 408 julius
The ORDB1 (ORSoC development board 1) with Actel A3PE1500 FPGA is supported by this build.
602 397 julius
 
603 408 julius
As the ORDB1 is intended to be a daughter board for a variety of I/O boards its options for configuration are extensive.
604
 
605
This board port of ORPSoC implements an example of a configurable system, with many cores that can be enabled or disabled as required by the expansion board's capabilities.
606
 
607 415 julius
The port was mainly developed with the ORSoC Ethernet expansion board (OREEB1), and was used with the OpenRISC port of the Linux kernel and BusyBox suite running network applications.
608 408 julius
 
609
This guide will overview how to simulation, synthesize and customise the system.
610
 
611
@node ORDB1A3PE1500 Structure
612 468 julius
@section Structure
613 397 julius
 
614 408 julius
Note that in this chapter the term @emph{board path} refers to the path in the project for this board port; @code{boards/actel/ordb1a3pe1500}.
615 397 julius
 
616 408 julius
The board port's structure is similar to that of a standalone project which accords with the OpenCores coding guidelines. However, all software and RTL that is available in the reference design is also available to the board port, with any local (ie. in the board's @code{rtl} or @code{sw} paths) versions taking precedence over the versions available in the reference design.
617
 
618
The Verilog RTL specific to this board is under @code{rtl/verilog} in the board path. The @code{include} path in there is the place where all required definitions files, configuring the RTL, are found.
619
 
620
Backend files, things such as PLLs and buffers generated by Actel's @emph{smartgen} tool, are found in the board's @code{backend/rtl/verilog} path.
621
 
622
@node ORDB1A3PE1500 Tools
623 468 julius
@section Tools
624 397 julius
 
625
@menu
626
* Host Tools::
627
* Target System Tools::
628
* EDA Tools::
629
* Debug Tools::
630
@end menu
631
 
632 408 julius
@node ORDB1A3PE1500 Host Tools
633 468 julius
@subsection Host Tools
634 408 julius
@cindex host tools required ORDB1A3PE1500
635 397 julius
 
636
Standard development suite of tools: gcc, make, etc.
637
 
638 408 julius
@node ORDB1A3PE1500 Target System Tools
639 468 julius
@subsection Target System Tools
640 408 julius
@cindex target system tools required ORDB1A3PE1500
641 397 julius
 
642
OpenRISC GNU toolchain. For installation, see OpenRISC GNU toolchain page on OpenCores.org.
643
 
644 408 julius
@node ORDB1A3PE1500 EDA Tools
645 468 julius
@subsection EDA Tools
646 408 julius
@cindex EDA tools required ORDB1A3PE1500
647 397 julius
 
648
RTL, gatelevel simulation: Mentor Graphics' Modelsim
649
Synthesis: Synopsys Synplify (included in Actel Libero Suite)
650
Backend: Actel Designer (included in Actel Libero Suite)
651
Programming: Actel FlashPRO (included in Actel Libero Suite)
652
 
653 530 julius
This has been tested with with Libero versions 8.6, 9.0sp1 and 9.1 under Ubuntu Linux. It is recommended the very latest version available be used.
654 408 julius
 
655
@node ORDB1A3PE1500 Debug Tools
656 468 julius
@subsection Debug Tools
657 408 julius
@cindex Debug tools required ORDB1A3PE1500
658 397 julius
 
659
or_debug_proxy, ORPmon
660
 
661 408 julius
@node ORDB1A3PE1500 Simulating
662 468 julius
@section Simulating
663 408 julius
@cindex simulating ORDB1A3PE1500
664 397 julius
 
665 468 julius
@subheading Run RTL Regression Test
666 408 julius
 
667
To run the default set of regression tests for the build, run the following command in the board's @code{sw/run} path.
668
 
669
@example
670
@kbd{make rtl-tests}
671
@end example
672
 
673 425 julius
The same set of options for RTL tests available in the reference design should be available in this build. @xref{Running A Set Of Specific Reference Design RTL Tests}.
674 408 julius
 
675 409 julius
Options specific to the ORDB1A3PE1500 build.
676
 
677
@table @code
678
 
679
@item PRELOAD_RAM
680
Set to '1' to enable loading of the software image into RAM at the beginning of simulation.
681
 
682
If the chosen bootROM program (set via a define in software header file in the board's @code{sw/board/include} path) will jump straight to RAM to begin execution, then the software image will need to be in RAM for the simulation to work. This define @emph{must} be used in that case for the simulation to do anything.
683
 
684
 
685
@end table
686
 
687
 
688
 
689 408 julius
@node ORDB1A3PE1500 Synthesis
690 468 julius
@section Synthesis
691 408 julius
 
692
Synthesis of the board port for the Actel technology with the Synplify tool can be run in the board's @code{syn/synplify/run} path with the following command.
693
 
694
@example
695
@kbd{make all}
696
@end example
697
 
698
This will create a EDIF netlist in @code{syn/synplify/out}.
699
 
700
Hopefully it's all automated enough so that, as long as the design is simulating as desired, the correct set of RTL will be picked up and synthesized without any need for customising scripts for the tool.
701
 
702
@node ORDB1A3PE1500 Synthesis Options
703 468 julius
@subsection Options
704 408 julius
 
705
The following can be passed as environment variables when running @kbd{make all}.
706
 
707
@table @code
708
 
709
@item RTL_TOP
710
Default's to the designs top level module, @emph{orpsoc_top}, but if wishing to synthesize a particular module, its name (not instantiated name) should be set here.
711
 
712
@item FPGA_PART
713
Defaults to A3PE1500 but if targeting any other set it with this.
714
 
715
@item FPGA_FAMILY
716
Defaults to the A3PE1500's @emph{ProASIC3E} but if targeting any other set it with this.
717
 
718
@item FPGA_PACKAGE
719
Defaults to PQFP208 but if targeting any other set it with this.
720
 
721
@item FPGA_SPEED_GRADE
722
Defaults to Std but if targeting any other set it with this.
723
 
724
@item FREQ
725
Target frequency for synthesis.
726
 
727
@item MAXFAN
728
Maximum net fanout.
729
 
730
@item MAXFAN_HARD
731
Hard limit on maximum net fanout.
732
 
733
@item GLOBALTHRESH
734
Threshold of fanout before promoting signal to a global routing net.
735
 
736
@item RETIMING
737
Defaults to '1' (on) but set to '0' to disable.
738
 
739
@item RESOURCE_SHARING
740
Defaults to '1' (on) but set to '0' to disable.
741
 
742
@item DISABLE_IO_INSERTION
743
Defaults to '0' (off) but set to '1' to enable. Useful when synthesizing individual modules not intended as a top level.
744
 
745
@end table
746
 
747
@node ORDB1A3PE1500 Synthesis Warnings
748 468 julius
@subsection Checks
749 408 julius
 
750
The following is a list of some considerations before synthesis.
751
 
752
@itemize @bullet
753
@item bootrom.v
754
 
755 415 julius
If the bootROM module is being used to provide the processor with a program at startup, check that board software include file, in the board's @code{sw/board/include} path, is selecting the correct bootROM program.
756 408 julius
 
757 449 julius
Do a @kbd{make distclean} from the synthesis run directory to be sure that the previous bootROM file is cleared away and regenerated when synthesis is run.
758 408 julius
 
759
 
760
@item Clean away old leftovers
761
 
762
If the unwanted files from an old synthesis run are still there before the next run, it's best to clean them away with @kbd{make clean} from the synthesis run directory.
763
 
764
 
765
@item Check Command Line Options
766
 
767
If using any command line settings, they can be checked by passing them to the following make target: @kbd{make print-config}
768
 
769
 
770
@end itemize
771
 
772
@node ORDB1A3PE1500 Place and Route
773 468 julius
@section Place and Route
774 408 julius
 
775
Place and route is run from the board's @code{backend/par/run} path with the following command.
776
 
777
@example
778
@kbd{make all}
779
@end example
780
 
781
This will create a @code{.adb} file in the same path.
782
 
783 439 julius
All steps, up to and including programming file generation are done here. FPGA device programming must be done using the programming FlashPro tool under Windows if using a free license.
784 408 julius
 
785
@node ORDB1A3PE1500 Place and route options
786 468 julius
@subsection Options
787 408 julius
 
788 439 julius
Most of the design's parameters are determined by processing the @code{orpsoc-defines.v} file and extracting, for example, the frequency of the clocks entering the design.
789 408 julius
 
790
The following can be passed as environment variables when running @kbd{make all}.
791
 
792
@table @code
793
 
794
@item FPGA_PART
795
Defaults to A3PE1500 but if targeting any other set it with this.
796
 
797
@item FPGA_FAMILY
798
Defaults to the A3PE1500's @emph{ProASIC3E} but if targeting any other set it with this.
799
 
800
@item FPGA_PACKAGE
801
Defaults to ``208 PQFP'' but if targeting any other set it with this.
802
 
803
 
804
@item FPGA_SPEED_GRADE
805
Defaults to Std but if targeting any other set it with this.
806
 
807
@item FPGA_VOLTAGE
808
Defaults to 1.5 but if targeting any other set it with this.
809
 
810
@item FPGA_TEMP_RANGE
811
Defaults to COM but if targeting any other set it with this.
812
 
813
@item FPGA_VOLT_RANGE
814
Defaults to COM but if targeting any other set it with this.
815
 
816
@item PLACE_INCREMENTAL
817
Defaults to off.
818
 
819
@item ROUTE_INCREMENTAL
820
Defaults to off.
821
 
822
@item PLACER_HIGH_EFFORT
823
Defaults to off.
824
 
825
@item BOARD_CONFIG
826
Defaults to @code{orsoccpuexpio.mkpinassigns}
827
 
828
@end table
829
 
830
@node ORDB1A3PE1500 Constraints
831 468 julius
@subsection Constraints
832 408 julius
 
833
 
834
A @emph{synposys design constraints} (SDC) file, and @emph{physical design constraints} (PDC) file are generated automatically by the scripts. The main Verilog defines file is parsed to detect which modules are included in the design, and generates the appropriate constraints which are embedded in the Makefile.
835
 
836
 
837
The PDC relies on the @code{BOARD_CONFIG} environment variable to indicate which pin assignment file to pull into the Makefile (they live in @code{backend/par/bin}). The PDC also depends on the actual contents of the main place and route Makefile, @code{backend/par/bin/Makefile}.
838
 
839
 
840
By default these should have support for the peripherals included with ORPSoC. Double check, however, that the correct constraints are set, by running the following command before starting place and route.
841
 
842
@example
843
@kbd{make pdc-file sdc-file}
844
@end example
845
 
846
These can be generated and edited and then used when running place and route, they will not get replaced.
847
 
848
@node ORDB1A3PE1500 Programming File Generation
849 468 julius
@section Programming File Generation
850 408 julius
 
851
The @code{.adb} file resulting from place and route can be opened in the Actel @emph{Designer} tool and a programming file generated there.
852
 
853
Once this programming file is created, Actel's @emph{FlashPro} can used to program the ORDB1A3PE1500 board.
854
 
855
@node ORDB1A3PE1500 Customising
856 468 julius
@section Customising
857 408 julius
 
858
The versatile nature of the ORDB1A3PE1500 means the design that goes on it must be equally versatile, if not more so.
859
 
860
The following sections have information on how to configure the design.
861
 
862
@node ORDB1A3PE1500 Customising Enabling Existing Modules
863 468 julius
@subsection Enabling Existing RTL Modules
864 408 julius
 
865
The design relies on the Verilog HDL @emph{define} function to indicate which modules are included.
866
 
867 415 julius
There are only a few modules included by default.
868 408 julius
 
869
@itemize @bullet
870
@item Processor - @emph{or1200}
871
@item Clock and reset generation - @emph{clkgen}
872
@item Bus arbiters - @emph{arbiter_ibus}, @emph{arbiter_dbus}, @emph{arbiter_bytebus}
873
@end itemize
874
 
875
The rest are optional, depending on what is defined in the board's @code{rtl/verilog/include/orpsoc-defines.v} file.
876
 
877
Inspect that file to see which modules are able to be included. At present the list includes USB 1.1 host controller and/or slave interface, I2C master/slave core, and SPI master cores.
878
 
879 530 julius
These cores should be supported and ready to go by just defining them (uncomment in the @code{orpsoc-defines.v} file.)
880 408 julius
 
881
@node ORDB1A3PE1500 Customising Adding Modules
882 468 julius
@subsection Adding RTL Modules
883 408 julius
 
884
There are a number of steps to take when adding a new module to the design.
885
 
886
@itemize @bullet
887
@item RTL Files
888
 
889 564 olof
Create a directory under the board's @code{rtl/verilog} directory, and name it the same as the top level of the module.
890 408 julius
 
891 564 olof
 
892
 
893 408 julius
Ensure the module's top level file and actual name of the module when it will be instantiated are @emph{all the same}.
894
 
895
Place any include files into the board's @code{rtl/verilog/include} path.
896
 
897
@item Instantiate in ORPSoC Top Level File
898
 
899
Instantiate the module in the ORPSoC top level file, @code{rtl/verilog/orpsoc_top/orpsoc_top.v}, and be sure to take care of the following.
900
@itemize @bullet
901
@item Create appropriate @emph{`define} in @code{orpsoc-defines.v} and surround module instantiation with it.
902
@item Add required I/Os (surrounded by appropriate @emph{`ifdef })
903
@item Attach to appropriate bus arbiter, declaring any signals required. Be sure to tie them off if modules is not included.
904
@item Update appropriate bus arbiter (in board's @code{rtl/verilog/arbiters} path) adding (uncommenting) additional ports as needed.
905
@item Update board's @code{rtl/verilog/include/orpsoc-params.v} file with appropriate set of parameters for new module, as well as arbiter memory mapping assignment.
906
@item Attach appropriate clocks and resets, modify the board's @code{rtl/verilog/clkgen/clkgen.v} file generating appropriate clocks if required.
907
@item Attach any interrupts to the processor's PIC vector in, assigned as the last thing in the file.
908
@end itemize
909
 
910
@item Update ORPSoC Testbench
911
 
912
Update the board's @code{bench/verilog/orpsoc_testbench.v} file with appropriate ports (surrounded by appropriate @emph{`ifdef}.)
913
 
914
Add any desired models to help test the module to the board's @code{bench/verilog} path and instantiate it correctly in the testbench.
915
 
916
@item Add Software Drivers and Tests
917
 
918
In a similar fashion to what is already in the board's @code{sw/drivers} and @code{sw/tests} path, create desired driver and test software to be used during simulation (and potentially on target.)
919
 
920
@item Update Backend Scripts
921
 
922 415 julius
If any I/O is added, or special timing specified, the board's backend main Makefile, @code{backend/par/bin/Makefile} and pinout files (in @code{backend/par/bin} will need to be updated.
923 408 julius
 
924
The section in @code{backend/par/bin/Makefile} mapping signals to Makefile variables will need to have these new signals added to them. The section in the file begins with @code{$(PDC_FILE):} and is actually a set of long bash lines.
925
 
926 530 julius
Continuing the format already there should be easy enough. Remember that the @code{orpsoc-defines.v} file is parsed and it's possible to tell if the module is included by testing if the variable is defined.
927 408 julius
 
928
For example, to add I/Os for a module called @code{foo}, and in @code{orpsoc-defines.v} a value @code{FOO1} is defined, we can add I/Os @code{foo1_srx_i} and @code{foo1_tx_o[3:0]} with the following.
929
 
930
@example
931
@kbd{   $(Q)if [ ! -z $$FOO1 ]; then \
932
        echo "set_io foo1_srx_i " $(FOO_SRX_BUS_SETTINGS) " \
933 410 julius
        -pinname "$(FOO1_SRX_PIN) >> $@@; \
934 408 julius
        echo "set_io foo1_tx_o\\[0\\] " $(FOO_TX_BUS_SETTINGS) " \
935 410 julius
         -pinname "$(FOO1_TX0_PIN) >> $@@; \
936 408 julius
        echo "set_io foo1_tx_o\\[1\\] " $(FOO_TX_BUS_SETTINGS) "  \
937 410 julius
        -pinname "$(FOO1_TX1_PIN) >> $@@; \
938 408 julius
        echo "set_io foo1_tx_o\\[2\\] " $(FOO_TX_BUS_SETTINGS) "  \
939 410 julius
        -pinname "$(FOO1_TX2_PIN) >> $@@; \
940 408 julius
        echo "set_io foo1_tx_o\\[3\\] " $(FOO_TX_BUS_SETTINGS) "  \
941 410 julius
        -pinname "$(FOO1_TX3_PIN) >> $@@; \
942
fi
943 408 julius
       }
944
@end example
945
 
946
@emph{(ensure there is no whitespace after the trailing backslashes.)}
947
 
948
It's a little hard to follow, but it's essentially one @code{set_io} line for each I/O line.
949
 
950
First the line checks if the module's define was exported (which happens automatically if it's defined in @code{orpsoc-defines.v}.
951
 
952
Note that what is defined can be checked by running @kbd{make print-defines} in the board's @code{backend/par/run} path.
953
 
954
The values of the bus settings variables depend on the desired I/O standards and other examples in the Makefile can be referenced.
955
 
956 415 julius
The pin numbers need to be set in the @code{.mkpinassigns} which is included into the Makefile (according to the @code{BOARD_CONFIG} variable set when running the @code{make} command.)
957 408 julius
 
958
These files are simple assignments of values to variables (and potentially then to other variables) which correspond to the variables finally used in the main Makefile.
959
 
960
The physical constraints file can be generated manually with the @kbd{make pdc-file} command.
961
 
962
@end itemize
963
 
964 415 julius
@c ****************************************************************************
965
@c ML501 board build chapter
966
@c ****************************************************************************
967 408 julius
 
968 415 julius
@node ML501
969
@chapter ML501
970
@cindex ML501 board build information
971 408 julius
 
972 415 julius
@menu
973
* Overview::
974
* Structure::
975
* Tools::
976
* Simulating::
977
* Synthesis and Backend::
978
* Programming File Generation::
979
* Customising::
980
* Running And Debugging Software::
981
@end menu
982 408 julius
 
983 415 julius
@node ML501 Overview
984 468 julius
@section Overview
985 408 julius
 
986 415 julius
The Xilinx ML501 board contains a Virtex LX50 part, varied memories and peripherals. See Xilinx's site for specific details:
987
 
988
http://www.xilinx.com/products/devkits/HW-V5-ML501-UNI-G.htm
989
 
990 496 julius
The OR1200 core and Wishbone bus is set to run at 66MHz. The OR1200 core, as defined here, is almost fully featured, with every hardware arithmetic option enabled, and the largest possible cache configuration, of 1024 sets with 8 words per line which is 32 kilobytes of cache each for instruction and data buses.
991
 
992 415 julius
Not all peripherals are supported, and adding support for each is a goal.
993
 
994
At present the build contains a memory controller for the DDR2 SDRAM (based around a Xilinx MIG derived controller) and SSRAM. None of the other peripherals (VGA/AC97/PS2/USB/LCD) have controllers in the design yet.
995
 
996 530 julius
The OpenCores 10/100 Ethernet MAC can be used for Ethernet, but only with the PHY in 10/100 mode using the MII interface to the Marvel Alaska Ethernet PHY IC. There still may be bugs in the FIFO buffer configuration in the ML501's @code{ethmac_defines.v} file should not be changed.
997 415 julius
 
998 560 julius
The ML501 build's scripts are capable of generating either a programming bitstream, @code{.bit}, file for direct programming of the FPGA via JTAG, or a flash image , @code{.mcs}, file which can be programmed into the on-board SPI flash which the FPGA can configure itself from on power-on. This flash image file may also contain a software image the processor can load at reset to, for example, present the user with the prompt for a boot monitor at power-on.
999 415 julius
 
1000 560 julius
This guide is a work in progress, and provides the basics on simulating, building and modifying the design.
1001 415 julius
 
1002
@node ML501 Structure
1003 468 julius
@section Structure
1004 415 julius
 
1005
Note that in this chapter the term @emph{board path} refers to the path in the project for this board port; @code{boards/xilinx/ml501}.
1006
 
1007
The board port's structure is similar to that of a standalone project which accords with the OpenCores coding guidelines. However, all software and RTL that is available in the reference design is also available to the board port, with any local (ie. in the board's @code{rtl} or @code{sw} paths) versions taking precedence over the versions available in the reference design.
1008
 
1009
The Verilog RTL specific to this board is under @code{rtl/verilog} in the board path. The @code{include} path in there is the place where all required definitions files, configuring the RTL, are found.
1010
 
1011
Backend files, mainly binary NGC files for mapping, are found in the board's @code{backend/bin} path.
1012
 
1013 425 julius
@node ML501 XILINX_PATH
1014 468 julius
@subsection ML501 XILINX_PATH
1015 425 julius
 
1016 560 julius
Be sure to set the environment variable @code{XILINX_PATH} to the path of the Xilinx tools' install path on the host machine. This path is usually the base install path for the Xilinx tool suite and contains subdirectories such as @code{ISE/}, @code{common/}, @code{PlanAhead/}, etc.
1017 415 julius
 
1018 560 julius
Most bash-like shells can use the following line to set this environment variable.
1019
 
1020
@example @kbd{export XILINX_PATH=/software/xilinx_12.3} @end example
1021
 
1022
Note that it helps to add the @code{XILINX_PATH} variable to the user's @code{.bashrc} script or similar to save setting it each time a new shell is opened.
1023
 
1024 415 julius
If the @code{XILINX_PATH} variable is not set correctly, the makefiles will not run.
1025
 
1026 530 julius
This build has been tested with ISE versions 11.1 and 12.3.
1027
 
1028 415 julius
@node ML501 Tools
1029 468 julius
@section Tools
1030 415 julius
 
1031
@menu
1032
* Host Tools::
1033
* Target System Tools::
1034
* EDA Tools::
1035
* Debug Tools::
1036
@end menu
1037
 
1038
@node ML501 Host Tools
1039 468 julius
@subsection Host Tools
1040 415 julius
@cindex host tools required ML501
1041
 
1042
Standard development suite of tools: gcc, make, etc.
1043
 
1044
@node ML501 Target System Tools
1045 468 julius
@subsection Target System Tools
1046 415 julius
@cindex target system tools required ML501
1047
 
1048
OpenRISC GNU toolchain. For installation, see OpenRISC GNU toolchain page on OpenCores.org.
1049
 
1050
@node ML501 EDA Tools
1051 468 julius
@subsection EDA Tools
1052 415 julius
@cindex EDA tools required ML501
1053
 
1054
RTL, gatelevel simulation: Mentor Graphics' Modelsim
1055
Synthesis: XST (from Xilinx ISE)
1056
Backend: ngdbuild/map/par/bitgen/promgen, etc. (from Xilinx ISE)
1057
Programming: iMPACT (from Xilinx ISE)
1058
 
1059 439 julius
This has been tested with Xilinx ISE 11.1 under Ubuntu Linux.
1060 415 julius
 
1061
 
1062
@node ML501 Debug Tools
1063 468 julius
@subsection Debug Tools
1064 415 julius
@cindex Debug tools required ML501
1065
 
1066
or_debug_proxy, ORPmon
1067
 
1068
@node ML501 Simulating
1069 468 julius
@section Simulating
1070 415 julius
@cindex simulating ML501
1071
 
1072 530 julius
Ensure the @code{XILINX_PATH} environment variable is set correctly. @xref{ML501 XILINX_PATH} for information.
1073 415 julius
 
1074 425 julius
Note that if this path is not set, simulations will not compile.
1075 415 julius
 
1076 468 julius
@subheading Run RTL Regression Test
1077 415 julius
 
1078
To run the default set of regression tests for the build, run the following command in the board's @code{sw/run} path.
1079
 
1080
@example
1081
@kbd{make rtl-tests}
1082
@end example
1083
 
1084 425 julius
The same set of options for RTL tests available in the reference design should be available in this build. @xref{Running A Set Of Specific Reference Design RTL Tests}.
1085 415 julius
 
1086
Options specific to the ML501 build.
1087
 
1088
@table @code
1089
 
1090
@item PRELOAD_RAM
1091
Set to '1' to enable loading of the software image into RAM at the beginning of simulation.
1092
 
1093
If the chosen bootROM program (set via a define in software header file in the board's @code{sw/board/include} path) will jump straight to RAM to begin execution, then the software image will need to be in RAM for the simulation to work. This define @emph{must} be used in that case for the simulation to do anything.
1094
 
1095
 
1096
@end table
1097
 
1098
 
1099
 
1100
@node ML501 Synthesis
1101 468 julius
@section Synthesis
1102 415 julius
 
1103
Synthesis of the board port for the Actel technology with the Synplify tool can be run in the board's @code{syn/xst/run} path with the following command.
1104
 
1105
@example
1106
@kbd{make all}
1107
@end example
1108
 
1109
This will create an NGC file in @code{syn/xst/run} named @code{orpsoc.ngc}.
1110
 
1111
Hopefully it's all automated enough so that, as long as the design is simulating as desired, the correct set of RTL will be picked up and synthesized without any need for customising scripts for the tool.
1112
 
1113
@node ML501 Synthesis Options
1114 468 julius
@subsection Options
1115 415 julius
 
1116
Use the following command int the @code{syn/xst/run} path to get a list of the variables used during synthesis. Any can be set on the command line when running @code{make all}.
1117
 
1118
@example
1119
@kbd{make print-config}
1120
@end example
1121
 
1122
 
1123
@node ML501 Synthesis Warnings
1124 468 julius
@subsection Checks
1125 415 julius
 
1126
The following is a list of some considerations before synthesis.
1127
 
1128
@itemize @bullet
1129
@item bootrom.v
1130
 
1131
If the bootROM module is being used to provide the processor with a program at startup (reset address in processor's define file is set to @code{0xf0000100} or similar), check that board software include file, in the board's @code{sw/board/include} path, is selecting the correct bootROM program.
1132
 
1133 449 julius
Do a @kbd{make distclean} from the synthesis run directory to be sure that the previous bootROM file is cleared away and regenerated when synthesis is run.
1134 415 julius
 
1135
 
1136
@item Clean away old leftovers
1137
 
1138
If the unwanted files from an old synthesis run are still there before the next run, it's best to clean them away with @kbd{make clean} from the synthesis run directory.
1139
 
1140
 
1141
 
1142
@end itemize
1143
 
1144
@node ML501 Synthesised Netlist
1145 468 julius
@subsection Netlist generation
1146 415 julius
 
1147
To create a Verilog HDL netlist of the post-synthesis design, run the following in the board's @code{syn/xst/run} path.
1148
 
1149
@example
1150
@kbd{make orpsoc.v}
1151
@end example
1152
 
1153
@node ML501 Place and Route
1154 468 julius
@section Place and Route
1155 415 julius
 
1156
Place and route of the design can be run from the board's @code{backend/par/run} path with the following command.
1157
 
1158
@example
1159
@kbd{make orpsoc.ncd}
1160
@end example
1161
 
1162
@node ML501 Timing Report
1163 468 julius
@section Post-PAR STA Report
1164 415 julius
 
1165
The @code{trce} tool can be used to generate a timing report of the post-place and route design.
1166
 
1167
@example
1168
@kbd{make timingreport}
1169
@end example
1170
 
1171
@node ML501 Back-annotated Netlist
1172 468 julius
@section Back-annotated Netlist
1173 415 julius
 
1174
A post-PAR back-annotated netlist can be generated with the following command.
1175
 
1176
@example
1177
@kbd{make netlist}
1178
@end example
1179
 
1180
This will make a new directory under the board's @code{backend/par/run} path named @code{netlist} and will contain a Verilog netlist and SDF file with timing information.
1181
 
1182
 
1183
@node ML501 Place and route options
1184 468 julius
@subsection Options
1185 415 julius
 
1186
To get a list of options that can be set when running the backend flow, run the following in the board's @code{backend/par/run} path.
1187
 
1188
@example
1189
@kbd{make print-config}
1190
@end example
1191
 
1192
@node ML501 Constraints
1193 468 julius
@subsection Constraints
1194 415 julius
 
1195
A Xilinx User Constraints File (UCF) file is in the board's @code{backend/par/bin} path. It is named @code{ml501.ucf}. It should be edited if any extra I/O or constraints are required.
1196
 
1197
Eventually it would be good to dynamically generated this, based on what is included in the design, but for now this must be hand modified if modules are added ore removed from the design.
1198
 
1199
@node ML501 Programming File Generation
1200 468 julius
@section Programming File Generation
1201 415 julius
 
1202
Programming file generation is run from the board's @code{backend/par/run} path with the following command.
1203
 
1204
@example
1205
@kbd{make orpsoc.bit}
1206
@end example
1207
 
1208
This file can then be loaded into the Xilinx iMPACT program and programmed onto the Virtex 5 part on the ML501.
1209
 
1210
@node ML501 SPI programming file
1211 468 julius
@subsection SPI programming file generation
1212 415 julius
 
1213
To generate a file, which can be programmed into the SPI flash on the board (and thus allowing the FPGA to be configured without using iMPACT each time) run the following command in the board's @code{backend/par/run} path.
1214
 
1215
@example
1216
@kbd{make orpsoc.mcs}
1217
@end example
1218
 
1219
@node ML501 SPI programming file with software
1220 468 julius
@subsection SPI programming file generation with software
1221 415 julius
 
1222
To generate a file, which can be programmed into the SPI flash on the board (and thus allowing the FPGA to be configured without using iMPACT each time) and also has a bootloader the processor can run (such as ORPmon) run the following command in the board's @code{backend/par/run} path.
1223
 
1224
@example
1225
@kbd{make orpsoc.mcs BOOTLOADER_BIN=/path/to/bootloader-binary-file.bin}
1226
@end example
1227
 
1228
The image is allowed to be up to 256KBytes in size.
1229
 
1230
As the SPI flash on the ML501 is only 2MBytes in size, and the FPGA configuration image takes up almost 1.5MBytes, the final 256KBytes are reserved for a software image to be loaded at reset by the processor.
1231
 
1232
This mark (the last 256KBytes of memory) is at hex address @code{0x1c0000}. This value is passed to the @code{promgen} tool when creating the @code{.mcs} file, and is set in the board's @code{board.h} file so the embedded bootloader in the design knows which address to load from.
1233
 
1234
If changing the address of the bootloader, to accommodate a larger image for example, be sure to update the address in the @code{board.h} file and set the environment variable @code{SPI_BOOTLOADER_SW_OFFSET_HEX} to the hex address to embed the binary image at (hexadecimal value without the leading ``@code{0x}''.) Note that changing the address to load from in @code{board.h} will require the entire design is re synthesized.
1235
 
1236
The file pointed to by @code{BOOTLOADER_BIN} should be a binary image with the  size of the image embedded in the first word.
1237
 
1238
The tool @code{bin2binsizeword} in ORPSoC's @code{sw/utils} path can add the sizeword to a binary image. A binary image is something created with the processor toolchains @code{objcopy -O binary} option. A tool like ORPmon is a good candidate for being embedded in the SPI flash as bootloader software - a binary image is automatically created when it's compiled, usually named @code{orpmon.or32.bin}. To embed that, it would simply need to be passed to the @code{bin2binsizeword} like the following:
1239
 
1240
@example
1241
@kbd{bin2binsizeword /path/to/orpmon/orpmon.or32.bin orpmon-sizeword.bin}
1242
@end example
1243
 
1244
This @code{orpmon-sizeword.bin} file should then be passed via the BOOTLOADER_BIN option when creating the @code{.mcs} file to embed it.
1245
 
1246
If once the FPGA configuration image, and a bootloader image is embedded in the SPI flash, the FPGA can be configured with ORPSoC and then the processor can load the bootloader (like ORPmon) with a single press of the board's @code{PROG} button. This makes developing on the board very easy.
1247
 
1248
@node ML501 SPI flash programming
1249 468 julius
@subsection SPI flash programming
1250 415 julius
 
1251 542 julius
There are two ways to program the M25P16 2MByte SPI flash from the Xilinx iMPACT tool - @emph{direct} and @emph{indirect}. Direct programming means the Xilinx programmer has a direct connection from its pins to the SPI bus. It then performs SPI accesses on the bus to erase and program the part. Indirect programming involves the FPGA and sets up connections to the SPI via it. Indirect programming may be slower, but it is the only supported method as of ISE 12 onwards.
1252
 
1253
There may be a way of programming directly using the open source @emph{xc3sprog} tool, http://sourceforge.net/projects/xc3sprog/ , but the author is yet to figure out how, and would greatly appreciate anyone who can provide a quick rundown on how this could be achieved.
1254
 
1255
Once programmed, booting from the SPI flash to ORPmon prompt is about 3 to 4 seconds.
1256
 
1257
@node ML501 Direct SPI flash programming
1258
@subsubsection Direct SPI flash programming
1259
 
1260
@emph{Note}: As of ISE 12, direct SPI flash programming is no longer supported. ISE 11 must be used if this method is to be used. Indirect SPI flash programming is the recommended method by Xilinx now. How annoying.
1261
 
1262 415 julius
For a guide on how to actually set up the ML501 board to program the SPI flash, see the section under ``@emph{My Own SPI Flash Image Demonstration}'' on page 26 of the Xilinx UG228 document, http://www.xilinx.com/support/documentation/boards_and_kits/ug228.pdf . Follow steps 1 to 4, and then 9 to 16, and supply the @code{.mcs} file generated here.
1263
 
1264 542 julius
A more general explanation of direct SPI flash programming can be found in XAPP951- http://www.xilinx.com/support/documentation/application\_notes/xapp951.pdf
1265
 
1266 415 julius
Be sure to set the @emph{CONFIG} switches to @code{00010101} (left-to-right when Xilinx logo in North-West of board) before attempting to program the SPI flash. The be sure to switch them back to @code{00000101} before attempting to boot the image.
1267
 
1268 542 julius
@emph{Note}: Direct SPI flash programming will require fly-leads from the Xilinx programming cable to the the board. See page 6 of XAPP1053 for a picture of this for a @emph{different} board, but to get the idea: http://www.xilinx.com/support/documentation/application_notes/xapp1053.pdf .
1269 415 julius
 
1270 479 julius
@emph{Note}: If leaving the SPI programming fly leads in place and attempting to boot the image, be sure to remove the @code{Vref} (@code{VCC3V3} on JP2) connection before attempting to boot. Be sure the configuration DIP SW15 is set back to the @code{00000101} position!
1271 415 julius
 
1272 479 julius
@emph{Note:} The other cable from the programmer (going to the JP1 header) @emph{must} be unplugged from the board before attempting to program the SPI flash.
1273
 
1274 542 julius
@node ML501 Inirect SPI flash programming
1275
@subsubsection Indirect SPI flash programming
1276 479 julius
 
1277 542 julius
The indirect method of programming the SPI flash has the memory show up as an extrnal module off the FPGA when performing an automatic JTAG boundary scan.
1278 415 julius
 
1279 542 julius
The following page has more information about the steps required. http://www.xilinx.com/support/documentation/sw\_manuals/xilinx11/pim\_p\_configure\_spi\_bpi\_through\_fpga.htm The @code{.mcs} file required is the one generated in previous steps in this guide.
1280 415 julius
 
1281 542 julius
@emph{Note:} As we generate the @code{.mcs} file with bit/byte swapping disabled (with the use of the @code{-spi} option when running the promgen tool) we must disable iMPACT's automatic bit/byte swapping when programming the SPI flash. In ISE 12 this option is found by going to the @emph{Edit menu -> Preferences}, and  in the @emph{Configuration Preferences} category, set the @emph{SPI Byte Swap} option to @emph{Ignore Setting}.
1282
 
1283
@emph{Note:} iMPACT from ISE 12 introduced errors in the software image when being programmed. It is advisable that versions of iMPACT from ISEs other than 12 are used until this bug is fixed.
1284
 
1285
 
1286 415 julius
@node ML501 Customising
1287 468 julius
@section Customising
1288 415 julius
 
1289
The large amount of peripherals on the ML501 means that things will want to be added or removed to suit the design.
1290
 
1291
The following sections have information on how to configure the design.
1292
 
1293
@node ML501 Customising Enabling Existing Modules
1294 468 julius
@subsection Enabling Existing RTL Modules
1295 415 julius
 
1296
The design relies on the Verilog HDL @emph{define} function to indicate which modules are included. See the board's @code{rtl/verilog/include/orpsoc-defines.v} file to determine which options are enabled by uncommented @code{`define} values.
1297
 
1298
These @code{`defines} will correspond to defines in the board's top level RTL file @code{boardpath/rtl/verilog/orpsoc_top/orpsoc_top.v}.
1299
 
1300
There are only a few modules included by default.
1301
 
1302
@itemize @bullet
1303
@item Processor - @emph{or1200}
1304
@item Clock and reset generation - @emph{clkgen}
1305
@item Bus arbiters - @emph{arbiter_ibus}, @emph{arbiter_dbus}, @emph{arbiter_bytebus}
1306
@end itemize
1307
 
1308
The rest are optional, depending on what is defined in the board's @code{rtl/verilog/include/orpsoc-defines.v} file.
1309
 
1310
@node ML501 Customising Adding Modules
1311 468 julius
@subsection Adding RTL Modules
1312 415 julius
 
1313
There are a number of steps to take when adding a new module to the design.
1314
 
1315
@itemize @bullet
1316
@item RTL Files
1317
 
1318 564 olof
@itemize @bullet
1319
@item Create a directory under the board's @code{rtl/verilog} directory, and name it the same as the top level of the module.
1320 415 julius
 
1321 564 olof
@emph{or}
1322 415 julius
 
1323 564 olof
Create a directory under the board's @code{modules} directory, containing a @code{rtl/verilog} directory, and name it the same as the top level of the module
1324 415 julius
 
1325 564 olof
@item Ensure the module's top level file and actual name of the module when it will be instantiated are @emph{all the same}.
1326
 
1327
@item Place any include files into the board's @code{rtl/verilog/include} path.
1328
@end itemize
1329 415 julius
@item Instantiate in ORPSoC Top Level File
1330
 
1331
Instantiate the module in the ORPSoC top level file, @code{rtl/verilog/orpsoc_top/orpsoc_top.v}, and be sure to take care of the following.
1332
@itemize @bullet
1333
@item Create appropriate @emph{`define} in @code{orpsoc-defines.v} and surround module instantiation with it.
1334
@item Add required I/Os (surrounded by appropriate @emph{`ifdef })
1335
@item Attach to appropriate bus arbiter, declaring any signals required. Be sure to tie them off if modules is not included.
1336
@item Update appropriate bus arbiter (in board's @code{rtl/verilog/arbiters} path) adding (uncommenting) additional ports as needed.
1337
@item Update board's @code{rtl/verilog/include/orpsoc-params.v} file with appropriate set of parameters for new module, as well as arbiter memory mapping assignment.
1338
@item Attach appropriate clocks and resets, modify the board's @code{rtl/verilog/clkgen/clkgen.v} file generating appropriate clocks if required.
1339
@item Attach any interrupts to the processor's PIC vector in, assigned as the last thing in the file.
1340
@end itemize
1341
 
1342
@item Update ORPSoC Testbench
1343
 
1344
Update the board's @code{bench/verilog/orpsoc_testbench.v} file with appropriate ports (surrounded by appropriate @emph{`ifdef}.)
1345
 
1346
Add any desired models to help test the module to the board's @code{bench/verilog} path and instantiate it correctly in the testbench.
1347
 
1348
@item Add Software Drivers and Tests
1349
 
1350
In a similar fashion to what is already in the board's @code{sw/drivers} and @code{sw/tests} path, create desired driver and test software to be used during simulation (and potentially on target.)
1351
 
1352
@item Update Backend Scripts
1353
 
1354
If any I/O is added, or special timing specified, the board's UCF file will need updating - see @code{boardpath/backend/par/bin/ml501.ucf}.
1355
 
1356
@end itemize
1357
 
1358
@node ML501 Running And Debugging Software
1359 468 julius
@section Running And Debugging Software
1360 415 julius
 
1361
@node ML501 Debug Interface
1362 468 julius
@subsection Debug Interface
1363 415 julius
 
1364
The debug interface uses a separate JTAG tap and some fly-leads must be connected from an @emph{ORSoC USB debugger} (http://opencores.com/shop,item,3) to the ML501.
1365
 
1366
From the USB debugger, a fly lead must take the following signals to the following pins on header J4 on the ML501.
1367
 
1368
@itemize @bullet
1369
@item
1370
tdo - HDR2_6
1371
@item
1372
tdi - HDR2_8
1373
@item
1374
tms - HDR2_10
1375
@item
1376
tck - HDR2_12
1377
@end itemize
1378
 
1379
This corresponds to right-most column of pins on the J4 header, starting on the third row going down.
1380
 
1381
Supply and ground pins must also be hooked up for the USB debugger.
1382
 
1383
The left column of pins on J4 are all tied to ground. All pins on J7 (expansion header located adjacent to J4) are all tied to VCC2V5, 2.5V DC, and this is OK for supplying the buffers on the USB debug cable, and can be used. So essentially put the supply leads anywhere on J7 and ground leads anywhere on the left column of J4.
1384
 
1385
Once the debug interface is connected, the @code{or_debug_proxy} application can be used to provide a stub for GDB to connect to. See http://opencores.org/openrisc,debugging_physical for more information.
1386
 
1387
@node ML501 UART
1388 468 julius
@subsection UART
1389 415 julius
 
1390
There are 2 ways of connecting to the UART in the design.
1391
 
1392
One is via the usual serial port connector, P3, on the ML501. This will obviously require a PC with a serial input and appropriate terminal application.
1393
 
1394
There is also a connection available via the USB debugger mentioned in the previous subsection.
1395
 
1396
The following pins are used for RX/TX to/from the design on header J4.
1397
 
1398
@itemize @bullet
1399
@item
1400
UART RX - HDR2_2
1401
@item
1402
UART TX - HDR2_4
1403
@end itemize
1404
 
1405
Again, supply and ground leads for the UART drivers on the USB debugger can be sourced from J7/left-column J4 as per the debug interface subsection.
1406
 
1407 530 julius
If both UART and debug interface are connected via the ORSoC USB debugger, this ultimately ends up with the first 2 pins on the right column of J4 as RX/TX for the UART then the JTAG TDO, TDI, TMS and TCK in succession down the right column of J4.
1408 415 julius
 
1409
See the ML501 schematic (http://www.xilinx.com/support/documentation/boards_and_kits/ml501_20061010_bw.pdf) for more details on these headers, and refer to the pinouts in the ML501 UCF, in the board's @code{backend/par/bin/ml501.ucf} file.
1410
 
1411 485 julius
 
1412 568 julius
 
1413 468 julius
@c ****************************************************************************
1414 568 julius
@c S3ADSP1800 board build chapter
1415
@c ****************************************************************************
1416
 
1417
@node S3ADSP1800
1418
@chapter S3ADSP1800
1419
@cindex S3ADSP1800 board build information
1420
 
1421
@menu
1422
* Overview::
1423
* Structure::
1424
* Tools::
1425
* Simulating::
1426
* Synthesis and Backend::
1427
* Programming File Generation::
1428
* Customising::
1429
* Running And Debugging Software::
1430
@end menu
1431
 
1432
@node S3ADSP1800 Overview
1433
@section Overview
1434
 
1435
The Xilinx XtremeDSP Starter Platform - Spartan-3A DSP 1800A Edition is known as the s3adsp1800 board in ORPSoC.
1436
 
1437
All information and resources relating to the board were sourced from Xilinx's board portal page:
1438
 
1439
http://www.xilinx.com/products/boards-and-kits/HW-SD1800A-DSP-SB-UNI-G.htm
1440
 
1441
The build currently contains the bare essentials to get the board up and running some software on the OpenRISC processor.
1442
 
1443
The system, at present contains the OpenRISC SoC system running at 25MHz with OR1200, Wishbone B3 arbiters, a Xilinx DDR2 memory controller (125MHz) with Wishbone wrapper and the OpenCores 10/100 Ethernet MAC. Debug capabilities are available via a ORSoC USB debug cable connected to pins on header J8.
1444
 
1445
The S3ADSP1800 build's scripts are capable of generating a programming bitstream, @code{.bit}, file for direct programming of the FPGA via JTAG.
1446
 
1447
@node S3ADSP1800 Structure
1448
@section Structure
1449
 
1450
Note that in this chapter the term @emph{board path} refers to the path in the project for this board port; @code{boards/xilinx/s3adsp1800}.
1451
 
1452
The board port's structure is similar to that of a standalone project which accords with the OpenCores coding guidelines. However, all software and RTL that is available in the reference design is also available to the board port, with any local (ie. in the board's @code{rtl} or @code{sw} paths) versions taking precedence over the versions available in the reference design.
1453
 
1454
The Verilog RTL specific to this board is under @code{rtl/verilog} in the board path. The @code{include} path in there is the place where all required definitions files, configuring the RTL, are found.
1455
 
1456
Backend files, mainly binary NGC files for mapping, are found in the board's @code{backend/bin} path.
1457
 
1458
@node S3ADSP1800 XILINX_PATH
1459
@subsection S3ADSP1800 XILINX_PATH
1460
 
1461
Be sure to set the environment variable @code{XILINX_PATH} to the path of the Xilinx tools' install path on the host machine. This path is usually the base install path for the Xilinx tool suite and contains subdirectories such as @code{ISE/}, @code{common/}, @code{PlanAhead/}, etc.
1462
 
1463
Most bash-like shells can use the following line to set this environment variable.
1464
 
1465
@example @kbd{export XILINX_PATH=/software/xilinx_13.1} @end example
1466
 
1467
Note that it helps to add the @code{XILINX_PATH} variable to the user's @code{.bashrc} script or similar to save setting it each time a new shell is opened.
1468
 
1469
If the @code{XILINX_PATH} variable is not set correctly, the makefiles will not run.
1470
 
1471
This build has been tested with ISE version 13.1
1472
 
1473
Note: At present a variable named @code{XILINX_SETTINGS_SCRIPT} is hardcoded in the board's @code{Makefile.inc} file. This may need to be changed by hand to point to the correct settings32.sh script provided by Xilinx. This should be fixed at some point in the future.
1474
 
1475
@node S3ADSP1800 Tools
1476
@section Tools
1477
 
1478
@menu
1479
* Host Tools::
1480
* Target System Tools::
1481
* EDA Tools::
1482
* Debug Tools::
1483
@end menu
1484
 
1485
@node S3ADSP1800 Host Tools
1486
@subsection Host Tools
1487
@cindex host tools required S3ADSP1800
1488
 
1489
Standard development suite of tools: gcc, make, etc.
1490
 
1491
@node S3ADSP1800 Target System Tools
1492
@subsection Target System Tools
1493
@cindex target system tools required S3ADSP1800
1494
 
1495
OpenRISC GNU toolchain. For installation, see OpenRISC GNU toolchain page on OpenCores.org.
1496
 
1497
@node S3ADSP1800 EDA Tools
1498
@subsection EDA Tools
1499
@cindex EDA tools required S3ADSP1800
1500
 
1501
RTL, gatelevel simulation: Mentor Graphics' Modelsim
1502
Synthesis: XST (from Xilinx ISE)
1503
Backend: ngdbuild/map/par/bitgen/promgen, etc. (from Xilinx ISE)
1504
Programming: iMPACT (from Xilinx ISE)
1505
 
1506
This has been tested with Xilinx ISE 13.1 under Ubuntu 11.04.
1507
 
1508
 
1509
@node S3ADSP1800 Debug Tools
1510
@subsection Debug Tools
1511
@cindex Debug tools required S3ADSP1800
1512
 
1513
or_debug_proxy
1514
 
1515
@node S3ADSP1800 Simulating
1516
@section Simulating
1517
@cindex simulating S3ADSP1800
1518
 
1519
Ensure the @code{XILINX_PATH} environment variable is set correctly. @xref{S3ADSP1800 XILINX_PATH} for information.
1520
 
1521
Note that if this path is not set, simulations will not compile.
1522
 
1523
@subheading Run RTL Regression Test
1524
 
1525
To run the default set of regression tests for the build, run the following command in the board's @code{sw/run} path.
1526
 
1527
@example
1528
@kbd{make rtl-tests}
1529
@end example
1530
 
1531
The same set of options for RTL tests available in the reference design should be available in this build. @xref{Running A Set Of Specific Reference Design RTL Tests}.
1532
 
1533
Note that no OpenCores 10/100 Ethernet MAC (``ethmac'') tests will function correctly for the time being.
1534
 
1535
Options specific to the S3ADSP1800 build.
1536
 
1537
@table @code
1538
 
1539
@item PRELOAD_RAM
1540
Set to '1' to enable loading of the software image into RAM at the beginning of simulation.
1541
 
1542
If the chosen bootROM program (set via a define in software header file in the board's @code{sw/board/include} path) will jump straight to RAM to begin execution, then the software image will need to be in RAM for the simulation to work. This define @emph{must} be used in that case for the simulation to do anything.
1543
 
1544
 
1545
@end table
1546
 
1547
 
1548
 
1549
@node S3ADSP1800 Synthesis
1550
@section Synthesis
1551
 
1552
Synthesis of the board port for the Actel technology with the Synplify tool can be run in the board's @code{syn/xst/run} path with the following command.
1553
 
1554
@example
1555
@kbd{make all}
1556
@end example
1557
 
1558
This will create an NGC file in @code{syn/xst/run} named @code{orpsoc.ngc}.
1559
 
1560
Hopefully it's all automated enough so that, as long as the design is simulating as desired, the correct set of RTL will be picked up and synthesized without any need for customising scripts for the tool.
1561
 
1562
@node S3ADSP1800 Synthesis Options
1563
@subsection Options
1564
 
1565
Use the following command int the @code{syn/xst/run} path to get a list of the variables used during synthesis. Any can be set on the command line when running @code{make all}.
1566
 
1567
@example
1568
@kbd{make print-config}
1569
@end example
1570
 
1571
 
1572
@node S3ADSP1800 Synthesis Warnings
1573
@subsection Checks
1574
 
1575
The following is a list of some considerations before synthesis.
1576
 
1577
@itemize @bullet
1578
@item bootrom.v
1579
 
1580
If the bootROM module is being used to provide the processor with a program at startup (reset address in processor's define file is set to @code{0xf0000100} or similar), check that board software include file, in the board's @code{sw/board/include} path, is selecting the correct bootROM program.
1581
 
1582
Do a @kbd{make distclean} from the synthesis run directory to be sure that the previous bootROM file is cleared away and regenerated when synthesis is run.
1583
 
1584
 
1585
@item Clean away old leftovers
1586
 
1587
If the unwanted files from an old synthesis run are still there before the next run, it's best to clean them away with @kbd{make clean} from the synthesis run directory.
1588
 
1589
 
1590
 
1591
@end itemize
1592
 
1593
@node S3ADSP1800 Synthesised Netlist
1594
@subsection Netlist generation
1595
 
1596
To create a Verilog HDL netlist of the post-synthesis design, run the following in the board's @code{syn/xst/run} path.
1597
 
1598
@example
1599
@kbd{make orpsoc.v}
1600
@end example
1601
 
1602
@node S3ADSP1800 Place and Route
1603
@section Place and Route
1604
 
1605
Place and route of the design can be run from the board's @code{backend/par/run} path with the following command.
1606
 
1607
@example
1608
@kbd{make orpsoc.ncd}
1609
@end example
1610
 
1611
@node S3ADSP1800 Timing Report
1612
@section Post-PAR STA Report
1613
 
1614
The @code{trce} tool can be used to generate a timing report of the post-place and route design.
1615
 
1616
@example
1617
@kbd{make timingreport}
1618
@end example
1619
 
1620
@node S3ADSP1800 Back-annotated Netlist
1621
@section Back-annotated Netlist
1622
 
1623
A post-PAR back-annotated netlist can be generated with the following command.
1624
 
1625
@example
1626
@kbd{make netlist}
1627
@end example
1628
 
1629
This will make a new directory under the board's @code{backend/par/run} path named @code{netlist} and will contain a Verilog netlist and SDF file with timing information.
1630
 
1631
 
1632
@node S3ADSP1800 Place and route options
1633
@subsection Options
1634
 
1635
To get a list of options that can be set when running the backend flow, run the following in the board's @code{backend/par/run} path.
1636
 
1637
@example
1638
@kbd{make print-config}
1639
@end example
1640
 
1641
@node S3ADSP1800 Constraints
1642
@subsection Constraints
1643
 
1644
A Xilinx User Constraints File (UCF) file is in the board's @code{backend/par/bin} path. It is named @code{s3adsp1800.ucf}. It should be edited if any extra I/O or constraints are required.
1645
 
1646
Note that if modules are enabled or disabled via their @code{`define} line in @code{orpsoc-defines.v} and they have I/O declared, then this I/O will need to be manually commented out of the UCF to avoid errors during mapping.
1647
 
1648
@node S3ADSP1800 Programming File Generation
1649
@section Programming File Generation
1650
 
1651
Programming file generation is run from the board's @code{backend/par/run} path with the following command.
1652
 
1653
@example
1654
@kbd{make orpsoc.bit}
1655
@end example
1656
 
1657
This file can then be loaded into the Xilinx iMPACT program and programmed onto the Spartan-3A part on the S3ADSP1800.
1658
 
1659
 
1660
@node S3ADSP1800 SPI flash programming
1661
@subsection SPI flash programming
1662
 
1663
Unfortunately, it is particularly inconvient to program the flash memory that the FPGA can configure itself with at power-on.
1664
 
1665
The iMPACT tool does not contain the appropriate facility to enable this, and a Windows-only tool provided from Avnet.
1666
 
1667
See Avnet's page on this board. http://www.em.avnet.com/spartan3a-dsp and follow the links to ``Support Files & Downloads'' and the file named ``Programming the Intel S33 Flash'' is the guide. The following link may directly work to download the files: http://tinyurl.com/63k8r5c
1668
 
1669
Another way is to load on a Microblaze design and somehow program the flash via the Xilinx GUI tool. This method will not be covered here. The XAPP number of the user guide to do this escapes me right now, but I'm pretty sure you don't want to have to do that.
1670
 
1671
Potentially this flash could be programmed via the SPI core in this board build. This would result in having to flash the FPGA with the s3adsp18000 build image via JTAG first, before downloading SPI programming software with the FPGA configuration embedded in it, to be programmed into the SPI flash. This would probably be easy enough to do but the author did not have enough time to experiment it at the time of writing. Patches to this file's texinfo source describing how this could be done would be greatly appreciated.
1672
 
1673
@node S3ADSP1800 Customising
1674
@section Customising
1675
 
1676
The large amount of peripherals on the S3ADSP1800 means that things will want to be added or removed to suit the design.
1677
 
1678
The following sections have information on how to configure the design.
1679
 
1680
@node S3ADSP1800 Customising Enabling Existing Modules
1681
@subsection Enabling Existing RTL Modules
1682
 
1683
The design relies on the Verilog HDL @emph{define} function to indicate which modules are included. See the board's @code{rtl/verilog/include/orpsoc-defines.v} file to determine which options are enabled by uncommented @code{`define} values.
1684
 
1685
These @code{`defines} will correspond to defines in the board's top level RTL file @code{boardpath/rtl/verilog/orpsoc_top/orpsoc_top.v}.
1686
 
1687
There are only a few modules included by default.
1688
 
1689
@itemize @bullet
1690
@item Processor - @emph{or1200}
1691
@item Clock and reset generation - @emph{clkgen}
1692
@item Bus arbiters - @emph{arbiter_ibus}, @emph{arbiter_dbus}, @emph{arbiter_bytebus}
1693
@end itemize
1694
 
1695
The rest are optional, depending on what is defined in the board's @code{rtl/verilog/include/orpsoc-defines.v} file.
1696
 
1697
@node S3ADSP1800 Customising Adding Modules
1698
@subsection Adding RTL Modules
1699
 
1700
There are a number of steps to take when adding a new module to the design.
1701
 
1702
@itemize @bullet
1703
@item RTL Files
1704
 
1705
@itemize @bullet
1706
@item Create a directory under the board's @code{rtl/verilog} directory, and name it the same as the top level of the module.
1707
 
1708
@emph{or}
1709
 
1710
Create a directory under the board's @code{modules} directory, containing a @code{rtl/verilog} directory, and name it the same as the top level of the module
1711
 
1712
@item Ensure the module's top level file and actual name of the module when it will be instantiated are @emph{all the same}.
1713
 
1714
@item Place any include files into the board's @code{rtl/verilog/include} path.
1715
@end itemize
1716
@item Instantiate in ORPSoC Top Level File
1717
 
1718
Instantiate the module in the ORPSoC top level file, @code{rtl/verilog/orpsoc_top/orpsoc_top.v}, and be sure to take care of the following.
1719
@itemize @bullet
1720
@item Create appropriate @emph{`define} in @code{orpsoc-defines.v} and surround module instantiation with it.
1721
@item Add required I/Os (surrounded by appropriate @emph{`ifdef })
1722
@item Attach to appropriate bus arbiter, declaring any signals required. Be sure to tie them off if modules is not included.
1723
@item Update appropriate bus arbiter (in board's @code{rtl/verilog/arbiters} path) adding (uncommenting) additional ports as needed.
1724
@item Update board's @code{rtl/verilog/include/orpsoc-params.v} file with appropriate set of parameters for new module, as well as arbiter memory mapping assignment.
1725
@item Attach appropriate clocks and resets, modify the board's @code{rtl/verilog/clkgen/clkgen.v} file generating appropriate clocks if required.
1726
@item Attach any interrupts to the processor's PIC vector in, assigned as the last thing in the file.
1727
@end itemize
1728
 
1729
@item Update ORPSoC Testbench
1730
 
1731
Update the board's @code{bench/verilog/orpsoc_testbench.v} file with appropriate ports (surrounded by appropriate @emph{`ifdef}.)
1732
 
1733
Add any desired models to help test the module to the board's @code{bench/verilog} path and instantiate it correctly in the testbench.
1734
 
1735
@item Add Software Drivers and Tests
1736
 
1737
In a similar fashion to what is already in the board's @code{sw/drivers} and @code{sw/tests} path, create desired driver and test software to be used during simulation (and potentially on target.)
1738
 
1739
@item Update Backend Scripts
1740
 
1741
If any I/O is added, or special timing specified, the board's UCF file will need updating - see @code{backend/par/bin/s3adsp1800.ucf}.
1742
 
1743
@end itemize
1744
 
1745
@node S3ADSP1800 Running And Debugging Software
1746
@section Running And Debugging Software
1747
 
1748
This section indicates how to connect a USB JTAG debugger to the board to control the system. At present this setup has only been tested with the ft2232-based ORSoC USB debugger  (http://opencores.com/shop,item,3).
1749
 
1750
 
1751
See the USB debugger documentation and schematics on orsoc.se: http://orsoc.se/usb-jtag-debugger/
1752
 
1753
Find more information about the Spartan 3 board (schematics, user guide, etc.) on the Xilinx site: http://www.xilinx.com/support/documentation/spartan-3a_dsp_board_and_kit_documentation.htm
1754
 
1755
@node S3ADSP1800 Debug Interface
1756
@subsection Debug Interface
1757
 
1758
The debug interface uses a separate JTAG tap and some fly-leads must be connected from an @emph{ORSoC USB debugger} to J8 on the S3ADSP1800.
1759
 
1760
From the USB debugger, a fly lead must take the following signals to the following pins on header J8 on the S3ADSP1800.
1761
 
1762
@itemize @bullet
1763
@item
1764
tdo - D0
1765
@item
1766
tdi - D1
1767
@item
1768
tms - D2
1769
@item
1770
tck - D3
1771
@end itemize
1772
 
1773
Supply and ground pins must also be hooked up for the USB debugger. They can also be found on the J8 header (either V2.5 or V3.3 should work for VCC.)
1774
 
1775
Once the debug interface is connected, the @code{or_debug_proxy} application can be used to provide a stub for GDB to connect to. See http://opencores.org/openrisc,debugging_physical for more information.
1776
 
1777
@node S3ADSP1800 UART
1778
@subsection UART
1779
 
1780
There are 2 ways of connecting to the UART in the design.
1781
 
1782
One is via the DB89 connector, P2. This will obviously require a PC with a serial input and appropriate terminal application.
1783
 
1784
There is also a connection available via the USB debugger mentioned in the previous subsection.
1785
 
1786
The following pins on the J8 are connected to the same UART core as goes to the P2 connector. The two UART RX lines are logically ``AND''ed internally.
1787
 
1788
@itemize @bullet
1789
@item
1790
UART RX - D4
1791
@item
1792
UART TX - D5
1793
@end itemize
1794
 
1795
Again, supply and ground leads for the UART drivers on the USB debugger can be sourced from J8.
1796
 
1797
 
1798
@c ****************************************************************************
1799 485 julius
@c Generic Design build chapter
1800
@c ****************************************************************************
1801
 
1802 492 julius
@node Generic Designs
1803
@chapter Generic Designs
1804 485 julius
@cindex Generic design information
1805
 
1806
@menu
1807
* Overview::
1808
@end menu
1809
 
1810
 
1811
@node Generic Build Overview
1812
@section Overview
1813
 
1814
The paths under @code{boards/generic} contain designs similar to the reference design, in that they are not technology specific, and used for development of certain features of the processor, or peripherals.
1815
 
1816 492 julius
These builds are a TODO, but should provide technology-independent builds, with any specialist modules required to debug, or assist in development or demonstration of a module.
1817 485 julius
 
1818
 
1819
@c ****************************************************************************
1820 468 julius
@c Software section
1821
@c ****************************************************************************
1822 415 julius
 
1823 468 julius
 
1824
@node Software
1825
@chapter Software
1826
 
1827
@cindex software use of @value{ORPSOC}
1828
 
1829
This section details the structure of the software library included in @value{ORPSOC}.
1830
 
1831
@node Software Overview
1832
@section Overview
1833
 
1834
The software provided with ORPSoC is intended to be of sufficient functionality to develop and test the designs, with some additional utility programs for board bring up.
1835
 
1836
The bulk of the software library consists of drivers and tests for the included RTL modules, focusing on the processor. A basic C library, implementing basic support functions such as printf, is included. This alleviates the prerequisite of a compiler with supporting C library installed.
1837
 
1838
Each board port may contain additional software drivers and tests in its own software directory, the structure of which mimics that of the main software directory.
1839
 
1840 530 julius
@node Software Components
1841 468 julius
@section Components
1842
 
1843
This section outlines the different components of the software library in the @code{sw/} path in the root of @value{ORPSOC}.
1844
 
1845
 
1846
@node Software Components Applications
1847
@subsection Applications
1848
 
1849
There are some included applications, which are neither drivers or tests.
1850
 
1851
Typically these will contain a @code{README} file in their directories which contain information on the software and its use.
1852
 
1853
In general, these are to be run on hardware, and thus will need to be compiled for a specific board. Be sure to pass the @code{BOARD} environment variable when compiling to pick up the appropriate board configuration. @xref{Software For Board Ports} for an example.
1854
 
1855
@node Software Components Drivers
1856
@subsection Drivers
1857
 
1858
Each RTL component may have a driver, which will be compiled into the liborpsoc library and be made available to applications and tests that use the library.
1859
 
1860
Each driver path should contain its source and an include path for driver headers.
1861
 
1862
@node Software Components CPU Drivers
1863
@subsection CPU Drivers
1864
 
1865
An attempt has been made to make the interface to basic CPU functions as generic as possible. This can allow different CPUs to be implemented in @value{ORPSOC}.
1866
 
1867
The header file @code{cpu-utils.h} should be included to gain access to the CPU driver functions, such as timers, special purpose registers, memory access macros, etc. This header will, in turn, include the appropriate CPU driver header.
1868
 
1869
@emph{Note:} What is included in the CPU driver, and how it should be interfaced is not documented yet, but in future every effort should be made to ensure a generic interface to CPU functions is used.
1870
 
1871
At present only the OR1200 has a driver, but it is intended that alternate OpenRISC processors can be implemented into ORPSoC and a driver for it to be easily used in the library.
1872
 
1873
The environment variable @code{CPU_DRIVER} is used to specify which driver is the CPU driver to be used at liborpsoc compile time.
1874
 
1875
@node Software Components Tests
1876
@subsection Tests
1877
 
1878
Each test subdirectory contains directories for each target. Usually there's just @code{sim} and @code{board}, the difference between the two being longer run-time and use of UART for board-targeted tests.
1879
 
1880
@emph{Note:} Test directory names should not contain hyphens or underscores. Test software files should be named with the single test directory name first, followed by a single word, eg. @code{or1200-simple.c}.
1881
 
1882
Test names are referenced using this @code{module}-@code{testname} pair. The automated testing mechanism implemented by the Makefile scripts will always search the @code{sim} paths for tests, rather than the @code{board} paths.
1883
 
1884 530 julius
@emph{Note:} There is no automated testing mechanism for the board-targeted software yet. It is anticipated that a testing harness for these will be developed, and we encourage users to help solve this problem.
1885 468 julius
 
1886
@node Software Components Library
1887
@subsection Library
1888
 
1889
The @code{lib} path in the root software directory is where the code for the minimal C library is located, and is the location of the @code{liborpsoc} archive file after its compilation.
1890
 
1891
@node Software Components Board
1892
@subsection Board
1893
 
1894
The @code{board} path in the software directory may, in future, contain other board-specific code, but at present its @code{include} path houses just an important header, @code{board.h} used for configuring the software when compiling programs targeted at a specific board port.
1895
 
1896
This file contains mainly defines of things such as the CPU frequency and timer rate, peripheral base addresses, IRQ numbers, and other board-specific defines. Each board port should contain its own, and is one of the reasons for passing the @code{BOARD} environment variable when compiling software targeted at a specific board port - so its board-specific defines will be used instead of the reference design's.
1897
 
1898
@node Software Components Utilities
1899
@subsection Utilities
1900
 
1901
The @code{utils} path contains tools used to help manipulate binary software images for a variety of purposes. All tools are designed to be run on the host machine, and not on ORPSoC.
1902
 
1903
 
1904
@node Software For Board Ports
1905
@section Software For Board Ports
1906
 
1907
Each board port will have its own software directory, if only to keep its @code{board.h} header file, specifying system parameters specific to the board.
1908
 
1909
It may also contain drivers and tests specific to peripherals for that board.
1910
 
1911
@emph{Note:} For any tests or drivers named the same found in both a board's software path and the root software path, the @emph{board's} software will be used instead.
1912
 
1913 530 julius
@emph{Note:} When compiling any software in the @emph{root} software path (such as in the applications folder) intended to run on a particular board, make use of the @code{BOARD} variable to indicate which board's configuration (@code{board.h} file, and any board-specific drivers) to use. For example:
1914 468 julius
 
1915
@example
1916
@kbd{orpsoc/sw/apps/app1$ make app1.elf BOARD=xilinx/ml501}
1917
@end example
1918
 
1919
It's also advisable to do a @code{make distclean} prior to clear out any preexisting libraries that may not contain software appropriate for the targeted board port (it may have been built with the reference design's @code{board.h}, for example.)
1920
 
1921
 
1922
 
1923 397 julius
@c ****************************************************************************
1924
@c End bits
1925
@c ****************************************************************************
1926
 
1927
@node  GNU Free Documentation License
1928
@chapter GNU Free Documentation License
1929
@cindex license for @value{ORPSOC}
1930
 
1931
@include fdl-1.2.texi
1932
 
1933
@node Index
1934
 
1935
@unnumbered Index
1936
 
1937
@printindex cp
1938
 
1939
@bye
1940
 

powered by: WebSVN 2.1.0

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