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