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