1 |
100 |
arniml |
|
2 |
|
|
README for the T400 uController project
|
3 |
|
|
=======================================
|
4 |
179 |
arniml |
Version: $Id: README 179 2009-04-01 19:48:38Z arniml $
|
5 |
100 |
arniml |
|
6 |
|
|
|
7 |
|
|
Introduction
|
8 |
|
|
------------
|
9 |
|
|
|
10 |
151 |
arniml |
The T400 µController is an implementation of National's 4-bit COP400
|
11 |
|
|
microcontroller family architecture. It is intended to be used as a
|
12 |
|
|
replacement for the original chip in SOCs recreating legacy systems.
|
13 |
|
|
Its final target is to provide design variants that are compatible with the
|
14 |
|
|
COP420/421 and COP410L/411L family members. All of them derived from the
|
15 |
|
|
common t400_core design.
|
16 |
100 |
arniml |
|
17 |
122 |
arniml |
|
18 |
100 |
arniml |
Download
|
19 |
|
|
--------
|
20 |
|
|
|
21 |
|
|
Download the latest stable release from the project homepage at OpenCores.org:
|
22 |
|
|
|
23 |
|
|
http://www.opencores.org/projects.cgi/web/t400/overview/
|
24 |
|
|
|
25 |
|
|
You can get the latest version of the design files from CVS:
|
26 |
|
|
|
27 |
|
|
http://www.opencores.org/pdownloads.cgi/list/t400
|
28 |
|
|
|
29 |
|
|
Please keep in mind that this is work in progress and might contain smaller or
|
30 |
|
|
bigger problems.
|
31 |
|
|
You should also check the Tracker for known bugs and see if they affect your
|
32 |
|
|
work.
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
Installation
|
36 |
|
|
------------
|
37 |
|
|
|
38 |
|
|
Once the directory structure is generated either by check-out from CVS or by
|
39 |
|
|
unpacking the tar-archive, the central project initialization file should be
|
40 |
|
|
set up. A template called init_project.template.sh is located in the sw
|
41 |
|
|
directory where a copy can be edited. Normally, only the definition for the
|
42 |
|
|
variable PROJECT_DIR has to be adjusted to the path where the directory
|
43 |
|
|
structure is located.
|
44 |
|
|
The commands for setting the necessary variables assume a bash/sh-like
|
45 |
|
|
shell. In case you run a different shell like csh or ksh, you should adjust
|
46 |
|
|
these commands as well.
|
47 |
|
|
|
48 |
|
|
The meaning of the variables is as follows:
|
49 |
|
|
|
50 |
|
|
* PROJECT_DIR
|
51 |
|
|
Points to the root of the project installation. All further references are
|
52 |
|
|
derived from its setting.
|
53 |
|
|
|
54 |
|
|
* MAKEFILES
|
55 |
|
|
Identifies the global Makefile for compilation of tests.
|
56 |
|
|
|
57 |
|
|
These variables must be properly set whenever scripts or makefiles of the T400
|
58 |
|
|
project are executed that are related to verification tasks. Otherwise, you
|
59 |
|
|
will most likely encounter error messages.
|
60 |
|
|
|
61 |
|
|
NOTE: The concepts of the mentioned shells require that the init_project.sh is
|
62 |
|
|
run in the context of the shell. I.e. you should 'source' the script
|
63 |
|
|
instead of executing it like a command. This will make sure that the
|
64 |
|
|
variable settings are really effective in the calling shell instance.
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
Directory Structure
|
68 |
|
|
-------------------
|
69 |
|
|
|
70 |
|
|
The project's directory structure follows the proposal of OpenCores.org.
|
71 |
|
|
|
72 |
|
|
t400
|
73 |
|
|
|
|
74 |
|
|
\--+-- rtl
|
75 |
|
|
| |
|
76 |
122 |
arniml |
| +-- vhdl : VHDL code containing the RTL description
|
77 |
|
|
| | | of the core.
|
78 |
|
|
| | \-- system : RTL VHDL code of sample systems.
|
79 |
|
|
| |
|
80 |
|
|
| \-- tech : Technology specific files.
|
81 |
|
|
| |
|
82 |
|
|
| +-- cyclone : Cyclone technology flavor.
|
83 |
|
|
| |
|
84 |
|
|
| +-- spartan : Spartan technology flavor.
|
85 |
|
|
| |
|
86 |
|
|
| \-- generic : Generic RTL designs.
|
87 |
100 |
arniml |
|
|
88 |
|
|
+-- bench
|
89 |
|
|
| |
|
90 |
|
|
| \-- vhdl : VHDL testbench code.
|
91 |
|
|
|
|
92 |
|
|
+-- sim
|
93 |
|
|
| |
|
94 |
|
|
| \-- rtl_sim : Directory for running simulations.
|
95 |
|
|
|
|
96 |
164 |
arniml |
+-- syn
|
97 |
|
|
| |
|
98 |
165 |
arniml |
| \-- t421 : T421 toplevel example synthesis.
|
99 |
|
|
| |
|
100 |
|
|
| +-- ep1c12 : for Altera Cyclone.
|
101 |
|
|
| |
|
102 |
|
|
| \-- xc3s1000 : for Xilinx Spartan3.
|
103 |
164 |
arniml |
|
|
104 |
100 |
arniml |
\-- sw : General purpose scripts and files.
|
105 |
|
|
|
|
106 |
|
|
\-- verif : The verification suite.
|
107 |
|
|
|
|
108 |
|
|
+-- include : Global includes and makefiles.
|
109 |
|
|
|
|
110 |
|
|
+-- black_box : Black-box verification tests.
|
111 |
|
|
|
|
112 |
122 |
arniml |
+-- int : Interrupt verification tests.
|
113 |
|
|
|
|
114 |
|
|
\-- system : General system level tests.
|
115 |
100 |
arniml |
|
116 |
|
|
|
117 |
|
|
Compiling the VHDL Code
|
118 |
|
|
-----------------------
|
119 |
|
|
|
120 |
|
|
VHDL compilation and simulation tasks take place inside in sim/rtl_sim
|
121 |
|
|
directory. The project setup supports only the batch mode of certain
|
122 |
|
|
simulators. However, there should be no problems to integrate the testbench
|
123 |
|
|
and RTL code into arbitrary simulation environments.
|
124 |
|
|
|
125 |
|
|
The main file for compilation is Makefile which contains all information
|
126 |
|
|
regarding the dependencies of the source files and their compilation
|
127 |
|
|
order.
|
128 |
|
|
|
129 |
|
|
Compilation is based on the make-utility, thus invocation looks like this:
|
130 |
|
|
|
131 |
|
|
$ make
|
132 |
|
|
|
133 |
|
|
This will call ghdl to analzye and elaborate the complete design hierarchy.
|
134 |
|
|
|
135 |
|
|
Tristan Gingold's GHDL simulator/compiler, a VHDL front-end for gcc.
|
136 |
|
|
http://ghdl.free.fr/
|
137 |
|
|
|
138 |
|
|
Make will analyze all VHDL files (RTL and testbench code) and elaborate all
|
139 |
142 |
arniml |
testbench top-levels:
|
140 |
100 |
arniml |
|
141 |
148 |
arniml |
* tb_t410_behav_c0
|
142 |
|
|
Testbench for the T410 derivative.
|
143 |
|
|
It instantiates the T410 system toplevel and is intended to exectue all
|
144 |
|
|
verifcation tests tagged with 't41x'.
|
145 |
|
|
|
146 |
|
|
* tb_t411_behav_c0
|
147 |
100 |
arniml |
Testbench for the T411 derivative.
|
148 |
|
|
It instantiates the T411 system toplevel and is intended to exectue all
|
149 |
|
|
verifcation tests tagged with 't41x'.
|
150 |
|
|
|
151 |
|
|
* tb_t420_behav_c0
|
152 |
|
|
The testbench for the T420 derivative.
|
153 |
|
|
It instantiates the T420 system toplevel and is intended to execute all
|
154 |
142 |
arniml |
verification tests tagged with 't42x' and 't420'.
|
155 |
|
|
|
156 |
|
|
* tb_t421_behav_c0
|
157 |
|
|
The testbench for the T421 derivative.
|
158 |
|
|
It instantiates the T421 system toplevel and is intended to execute all
|
159 |
100 |
arniml |
verification tests tagged with 't42x'.
|
160 |
|
|
|
161 |
|
|
* tb_int_behav_c0
|
162 |
|
|
The testbench for the interrupt verification suite.
|
163 |
|
|
It instantiates the T420 system topevel and is intended to execute all
|
164 |
|
|
verification tests tagged with 'int'.
|
165 |
|
|
|
166 |
122 |
arniml |
* tb_microbus_behav_c0
|
167 |
|
|
The testbench for the microbus verification.
|
168 |
|
|
It instantiates the T420 system toplevel in microbus configuration and is
|
169 |
|
|
intended to execute all verifications tests tagged with 'mb'.
|
170 |
|
|
|
171 |
142 |
arniml |
* tb_prod_behav_c0
|
172 |
|
|
The testbench for the production test.
|
173 |
|
|
It instantiates the T420 system toplevel an checks D and P output ports
|
174 |
|
|
for the patterns generated by the software as proposed in
|
175 |
|
|
"Testing of COP400 Familiy Devices"
|
176 |
|
|
National Semiconductor
|
177 |
|
|
COP Note 7
|
178 |
|
|
April 1991
|
179 |
|
|
|
180 |
100 |
arniml |
The Makefile has a 'clean' target to delete all intermediate data:
|
181 |
|
|
|
182 |
|
|
$ make clean
|
183 |
|
|
|
184 |
|
|
The basic simple sequence list can be found in COMPILE_LIST. This can be
|
185 |
|
|
useful to quickly set up the analyze stage of any compiler or
|
186 |
|
|
synthesizer. Especially when synthesizing the code, you want to skip the VHDL
|
187 |
|
|
configurations in *-c.vhd and everything below the bench/ directory.
|
188 |
|
|
|
189 |
122 |
arniml |
|
190 |
100 |
arniml |
Preparation of the ROM Files
|
191 |
|
|
----------------------------
|
192 |
|
|
|
193 |
|
|
All testbenches listed above load the internal ROM of the controller from a
|
194 |
164 |
arniml |
file in hex-format. Its existance is mandatory since it is referenced in the
|
195 |
100 |
arniml |
VHDL code of the ROM model lpm_rom.vhd. In case it is missing, the
|
196 |
|
|
simulation will stop immediately after elaborating the design.
|
197 |
|
|
|
198 |
|
|
These files are:
|
199 |
|
|
|
200 |
|
|
* rom_41x.hex
|
201 |
|
|
Program ROM compiled for the T41x derivatives. Maximum size 512 bytes.
|
202 |
|
|
Referenced by the t410_notri system.
|
203 |
|
|
Enabled by the 't41x' tag.
|
204 |
|
|
|
205 |
|
|
* rom_42x.hex
|
206 |
|
|
Program ROM compiled for the T42x derivatives. Maximum size 1024 bytes.
|
207 |
|
|
Referenced by the t420_notri system.
|
208 |
142 |
arniml |
Enabled by the 't42x', 't420', 'int', 'mb' and 'prod' tag.
|
209 |
100 |
arniml |
|
210 |
|
|
The verification flow for the T400 project generates these two files
|
211 |
|
|
automatically from the assembler source files. Whenever the make process
|
212 |
|
|
locates one or more of the above tags, it assembles and links the source code
|
213 |
|
|
for the repsective derivative.
|
214 |
|
|
|
215 |
|
|
All regression tests and the general purpose software is organized in a cell
|
216 |
|
|
structure. Currently, this means that the software for a cell is contained in
|
217 |
|
|
a dedicated directory where the assembler run takes place. In the future,
|
218 |
|
|
there will be more aspects to a cell.
|
219 |
|
|
|
220 |
|
|
Assembling, linking and putting the hex-files in place is under the control of
|
221 |
|
|
the make-mechanism. E.g. to assemble the source code of a cell, issue the
|
222 |
|
|
following command:
|
223 |
|
|
|
224 |
|
|
$ make
|
225 |
|
|
|
226 |
|
|
The above mention environment variable MAKEFILES enables execution of the make
|
227 |
|
|
process from within any subdirectory in the verification tree. This generates
|
228 |
|
|
the linker file (test_41x.p and test_42x.p) and derives hex-files which are
|
229 |
|
|
placed into the simulation directory. So most likely, for running a test case
|
230 |
|
|
or any other software, you will want to issue:
|
231 |
|
|
|
232 |
|
|
The only supported assembler is Alfred Arnold's macroassembler AS. See
|
233 |
|
|
|
234 |
|
|
http://john.ccac.rwth-aachen.de:8000/as/
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
Verification Environment
|
238 |
|
|
------------------------
|
239 |
|
|
|
240 |
|
|
The verification environment consists of a number of test programs. They are
|
241 |
|
|
all self-checking. I.e. after testing the targeted functionality, they emit a
|
242 |
|
|
pass/fail information. This information is detected by the testbench which
|
243 |
|
|
stops the simulation and prints out the simulation result. This is the default
|
244 |
|
|
mechanism for stopping the VHDL simulation.
|
245 |
|
|
|
246 |
|
|
Pass/fail is signalled by a certain sequence of the L port contents:
|
247 |
|
|
(R denotes an optional value stored in A when calling the pass or fail
|
248 |
|
|
routines)
|
249 |
|
|
|
250 |
|
|
1) L outputs 0x0R
|
251 |
|
|
2) L outputs 0xaR
|
252 |
|
|
3) L outputs 0x5R
|
253 |
|
|
4) L outputs 0x0R -> Pass
|
254 |
|
|
L outputs 0xfR -> Fail
|
255 |
|
|
|
256 |
|
|
The detection is modelled like a state machine and in case the sequence is of
|
257 |
|
|
bytes inside the accumulator does not match, the detection process restarts
|
258 |
|
|
from the beginning. This mechanism is part of all verification tests except
|
259 |
|
|
for the interrupt testbench.
|
260 |
|
|
|
261 |
|
|
The complete regression suite can be executed with the run_regression.pl
|
262 |
|
|
script. For each test cell, it steps through the sequence
|
263 |
|
|
|
264 |
|
|
1) Assemble the source code
|
265 |
|
|
2) Run the compiled VHDL design (currently only GHDL)
|
266 |
|
|
|
267 |
|
|
It is highly recommended to redirect the output of run_regression.pl into a
|
268 |
|
|
file. Otherwise, analyzing the messages related to each test cell is almost
|
269 |
|
|
impossible.
|
270 |
122 |
arniml |
|
271 |
|
|
|
272 |
|
|
Clocking System
|
273 |
|
|
---------------
|
274 |
|
|
|
275 |
|
|
The main clock is supplied at input ck_i. To ease system integration, ck_i can
|
276 |
|
|
accept integer multiples of the target clock frequency. Input ck_en_i is used
|
277 |
|
|
to qualify rising edges on ck_i as active clock edges. When ck_i is supplied
|
278 |
|
|
with the target frequency, ck_en_i can be kept high constantly.
|
279 |
|
|
|
280 |
|
|
|
281 |
148 |
arniml |
Generic Parameters
|
282 |
|
|
------------------
|
283 |
122 |
arniml |
|
284 |
148 |
arniml |
Most generic parameters are provided to set the numerous I/O options. Thus
|
285 |
|
|
such options are exhibited on the toplevel designs.
|
286 |
|
|
All generics are implemented with integer types to enable analysis of the RTL
|
287 |
|
|
code without tool restrictions. The related constants are defined in
|
288 |
|
|
t400_opt_pack-p.vhd.
|
289 |
|
|
|
290 |
|
|
opt_type_g : Derivative type - T420, T421, T410, T411
|
291 |
|
|
opt_ck_div_g : Internal divider on CK
|
292 |
|
|
opt_cko_g : Enable CKO as general purpose input
|
293 |
|
|
opt_l_out_type_7_g : Output driver type L[7]
|
294 |
|
|
opt_l_out_type_6_g : Output driver type L[6]
|
295 |
|
|
opt_l_out_type_5_g : Output driver type L[5]
|
296 |
|
|
opt_l_out_type_4_g : Output driver type L[4]
|
297 |
|
|
opt_l_out_type_3_g : Output driver type L[3]
|
298 |
|
|
opt_l_out_type_2_g : Output driver type L[2]
|
299 |
|
|
opt_l_out_type_1_g : Output driver type L[1]
|
300 |
|
|
opt_l_out_type_0_g : Output driver type L[0]
|
301 |
|
|
opt_microbus_g : Enable MICROBUS interface
|
302 |
|
|
opt_d_out_type_3_g : Output driver type D[3]
|
303 |
|
|
opt_d_out_type_2_g : Output driver type D[2]
|
304 |
|
|
opt_d_out_type_1_g : Output driver type D[1]
|
305 |
|
|
opt_d_out_type_0_g : Output driver type D[0]
|
306 |
|
|
opt_g_out_type_3_g : Output driver type G[3]
|
307 |
|
|
opt_g_out_type_2_g : Output driver type G[2]
|
308 |
|
|
opt_g_out_type_1_g : Output driver type G[1]
|
309 |
|
|
opt_g_out_type_0_g : Output driver type G[0]
|
310 |
|
|
opt_so_output_type_g : Output driver type SO
|
311 |
|
|
opt_sk_output_type_g : Output driver type SK
|
312 |
|
|
|
313 |
|
|
|
314 |
122 |
arniml |
FPGA Implementation
|
315 |
|
|
-------------------
|
316 |
|
|
|
317 |
|
|
All of the design files contain pure RTL code. This is true even for the
|
318 |
|
|
technology specific power-on reset module. Two flavors exist, each of them
|
319 |
|
|
implementing the desired behavior in a way that is understood by the design
|
320 |
164 |
arniml |
tools. The RAM for the data memory is described by generic RTL code as
|
321 |
122 |
arniml |
well. It should be translated automatically by the tool chain to a technology
|
322 |
|
|
specific RAM macro.
|
323 |
|
|
|
324 |
|
|
There is a generic method for the program memory ROM as well, although this
|
325 |
|
|
project uses a flow where hex-files are loaded by lpm_rom.vhd as the default
|
326 |
|
|
method. Convert the ROM image to an RTL VHDL file with one of the two
|
327 |
|
|
following commands (either from hex or bin format):
|
328 |
|
|
|
329 |
|
|
$ hex2rom -b [rom image file] rom_t41x 9l8s > rom_t41x.vhd
|
330 |
|
|
$ hex2rom -b [rom image file] rom_t42x 10l8s > rom_t42x.vhd
|
331 |
|
|
|
332 |
|
|
The option -b specifies that contains binary data. Skip this
|
333 |
|
|
option to process a file in hex format.
|
334 |
|
|
|
335 |
|
|
These resulting RTL representations are instantiated by t410_rom-struct-a.vhd
|
336 |
|
|
and t420_rom-struct-a.vhd. Altera and Xilinx design tools will detect and
|
337 |
|
|
extract the ROM and turn it into a memory macro.
|