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

Subversion Repositories ion

[/] [ion/] [trunk/] [doc/] [src/] [tex/] [hw_demo.tex] - Blame information for rev 220

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

Line No. Rev Author Line
1 210 ja_rd
\chapter{Hardware Demo}
2
\label{hw_demo}
3
 
4
\section{Pre-generated demo}
5
\label{pregenerated_demo}
6
 
7
    The project includes a few synthesizable code samples, including a
8
    'Hello world' demo and a memory tester. Only the 'hello' demo is included
9
    in pre-generated form, the others have to be built using the included
10
    makefiles -- assuming you have a mips toolchain.\\
11
 
12
    'Pre-generated' in this context means that all the vhdl files necessary for
13
    building the demo are already included with the project, and the only
14
    tool needed is the synthesis tool.
15
 
16
    The pregenerated demo is included just for convenience, so that you can
17
    launch some small application on hardware without installing a C toolchain.\\
18
 
19
    A constraints file is provided ('/vhdl/demo/c2sb\_demo.csv') which includes
20
    all the pin constraints for the default target board, in CSV format. This
21
    constraints file is shared by all demos targeted to the DE-1 board.\\
22
 
23
    The default target board is TerasIC's DE-1, with a Cyclone-II FPGA
24
    (EP2C20F484C7). This is the only hardware platform the core has been
25
    tested in, so far.\\
26
 
27
    I have used the free Altera IDE (Altera Quartus II 9.0). This version of
28
    Quartus does not even require a free license file and can be downloaded for
29
    free from the altera web site. But if you have a DE-1 board on hand I guess
30
    you already know that.\\
31
 
32
    I assume you are familiar with Altera tools but anyway this is how to set up
33
    a project using Quartus II:
34
 
35
    \begin{enumerate}
36
        \item Create new project with the new project wizard.
37
            Top entity should be c2sb\_demo.
38
            Suggested path is /syn/altera/(project name).
39
        \item Set target device as EP2C20F484C7.
40
            This choice tells the synth tool what speed grade and chip package
41
            we'll be targetting.
42
        \item 'Next' your way out of the new project wizard.
43
        \item Add to the project all the vhdl files in /vhdl and /vhdl/demo,
44
              except mips\_cache\_stub.vhdl and sdram\_controller.vhdl.
45
        \item Select file c2sb\_demo.vhdl as top.
46
        \item Import pin constraints file (assignments-\textgreater import assignments).
47
        \item Create a clock constraint for signal clk (51 MHz or some other
48
            suitable speed which gives us some minimal slack).
49
        \item In the device settings window, click "Device and pin options...".
50
        \item Select tab "Dual-Purpose pins".
51
        \item Double-click on nCEO value column and select "use as regular I/O".
52
            IMPORTANT: otherwise the synthesis will fail; we need to use a FPGA
53
            pin that happens to be dual-purpose (programming and regular).
54
        \item Select 'balanced' optimization.
55
        \item Save the project and synthesize.
56
        \item Make sure the clock constraint is met (timing analyzer report).
57
            There is a random element to the synthesis process, as you know,
58
            but the core as shipped should pass the constraint.
59
        \item Program the FPGA from Quartus-2
60
        \item If you have a terminal hooked to the serial port (19200/8/N/1) you
61
            should see a welcome message after depressing the reset button.
62
            (by default this is pusbutton 2).
63
 
64
    \end{enumerate}
65
 
66
    In the present version, the synthesis will produce a lot of warnings. The
67
    ugliest are about unused pins and an undeclared clock line. None of them
68
    should be really scary.\\
69
 
70
    Note that none of the on-board goodies are used in the demo except as noted
71
    in section ~\ref{porting_hw_demo} below.\\
72
 
73
    In order to generate the demos (not using the pre-generated file) you
74
    have to use the makefiles provided with the code samples. Please see
75
    the sample readme files and the makefiles for details. In short, provided
76
    you have a MIPS toolchain installed and Python 2.5+, all you have to do
77
    is run make (which will automatically build all the vhdl files where they
78
    need to be, etc.) and run the synthesis.\\
79
 
80
 
81
\section{Porting to other dev boards}
82
\label{porting_hw_demo}
83
 
84
    I will only deal here with the 'hello' demo, the process is the same
85
    for all other samples that don't involve external FLASH.\\
86
 
87
    The 'hello' demo should be easily portable to any board which has all of
88
    this:
89
 
90
    \begin{itemize}
91
    \item An FPGA capable enough (the demo uses internal memory for code)
92
    \item At least 4KB of 16-bit wide external, asynchronous, old-fashioned SRAM
93
    \item A reset pin (possibly a pushbutton)
94
    \item A clock input (uart modules assume 50MHz, see below)
95
    \item RXD and TXD UART pins, plus a connector, header or whatever
96
    \end{itemize}
97
 
98
    The only modules that care at all about clock rate are the UART
99
    modules. They are hardwired to 19200 bauds when clocked at 50MHz, so if you
100
    use a different frequency you must edit the generics in the demo entity
101
    accordingly.\\
102
    Be aware that these uart modules have been used a lot in other projects but
103
    have not been tested with a wide range of clock rates; they should work but
104
    you have been warned.\\
105
 
106
    Though there is no reset control logic, the reset input is synchronized
107
    internally, so you can use a raw pushbutton -- you may trigger multiple
108
    resets if your pushbutton isn't tight but you'll never cause metastability
109
    trouble.\\
110
 
111
    Assuming you take care of all of the above, the easiest way I see to port
112
    the demo is just editing the top module ports ('/vhdl/demo/c2sb\_demo.vhdl')
113
    to match your board setup.\\
114
 
115
    All the code in this project is vendor agnostic (or should be, I have only
116
    tried it on Quartus and ISE). Specifically, it does not instantiate memory
117
    blocks (relying instead on memory inference) or clock managers or buffers.
118
    This has its drawbacks but is an stated goal of the project -- in the long
119
    run it pays, I think, and it certainly makes the porting easier.\\
120
 
121
\section{'Adventure' demo}
122
\label{adventure}
123
 
124
    There is another demo targeting the same hardware as the 'hello' demo above:
125
    a port of 'Adventure'. The C source (included) has been slightly modified
126
    to not use any library functions nor any filesystem (instead uses a built-in
127
    constant string table).\\
128
 
129
    Build steps are the same as for the hello demo (the make target is 'demo').\\
130
 
131
    Since the binary executable is too large to fit internal BRAM, it has to be
132
    executed from the DE-1 onboard flash. You need to write file 'adventure.bin'
133
    to the start of the FLASH using the 'Control Panel' tool that came with your
134
    DE-1 board. That's the only salient difference. That and the amount of SRAM;
135
    The 512KB present on the DE-1 are enough but I don't remember right now
136
    what is the minimum, please look at the map file. This should only matter
137
    if you want to port to another board.\\
138
 
139
    The game will offer you an auto-walkthrough option. Answer 'y' and it will
140
    play itself for about 250 moves, leaving you at an intermediate stage of
141
    the game from which you can play on.\\
142
 
143
    Now, admittedly 'Adventure' is no standard benchmark and even running it to
144
    completion does not guarantee that there are no bugs hidden in the cache or
145
    any of the opcodes.
146
    On the other hand, when you get to the \emph{maze of twisty little passages}
147
    you know you have a computer, finished or not. The 'Adventure' demo is
148
    great as a confidence builder.\\
149
 
150
    Besides, running Adventure on a computer built by myself is something
151
    I just wanted to do :)\\

powered by: WebSVN 2.1.0

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