1 |
8 |
gdevic |
A-Z80
|
2 |
|
|
A conceptual implementation of the Z80 CPU
|
3 |
|
|
------------------------------------------
|
4 |
|
|
for Altera and Xilinx FPGAs
|
5 |
3 |
gdevic |
|
6 |
|
|
This project is described in more details at: www.baltazarstudios.com
|
7 |
|
|
|
8 |
|
|
Prerequisites:
|
9 |
8 |
gdevic |
* Altera Quartus and Modelsim (free web editions) OR
|
10 |
|
|
* Xilinx ISE (free Webpack edition)
|
11 |
|
|
* Python 3.5.x
|
12 |
3 |
gdevic |
|
13 |
|
|
A-Z80 "cpu" consists of several functional blocks and a top-level module:
|
14 |
|
|
alu contains ALU block, ALU control and flags logic
|
15 |
|
|
bus contains data bus switches, pin logic, address latch and the
|
16 |
|
|
address incrementer
|
17 |
|
|
register contains CPU register file and the register control logic
|
18 |
|
|
control contains PLA, the sequencer and other control blocks
|
19 |
|
|
toplevel A-Z80 top level core, interfaces and the test code
|
20 |
|
|
|
21 |
|
|
"host" integrates the A-Z80 into several complete top-level designs:
|
22 |
|
|
"basic" contains a simplified board consisting of A-Z80 CPU, memory
|
23 |
|
|
and UART modules that can run small Z80 programs
|
24 |
|
|
"zxspectrum" contains an implementation of the Sinclair ZX Spectrum
|
25 |
|
|
|
26 |
8 |
gdevic |
You probably want to start by loading one of those designs.
|
27 |
3 |
gdevic |
|
28 |
|
|
"tools" contains various tools related to the project.
|
29 |
|
|
|
30 |
|
|
Read the 'readme.txt' files in each of the folders for additional information.
|
31 |
|
|
Read 'Quick Start' and 'Users Guide' documents in the 'docs' folder.
|
32 |
|
|
|
33 |
|
|
A-Z80 Logic Design
|
34 |
|
|
==================
|
35 |
|
|
Each functional block contains a Quartus project file:
|
36 |
|
|
.//test_.qpf
|
37 |
|
|
|
38 |
|
|
Quartus projects are only used as containers for files within individual
|
39 |
8 |
gdevic |
modules; complete and working top-level solutions that use A-Z80 are in the
|
40 |
|
|
"host" folder.
|
41 |
3 |
gdevic |
|
42 |
|
|
Majority of sub-modules are designed in the Quartus schematic editor and then
|
43 |
8 |
gdevic |
exported to Verilog for simulation and top-level integration. If you decide
|
44 |
|
|
to create a design using the A-Z80 CPU, you can either use schematic files
|
45 |
|
|
(in Altera Quartus) or corresponding Verilog sources (for both Altera
|
46 |
|
|
and Xilinx tools).
|
47 |
3 |
gdevic |
|
48 |
|
|
Simulation
|
49 |
|
|
==========
|
50 |
|
|
Before you can load and simulate any module through Modelsim, you need to set up
|
51 |
8 |
gdevic |
the environment by running a Python script 'modelsim_setup.py'. The script creates
|
52 |
3 |
gdevic |
relative file path mapping to source files in all module project folders.
|
53 |
|
|
|
54 |
|
|
Each functional block, including the top level, contains a Modelsim simulation
|
55 |
|
|
profile: .//simulation/modelsim/test_.mpf
|
56 |
|
|
|
57 |
8 |
gdevic |
After opening a Modelsim session, create a library and compile sources:
|
58 |
3 |
gdevic |
ModelSim> vlib work
|
59 |
8 |
gdevic |
Compile->Compile All
|
60 |
|
|
Run a simulation through one of the defined configurations.
|
61 |
3 |
gdevic |
|
62 |
8 |
gdevic |
If you get a message "Unable to compile", you likely forgot to run 'modelsim_setup.py'.
|
63 |
|
|
Exit ModelSim, git revert changes to ".mpf" file, delete "work" folder and run
|
64 |
|
|
'modelsim_setup.py'. Rinse, repeat.
|
65 |
3 |
gdevic |
|
66 |
8 |
gdevic |
Each project contains a set of predefined waveform scripts which you can
|
67 |
|
|
load before running a simulation:
|
68 |
3 |
gdevic |
.//simulation/modelsim/wave_.do
|
69 |
|
|
|
70 |
|
|
Email me if you have any questions,
|
71 |
|
|
Goran Devic
|
72 |
|
|
gdevic@yahoo.com
|
73 |
|
|
|
74 |
|
|
----------------------------------------------------------------------------------
|
75 |
|
|
This complete project and each file therein is covered under the GNU GPL2.0 license.
|
76 |
|
|
It basically states that anyone is free to use it and distribute it, but the full
|
77 |
|
|
source needs to be available under the same terms:
|
78 |
|
|
|
79 |
|
|
This program is free software; you can redistribute it and/or modify it
|
80 |
|
|
under the terms of the GNU General Public License as published by the Free
|
81 |
|
|
Software Foundation; either version 2 of the License, or (at your option)
|
82 |
|
|
any later version.
|
83 |
|
|
|
84 |
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
85 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
86 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
87 |
|
|
more details.
|
88 |
|
|
|
89 |
|
|
You should have received a copy of the GNU General Public License along
|
90 |
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
91 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|