1 |
3 |
alfik |
### Description
|
2 |
|
|
|
3 |
|
|
The ao486 is an x86 compatible Verilog core implementing all features of a 486 SX.
|
4 |
|
|
The core was modeled and tested based on the Bochs software x86 implementation.
|
5 |
|
|
Together with the 486 core, the ao486 project also contains a SoC capable of
|
6 |
|
|
booting the Linux kernel version 3.13 and Microsoft Windows 95.
|
7 |
|
|
|
8 |
|
|
### Features
|
9 |
|
|
|
10 |
|
|
The ao486 processor model has the following features:
|
11 |
|
|
- pipeline architecture with 4 main stages: decode, read, execute and write,
|
12 |
|
|
- all 486 instructions are implemented, together with CPUID,
|
13 |
|
|
- 16 kB instruction cache,
|
14 |
|
|
- 16 kB write-back data cache,
|
15 |
|
|
- TLB for 32 entries,
|
16 |
|
|
- Altera Avalon interfaces for memory and io access.
|
17 |
|
|
|
18 |
|
|
The ao486 SoC consists of the following components:
|
19 |
|
|
- ao486 processor,
|
20 |
|
|
- IDE hard drive that redirects to a HDL SD card driver,
|
21 |
|
|
- floppy controller that also redirects to the SD card driver,
|
22 |
|
|
- 8259 PIC,
|
23 |
|
|
- 8237 DMA,
|
24 |
|
|
- Sound Blaster 2.0 with DSP and OPL2 (FM synthesis not fully working).
|
25 |
|
|
Sound output redirected to a WM8731 audio codec,
|
26 |
|
|
- 8254 PIT,
|
27 |
|
|
- 8042 keyboard and mouse controller,
|
28 |
|
|
- RTC
|
29 |
|
|
- standard VGA.
|
30 |
|
|
|
31 |
|
|
All components are modeled as Altera Qsys components. Altera Qsys connects all
|
32 |
|
|
parts together, and supplies the SDRAM controller.
|
33 |
|
|
|
34 |
|
|
The ao486 project is currently only running on the Terasic DE2-115 board.
|
35 |
|
|
|
36 |
|
|
### Resource usage
|
37 |
|
|
|
38 |
|
|
The project is synthesised for the Altera Cyclone IV E EP4CE115F29C7 device.
|
39 |
|
|
Resource utilization is as follows:
|
40 |
|
|
|
41 |
|
|
| Unit | Logic cells | M9K memory blocks |
|
42 |
|
|
|--------------------|-------------|-------------------|
|
43 |
|
|
| ao486 processor | 36517 | 47 |
|
44 |
|
|
| floppy | 1514 | 2 |
|
45 |
|
|
| hdd | 2071 | 17 |
|
46 |
|
|
| nios2 | 1056 | 3 |
|
47 |
|
|
| onchip for nios2 | 0 | 32 |
|
48 |
|
|
| pc_dma | 848 | 0 |
|
49 |
|
|
| pic | 388 | 0 |
|
50 |
|
|
| pit | 667 | 0 |
|
51 |
|
|
| ps2 | 742 | 2 |
|
52 |
|
|
| rtc | 783 | 1 |
|
53 |
|
|
| sound | 37131 | 29 |
|
54 |
|
|
| vga | 2534 | 260 |
|
55 |
|
|
|
56 |
|
|
The fitter raport after compiling all components of the ao486 project is as
|
57 |
|
|
follows:
|
58 |
|
|
|
59 |
|
|
```
|
60 |
|
|
Fitter Status : Successful - Sun Mar 30 21:00:13 2014
|
61 |
|
|
Quartus II 64-Bit Version : 13.1.0 Build 162 10/23/2013 SJ Web Edition
|
62 |
|
|
Revision Name : soc
|
63 |
|
|
Top-level Entity Name : soc
|
64 |
|
|
Family : Cyclone IV E
|
65 |
|
|
Device : EP4CE115F29C7
|
66 |
|
|
Timing Models : Final
|
67 |
|
|
Total logic elements : 91,256 / 114,480 ( 80 % )
|
68 |
|
|
Total combinational functions : 86,811 / 114,480 ( 76 % )
|
69 |
|
|
Dedicated logic registers : 26,746 / 114,480 ( 23 % )
|
70 |
|
|
Total registers : 26865
|
71 |
|
|
Total pins : 108 / 529 ( 20 % )
|
72 |
|
|
Total virtual pins : 0
|
73 |
|
|
Total memory bits : 2,993,408 / 3,981,312 ( 75 % )
|
74 |
|
|
Embedded Multiplier 9-bit elements : 44 / 532 ( 8 % )
|
75 |
|
|
Total PLLs : 1 / 4 ( 25 % )
|
76 |
|
|
```
|
77 |
|
|
|
78 |
|
|
The maximum frequency is 39 MHz. The project uses a 30 MHz clock.
|
79 |
|
|
|
80 |
6 |
alfik |
### CPU benchmarks
|
81 |
|
|
|
82 |
|
|
The package DosTests.zip from
|
83 |
|
|
http://www.roylongbottom.org.uk/dhrystone%20results.htm
|
84 |
|
|
was used to benchmark the ao486.
|
85 |
|
|
|
86 |
|
|
| Test | Result |
|
87 |
|
|
-------------------------------------|---------------|
|
88 |
|
|
| Dhryston 1 Benchmark Non-Optimised | 1.00 VAX MIPS |
|
89 |
|
|
| Dhryston 1 Benchmark Optimised | 4.58 VAX MIPS |
|
90 |
|
|
| Dhryston 2 Benchmark Non-Optimised | 1.01 VAX MIPS |
|
91 |
|
|
| Dhryston 2 Benchmark Optimised | 3.84 VAX MIPS |
|
92 |
|
|
|
93 |
|
|
|
94 |
3 |
alfik |
### Running software
|
95 |
|
|
|
96 |
|
|
The ao486 successfuly runs the following software:
|
97 |
|
|
- Microsoft MS-DOS version 6.22,
|
98 |
|
|
- Microsoft Windows for Workgroups 3.11,
|
99 |
|
|
- Microsoft Windows 95,
|
100 |
|
|
- Linux 3.13.1.
|
101 |
|
|
|
102 |
|
|
### BIOS
|
103 |
|
|
|
104 |
|
|
The ao486 project uses the BIOS from the Bochs project
|
105 |
|
|
(http://bochs.sourceforge.net, version 2.6.2). Some minor changes
|
106 |
|
|
were required to support the hard drive.
|
107 |
|
|
|
108 |
|
|
The VGA BIOS is from the VGABIOS project (http://www.nongnu.org/vgabios,
|
109 |
|
|
version 0.7a). No changes were required. The VGA model does not have VBE
|
110 |
|
|
extensions, so the extensions were disabled.
|
111 |
|
|
|
112 |
|
|
### NIOS2 controller
|
113 |
|
|
|
114 |
|
|
The ao486 SoC uses a Altera NIOS2 processor for managing all components and
|
115 |
|
|
displaying the contents of the On Screen Display.
|
116 |
|
|
|
117 |
|
|
The OSD allows the user to insert and remove floppy disks.
|
118 |
|
|
|
119 |
|
|
### License
|
120 |
|
|
|
121 |
|
|
All files in the following directories:
|
122 |
|
|
- rtl,
|
123 |
|
|
- ao486_tool,
|
124 |
|
|
- sim
|
125 |
|
|
|
126 |
|
|
are licensed under the BSD license:
|
127 |
|
|
|
128 |
|
|
All files in the following directories:
|
129 |
|
|
- bochs486,
|
130 |
|
|
- bochsDevs
|
131 |
|
|
|
132 |
|
|
are taken from the Bochs Project and are licensed under the LGPL license.
|
133 |
|
|
|
134 |
|
|
The binary file sd/fd_1_44m/fdboot.img is taken from the FreeDOS project.
|
135 |
|
|
|
136 |
|
|
The binary file sd/bios/bochs_legacy is a compiled BIOS from the Bochs project.
|
137 |
|
|
|
138 |
|
|
The binary file sd/vgabios/vgabios-lgpl is a compiled VGA BIOS from the vgabios
|
139 |
|
|
project.
|
140 |
|
|
|
141 |
|
|
### Compiling
|
142 |
|
|
To compile the SoC, which contains the NIOS II microcontroller, Altera Quartus II software is required.
|
143 |
|
|
The Verilog components of the SoC, in particular the ao486 processor, should be possible to compile
|
144 |
|
|
in any Verilog compiler. Currently synthesis project files are prepared only for Altera Quartus II.
|
145 |
|
|
|
146 |
|
|
NOTE: In the current version some synthesis project files -- especially the paths in those files, could be
|
147 |
|
|
broken.
|
148 |
|
|
|
149 |
|
|
#### ao486 processor
|
150 |
|
|
To compile the ao486 processor load the project file from syn/components/ao486/ao486.qpf.
|
151 |
|
|
|
152 |
|
|
#### SoC
|
153 |
|
|
To compile the ao486 SoC load the project file from syn/soc/soc.qpf.
|
154 |
|
|
|
155 |
5 |
alfik |
Before compiling in Altera Quartus II, the Qsys system must be generated.
|
156 |
|
|
|
157 |
3 |
alfik |
#### BIOS
|
158 |
|
|
To compile the BIOS do the following:
|
159 |
|
|
- extract the bochs-2.6.2 source archive,
|
160 |
|
|
- apply the patch from the directory bios/bochs-2.6.2 by running in the extracted directory:
|
161 |
|
|
patch -p1 < (path to patch file)
|
162 |
|
|
- run ./configure in bochs
|
163 |
|
|
- run make in bochs
|
164 |
|
|
- cd bios
|
165 |
|
|
- make
|
166 |
|
|
- the binary file BIOS-bochs-legacy works with ao486 SoC.
|
167 |
|
|
|
168 |
|
|
#### VGABIOS
|
169 |
|
|
To compile the VGABIOS do the following:
|
170 |
|
|
- extract the vgabios-0.7a source archive,
|
171 |
|
|
- apply the patch form the directory bios/vgabios-0.7a by running in the extracted directory:
|
172 |
|
|
patch -p1 < (path to patch file)
|
173 |
|
|
- run make in vgabios,
|
174 |
|
|
- the binary file VGABIOS-lgpl-latest.bin works with ao486 SoC.
|
175 |
|
|
|
176 |
|
|
### Running the SoC on Terasic DE2-115
|
177 |
|
|
|
178 |
|
|
- compile the soc Altera Quartus II project in syn/soc/soc.qpf
|
179 |
|
|
- compile the firmware for the NIOS II by:
|
180 |
|
|
- opening the Nios II Software Build Tools for Eclipse,
|
181 |
|
|
- creating a workspace in the directory syn/soc/firmware,
|
182 |
|
|
- importing the two projects 'exe' and 'exe_bsp',
|
183 |
|
|
- genrating BSP on the 'exe_bsp' project,
|
184 |
|
|
- compiling the 'exe' project.
|
185 |
5 |
alfik |
- compile the BIOS and copy the binary to the directory sd/bios,
|
186 |
|
|
- compile the VGABIOS and copy the binary to the directory sd/vgabios,
|
187 |
|
|
- compile the ao486_tool by running 'ant jar' in the directory ao486_tool,
|
188 |
3 |
alfik |
- edit the files in the directory sd/hdd. They contain the position of the virtual hard disk located on
|
189 |
|
|
the SD card. The start entry must be a multiplicity of 512. The values are in bytes from the begining
|
190 |
|
|
of the SD card,
|
191 |
|
|
- run 'java -cp ./dist/ao486_tool.jar ao486.SDGenerator' in the directory ao486_tool,
|
192 |
|
|
- copy the file ao486_tool/sd.dat to the first sectors of the SD card by using 'dd if=sd.dat of=/dev/sdXXX'.
|
193 |
5 |
alfik |
- insert the SD card to the Terasic DE2-115 board,
|
194 |
3 |
alfik |
- program the FPGA using the SOF file,
|
195 |
|
|
- load and run the firmware of the NIOS II controller,
|
196 |
|
|
- select the BIOS file on the On Screen Display by using KEY0 for down, KEY1 for up and KEY2 for select,
|
197 |
|
|
- select the VGABIOS file on the OSD,
|
198 |
|
|
- select the hard drive on the OSD,
|
199 |
|
|
- select the floppy on the OSD. Use the KEYs to select the floppy image. Use KEY3 to cancel.
|
200 |
|
|
- after selecting the floppy or pressing cancel, ao486 boots,
|
201 |
|
|
- to activate the OSD press KEY2.
|