1 |
34 |
arniml |
|
2 |
|
|
README for the GCpad core
|
3 |
|
|
=========================
|
4 |
|
|
Version: $Date: 2004-10-28 20:00:12 $
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
Description
|
8 |
|
|
-----------
|
9 |
|
|
|
10 |
|
|
The GCpad core interfaces to the gamepad used with the Nintendo Gamecube video
|
11 |
|
|
gaming system. The core communicates with the gamepad using its proprietary
|
12 |
|
|
communication protocol and offers the retrieved information for further
|
13 |
|
|
processing.
|
14 |
|
|
|
15 |
|
|
To suit the needs of the integrating system, two different flavors of the core
|
16 |
|
|
are available:
|
17 |
|
|
|
18 |
|
|
* For simple applications the basic flavor manages all communication issues
|
19 |
|
|
with the gamepad and provides the current status of the buttons and analog
|
20 |
|
|
axes at its interface. The integrating system does not need to interfere
|
21 |
|
|
with gamepad communication and can statically read the button and axes
|
22 |
|
|
status information.
|
23 |
|
|
|
24 |
|
|
* The full flavor allows full control of the gamepad communication by the
|
25 |
|
|
integrating system. This flavor offers a command and response interface
|
26 |
|
|
which is driven by the system to send arbitrary commands to the
|
27 |
|
|
gamepad. The response of the gamepad is available for further processing.
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
Connecting the Pad
|
31 |
|
|
------------------
|
32 |
|
|
|
33 |
|
|
Information is exchanged between the gamepad and the host side over a single
|
34 |
|
|
wire. Both sides seem to implement an open-collector style output
|
35 |
|
|
driver. Therefore, an external pull-up resistor of 1kOhm to the 3.43V supply
|
36 |
|
|
is required at the DATA line.
|
37 |
|
|
Sticking exactly to the 3.3V supply seems not to be necessary. I use the 3.3V
|
38 |
|
|
supply which is available from the FPGA board. Please note that the 5V supply
|
39 |
|
|
is required for certain controller types even if the rumble motor is not used.
|
40 |
|
|
|
41 |
|
|
The connector seems to be a special type designed for the Gamecube. It might
|
42 |
|
|
be hard to find a matching counterpart. If you do not want to rip up the
|
43 |
|
|
controller cable then your alternative option might be to reuse an extension
|
44 |
|
|
cable. They are quite cheap and pass through all required wires. Just remove
|
45 |
|
|
the connector that is plugged into the console and attach your favorite
|
46 |
|
|
standard connector.
|
47 |
|
|
|
48 |
|
|
See gcpad.png.
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
Verification
|
52 |
|
|
------------
|
53 |
|
|
|
54 |
|
|
The GCpad core comes with a simple testbench that includes a simulation model
|
55 |
|
|
of a Gamecube controller. Serial information is sent to the core and the
|
56 |
|
|
reported button states are compared against the input. Both flavors are tested
|
57 |
|
|
in parallel there.
|
58 |
|
|
You should normally not need to run the testbench. But in case you modified
|
59 |
|
|
the VHDL code the testbench gives some hints if the design has been broken.
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
Directory Structure
|
63 |
|
|
-------------------
|
64 |
|
|
|
65 |
|
|
The core's directory structure follows the proposal of OpenCores.org.
|
66 |
|
|
|
67 |
|
|
gcpad
|
68 |
|
|
|
|
69 |
|
|
\--+-- doc : Integration Manual
|
70 |
|
|
|
|
71 |
|
|
+-- rtl
|
72 |
|
|
| |
|
73 |
|
|
| \-- vhdl : VHDL code containing the RTL description
|
74 |
|
|
| of the core.
|
75 |
|
|
|
|
76 |
|
|
+-- bench
|
77 |
|
|
| |
|
78 |
|
|
| \-- vhdl : VHDL testbench code.
|
79 |
|
|
|
|
80 |
|
|
\-- sim
|
81 |
|
|
|
|
82 |
|
|
\-- rtl_sim : Directory for running simulations.
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
Compiling the VHDL Code
|
86 |
|
|
-----------------------
|
87 |
|
|
|
88 |
|
|
VHDL compilation and simulation tasks take place inside in sim/rtl_sim
|
89 |
|
|
directory. The project setup supports only the GHDL simulator (see
|
90 |
|
|
http://ghdl.free.fr).
|
91 |
|
|
|
92 |
|
|
To compile the code simply type at the shell
|
93 |
|
|
|
94 |
|
|
$ make
|
95 |
|
|
|
96 |
|
|
This should result in a file called tb_behav_c0 which can be executed as any
|
97 |
|
|
other executable.
|
98 |
|
|
|
99 |
|
|
The basic simple sequence list can be found in COMPILE_LIST. This can be
|
100 |
|
|
useful to quickly set up the analyze stage of any compiler or
|
101 |
|
|
synthesizer. Especially when synthesizing the code, you want to skip the VHDL
|
102 |
|
|
configurations in *-c.vhd and everything below the bench/ directory.
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
References
|
106 |
|
|
----------
|
107 |
|
|
|
108 |
|
|
* James' excellent page covering many details of the Gamecube controller
|
109 |
|
|
protocol
|
110 |
|
|
http://www.int03.co.uk/crema/hardware/gamecube/gc-control.htm
|
111 |
|
|
|
112 |
|
|
* Yet Another Gamecube Documentation
|
113 |
|
|
http://www.gc-linux.org/docs/yagcd/index.html
|
114 |
|
|
Refer to section 5.8, 9.1 and 9.2.
|