1 |
114 |
arniml |
|
2 |
|
|
README for the T48 uController project
|
3 |
|
|
======================================
|
4 |
137 |
arniml |
Version: $Date: 2004-09-16 20:45:12 $
|
5 |
114 |
arniml |
|
6 |
|
|
|
7 |
|
|
Introduction
|
8 |
|
|
------------
|
9 |
|
|
|
10 |
|
|
The T48 µController core an is implementation of the MCS-48 microcontroller
|
11 |
|
|
family architecture. While being a controller core for SoC, it also aims for
|
12 |
|
|
code-compatability and cycle-accuracy so that it can be used as a drop-in
|
13 |
|
|
replacement for any MCS-48 controller.
|
14 |
|
|
It can be configured to better suit the requirements and characteristics of
|
15 |
|
|
the integrating system. On the other hand, nearly the full functionality of a
|
16 |
|
|
stock 8048/8049 is available.
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
Download
|
20 |
|
|
--------
|
21 |
|
|
|
22 |
|
|
Download the latest stable release from the project homepage at OpenCores.org:
|
23 |
|
|
|
24 |
|
|
http://www.opencores.org/projects.cgi/web/t48/overview/
|
25 |
|
|
|
26 |
|
|
You can get the latest version of the design files from CVS:
|
27 |
|
|
|
28 |
|
|
http://www.opencores.org/pdownloads.cgi/list/t48
|
29 |
|
|
|
30 |
|
|
Please keep in mind that this is work in progress and might contain smaller or
|
31 |
|
|
bigger problems.
|
32 |
|
|
You should also check the Tracker for known bugs and see if they affect your
|
33 |
|
|
work.
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
Installation
|
37 |
|
|
------------
|
38 |
|
|
|
39 |
|
|
Once the directory structure is generated either by check-out from CVS or by
|
40 |
|
|
unpacking the tar-archive, the central project initialization file should be
|
41 |
|
|
set up. A template called init_project.template.sh is located in the sw
|
42 |
|
|
directory where a copy can be edited. Normally, only the definition for the
|
43 |
|
|
variable PROJECT_DIR has to be adjusted to the path where the directory
|
44 |
|
|
structure is located.
|
45 |
|
|
The commands for setting the necessary variables assume a bash/sh-like
|
46 |
|
|
shell. In case you run a different shell like csh or ksh, you should adjust
|
47 |
|
|
these commands as well.
|
48 |
|
|
|
49 |
|
|
The meaning of the variables is as follows:
|
50 |
|
|
|
51 |
|
|
* PROJECT_DIR
|
52 |
|
|
Points to the root of the project installation. All further references are
|
53 |
|
|
derived from its setting.
|
54 |
|
|
|
55 |
|
|
* VERIF_DIR
|
56 |
|
|
Location of the verification suite.
|
57 |
|
|
|
58 |
|
|
* SIM_DIR
|
59 |
|
|
Directory for running simulations.
|
60 |
|
|
|
61 |
|
|
These variables must be properly set whenever scripts or makefiles of the T48
|
62 |
|
|
project are executed. Otherwise, you will most likely encounter error
|
63 |
|
|
messages.
|
64 |
|
|
|
65 |
|
|
NOTE: The concepts of the mentioned shells require that the init_project.sh is
|
66 |
|
|
run in the context of the shell. I.e. you should 'source' the script
|
67 |
|
|
instead of executing it like a command. This will make sure that the
|
68 |
|
|
variable settings are really effective in the calling shell instance.
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
Directory Structure
|
72 |
|
|
-------------------
|
73 |
|
|
|
74 |
|
|
The project's directory structure follows the proposal of OpenCores.org.
|
75 |
|
|
|
76 |
|
|
t48
|
77 |
|
|
|
|
78 |
|
|
\--+-- rtl
|
79 |
|
|
| |
|
80 |
|
|
| \-- vhdl : VHDL code containing the RTL description
|
81 |
|
|
| | of the core.
|
82 |
|
|
| \-- system : RTL VHDL code of sample systems.
|
83 |
|
|
|
|
84 |
|
|
+-- bench
|
85 |
|
|
| |
|
86 |
|
|
| \-- vhdl : VHDL testbench code.
|
87 |
|
|
|
|
88 |
|
|
+-- sim
|
89 |
|
|
| |
|
90 |
|
|
| \-- rtl_sim : Directory for running simulations.
|
91 |
|
|
|
|
92 |
|
|
\-- sw : General purpose scripts and files.
|
93 |
|
|
|
|
94 |
|
|
+-- i8039emu : An MCS-48 emulator written in C.
|
95 |
|
|
|
|
96 |
|
|
\-- verif : The verification suite.
|
97 |
|
|
|
|
98 |
|
|
+-- include : Global includes and makefiles.
|
99 |
|
|
|
|
100 |
|
|
+-- black_box : Black-box verification tests.
|
101 |
|
|
|
|
102 |
|
|
+-- white_box : White-box verification tests.
|
103 |
|
|
|
|
104 |
|
|
\-- gp_sw : General purpose software.
|
105 |
115 |
arniml |
|
106 |
|
|
|
107 |
|
|
Compiling the VHDL Code
|
108 |
|
|
-----------------------
|
109 |
|
|
|
110 |
|
|
VHDL compilation and simulation tasks take place inside in sim/rtl_sim
|
111 |
|
|
directory. The project setup supports only the batch mode of certain
|
112 |
|
|
simulators. However, there should be no problems to integrate the testbench
|
113 |
|
|
and RTL code into arbitrary simulation environments.
|
114 |
|
|
|
115 |
|
|
The main file for compilation is Makefile.hier which contains all information
|
116 |
|
|
regarding the dependencies of the source files and their compilation
|
117 |
|
|
order. There is a dedicated file for each supported simulator that maps the
|
118 |
|
|
generic information of Makefile.hier to object files specific to the given
|
119 |
|
|
simulator.
|
120 |
|
|
|
121 |
|
|
Compilation is based on the make-utility, thus invocation looks like this:
|
122 |
|
|
|
123 |
|
|
$ make -f Makefile.
|
124 |
|
|
|
125 |
|
|
where denotes one of the supported simulators:
|
126 |
|
|
|
127 |
|
|
* Makefile.ghdl
|
128 |
|
|
Tristan Gingold's GHDL simulator/compiler, a VHDL front-end for gcc.
|
129 |
|
|
http://ghdl.free.fr/
|
130 |
|
|
|
131 |
|
|
* Makefile.simili
|
132 |
|
|
VHDL Simili, a VHDL simulator by Symphony EDA
|
133 |
|
|
http://www.symphonyeda.com/
|
134 |
|
|
|
135 |
|
|
Make will analyze all VHDL files (RTL and testbench code) and elaborate all
|
136 |
|
|
three testbench top-levels if appropriate for the chosen simulator:
|
137 |
|
|
|
138 |
|
|
* tb_behav_c0
|
139 |
|
|
The main testbench for regression testing.
|
140 |
|
|
Instantiates the plain t48_core and provides internal RAM (256 bytes) and
|
141 |
|
|
ROM (2k bytes) plus 2k bytes of external ROM.
|
142 |
|
|
|
143 |
|
|
* tb_t8048_behav_c0
|
144 |
|
|
The testbench for the t8048 sample system.
|
145 |
|
|
|
146 |
|
|
* tb_t8039_behav_c0
|
147 |
|
|
The testbench for the 8039 sample system.
|
148 |
|
|
|
149 |
137 |
arniml |
Each Makefile has a 'clean' target to delete all intermediate data:
|
150 |
115 |
arniml |
|
151 |
|
|
$ make -f Makefile. clean
|
152 |
|
|
|
153 |
137 |
arniml |
The basic simple sequence list can be found in COMPILE_LIST. This can be
|
154 |
|
|
useful to quickly set up the analyze stage of any compiler or
|
155 |
|
|
synthesizer. Especially when synthesizing the code, you want to skip the VHDL
|
156 |
|
|
configurations in *-c.vhd and everything below the bench/ directory.
|
157 |
115 |
arniml |
|
158 |
|
|
Preparation of the ROM Files
|
159 |
|
|
----------------------------
|
160 |
|
|
|
161 |
|
|
All testbenches listed above need two files in hex-format. They contain the
|
162 |
|
|
program for the T48 core and are loaded into internal and external ROM at
|
163 |
|
|
simulation startup. Their existance is mandatory as they are referenced in the
|
164 |
|
|
VHDL code of the ROM model lpm_rom.vhd. In case they are missing, the
|
165 |
|
|
simulation will stop immediately after elaborating the design.
|
166 |
|
|
|
167 |
|
|
These files are:
|
168 |
|
|
|
169 |
|
|
* t48_rom.hex
|
170 |
|
|
Internal ROM contents at address range 000H to 7FFH.
|
171 |
|
|
Intel hex format, starting at address 000H.
|
172 |
|
|
|
173 |
|
|
* t48_ext_rom.hex
|
174 |
|
|
External ROM contents at address range 800H to FFFH.
|
175 |
|
|
Intel hex format, starting at address 000H.
|
176 |
|
|
|
177 |
|
|
The verification flow for the T48 project generates these two files
|
178 |
|
|
automatically from the assembler source files.
|
179 |
|
|
|
180 |
|
|
All regression tests and the general purpose software is organized in a cell
|
181 |
|
|
structure. Currently, this means that the software for a cell is contained in
|
182 |
|
|
a dedicated directory where the assembler run takes place. In the future,
|
183 |
|
|
there will be more aspects to a cell.
|
184 |
|
|
|
185 |
|
|
Assembling, linking and putting the hex-files in place is under the control of
|
186 |
|
|
the make-mechanism. E.g. to assemble the source code of a cell, issue the
|
187 |
|
|
following command:
|
188 |
|
|
|
189 |
|
|
$ make -f $VERIF_DIR/include/Makefile.cell
|
190 |
|
|
|
191 |
|
|
This generates the linker file (test.p) and distributes its contents to the
|
192 |
|
|
required ROM files for internal and external program ROM. The target 'simu'
|
193 |
|
|
copies these files automatically to the simulation directory. So most likely,
|
194 |
|
|
for running a test case or any other software, you will want to issue:
|
195 |
|
|
|
196 |
|
|
$ make -f VERIF_DIR/include/Makefile.cell simu clean
|
197 |
|
|
|
198 |
|
|
The only supported assembler is Alfred Arnold's macroassembler AS. See
|
199 |
|
|
|
200 |
|
|
http://john.ccac.rwth-aachen.de:8000/as/
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
Verification Environment
|
204 |
|
|
------------------------
|
205 |
|
|
|
206 |
|
|
The verification environment consists of a number of test programs. They are
|
207 |
|
|
all self-checking. I.e. after testing the targeted functionality, they emit a
|
208 |
|
|
pass/fail information. This information is detected by the testbench which
|
209 |
|
|
stops the simulation and prints out the simulation result. This is the default
|
210 |
|
|
mechanism for stopping the VHDL simulation.
|
211 |
|
|
|
212 |
|
|
Pass/fail is signalled by a certain sequence of the accumulator contents:
|
213 |
|
|
|
214 |
|
|
1) Accumulator contains AAH
|
215 |
|
|
2) Accumulator contains 55H
|
216 |
|
|
3) Accumulator contains 01H -> Pass
|
217 |
|
|
Accumulator contains 00H -> Fail
|
218 |
|
|
|
219 |
|
|
The detection is modelled like a state machine and in case the sequence is of
|
220 |
|
|
bytes inside the accumulator does not match, the detection process restarts
|
221 |
|
|
from the beginning. This mechanism is part of all verification tests.
|
222 |
|
|
|
223 |
|
|
The complete regression suite can be executed with the run_regression.pl
|
224 |
|
|
script. For each test cell, it steps through the sequence
|
225 |
|
|
|
226 |
|
|
1) Assemble the source code
|
227 |
|
|
2) Run the compiled VHDL design (currently only GHDL)
|
228 |
|
|
3) Optionally perform a dump compare against the C-model
|
229 |
|
|
|
230 |
|
|
It is highly recommended to redirect the output of run_regression.pl into a
|
231 |
|
|
file. Otherwise, analyzing the messages related to each test cell is almost
|
232 |
|
|
impossible.
|