SAIFIINDUSTRIES commited on
Commit
ed7714b
·
verified ·
1 Parent(s): df0a64a

Add batch 10 (abdelazeem201_Systolic-array-implementation-in-RTL-for-TPU, MiSTer-devel_ao486_MiSTer, pulp-platform_cheshire, WangXuan95_FPGA-ftdi245fifo, wuxx_Colorlight-FPGA-Projects)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +69 -0
  2. MiSTer-devel_ao486_MiSTer/.gitignore +40 -0
  3. MiSTer-devel_ao486_MiSTer/LICENSE +47 -0
  4. MiSTer-devel_ao486_MiSTer/README.md +119 -0
  5. MiSTer-devel_ao486_MiSTer/ao486.qpf +2 -0
  6. MiSTer-devel_ao486_MiSTer/ao486.qsf +70 -0
  7. MiSTer-devel_ao486_MiSTer/ao486.sdc +26 -0
  8. MiSTer-devel_ao486_MiSTer/ao486.srf +25 -0
  9. MiSTer-devel_ao486_MiSTer/ao486.sv +1048 -0
  10. MiSTer-devel_ao486_MiSTer/clean.bat +36 -0
  11. MiSTer-devel_ao486_MiSTer/clean.sh +35 -0
  12. MiSTer-devel_ao486_MiSTer/files.qip +24 -0
  13. MiSTer-devel_ao486_MiSTer/releases/ao486_20170803.rbf +3 -0
  14. MiSTer-devel_ao486_MiSTer/releases/ao486_20170805.rbf +3 -0
  15. MiSTer-devel_ao486_MiSTer/releases/ao486_20170806.rbf +3 -0
  16. MiSTer-devel_ao486_MiSTer/releases/ao486_20170813.rbf +3 -0
  17. MiSTer-devel_ao486_MiSTer/releases/ao486_20170818.rbf +3 -0
  18. MiSTer-devel_ao486_MiSTer/releases/ao486_20170821.rbf +3 -0
  19. MiSTer-devel_ao486_MiSTer/releases/ao486_20170824.rbf +3 -0
  20. MiSTer-devel_ao486_MiSTer/releases/ao486_20180101.rbf +3 -0
  21. MiSTer-devel_ao486_MiSTer/releases/ao486_20180123.rbf +3 -0
  22. MiSTer-devel_ao486_MiSTer/releases/ao486_20180304.rbf +3 -0
  23. MiSTer-devel_ao486_MiSTer/releases/ao486_20180407.rbf +3 -0
  24. MiSTer-devel_ao486_MiSTer/releases/ao486_20180410.rbf +3 -0
  25. MiSTer-devel_ao486_MiSTer/releases/ao486_20180426.rbf +3 -0
  26. MiSTer-devel_ao486_MiSTer/releases/ao486_20180617.rbf +3 -0
  27. MiSTer-devel_ao486_MiSTer/releases/ao486_20181215.rbf +3 -0
  28. MiSTer-devel_ao486_MiSTer/releases/ao486_20190117.rbf +3 -0
  29. MiSTer-devel_ao486_MiSTer/releases/ao486_20190227.rbf +3 -0
  30. MiSTer-devel_ao486_MiSTer/releases/ao486_20190308.rbf +3 -0
  31. MiSTer-devel_ao486_MiSTer/releases/ao486_20190425.rbf +3 -0
  32. MiSTer-devel_ao486_MiSTer/releases/ao486_20190719.rbf +3 -0
  33. MiSTer-devel_ao486_MiSTer/releases/ao486_20190927.rbf +3 -0
  34. MiSTer-devel_ao486_MiSTer/releases/ao486_20191221.rbf +3 -0
  35. MiSTer-devel_ao486_MiSTer/releases/ao486_20200421.rbf +3 -0
  36. MiSTer-devel_ao486_MiSTer/releases/ao486_20200510.rbf +3 -0
  37. MiSTer-devel_ao486_MiSTer/releases/ao486_20200814.rbf +3 -0
  38. MiSTer-devel_ao486_MiSTer/releases/ao486_20200816.rbf +3 -0
  39. MiSTer-devel_ao486_MiSTer/releases/ao486_20200822.rbf +3 -0
  40. MiSTer-devel_ao486_MiSTer/releases/ao486_20200831.rbf +3 -0
  41. MiSTer-devel_ao486_MiSTer/releases/ao486_20200907.rbf +3 -0
  42. MiSTer-devel_ao486_MiSTer/releases/ao486_20200917.rbf +3 -0
  43. MiSTer-devel_ao486_MiSTer/releases/ao486_20200922.rbf +3 -0
  44. MiSTer-devel_ao486_MiSTer/releases/ao486_20201101.rbf +3 -0
  45. MiSTer-devel_ao486_MiSTer/releases/ao486_20201106.rbf +3 -0
  46. MiSTer-devel_ao486_MiSTer/releases/ao486_20210103.rbf +3 -0
  47. MiSTer-devel_ao486_MiSTer/releases/ao486_20210107.rbf +3 -0
  48. MiSTer-devel_ao486_MiSTer/releases/ao486_20210109.rbf +3 -0
  49. MiSTer-devel_ao486_MiSTer/releases/ao486_20210117.rbf +3 -0
  50. MiSTer-devel_ao486_MiSTer/releases/ao486_20210226.rbf +3 -0
.gitattributes CHANGED
@@ -854,3 +854,72 @@ suisuisi_FPGAandCNN/DigitalRecognition/verilog/imp/incremental_db/compiled_parti
854
  suisuisi_FPGAandCNN/DigitalRecognition/verilog/imp/output_file.jic filter=lfs diff=lfs merge=lfs -text
855
  suisuisi_FPGAandCNN/DigitalRecognition/verilog/imp/output_files/cam_proj.pof filter=lfs diff=lfs merge=lfs -text
856
  suisuisi_FPGAandCNN/DnnKernelHLS/learning/mnist_dataset/mnist_dataset/train-images-idx3-ubyte/train-images.idx3-ubyte filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
854
  suisuisi_FPGAandCNN/DigitalRecognition/verilog/imp/output_file.jic filter=lfs diff=lfs merge=lfs -text
855
  suisuisi_FPGAandCNN/DigitalRecognition/verilog/imp/output_files/cam_proj.pof filter=lfs diff=lfs merge=lfs -text
856
  suisuisi_FPGAandCNN/DnnKernelHLS/learning/mnist_dataset/mnist_dataset/train-images-idx3-ubyte/train-images.idx3-ubyte filter=lfs diff=lfs merge=lfs -text
857
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20170803.rbf filter=lfs diff=lfs merge=lfs -text
858
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20170805.rbf filter=lfs diff=lfs merge=lfs -text
859
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20170806.rbf filter=lfs diff=lfs merge=lfs -text
860
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20170813.rbf filter=lfs diff=lfs merge=lfs -text
861
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20170818.rbf filter=lfs diff=lfs merge=lfs -text
862
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20170821.rbf filter=lfs diff=lfs merge=lfs -text
863
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20170824.rbf filter=lfs diff=lfs merge=lfs -text
864
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20180101.rbf filter=lfs diff=lfs merge=lfs -text
865
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20180123.rbf filter=lfs diff=lfs merge=lfs -text
866
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20180304.rbf filter=lfs diff=lfs merge=lfs -text
867
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20180407.rbf filter=lfs diff=lfs merge=lfs -text
868
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20180410.rbf filter=lfs diff=lfs merge=lfs -text
869
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20180426.rbf filter=lfs diff=lfs merge=lfs -text
870
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20180617.rbf filter=lfs diff=lfs merge=lfs -text
871
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20181215.rbf filter=lfs diff=lfs merge=lfs -text
872
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20190117.rbf filter=lfs diff=lfs merge=lfs -text
873
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20190227.rbf filter=lfs diff=lfs merge=lfs -text
874
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20190308.rbf filter=lfs diff=lfs merge=lfs -text
875
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20190425.rbf filter=lfs diff=lfs merge=lfs -text
876
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20190719.rbf filter=lfs diff=lfs merge=lfs -text
877
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20190927.rbf filter=lfs diff=lfs merge=lfs -text
878
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20191221.rbf filter=lfs diff=lfs merge=lfs -text
879
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200421.rbf filter=lfs diff=lfs merge=lfs -text
880
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200510.rbf filter=lfs diff=lfs merge=lfs -text
881
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200814.rbf filter=lfs diff=lfs merge=lfs -text
882
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200816.rbf filter=lfs diff=lfs merge=lfs -text
883
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200822.rbf filter=lfs diff=lfs merge=lfs -text
884
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200831.rbf filter=lfs diff=lfs merge=lfs -text
885
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200907.rbf filter=lfs diff=lfs merge=lfs -text
886
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200917.rbf filter=lfs diff=lfs merge=lfs -text
887
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20200922.rbf filter=lfs diff=lfs merge=lfs -text
888
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20201101.rbf filter=lfs diff=lfs merge=lfs -text
889
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20201106.rbf filter=lfs diff=lfs merge=lfs -text
890
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20210103.rbf filter=lfs diff=lfs merge=lfs -text
891
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20210107.rbf filter=lfs diff=lfs merge=lfs -text
892
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20210109.rbf filter=lfs diff=lfs merge=lfs -text
893
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20210117.rbf filter=lfs diff=lfs merge=lfs -text
894
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20210226.rbf filter=lfs diff=lfs merge=lfs -text
895
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20210324.rbf filter=lfs diff=lfs merge=lfs -text
896
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20210329.rbf filter=lfs diff=lfs merge=lfs -text
897
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20210630.rbf filter=lfs diff=lfs merge=lfs -text
898
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20211010.rbf filter=lfs diff=lfs merge=lfs -text
899
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20220211.rbf filter=lfs diff=lfs merge=lfs -text
900
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20220224.rbf filter=lfs diff=lfs merge=lfs -text
901
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20220226.rbf filter=lfs diff=lfs merge=lfs -text
902
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20220301.rbf filter=lfs diff=lfs merge=lfs -text
903
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20220326.rbf filter=lfs diff=lfs merge=lfs -text
904
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20220914.rbf filter=lfs diff=lfs merge=lfs -text
905
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20221217.rbf filter=lfs diff=lfs merge=lfs -text
906
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20230816.rbf filter=lfs diff=lfs merge=lfs -text
907
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20230818.rbf filter=lfs diff=lfs merge=lfs -text
908
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20230922.rbf filter=lfs diff=lfs merge=lfs -text
909
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20231204.rbf filter=lfs diff=lfs merge=lfs -text
910
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20240409.rbf filter=lfs diff=lfs merge=lfs -text
911
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20240524.rbf filter=lfs diff=lfs merge=lfs -text
912
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20240528.rbf filter=lfs diff=lfs merge=lfs -text
913
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20240616.rbf filter=lfs diff=lfs merge=lfs -text
914
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20241227.rbf filter=lfs diff=lfs merge=lfs -text
915
+ MiSTer-devel_ao486_MiSTer/releases/ao486_20260603.rbf filter=lfs diff=lfs merge=lfs -text
916
+ MiSTer-devel_ao486_MiSTer/sim/modelsim/cpu/lua_tests/FASM.EXE filter=lfs diff=lfs merge=lfs -text
917
+ abdelazeem201_Systolic-array-implementation-in-RTL-for-TPU/Pics/Capture.PNG filter=lfs diff=lfs merge=lfs -text
918
+ abdelazeem201_Systolic-array-implementation-in-RTL-for-TPU/pnr/.tmp.itf2TLU.oldattach filter=lfs diff=lfs merge=lfs -text
919
+ abdelazeem201_Systolic-array-implementation-in-RTL-for-TPU/pnr/output/tpu_top.sdc filter=lfs diff=lfs merge=lfs -text
920
+ abdelazeem201_Systolic-array-implementation-in-RTL-for-TPU/pnr/pna_output/tpu_top.VDD.pw_hl.pna filter=lfs diff=lfs merge=lfs -text
921
+ abdelazeem201_Systolic-array-implementation-in-RTL-for-TPU/pnr/pna_output/tpu_top.VSS.pw_hl.pna filter=lfs diff=lfs merge=lfs -text
922
+ abdelazeem201_Systolic-array-implementation-in-RTL-for-TPU/syn/output/tpu_top.ddc filter=lfs diff=lfs merge=lfs -text
923
+ wuxx_Colorlight-FPGA-Projects/doc/E_ETRON_EM_EM638325BK.PDF filter=lfs diff=lfs merge=lfs -text
924
+ wuxx_Colorlight-FPGA-Projects/tools/ujprog.bit2svf.arm filter=lfs diff=lfs merge=lfs -text
925
+ wuxx_Colorlight-FPGA-Projects/tools/ujprog.bit2svf.x64 filter=lfs diff=lfs merge=lfs -text
MiSTer-devel_ao486_MiSTer/.gitignore ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ db
2
+ greybox_tmp
3
+ incremental_db
4
+ output_files
5
+ simulation
6
+ hc_output
7
+ scaler
8
+ hps_isw_handoff
9
+ vip
10
+ system
11
+ *_sim
12
+ .qsys_edit
13
+ PLLJ_PLLSPE_INFO.txt
14
+ *.bak
15
+ *.orig
16
+ *.rej
17
+ *.qdf
18
+ *.rpt
19
+ *.smsg
20
+ *.summary
21
+ *.done
22
+ *.jdi
23
+ *.pin
24
+ *.sof
25
+ *.qws
26
+ *.ppf
27
+ *.ddb
28
+ build_id.v
29
+ c5_pin_model_dump.txt
30
+ *.sopcinfo
31
+ *.csv
32
+ *.f
33
+ *.cmp
34
+ *.sip
35
+ *.spd
36
+ *.bsf
37
+ *~
38
+ *.xml
39
+ *_netlist
40
+ *.cdf
MiSTer-devel_ao486_MiSTer/LICENSE ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ All files in the following directories:
2
+ - rtl
3
+ - ao486_tool
4
+ - sim
5
+ are licensed under the BSD license:
6
+
7
+ --------------------------------------------------------------------------------
8
+
9
+ Copyright (c) 2014, Aleksander Osman
10
+ All rights reserved.
11
+
12
+ Redistribution and use in source and binary forms, with or without
13
+ modification, are permitted provided that the following conditions are met:
14
+
15
+ * Redistributions of source code must retain the above copyright notice, this
16
+ list of conditions and the following disclaimer.
17
+
18
+ * Redistributions in binary form must reproduce the above copyright notice,
19
+ this list of conditions and the following disclaimer in the documentation
20
+ and/or other materials provided with the distribution.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+
33
+ --------------------------------------------------------------------------------
34
+
35
+ All files in the following directories:
36
+ - bochs486
37
+ - bochsDevs
38
+ are taken from the Bochs Project and are licensed under the LGPL license.
39
+
40
+ --------------------------------------------------------------------------------
41
+
42
+ The binary file sd/fd_1_44m/fdboot.img is taken from the FreeDOS project.
43
+
44
+ The binary file sd/bios/bochs_legacy is a compiled BIOS from the Bochs project.
45
+
46
+ The binary file sd/vgabios/vgabios-lgpl is a compiled VGA BIOS from the vgabios
47
+ project.
MiSTer-devel_ao486_MiSTer/README.md ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ao486 port for MiSTer by Sorgelig.
2
+
3
+ MiSTer port of the ao486 core originally written by Aleksander Osman, which has been greatly reworked with many new features and performance added.
4
+
5
+ Original Core [repository](https://github.com/alfikpl/ao486)
6
+
7
+ ## Features:
8
+ * 486SX33 performance (no-FPU).
9
+ * 256MB RAM
10
+ * SVGA with up to 1280x1024@256, 1024x768@64K, 640x480@16M resolutions
11
+ * Sound Blaster 16 (DSP v4.05) and Sound Blaster Pro (DSP v3.02) with OPL3 and C/MS
12
+ * High speed UART (3Mbps) internet connection
13
+ * MIDI port (dumb and fake-smart modes)
14
+ * External MIDI device support (MT32-pi and generic MIDI)
15
+ * 4 HDDs with up to 137GB each
16
+ * 2 CD-ROMs
17
+ * Shared folder support
18
+
19
+ ## How to install
20
+
21
+ * Copy ao486.rbf to the _Computer folder on your SD card. This will be automatically copied there if you are using the update script.
22
+ * Create games/ao486/ directory on SD card and copy [boot0.rom](https://github.com/MiSTer-devel/ao486_MiSTer/blob/master/releases/boot0.rom), [boot1.rom](https://github.com/MiSTer-devel/ao486_MiSTer/blob/master/releases/boot1.rom) there.
23
+ * For CD images, the typical location is games/ao486/cd/ and you can either have the game folders, or CHD, IMG, ISO, BIN/CUE files in the root for mounting. The imgset command can be used in DOS to mount/unmount images placed here by passing the exact path.
24
+ * For floppy: copy desired floppy raw image with extension **img** to games/ao486/floppy/ directory. The imgset command can be used in DOS to mount/unmount images placed here by passing the exact path.
25
+ * For HDD: create an empty file of desired size with extension **vhd** in ao486 directory (or prepare .vhd file separately with any tool supporting .vhd or hard disk .img files and copy to games/ao486/ folder)
26
+ * Boot ao486 and in OSD choose desired floppy, hdd, cd, and boot order. A valid DOS or supported OS boot is required for the core to boot an OS. Typical use cases: DOS Install disks on floppy with a clean VHD mounted for HDD. Pre-configured VHDs with OS and programs, Boot CDs, etc.
27
+ * Save settings and press "Reset and apply HDD"
28
+ * Optional shared folder can be used in conjuction with [MisterFS.exe](https://github.com/MiSTer-devel/ao486_MiSTer/blob/master/releases/drv/misterfs.exe) running as a TSR in your DOS image to exchange files between games/ao486/shared from inside DOS.
29
+
30
+ HDD image is a raw image with MBR. It can be opened in Windows/Linux by many applications,
31
+ so it's possible to prepare a HDD in windows/linux (in most cases you need to work with .img files, then just rename it to .vhd extension)
32
+
33
+ ### Core Speed and Options and Drivers
34
+ The default core speed is set to 90Mhz with both L1 and L2 caches enabled. This will give you the maximum speed for the release version of ao486. Some games, especially older games, are sensitive to speed and cache so you can change the speed options and cache to fit the game.
35
+ Optionally you can use the sysctl.exe program to automatically change these settings before launching your game. This is especially useful for batch scripts where you want to change those options and then set it back after the game exits.
36
+
37
+ Core options under Hardware:
38
+ * CPU Clock: 15MHz, 30Mhz, 56MHz, 90Mhz (90MHz)
39
+ * L1 Cache: On, Off (On)
40
+ * L2 Cache: On, Off (On)
41
+ * RAM Size: 256MB, 16MB (256MB)
42
+
43
+ Optional programs and drivers: https://github.com/MiSTer-devel/ao486_MiSTer/tree/master/releases/drv
44
+ * MISTERFB.DRV/INF: Windows Video Driver
45
+ * imgset.exe: Used for mounting fdd, cd, and ide drives. Run 'imgset' for options.
46
+ * misterfs.exe: You will need to copy this file to a VHD and run it using, "misterfs LETTER" where letter is the drive letter you want to mount the shared folder to. Create a /games/ao486/shared folder and copy files named to the 8.3 filename standard (SFN - short filename). This allows for file copy from the shared folder and accessable from within dos on a mounted drive. The tool is basic so it should be mainly used for file copy and not for running programs.
47
+ * modem9x.inf: Used for Windows modem setup.
48
+ * mpuctl.exe: tool for sending commands to the optional mt32-pi baremetal synth. See reference below.
49
+ * sbctl.exe: set Sound Blaster configs. Supported: I5,I7,I10,H5,H1,T4,T6
50
+ * sysctl.exe: Used for setting core options and cache referenced above from command line. Usase: SYSCTL SYS/MENU 90Mhz/56Mhz/15Mhz L1+/L1- L2+/L2-
51
+
52
+ ### Gravis UltraSound
53
+ Default config: baseport=240, IRQ1=7, IRQ2=7, DMA1=7, DMA2=7. (SET ULTRASND=240,7,7,7,7)
54
+ If you changed(sbctl.exe tool) SB IRQ to 7, GUS IRQ1&2 changed to 5.
55
+ Supported GUS 1MB DRAM(required SDRAM module). Any CPU frequency, except 15MHz(too slow).
56
+
57
+ ### Sound Blaster
58
+ Default config: A220 I5 D1 H5 T6
59
+ Supported alternative configs with IRQ 7 or 10 and/or no-HDMA (16bit DMA through 8bit DMA).
60
+ Standard SB16 config (diagnose) can be used to set alternative settings, or included sbctl util. Windows driver manages alternative settings by itself when manually configured.
61
+
62
+ Current implementation supports SoundBlaster Pro specific commands (not available in SB16 originally) as well. Compatible config for SBPro is "A220 I5 D1 T4" in case if some game will require it.
63
+
64
+ ASP/CSP is not implemented, but some specific commands with dummy replies are added to let Windows driver work.
65
+
66
+ Simple volume (only master volume) is implemented in mixer so windows volume can be used in additional to standard MiSTer volume control.
67
+
68
+ ### C/MS Audio
69
+ C/MS (dual SAA1099) can be enabled in OSD. When enabled it prevents OPL2/3 access on ports 220-223. OPL2/3 still can be accessed on ports 388-38B (AdLib).
70
+
71
+ ### OPL2/3 (Adlib)
72
+ OPL2/3 can be accessed as a part of Sound Blaster board at ports 220-223 (if C/MS is not enabled) and 228-229(OPL2 only). However it's recommended to use AdLib ports 388-38B instead.
73
+
74
+ ### MIDI settings:
75
+ * address: 330h
76
+ * IRQ: 9
77
+
78
+ ### MT32-pi support:
79
+ [MT32-pi](https://github.com/dwhinham/mt32-pi) connection is supported through USER I/O port. MT32-pi is automatically detected.
80
+ Supported straight and crossed RX<->TX cables.
81
+
82
+ MT32-pi config and settings are [here](https://github.com/dwhinham/mt32-pi/wiki/MiSTer-FPGA-user-port-connection).
83
+
84
+ MT32-pi interface board is on [Hardware repository](https://github.com/MiSTer-devel/Hardware_MiSTer)
85
+
86
+ LCD and buttons are for convenience but not required. Basically only USER I/O connector is required, so it can be assembled without interface board.
87
+
88
+ ### Note:
89
+ * Press **WIN+F12** to access **OSD on ao486 core**. F12 alone acts as generic F12 PC key.
90
+
91
+ ### CD-ROM
92
+ Currently only data portion of CD is supported. Best image format is ISO, but BIN/CUE and CHD format discs still can be mounted. You just need to mount bin file or if it's multi-file image, then usually first track is data which you need to mount.
93
+
94
+ IDE 1-0 has special function - it's a placeholder for CD. So you can hot-swap CD images in this drive. Regardless special function this drive also supports HDD images. Once HDD image is loaded upon reboot this drive loses CD placeholder feature.
95
+
96
+ ### Hard Disk and CD-ROM in Windows
97
+ Core supports up to 4 HDD images up to 137GB each. Up to 2 CD-ROMs are supported.
98
+
99
+ Currently due to unknown source of issue Windows works with IDE devices through BIOS. Most likely some BIOS function doesn't supply correct info for Windows drivers.
100
+ It doesn't prevent windows from working but you need to keep in mind some specifics:
101
+ * Hard disks mounted on Primary IDE (0-0/0-1) need no attentions. They simply work.
102
+ * Driver for Secondary IDE (1-0/1-1) have yellow mark. It's recommended to delete this device from device list - it's not used anyway but will be installed every time you start automatic HW detection procedure.
103
+ * CD-ROM needs oakcdrom.sys and mscdex.exe added to config.sys and autoexec.bat respectively (you may find them on bootable Window98 CD). Windows will use it to access CD-ROM.
104
+ * CD-ROM autostart won't be automatically triggered (because work through BIOS). After replacing image file in CD-ROM you need to refresh the folder with drives (F5) and icon of CD will be changed if provided by image. Autostart will be triggered when you click on CD icon.
105
+
106
+ ### Building core
107
+ * Quartus 17.0 doesn't install properly on newer Linux distros, so use Docker instead. Install Docker for your dist https://docs.docker.com/engine/install/
108
+ * Download Docker image containing Quartus Lite Edition 17.0 from https://github.com/raetro/sdk-docker-fpga:
109
+
110
+ docker pull ghcr.io/raetro/quartus:mister
111
+
112
+ * Build project
113
+ * After cloning this repo and changing to the directory:
114
+
115
+ docker run -it --rm -v $(pwd):/build raetro/quartus:mister quartus_sh --flow compile ao486.qpf
116
+
117
+ * Access GUI
118
+
119
+ docker run --rm -ti --net=host --ipc=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --env="QT_X11_NO_MITSHM=1" -v $(pwd):/build raetro/quartus:mister quartus
MiSTer-devel_ao486_MiSTer/ao486.qpf ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ QUARTUS_VERSION = "17.0"
2
+ PROJECT_REVISION = "ao486"
MiSTer-devel_ao486_MiSTer/ao486.qsf ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --------------------------------------------------------------------------
2
+ #
3
+ # MiSTer project
4
+ #
5
+ # WARNING WARNING WARNING:
6
+ # Do not add files to project in Quartus IDE! It will mess this file!
7
+ # Add the files manually to files.qip file.
8
+ #
9
+ # --------------------------------------------------------------------------
10
+
11
+ set_global_assignment -name TOP_LEVEL_ENTITY sys_top
12
+ set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
13
+ set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
14
+ set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
15
+
16
+ set_global_assignment -name LAST_QUARTUS_VERSION "17.0.2 Standard Edition"
17
+
18
+ set_global_assignment -name GENERATE_RBF_FILE ON
19
+ set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
20
+ set_global_assignment -name NUM_PARALLEL_PROCESSORS ALL
21
+ set_global_assignment -name SAVE_DISK_SPACE OFF
22
+ set_global_assignment -name SMART_RECOMPILE ON
23
+ set_global_assignment -name MIN_CORE_JUNCTION_TEMP "-40"
24
+ set_global_assignment -name MAX_CORE_JUNCTION_TEMP 100
25
+ set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "23 MM HEAT SINK WITH 200 LFPM AIRFLOW"
26
+ set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)"
27
+ set_global_assignment -name TIMEQUEST_MULTICORNER_ANALYSIS OFF
28
+ set_global_assignment -name OPTIMIZE_POWER_DURING_FITTING OFF
29
+ set_global_assignment -name FINAL_PLACEMENT_OPTIMIZATION ALWAYS
30
+ set_global_assignment -name FITTER_EFFORT "STANDARD FIT"
31
+ set_global_assignment -name OPTIMIZATION_MODE "HIGH PERFORMANCE EFFORT"
32
+ set_global_assignment -name ALLOW_POWER_UP_DONT_CARE ON
33
+ set_global_assignment -name QII_AUTO_PACKED_REGISTERS "SPARSE AUTO"
34
+ set_global_assignment -name ROUTER_LCELL_INSERTION_AND_LOGIC_DUPLICATION ON
35
+ set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC ON
36
+ set_global_assignment -name PHYSICAL_SYNTHESIS_EFFORT EXTRA
37
+ set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION ON
38
+ set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_RETIMING ON
39
+ set_global_assignment -name OPTIMIZATION_TECHNIQUE SPEED
40
+ set_global_assignment -name MUX_RESTRUCTURE ON
41
+ set_global_assignment -name REMOVE_REDUNDANT_LOGIC_CELLS ON
42
+ set_global_assignment -name AUTO_DELAY_CHAINS_FOR_HIGH_FANOUT_INPUT_PINS ON
43
+ set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC_FOR_AREA ON
44
+ set_global_assignment -name ADV_NETLIST_OPT_SYNTH_WYSIWYG_REMAP ON
45
+ set_global_assignment -name SYNTH_GATED_CLOCK_CONVERSION ON
46
+ set_global_assignment -name PRE_MAPPING_RESYNTHESIS ON
47
+ set_global_assignment -name ROUTER_CLOCKING_TOPOLOGY_ANALYSIS ON
48
+ set_global_assignment -name ECO_OPTIMIZE_TIMING ON
49
+ set_global_assignment -name PERIPHERY_TO_CORE_PLACEMENT_AND_ROUTING_OPTIMIZATION ON
50
+ set_global_assignment -name PHYSICAL_SYNTHESIS_ASYNCHRONOUS_SIGNAL_PIPELINING ON
51
+ set_global_assignment -name ALM_REGISTER_PACKING_EFFORT LOW
52
+ set_global_assignment -name OPTIMIZE_POWER_DURING_SYNTHESIS OFF
53
+ set_global_assignment -name ROUTER_REGISTER_DUPLICATION ON
54
+ set_global_assignment -name FITTER_AGGRESSIVE_ROUTABILITY_OPTIMIZATION ALWAYS
55
+ set_global_assignment -name SEED 1
56
+
57
+ set_global_assignment -name VERILOG_MACRO "MISTER_FB=1"
58
+
59
+ #enable it only if 8bit indexed mode is used in core
60
+ set_global_assignment -name VERILOG_MACRO "MISTER_FB_PALETTE=1"
61
+
62
+ #set_global_assignment -name VERILOG_MACRO "MISTER_DUAL_SDRAM=1"
63
+
64
+ #do not enable DEBUG_NOHDMI in release!
65
+ #set_global_assignment -name VERILOG_MACRO "MISTER_DEBUG_NOHDMI=1"
66
+
67
+ source sys/sys.tcl
68
+ source sys/sys_analog.tcl
69
+ source files.qip
70
+ set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
MiSTer-devel_ao486_MiSTer/ao486.sdc ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ derive_pll_clocks
2
+ derive_clock_uncertainty
3
+
4
+ set clk_sys {*|pll|pll_inst|altera_pll_i|*[0].*|divclk}
5
+ set clk_uart1 {*|pll|pll_inst|altera_pll_i|*[1].*|divclk}
6
+ set clk_mpu {*|pll|pll_inst|altera_pll_i|*[2].*|divclk}
7
+ set clk_audio {pll_audio|pll_audio_inst|altera_pll_i|*[0].*|divclk}
8
+ set clk_vga {*|pll|pll_inst|altera_pll_i|*[4].*|divclk}
9
+ set clk_uart2 {*|pll|pll_inst|altera_pll_i|*[5].*|divclk}
10
+
11
+ set_false_path -from [get_clocks $clk_sys] -to [get_clocks $clk_vga]
12
+ set_false_path -from [get_clocks $clk_vga] -to [get_clocks $clk_sys]
13
+
14
+ set_false_path -from [get_clocks $clk_audio] -to [get_clocks $clk_sys]
15
+ set_false_path -from [get_clocks $clk_sys] -to [get_clocks $clk_audio]
16
+
17
+ set_false_path -from [get_clocks $clk_sys] -to [get_clocks $clk_uart1]
18
+ set_false_path -from [get_clocks $clk_uart1] -to [get_clocks $clk_sys]
19
+ set_false_path -from [get_clocks $clk_sys] -to [get_clocks $clk_uart2]
20
+ set_false_path -from [get_clocks $clk_uart2] -to [get_clocks $clk_sys]
21
+
22
+ set_false_path -from [get_clocks $clk_sys] -to [get_clocks $clk_mpu]
23
+ set_false_path -from [get_clocks $clk_mpu] -to [get_clocks $clk_sys]
24
+
25
+ set_multicycle_path -from {emu:emu|reset*} -setup 2
26
+ set_multicycle_path -from {emu:emu|reset*} -hold 1
MiSTer-devel_ao486_MiSTer/ao486.srf ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ { "" "" "" "System.pll_0: Able to implement PLL - Actual settings differ from Requested settings" { } { } 0 12251 "" 0 0 "Design Software" 0 -1 0 ""}
2
+ { "" "" "" "Port \"extclk\" on the entity instantiation of \"cyclonev_pll\" is connected to a signal of width 1. The formal width of the signal in the module is 2. The extra bits will be left dangling without any fan-out logic." { } { } 0 12030 "" 0 0 "Design Software" 0 -1 0 ""}
3
+ { "" "" "" "RST port on the PLL is not properly connected on instance emu:emu\|system:u0\|system_pll_0:pll_0\|altera_pll:altera_pll_i\|general\[0\].gpll. The reset port on the PLL should be connected. If the PLL loses lock for any reason, you might need to manually reset the PLL in order to re-establish lock to the reference clock." { } { } 0 0 "" 0 0 "Design Software" 0 -1 0 ""}
4
+ { "" "" "" "RST port on the PLL is not properly connected on instance emu:emu\|system:u0\|system_pll_0:pll_0\|altera_pll:altera_pll_i\|general\[1\].gpll. The reset port on the PLL should be connected. If the PLL loses lock for any reason, you might need to manually reset the PLL in order to re-establish lock to the reference clock." { } { } 0 0 "" 0 0 "Design Software" 0 -1 0 ""}
5
+ { "" "" "" "RST port on the PLL is not properly connected on instance emu:emu\|system:u0\|system_pll_0:pll_0\|altera_pll:altera_pll_i\|general\[2\].gpll. The reset port on the PLL should be connected. If the PLL loses lock for any reason, you might need to manually reset the PLL in order to re-establish lock to the reference clock." { } { } 0 0 "" 0 0 "Design Software" 0 -1 0 ""}
6
+ { "" "" "" "LOCKED port on the PLL is not properly connected on instance \"emu:emu\|system:u0\|system_pll_0:pll_0\|altera_pll:altera_pll_i\|general\[0\].gpll\". The LOCKED port on the PLL should be connected when the FBOUTCLK port is connected. Although it is unnecessary to connect the LOCKED signal, any logic driven off of an output clock of the PLL will not know when the PLL is locked and ready." { } { } 0 21300 "" 0 0 "Design Software" 0 -1 0 ""}
7
+ { "" "" "" "RST port on the PLL is not properly connected on instance pll_audio:pll_audio\|pll_audio_0002:pll_audio_inst\|altera_pll:altera_pll_i\|general\[0\].gpll. The reset port on the PLL should be connected. If the PLL loses lock for any reason, you might need to manually reset the PLL in order to re-establish lock to the reference clock." { } { } 0 0 "" 0 0 "Design Software" 0 -1 0 ""}
8
+ { "" "" "" "LOCKED port on the PLL is not properly connected on instance \"pll_audio:pll_audio\|pll_audio_0002:pll_audio_inst\|altera_pll:altera_pll_i\|general\[0\].gpll\". The LOCKED port on the PLL should be connected when the FBOUTCLK port is connected. Although it is unnecessary to connect the LOCKED signal, any logic driven off of an output clock of the PLL will not know when the PLL is locked and ready." { } { } 0 21300 "" 0 0 "Design Software" 0 -1 0 ""}
9
+ { "" "" "" "RST port on the PLL is not properly connected on instance emu:emu\|pll2:pll\|pll2_0002:pll_inst\|altera_pll:altera_pll_i\|general\[0\].gpll. The reset port on the PLL should be connected. If the PLL loses lock for any reason, you might need to manually reset the PLL in order to re-establish lock to the reference clock." { } { } 0 0 "" 0 0 "Design Software" 0 -1 0 ""}
10
+ { "" "" "" "LOCKED port on the PLL is not properly connected on instance \"emu:emu\|pll2:pll\|pll2_0002:pll_inst\|altera_pll:altera_pll_i\|general\[0\].gpll\". The LOCKED port on the PLL should be connected when the FBOUTCLK port is connected. Although it is unnecessary to connect the LOCKED signal, any logic driven off of an output clock of the PLL will not know when the PLL is locked and ready." { } { } 0 21300 "" 0 0 "Design Software" 0 -1 0 ""}
11
+ { "" "" "" "Found RAM instances implemented as ROM because the write logic is disabled. One instance is listed below as an example." { } { } 0 18550 "" 0 0 "Design Software" 0 -1 0 ""}
12
+ { "" "" "" "RST port on the PLL is not properly connected on instance emu:emu\|pll2:pll\|pll2_0002:pll_inst\|altera_pll:altera_pll_i\|general\[1\].gpll. The reset port on the PLL should be connected. If the PLL loses lock for any reason, you might need to manually reset the PLL in order to re-establish lock to the reference clock." { } { } 0 0 "" 0 0 "Design Software" 0 -1 0 ""}
13
+ { "" "" "" "RST port on the PLL is not properly connected on instance emu:emu\|pll:pll\|pll_0002:pll_inst\|altera_pll:altera_pll_i\|general\[0\].gpll. The reset port on the PLL should be connected. If the PLL loses lock for any reason, you might need to manually reset the PLL in order to re-establish lock to the reference clock." { } { } 0 0 "" 0 0 "Design Software" 0 -1 0 ""}
14
+ { "" "" "" "LOCKED port on the PLL is not properly connected on instance \"emu:emu\|pll:pll\|pll_0002:pll_inst\|altera_pll:altera_pll_i\|general\[0\].gpll\". The LOCKED port on the PLL should be connected when the FBOUTCLK port is connected. Although it is unnecessary to connect the LOCKED signal, any logic driven off of an output clock of the PLL will not know when the PLL is locked and ready." { } { } 0 21300 "" 0 0 "Design Software" 0 -1 0 ""}
15
+ { "" "" "" "RST port on the PLL is not properly connected on instance emu:emu\|pll:pll\|pll_0002:pll_inst\|altera_pll:altera_pll_i\|general\[1\].gpll. The reset port on the PLL should be connected. If the PLL loses lock for any reason, you might need to manually reset the PLL in order to re-establish lock to the reference clock." { } { } 0 0 "" 0 0 "Design Software" 0 -1 0 ""}
16
+ { "" "" "" "Variable or input pin \"outclock\" is defined but never used." { } { } 0 287013 "" 0 0 "Design Software" 0 -1 0 ""}
17
+ { "" "" "" "*" { } { } 0 276027 "" 0 0 "Design Software" 0 -1 0 ""}
18
+ { "" "" "" "*" { } { } 0 276020 "" 0 0 "Design Software" 0 -1 0 ""}
19
+ { "" "" "" "*" { } { } 0 20013 "" 0 0 "Design Software" 0 -1 0 ""}
20
+ { "" "" "" "altera_pll.v" { } { } 0 9999 "" 0 0 "Design Software" 0 -1 0 ""}
21
+ { "" "" "" "altera_cyclonev_pll.v" { } { } 0 9999 "" 0 0 "Design Software" 0 -1 0 ""}
22
+ { "" "" "" "altera_pll_reconfig_core.v" { } { } 0 9999 "" 0 0 "Design Software" 0 -1 0 ""}
23
+ { "" "" "" "altera_merlin_width_adapter.sv" { } { } 0 9999 "" 0 0 "Design Software" 0 -1 0 ""}
24
+ { "" "" "" "altera_merlin_burst_adapter_13_1.sv" { } { } 0 9999 "" 0 0 "Design Software" 0 -1 0 ""}
25
+ { "" "" "" "altera_merlin_address_alignment.sv" { } { } 0 9999 "" 0 0 "Design Software" 0 -1 0 ""}
MiSTer-devel_ao486_MiSTer/ao486.sv ADDED
@@ -0,0 +1,1048 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //============================================================================
2
+ // ao486
3
+ //
4
+ // Port to MiSTer.
5
+ // Copyright (C) 2017-2020 Alexey Melnikov
6
+ //
7
+ // This program is free software; you can redistribute it and/or modify it
8
+ // under the terms of the GNU General Public License as published by the Free
9
+ // Software Foundation; either version 2 of the License, or (at your option)
10
+ // any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful, but WITHOUT
13
+ // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
+ // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
+ // more details.
16
+ //
17
+ // You should have received a copy of the GNU General Public License along
18
+ // with this program; if not, write to the Free Software Foundation, Inc.,
19
+ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+ //============================================================================
21
+
22
+ module emu
23
+ (
24
+ `include "sys/emu_ports.vh"
25
+ );
26
+
27
+ //`define DEBUG
28
+
29
+ assign ADC_BUS = 'Z;
30
+ assign {SDRAM_A, SDRAM_BA, SDRAM_DQ, SDRAM_CLK, SDRAM_CKE, SDRAM_DQML, SDRAM_DQMH, SDRAM_nWE, SDRAM_nCAS, SDRAM_nRAS, SDRAM_nCS} = 'Z;
31
+ assign {SD_SCK, SD_MOSI, SD_CS} = 'Z;
32
+
33
+ assign LED_DISK[1] = 0;
34
+ assign LED_POWER = 0;
35
+ assign BUTTONS = {~ps2_reset_n, 1'b0};
36
+ assign HDMI_FREEZE = 0;
37
+ assign HDMI_BLACKOUT = 0;
38
+ assign HDMI_BOB_DEINT = 0;
39
+ assign VGA_DISABLE = 0;
40
+
41
+ led hdd_led(clk_sys, |mgmt_req[5:0], LED_DISK[0]);
42
+ led fdd_led(clk_sys, |mgmt_req[7:6], LED_USER);
43
+
44
+ // Status Bit Map:
45
+ // 0 1 2 3 4 5 6
46
+ // 01234567890123456789012345678901 23456789012345678901234567890123
47
+ // 0123456789ABCDEFGHIJKLMNOPQRSTUV 0123456789ABCDEFGHIJKLMNOPQRSTUV
48
+ // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX
49
+
50
+ `include "build_id.v"
51
+ localparam CONF_STR =
52
+ {
53
+ "AO486;UART115200:4000000(Turbo 115200),MIDI;",
54
+ "S0,IMGIMAVFD,Floppy A:;",
55
+ "S1,IMGIMAVFD,Floppy B:;",
56
+ "O12,Write Protect,None,A:,B:,A: & B:;",
57
+ "-;",
58
+ "S2,VHD,IDE 0-0;",
59
+ "S3,VHD,IDE 0-1;",
60
+ "-;",
61
+ "S4,VHDISOCUECHD,IDE 1-0;",
62
+ "S5,VHDISOCUECHD,IDE 1-1;",
63
+ "-;",
64
+ "oJM,CPU Preset,User Defined,~PC XT-7MHz,~PC AT-8MHz,~PC AT-10MHz,~PC AT-20MHz,~PS/2-20MHz,~386SX-25MHz,~386DX-33Mhz,~386DX-40Mhz,~486SX-33Mhz,~486DX-33Mhz,MAX (unstable);",
65
+ "-;",
66
+ "P1,Audio & Video;",
67
+ "P1-;",
68
+ "P1OMN,Aspect ratio,Original,Full Screen,[ARC1],[ARC2];",
69
+ "P1O4,VSync,60Hz,Variable;",
70
+ "P1O8,16/24bit mode,BGR,RGB;",
71
+ "P1O9,16bit format,1555,565;",
72
+ "P1OE,Low-Res,Native,4x;",
73
+ "P1oDE,Scale,Normal,V-Integer,Narrower HV-Integer,Wider HV-Integer;",
74
+ "P1oN,Border,No,Yes;",
75
+ "P1-;",
76
+ "P1O3,FM mode,OPL2,OPL3;",
77
+ "P1OH,C/MS,Disable,Enable;",
78
+ "P1OIJ,PC Speaker Volume,1,2,3,4;",
79
+ "P1OKL,Audio Boost,No,2x,4x;",
80
+ "P1oBC,Stereo Mix,none,25%,50%,100%;",
81
+ "P1oO,SB Swap L/R,Off,On;",
82
+ "P1OP,MT32 Volume Ctl,MIDI,Line-In;",
83
+
84
+ "P2,Hardware;",
85
+ "P2o01,Boot 1st,Floppy/Hard Disk,Floppy,Hard Disk,CD-ROM;",
86
+ "P2o23,Boot 2nd,NONE,Floppy,Hard Disk,CD-ROM;",
87
+ "P2o45,Boot 3rd,NONE,Floppy,Hard Disk,CD-ROM;",
88
+ "P2-;",
89
+ "P2o6,IDE 1-0 CD Hot-Swap,Yes,No;",
90
+ "P2o7,IDE 1-1 CD Hot-Swap,No,Yes;",
91
+ "P2-;",
92
+ "P2OB,RAM Size,256MB,16MB;",
93
+ "P2oP,D0000h-EFFFFh RAM,Off,On;",
94
+ `ifndef DEBUG
95
+ "H5P2-;",
96
+ "H5D2D1P2O56,CPU Clock,90MHz,15MHz,30MHz,56MHz;",
97
+ "H5h0P2O7,Overclock,Off,100Mhz;",
98
+ "H5D2P2OF,L1 Cache,On,Off;",
99
+ "H5D2P2OG,L2 Cache,On,Off;",
100
+ `endif
101
+ "P2-;",
102
+ "P2OA,USER I/O,MIDI,COM2;",
103
+ "P2-;",
104
+ "P2OCD,Joystick Type,2 Buttons,4 Buttons,Gravis Pro,None;",
105
+ "P2oFG,Joystick Mode,2 Joysticks,2 Sticks,2 Wheels,4-axes Wheel;",
106
+ "P2oQR,Joystick Axes,Timed,Count 8+141,Count 0+256,Count 6+256;",
107
+ "P2oH,Joystick 1,Enabled,Disabled;",
108
+ "P2oI,Joystick 2,Enabled,Disabled;",
109
+
110
+ "h3P3,MT32-pi;",
111
+ "h3P3-;",
112
+ "h3P3OO,Use MT32-pi,Yes,No;",
113
+ "h3P3o9A,Show Info,No,Yes,LCD-On(non-FB),LCD-Auto(non-FB);",
114
+ "h3P3-;",
115
+ "h3P3-,Default Config:;",
116
+ "h3P3OQ,Synth,Munt,FluidSynth;",
117
+ "h3P3ORS,Munt ROM,MT-32 v1,MT-32 v2,CM-32L;",
118
+ "h3P3OTV,SoundFont,0,1,2,3,4,5,6,7;",
119
+ "h3P3-;",
120
+ "h3P3r8,Reset Hanging Notes;",
121
+ "-;",
122
+ "R0,Reset and apply HDD;",
123
+ "J,Button 1,Button 2,Button 3,Button 4,Start,Select,R1,L1,R2,L2;",
124
+ "jn,A,B,X,Y,Start,Select,R,L;",
125
+ "I,",
126
+ "MT32-pi: SoundFont #0,",
127
+ "MT32-pi: SoundFont #1,",
128
+ "MT32-pi: SoundFont #2,",
129
+ "MT32-pi: SoundFont #3,",
130
+ "MT32-pi: SoundFont #4,",
131
+ "MT32-pi: SoundFont #5,",
132
+ "MT32-pi: SoundFont #6,",
133
+ "MT32-pi: SoundFont #7,",
134
+ "MT32-pi: MT-32 v1,",
135
+ "MT32-pi: MT-32 v2,",
136
+ "MT32-pi: CM-32L,",
137
+ "MT32-pi: Unknown mode;",
138
+ "V,v",`BUILD_DATE
139
+ };
140
+
141
+ ////////////////////////////////////////////////////////////////////////
142
+
143
+ wire ps2_kbd_clk_out;
144
+ wire ps2_kbd_data_out;
145
+ wire ps2_kbd_clk_in;
146
+ wire ps2_kbd_data_in;
147
+ wire [10:0] ps2_key;
148
+
149
+ wire ps2_mouse_clk_out;
150
+ wire ps2_mouse_data_out;
151
+ wire ps2_mouse_clk_in;
152
+ wire ps2_mouse_data_in;
153
+
154
+ wire [1:0] buttons;
155
+ wire [63:0] status;
156
+
157
+ wire [13:0] joystick_0;
158
+ wire [13:0] joystick_1;
159
+ wire [15:0] joystick_l_analog_0;
160
+ wire [15:0] joystick_l_analog_1;
161
+ wire [15:0] joystick_r_analog_0;
162
+ wire [15:0] joystick_r_analog_1;
163
+
164
+ wire [21:0] gamma_bus;
165
+ wire [7:0] uart1_mode;
166
+ wire [31:0] uart1_speed;
167
+
168
+ hps_io #(.CONF_STR(CONF_STR), .CONF_STR_BRAM(0), .PS2DIV(2000), .PS2WE(1), .WIDE(1)) hps_io
169
+ (
170
+ .clk_sys(clk_sys),
171
+ .HPS_BUS(HPS_BUS),
172
+
173
+ .ps2_key(ps2_key),
174
+ .ps2_kbd_clk_out(ps2_kbd_clk_out),
175
+ .ps2_kbd_data_out(ps2_kbd_data_out),
176
+ .ps2_kbd_clk_in(ps2_kbd_clk_in),
177
+ .ps2_kbd_data_in(ps2_kbd_data_in),
178
+
179
+ .ps2_mouse_clk_out(ps2_mouse_clk_out),
180
+ .ps2_mouse_data_out(ps2_mouse_data_out),
181
+ .ps2_mouse_clk_in(ps2_mouse_clk_in),
182
+ .ps2_mouse_data_in(ps2_mouse_data_in),
183
+
184
+ .buttons(buttons),
185
+ .status(status),
186
+ .status_menumask({|status[54:51],mt32_newmode,mt32_available,syscfg[7],status[7],dbg_menu}),
187
+ .info_req(mt32_info_req),
188
+ .info(mt32_info_disp),
189
+
190
+ .new_vmode(status[4]),
191
+ .gamma_bus(gamma_bus),
192
+
193
+ .uart_mode(uart1_mode),
194
+ .uart_speed(uart1_speed),
195
+
196
+ .joystick_0(joystick_0),
197
+ .joystick_1(joystick_1),
198
+ .joystick_l_analog_0(joystick_l_analog_0),
199
+ .joystick_l_analog_1(joystick_l_analog_1),
200
+ .joystick_r_analog_0(joystick_r_analog_0),
201
+ .joystick_r_analog_1(joystick_r_analog_1),
202
+
203
+ .EXT_BUS(EXT_BUS)
204
+ );
205
+
206
+ wire [15:0] mgmt_din;
207
+ wire [15:0] mgmt_dout;
208
+ wire [15:0] mgmt_addr;
209
+ wire mgmt_rd;
210
+ wire mgmt_wr;
211
+ wire [7:0] mgmt_req;
212
+
213
+ wire [35:0] EXT_BUS;
214
+ hps_ext hps_ext
215
+ (
216
+ .clk_sys(clk_sys),
217
+ .EXT_BUS(EXT_BUS),
218
+
219
+ .ext_din(mgmt_din),
220
+ .ext_dout(mgmt_dout),
221
+ .ext_addr(mgmt_addr),
222
+ .ext_rd(mgmt_rd),
223
+ .ext_wr(mgmt_wr),
224
+
225
+ .cdda_req(cdda_req),
226
+ .cdda_wr(cdda_wr),
227
+ .cdda_dout(cdda_dout),
228
+
229
+ .ext_req(mgmt_req),
230
+ .ext_hotswap(status[39:38])
231
+ );
232
+
233
+ ///////////////////////////// PLL ////////////////////////////////////
234
+
235
+ wire clk_sys, clk_uart1, clk_uart2, clk_mpu, clk_vga;
236
+ reg [27:0] cur_rate;
237
+
238
+ `ifdef DEBUG
239
+
240
+ pll2 pll
241
+ (
242
+ .refclk(CLK_50M),
243
+ .outclk_0(clk_vga),
244
+ .outclk_1(clk_uart1),
245
+ .outclk_2(clk_mpu),
246
+ .outclk_3(),
247
+ .outclk_4(clk_sys),
248
+ .outclk_5(clk_uart2)
249
+ );
250
+
251
+ always @(posedge clk_sys) cur_rate <= 30000000;
252
+
253
+ `else
254
+
255
+
256
+ wire pll_locked;
257
+ pll pll
258
+ (
259
+ .refclk(CLK_50M),
260
+ .rst(0),
261
+ .outclk_0(clk_sys),
262
+ .outclk_1(clk_uart1),
263
+ .outclk_2(clk_mpu),
264
+ .outclk_3(), // 14.285714 instead of 14.318181 which is within tolerance of typical resonator
265
+ .outclk_4(clk_vga),
266
+ .outclk_5(clk_uart2),
267
+ .locked(pll_locked),
268
+ .reconfig_to_pll(reconfig_to_pll),
269
+ .reconfig_from_pll(reconfig_from_pll)
270
+ );
271
+
272
+ wire [63:0] reconfig_to_pll;
273
+ wire [63:0] reconfig_from_pll;
274
+ wire cfg_waitrequest;
275
+ reg cfg_write;
276
+ reg [5:0] cfg_address;
277
+ reg [31:0] cfg_data;
278
+
279
+ pll_cfg pll_cfg
280
+ (
281
+ .mgmt_clk(CLK_50M),
282
+ .mgmt_reset(0),
283
+ .mgmt_waitrequest(cfg_waitrequest),
284
+ .mgmt_read(0),
285
+ .mgmt_readdata(),
286
+ .mgmt_write(cfg_write),
287
+ .mgmt_address(cfg_address),
288
+ .mgmt_writedata(cfg_data),
289
+ .reconfig_to_pll(reconfig_to_pll),
290
+ .reconfig_from_pll(reconfig_from_pll)
291
+ );
292
+
293
+ reg [2:0] clk_req;
294
+ reg l1, l2;
295
+ always @(posedge clk_sys) begin
296
+ case(status[54:51])
297
+ 'd1: begin clk_req <= 'd3; l1 <= 1'b1; l2 <= 1'b1; end // ao486 XT 7
298
+ 'd2: begin clk_req <= 'd1; l1 <= 1'b1; l2 <= 1'b0; end // ao486 AT 8
299
+ 'd3: begin clk_req <= 'd2; l1 <= 1'b0; l2 <= 1'b1; end // ao486 AT 10
300
+ 'd4: begin clk_req <= 'd2; l1 <= 1'b1; l2 <= 1'b0; end // ao486 AT 20
301
+ 'd5: begin clk_req <= 'd1; l1 <= 1'b0; l2 <= 1'b0; end // ao486 PS/2 20
302
+ 'd6: begin clk_req <= 'd3; l1 <= 1'b1; l2 <= 1'b0; end // ao486 3SX 25
303
+ 'd7: begin clk_req <= 'd2; l1 <= 1'b0; l2 <= 1'b0; end // ao486 3DX 33
304
+ 'd8: begin clk_req <= 'd0; l1 <= 1'b1; l2 <= 1'b0; end // ao486 3DX 40
305
+ 'd9: begin clk_req <= 'd3; l1 <= 1'b0; l2 <= 1'b0; end // ao486 4SX 33
306
+ 'd10: begin clk_req <= 'd0; l1 <= 1'b0; l2 <= 1'b0; end // ao486 MAX (stable)
307
+ 'd11: begin clk_req <= 'd4; l1 <= 1'b0; l2 <= 1'b0; end // ao486 MAX+ (unstable)
308
+ default: begin
309
+ // CPU & Cache config
310
+ clk_req <= {status[7], syscfg[7] ? syscfg[1:0] : status[6:5]};
311
+ l1 <= syscfg[7] ? syscfg[4] : status[15];
312
+ l2 <= syscfg[7] ? syscfg[5] : status[16];
313
+ end
314
+ endcase
315
+ end
316
+
317
+ reg [2:0] speed;
318
+ always @(posedge CLK_50M) begin
319
+ reg [2:0] sp1, sp2;
320
+
321
+ sp1 <= clk_req;
322
+ sp2 <= sp1;
323
+
324
+ if(sp2 == sp1) speed <= sp2;
325
+ end
326
+
327
+ reg uspeed_sys;
328
+ always @(posedge clk_sys) uspeed_sys <= (uart1_speed <= 115200);
329
+
330
+ reg uspeed;
331
+ always @(posedge CLK_50M) begin
332
+ reg sp1, sp2;
333
+
334
+ sp1 <= uspeed_sys;
335
+ sp2 <= sp1;
336
+
337
+ if(sp2 == sp1) uspeed <= sp2;
338
+ end
339
+
340
+ (* romstyle = "logic" *) wire [27:0] clk_rate[8] = '{90000000, 15000000, 30000000, 56250000, 100000000, 100000000, 100000000, 100000000 };
341
+ (* romstyle = "logic" *) wire [17:0] speed_div[8] = '{ 'h0505, 'h1e1e, 'h0f0f, 'h0808, 'h20504, 'h20504, 'h20504, 'h20504 };
342
+
343
+ always @(posedge CLK_50M) begin
344
+ reg [2:0] old_speed = 0;
345
+ reg [2:0] state = 0;
346
+ reg old_uspeed = 0;
347
+ reg old_rst = 0;
348
+
349
+ if(!cfg_waitrequest) begin
350
+
351
+ cfg_write <= 0;
352
+
353
+ if(pll_locked) begin
354
+ if(state) state<=state+1'd1;
355
+ case(state)
356
+ 0: begin
357
+ old_rst <= reset;
358
+ old_speed <= speed;
359
+ old_uspeed <= uspeed;
360
+ if((old_speed != speed) || (old_uspeed != uspeed) || (old_rst & ~reset)) state <= 1;
361
+ end
362
+ 1: begin
363
+ cfg_address <= 0;
364
+ cfg_data <= 0;
365
+ cfg_write <= 1;
366
+ end
367
+ 3: begin
368
+ cfg_address <= 5;
369
+ cfg_data <= speed_div[speed];
370
+ cfg_write <= 1;
371
+ end
372
+ 5: begin
373
+ cfg_address <= 5;
374
+ cfg_data <= uspeed ? 32'h4F4F4 : 32'h40909;
375
+ cfg_write <= 1;
376
+ end
377
+ 7: begin
378
+ cfg_address <= 2;
379
+ cfg_data <= 0;
380
+ cfg_write <= 1;
381
+ end
382
+ endcase
383
+ end
384
+ end
385
+ end
386
+
387
+ always @(posedge clk_sys) cur_rate <= clk_rate[clk_req];
388
+
389
+ `endif
390
+
391
+ //////////////////////////// UART ////////////////////////////////////
392
+
393
+ /// UART1
394
+
395
+ wire uart1_cts, uart1_dcd, uart1_dsr, uart1_rts, uart1_dtr;
396
+ wire uart1_tx, uart1_rx;
397
+ wire mpu_tx, mpu_rx;
398
+
399
+ wire hps_mpu = (uart1_mode >= 3);
400
+
401
+ assign UART_RTS = ~hps_mpu & uart1_rts;
402
+ assign UART_DTR = ~hps_mpu & uart1_dtr;
403
+ assign uart1_cts = ~hps_mpu & UART_CTS;
404
+ assign uart1_dcd = ~hps_mpu & UART_DSR;
405
+ assign uart1_dsr = ~hps_mpu & UART_DSR;
406
+ assign uart1_rx = ~hps_mpu & UART_RXD;
407
+ assign mpu_rx = ~hps_mpu ? midi_rx : UART_RXD;
408
+ assign UART_TXD = ~hps_mpu ? uart1_tx : (mpu_tx & ~mt32_use);
409
+
410
+ /// UART2
411
+
412
+ wire user_io_mode = status[10];
413
+
414
+ assign USER_OUT = user_io_mode ? {1'b1, 1'b1, uart2_dtr, 1'b1, uart2_rts, uart2_tx, 1'b1} : mt32_out;
415
+
416
+ //
417
+ // Pin | USB Name | |Signal
418
+ // ----+----------+---+-------------
419
+ // 0 | D+ | I |RX
420
+ // 1 | D- | O |TX
421
+ // 2 | TX- | O |RTS
422
+ // 3 | GND_d | I |CTS
423
+ // 4 | RX+ | O |DTR
424
+ // 5 | RX- | I |DSR
425
+ // 6 | TX+ | I |DCD
426
+ //
427
+
428
+ wire uart2_tx, uart2_rts, uart2_dtr;
429
+
430
+ wire uart2_rx = ~user_io_mode | USER_IN[0];
431
+ wire uart2_cts = ~user_io_mode | USER_IN[3];
432
+ wire uart2_dsr = ~user_io_mode | USER_IN[5];
433
+ wire uart2_dcd = ~user_io_mode | USER_IN[6];
434
+
435
+ //////////////////////////// VIDEO ///////////////////////////////////
436
+
437
+ assign VGA_F1 = 0;
438
+ assign VGA_SL = 0;
439
+ assign VGA_SCALER = 1;
440
+ assign CLK_VIDEO = clk_vga;
441
+ assign CE_PIXEL = vga_ce;
442
+
443
+ wire [7:0] r,g,b;
444
+ wire HSync,VSync;
445
+ wire ce_pix;
446
+
447
+ video_cleaner video_cleaner
448
+ (
449
+ .clk_vid(CLK_VIDEO),
450
+ .ce_pix(vga_ce),
451
+
452
+ .R(r),
453
+ .G(g),
454
+ .B(b),
455
+
456
+ .HSync(HSync),
457
+ .VSync(VSync),
458
+ .DE_in(vga_de),
459
+
460
+ .VGA_R(R),
461
+ .VGA_G(G),
462
+ .VGA_B(B),
463
+ .VGA_VS(vs),
464
+ .VGA_HS(hs),
465
+ .DE_out(de1)
466
+ );
467
+
468
+ wire hs,vs,de1;
469
+ wire [7:0] R,G,B;
470
+
471
+ gamma_fast gamma
472
+ (
473
+ .clk_vid(CLK_VIDEO),
474
+ .ce_pix(CE_PIXEL),
475
+
476
+ .gamma_bus(gamma_bus),
477
+
478
+ .HSync(hs),
479
+ .VSync(vs),
480
+ .DE(de1),
481
+ .RGB_in(mt32_lcd ? {{2{mt32_lcd_pix}},R[7:2], {2{mt32_lcd_pix}},G[7:2], {2{mt32_lcd_pix}},B[7:2]} : {R,G,B}),
482
+
483
+ .HSync_out(VGA_HS),
484
+ .VSync_out(VGA_VS),
485
+ .DE_out(VGA_DE),
486
+ .RGB_out({VGA_R,VGA_G,VGA_B})
487
+ );
488
+
489
+ wire [7:0] vga_pal_a;
490
+ wire [17:0] vga_pal_d;
491
+ wire vga_pal_we;
492
+
493
+ wire [19:0] vga_start_addr;
494
+ wire [8:0] vga_width;
495
+ wire [8:0] vga_stride;
496
+ wire [10:0] vga_height;
497
+ wire [3:0] vga_flags;
498
+ wire vga_off;
499
+ wire vga_ce;
500
+ wire vga_de;
501
+
502
+ reg fb_en;
503
+ reg [31:0] fb_base;
504
+ reg [11:0] fb_height;
505
+ reg [11:0] fb_width;
506
+ reg [13:0] fb_stride;
507
+ reg [4:0] fb_fmt;
508
+ reg fb_off;
509
+
510
+ always @(posedge clk_sys) begin
511
+ fb_en <= ~vga_flags[2] && |vga_flags[1:0]; // framebuffer enabled for high resolution and 16-bit/24-bit/32-bit color modes
512
+ fb_base <= {4'h3, 6'b111110, vga_start_addr, 2'b00};
513
+ fb_width <= (vga_flags[1:0] == 3) ? 12'd640 /*({vga_width, 3'b000}/3)*/ : vga_flags[2] ? {vga_width, 2'b00} : {vga_width, 3'b000};
514
+ fb_stride <= {vga_stride, 3'b000};
515
+ fb_height <= ~status[14] && vga_flags[3] ? vga_height[10:1] : vga_height;
516
+ fb_fmt[2:0] <= (vga_flags[1:0] == 3) ? 3'b101 : (vga_flags[1:0] == 2) ? 3'b100 : 3'b011; // 011=8bpp 100=16bpp 101=24bpp 110=32bpp
517
+ fb_fmt[4:3] <= {~status[8],~status[9]};
518
+ fb_off <= vga_off;
519
+ end
520
+
521
+ assign FB_PAL_CLK = clk_sys;
522
+ assign FB_PAL_ADDR = vga_pal_a;
523
+ assign FB_PAL_DOUT = {vga_pal_d[17:12], vga_pal_d[17:16], vga_pal_d[11:6], vga_pal_d[11:10], vga_pal_d[5:0], vga_pal_d[5:4]};
524
+ assign FB_PAL_WR = vga_pal_we;
525
+ assign FB_EN = fb_en;
526
+ assign FB_BASE = fb_base;
527
+ assign FB_FORMAT = fb_fmt;
528
+ assign FB_WIDTH = fb_width;
529
+ assign FB_HEIGHT = fb_height;
530
+ assign FB_STRIDE = fb_stride;
531
+ assign FB_FORCE_BLANK = fb_off;
532
+
533
+ reg f60;
534
+ always @(posedge clk_sys) f60 <= fb_en || (fb_width > 760);
535
+
536
+ reg [2:0] ar,SCALE;
537
+ reg [11:0] arx_i,ary_i;
538
+ always @(posedge CLK_VIDEO) begin
539
+ ar <= status[23:22];
540
+ SCALE <= status[46:45];
541
+ arx_i <= (!ar) ? 8'd4 : (ar - 1'd1);
542
+ ary_i <= (!ar) ? 8'd3 : 8'd0;
543
+ end
544
+
545
+ wire [12:0] fb_arx, arx, fb_ary, ary;
546
+
547
+ video_scale_int fb_scale
548
+ (
549
+ .*,
550
+ .hsize(fb_width),
551
+ .vsize(fb_height),
552
+ .arx_o(fb_arx),
553
+ .ary_o(fb_ary)
554
+ );
555
+
556
+ video_freak video_freak
557
+ (
558
+ .*,
559
+ .VGA_DE_IN(VGA_DE),
560
+ .VGA_DE(),
561
+ .ARX(arx_i),
562
+ .ARY(ary_i),
563
+ .CROP_SIZE(0),
564
+ .CROP_OFF(0),
565
+ .VIDEO_ARX(arx),
566
+ .VIDEO_ARY(ary)
567
+ );
568
+
569
+ assign VIDEO_ARX = fb_en ? fb_arx : arx;
570
+ assign VIDEO_ARY = fb_en ? fb_ary : ary;
571
+
572
+ ////////////////////////////////////////////////////////////////////////
573
+
574
+ assign DDRAM_ADDR[28:25] = 4'h3;
575
+
576
+ system system
577
+ (
578
+ .clk_sys (clk_sys),
579
+ .clk_audio (CLK_AUDIO),
580
+ .clk_uart1 (clk_uart1),
581
+ .clk_uart2 (clk_uart2),
582
+ .clk_mpu (clk_mpu),
583
+ .clk_vga (clk_vga),
584
+
585
+ .reset (reset),
586
+
587
+ .clock_rate (cur_rate),
588
+
589
+ .syscfg (syscfg),
590
+ .l1_disable (l1),
591
+ .l2_disable (l2),
592
+
593
+ .video_ce (vga_ce),
594
+ .video_f60 (~status[4] | f60),
595
+ .video_blank_n (vga_de),
596
+ .video_hsync (HSync),
597
+ .video_vsync (VSync),
598
+ .video_r (r),
599
+ .video_g (g),
600
+ .video_b (b),
601
+
602
+ .clock_rate_vga (90000000),
603
+ .video_pal_a (vga_pal_a),
604
+ .video_pal_d (vga_pal_d),
605
+ .video_pal_we (vga_pal_we),
606
+ .video_start_addr (vga_start_addr),
607
+ .video_width (vga_width),
608
+ .video_stride (vga_stride),
609
+ .video_height (vga_height),
610
+ .video_flags (vga_flags),
611
+ .video_off (vga_off),
612
+ .video_fb_en (fb_en),
613
+ .video_lores (~status[14]),
614
+ .video_border (status[55] && ~fb_en), // hide border for high resolution and 16/24/32 bpp color modes (when fb_en)
615
+
616
+ .sample_cms_l (cms_out_l),
617
+ .sample_cms_r (cms_out_r),
618
+ .sample_sb_l (sb_out_l),
619
+ .sample_sb_r (sb_out_r),
620
+ .sample_opl_l (opl_out_l),
621
+ .sample_opl_r (opl_out_r),
622
+ .sample_gus_l (gus_out_l),
623
+ .sample_gus_r (gus_out_r),
624
+ .sound_fm_mode (status[3]),
625
+ .sound_cms_en (status[17]),
626
+ .sbp (sbp),
627
+ .vol_master_l (vol_master_l),
628
+ .vol_master_r (vol_master_r),
629
+ .vol_voice_l (vol_voice_l),
630
+ .vol_voice_r (vol_voice_r),
631
+ .vol_midi_l (vol_midi_l),
632
+ .vol_midi_r (vol_midi_r),
633
+ .vol_cd_l (vol_cd_l),
634
+ .vol_cd_r (vol_cd_r),
635
+ .vol_line_l (vol_line_l),
636
+ .vol_line_r (vol_line_r),
637
+ .vol_spk (vol_spk),
638
+ .vol_en (vol_en),
639
+ .speaker_out (speaker_out),
640
+
641
+ .ps2_reset_n (ps2_reset_n),
642
+
643
+ .ps2_kbclk_in (ps2_kbd_clk_out),
644
+ .ps2_kbdat_in (ps2_kbd_data_out),
645
+ .ps2_kbclk_out (ps2_kbd_clk_in),
646
+ .ps2_kbdat_out (ps2_kbd_data_in),
647
+
648
+ .ps2_mouseclk_in (ps2_mouse_clk_out),
649
+ .ps2_mousedat_in (ps2_mouse_data_out),
650
+ .ps2_mouseclk_out (ps2_mouse_clk_in),
651
+ .ps2_mousedat_out (ps2_mouse_data_in),
652
+
653
+ .joystick_dis (joystick_dis),
654
+ .joystick_dig_1 (joystick_0 & dig_mask),
655
+ .joystick_dig_2 (status[47] ? 14'd0 : (joystick_1 & dig_mask)),
656
+ .joystick_ana_1 ({ja_1y,ja_1x}),
657
+ .joystick_ana_2 ({ja_2y,ja_2x}),
658
+ .joystick_mode (status[13:12]),
659
+ .joystick_timed (status[59:58]),
660
+
661
+ .mgmt_readdata (mgmt_din),
662
+ .mgmt_writedata (mgmt_dout),
663
+ .mgmt_address (mgmt_addr),
664
+ .mgmt_write (mgmt_wr),
665
+ .mgmt_read (mgmt_rd),
666
+
667
+ .ide0_request (mgmt_req[2:0]),
668
+ .ide1_request (mgmt_req[5:3]),
669
+ .fdd_request (mgmt_req[7:6]),
670
+ .floppy_wp (status[2:1]),
671
+
672
+ .uart1_rx (uart1_rx),
673
+ .uart1_tx (uart1_tx),
674
+ .uart1_cts_n (uart1_cts),
675
+ .uart1_dcd_n (uart1_dcd),
676
+ .uart1_dsr_n (uart1_dsr),
677
+ .uart1_rts_n (uart1_rts),
678
+ .uart1_dtr_n (uart1_dtr),
679
+
680
+ .uart2_rx (uart2_rx),
681
+ .uart2_tx (uart2_tx),
682
+ .uart2_cts_n (uart2_cts),
683
+ .uart2_dcd_n (uart2_dcd),
684
+ .uart2_dsr_n (uart2_dsr),
685
+ .uart2_rts_n (uart2_rts),
686
+ .uart2_dtr_n (uart2_dtr),
687
+
688
+ .mpu_rx (mpu_rx),
689
+ .mpu_tx (mpu_tx),
690
+
691
+ .uma_ram (status[57]),
692
+ .bootcfg (status[37:32]),
693
+
694
+ .DDRAM_CLK (DDRAM_CLK),
695
+ .DDRAM_ADDR (DDRAM_ADDR[24:0]),
696
+ .DDRAM_DIN (DDRAM_DIN),
697
+ .DDRAM_DOUT (DDRAM_DOUT),
698
+ .DDRAM_DOUT_READY (DDRAM_DOUT_READY),
699
+ .DDRAM_BE (DDRAM_BE),
700
+ .DDRAM_BURSTCNT (DDRAM_BURSTCNT),
701
+ .DDRAM_BUSY (DDRAM_BUSY),
702
+ .DDRAM_RD (DDRAM_RD),
703
+ .DDRAM_WE (DDRAM_WE),
704
+
705
+ .pll_locked (pll_locked),
706
+ .SDRAM_DQ (SDRAM_DQ),
707
+ .SDRAM_A (SDRAM_A),
708
+ .SDRAM_DQML (SDRAM_DQML),
709
+ .SDRAM_DQMH (SDRAM_DQMH),
710
+ .SDRAM_BA (SDRAM_BA),
711
+ .SDRAM_nCS (SDRAM_nCS),
712
+ .SDRAM_nWE (SDRAM_nWE),
713
+ .SDRAM_nRAS (SDRAM_nRAS),
714
+ .SDRAM_nCAS (SDRAM_nCAS),
715
+ .SDRAM_CLK (SDRAM_CLK),
716
+ .SDRAM_CKE (SDRAM_CKE)
717
+ );
718
+
719
+ wire [7:0] syscfg;
720
+ wire ps2_reset_n;
721
+
722
+ reg reset;
723
+ always @(posedge clk_sys) begin
724
+ reg init_reset_n = 0;
725
+ reg old_rst = 0;
726
+
727
+ reset <= buttons[1] | status[0] | RESET | ~init_reset_n;
728
+
729
+ old_rst <= status[0];
730
+ if(old_rst & ~status[0]) init_reset_n <= 1;
731
+ end
732
+
733
+ reg dbg_menu = 0;
734
+ always @(posedge clk_sys) begin
735
+ reg old_stb;
736
+ reg enter = 0;
737
+ reg esc = 0;
738
+
739
+ old_stb <= ps2_key[10];
740
+ if(old_stb ^ ps2_key[10]) begin
741
+ if(ps2_key[7:0] == 'h5A) enter <= ps2_key[9];
742
+ if(ps2_key[7:0] == 'h76) esc <= ps2_key[9];
743
+ end
744
+
745
+ if(enter & esc) begin
746
+ dbg_menu <= ~dbg_menu;
747
+ enter <= 0;
748
+ esc <= 0;
749
+ end
750
+
751
+ if(status[7]) dbg_menu <= 1;
752
+ end
753
+
754
+
755
+ wire [7:0] ja_1x,ja_1y,ja_2x,ja_2y;
756
+ wire [15:0] dig_mask;
757
+ wire [1:0] joystick_dis;
758
+
759
+ wire [7:0] pedal_combo;
760
+ always_comb begin
761
+ ja_1x = joystick_l_analog_0[7:0];
762
+ ja_1y = joystick_l_analog_0[15:8];
763
+ ja_2x = joystick_l_analog_1[7:0];
764
+ ja_2y = joystick_l_analog_1[15:8];
765
+ dig_mask = '1;
766
+ joystick_dis = status[50:49];
767
+
768
+ case(status[48:47])
769
+ 1: begin
770
+ ja_2x = joystick_r_analog_0[7:0];
771
+ ja_2y = joystick_r_analog_0[15:8];
772
+ joystick_dis[1] = status[49];
773
+ end
774
+ 2: begin
775
+ ja_1y = 0;
776
+ if(joystick_l_analog_0[15]) ja_1y = joystick_l_analog_0[15:8];
777
+ if(joystick_r_analog_0[15]) ja_1y = ja_1y - joystick_r_analog_0[15:8];
778
+ ja_2y = 0;
779
+ if(joystick_l_analog_1[15]) ja_2y = joystick_l_analog_1[15:8];
780
+ if(joystick_r_analog_1[15]) ja_2y = ja_2y - joystick_r_analog_1[15:8];
781
+ dig_mask[3:0] = 0;
782
+ end
783
+ 3: begin
784
+ ja_1y = joystick_l_analog_0[15] ? {joystick_l_analog_0[14:8] + 7'd63, 1'b0} : 8'd127;
785
+ ja_2y = joystick_r_analog_0[15] ? {joystick_r_analog_0[14:8] + 7'd63, 1'b0} : 8'd127;
786
+ ja_2x = joystick_r_analog_0[7] ? {joystick_r_analog_0[6:0] + 7'd63, 1'b0} : 8'd127;
787
+ dig_mask[3:0] = 0;
788
+ joystick_dis[1] = status[49];
789
+ end
790
+ default:;
791
+ endcase
792
+ end
793
+
794
+ //////////////////////////// MT32pi //////////////////////////////////
795
+
796
+ wire mt32_reset = status[40] | reset;
797
+ wire mt32_disable = status[24];
798
+ wire mt32_mode_req = status[26];
799
+ wire [1:0] mt32_rom_req = status[28:27];
800
+ wire [7:0] mt32_sf_req = status[31:29];
801
+ wire [1:0] mt32_info = status[42:41];
802
+
803
+ wire [15:0] mt32_i2s_r, mt32_i2s_l;
804
+ wire [7:0] mt32_mode, mt32_rom, mt32_sf;
805
+ wire mt32_lcd_en, mt32_lcd_pix, mt32_lcd_update;
806
+ wire midi_rx;
807
+
808
+ wire mt32_newmode;
809
+ wire mt32_available;
810
+ wire mt32_use = mt32_available & ~mt32_disable;
811
+ wire mt32_mute = mt32_available & mt32_disable;
812
+
813
+ wire [6:0] mt32_out;
814
+ mt32pi mt32pi
815
+ (
816
+ .*,
817
+ .reset(mt32_reset),
818
+ .USER_IN(user_io_mode ? 7'h7F : USER_IN),
819
+ .USER_OUT(mt32_out),
820
+ .midi_tx(mpu_tx | mt32_mute)
821
+ );
822
+
823
+ reg mt32_info_req;
824
+ reg [3:0] mt32_info_disp;
825
+ always @(posedge clk_sys) begin
826
+ reg old_mode;
827
+
828
+ old_mode <= mt32_newmode;
829
+ mt32_info_req <= (old_mode ^ mt32_newmode) && (mt32_info == 1);
830
+
831
+ mt32_info_disp <= (mt32_mode == 'hA2) ? (4'd1 + mt32_sf[2:0]) :
832
+ (mt32_mode == 'hA1 && mt32_rom == 0) ? 4'd9 :
833
+ (mt32_mode == 'hA1 && mt32_rom == 1) ? 4'd10 :
834
+ (mt32_mode == 'hA1 && mt32_rom == 2) ? 4'd11 : 4'd12;
835
+ end
836
+
837
+ reg mt32_lcd_on;
838
+ always @(posedge CLK_VIDEO) begin
839
+ int to;
840
+ reg old_update;
841
+
842
+ old_update <= mt32_lcd_update;
843
+ if(to) to <= to - 1;
844
+
845
+ if(mt32_info == 2) mt32_lcd_on <= 1;
846
+ else if(mt32_info != 3) mt32_lcd_on <= 0;
847
+ else begin
848
+ if(!to) mt32_lcd_on <= 0;
849
+ if(old_update ^ mt32_lcd_update) begin
850
+ mt32_lcd_on <= 1;
851
+ to <= 90000000 * 2;
852
+ end
853
+ end
854
+ end
855
+
856
+ wire mt32_lcd = mt32_lcd_on & mt32_lcd_en;
857
+
858
+ //////////////////////////// AUDIO ///////////////////////////////////
859
+
860
+ // PC Speaker
861
+ wire speaker_out, speaker_out_clk_audio;
862
+ wire [1:0] vol_spk;
863
+ reg [16:0] spk_out;
864
+
865
+ synchronizer speaker_out_sync
866
+ (
867
+ .clk(CLK_AUDIO),
868
+ .in(speaker_out),
869
+ .out(speaker_out_clk_audio)
870
+ );
871
+
872
+ always @(posedge CLK_AUDIO) begin
873
+ reg [16:0] spk;
874
+ spk <= {2'b00, {3'b000,speaker_out_clk_audio} << status[19:18], 11'd0};
875
+ spk_out <= spk >> ~vol_spk;
876
+ end
877
+
878
+ wire [15:0] gus_out_l, gus_out_r;
879
+
880
+ // CD-DA (Redbook audio)
881
+ wire [15:0] cdda_l;
882
+ wire [15:0] cdda_r;
883
+ wire [31:0] cdda_dout;
884
+ wire cdda_req;
885
+ wire cdda_wr;
886
+
887
+ cdda #(24576000) cdda
888
+ (
889
+ .CLK(clk_sys),
890
+ .CDDA_REQ(cdda_req),
891
+ .CDDA_WR(cdda_wr),
892
+ .CDDA_DATA(cdda_dout),
893
+
894
+ .VOLUME_L(4'b1111),
895
+ .VOLUME_R(4'b1111),
896
+
897
+ .CLK_AUDIO(CLK_AUDIO),
898
+ .AUDIO_L(cdda_l),
899
+ .AUDIO_R(cdda_r)
900
+ );
901
+
902
+ wire [8:0] cms_out_l, cms_out_r;
903
+ wire [15:0] sb_out_l, sb_out_r;
904
+ wire [15:0] opl_out_l, opl_out_r;
905
+
906
+ wire sbp;
907
+ wire [4:0] vol_master_l, vol_master_r, vol_voice_l, vol_voice_r, vol_midi_l, vol_midi_r, vol_cd_l, vol_cd_r, vol_line_l, vol_line_r;
908
+ wire [4:0] vol_en;
909
+
910
+ // Select MT-32 volume control
911
+ wire [4:0] vol_mt32_l = ~status[25] ? vol_midi_l : vol_en[4] ? vol_line_l : 5'd0;
912
+ wire [4:0] vol_mt32_r = ~status[25] ? vol_midi_r : vol_en[3] ? vol_line_r : 5'd0;
913
+
914
+ // Apply per-channel volume controls
915
+ wire [15:0] master_l, master_r, sb_l, sb_r, opl_l, opl_r, cd_l, cd_r, mt32_l, mt32_r;
916
+ wire sb_volume_valid;
917
+ sb_volume #(.NUM_CH(10), .SAMPLE_WIDTH(16)) sb_volume_inst (
918
+ .clk(CLK_AUDIO),
919
+ .sbp(sbp),
920
+ // Volume controls
921
+ .volumes_in({vol_master_l, vol_master_r, // Master volume
922
+ vol_voice_l, vol_voice_r, // Voice (SB DAC/DMA)
923
+ vol_midi_l, vol_midi_r, // MIDI (FM/OPL)
924
+ vol_cd_l, vol_cd_r, // CD
925
+ vol_mt32_l, vol_mt32_r}), // MT-32
926
+ // Pre-volume audio samples
927
+ .samples_in({mix_pre_l, mix_pre_r, // Master mix (pre-volume)
928
+ sb_out_l, sb_out_r, // SB DAC/DMA
929
+ opl_out_l, opl_out_r, // OPL2/3 FM synthesis
930
+ cdda_l, cdda_r, // CD-DA (Redbook audio)
931
+ mt32_i2s_l, mt32_i2s_r}), // MT-32 I2S
932
+ // Post-volume audio samples
933
+ .samples_out({master_l, master_r,
934
+ sb_l, sb_r,
935
+ opl_l, opl_r,
936
+ cd_l, cd_r,
937
+ mt32_l, mt32_r}),
938
+ .valid(sb_volume_valid)
939
+ );
940
+
941
+ // SB channel swap after volume stage
942
+ wire [15:0] sb_l_swap = status[56] ? sb_r : sb_l;
943
+ wire [15:0] sb_r_swap = status[56] ? sb_l : sb_r;
944
+
945
+ reg [15:0] mix_dry_l, mix_dry_r;
946
+ reg [15:0] audio_l, audio_r;
947
+ always @(posedge CLK_AUDIO) begin
948
+ reg [16:0] mix_tmp_l, mix_tmp_r;
949
+
950
+ if (sb_volume_valid) begin
951
+ audio_l <= master_l;
952
+ audio_r <= master_r;
953
+
954
+ mix_tmp_l <= spk_out // PC Speaker
955
+ + {2'b00, cms_out_l, cms_out_l[8:4]} // C/MS or Game Blaster
956
+ + {sb_l_swap[15],sb_l_swap} // SB DAC/DMA
957
+ + {opl_l[15],opl_l} // OPL2/3 FM synthesis
958
+ + (vol_en[2] ? {cd_l[15],cd_l} : 17'd0) // CD-DA (Redbook audio)
959
+ + (mt32_mute ? 17'd0 : {mt32_l[15],mt32_l}) // MT-32
960
+ + {gus_out_l[15],gus_out_l}; // GUS
961
+ mix_tmp_r <= spk_out
962
+ + {2'b00, cms_out_r, cms_out_r[8:4]}
963
+ + {sb_r_swap[15],sb_r_swap}
964
+ + {opl_r[15],opl_r}
965
+ + (vol_en[1] ? {cd_r[15],cd_r} : 17'd0)
966
+ + (mt32_mute ? 17'd0 : {mt32_r[15],mt32_r})
967
+ + {gus_out_r[15],gus_out_r};
968
+ end
969
+
970
+ // Hard clip to prevent overflow
971
+ mix_dry_l <= (^mix_tmp_l[16:15]) ? {mix_tmp_l[16], {15{mix_tmp_l[15]}}} : mix_tmp_l[15:0];
972
+ mix_dry_r <= (^mix_tmp_r[16:15]) ? {mix_tmp_r[16], {15{mix_tmp_r[15]}}} : mix_tmp_r[15:0];
973
+ end
974
+
975
+ // Audio compression
976
+ wire [15:0] mix_cmp_l, mix_cmp_r;
977
+ acompr acompr_l(CLK_AUDIO, status[21], mix_dry_l, mix_cmp_l);
978
+ acompr acompr_r(CLK_AUDIO, status[21], mix_dry_r, mix_cmp_r);
979
+
980
+ // Select between compressed/dry pre-volume master mix
981
+ wire [15:0] mix_pre_l = status[21:20] ? mix_cmp_l : mix_dry_l;
982
+ wire [15:0] mix_pre_r = status[21:20] ? mix_cmp_r : mix_dry_r;
983
+
984
+ assign AUDIO_L = audio_l;
985
+ assign AUDIO_R = audio_r;
986
+ assign AUDIO_S = 1;
987
+ assign AUDIO_MIX = status[44:43];
988
+
989
+ ////////////////////////////////////////////////////////////////////////
990
+
991
+ endmodule
992
+
993
+ module led
994
+ (
995
+ input clk,
996
+ input in,
997
+ output reg out
998
+ );
999
+
1000
+ integer counter = 0;
1001
+ always @(posedge clk) begin
1002
+ if(!counter) out <= 0;
1003
+ else begin
1004
+ counter <= counter - 1'b1;
1005
+ out <= 1;
1006
+ end
1007
+
1008
+ if(in) counter <= 4500000;
1009
+ end
1010
+
1011
+ endmodule
1012
+
1013
+ module acompr
1014
+ (
1015
+ input clk,
1016
+ input mode,
1017
+ input [15:0] inp,
1018
+ output reg [15:0] out
1019
+ );
1020
+
1021
+ localparam [3:0] comp_f1 = 4;
1022
+ localparam [3:0] comp_a1 = 2;
1023
+ localparam comp_x1 = ((32767 * (comp_f1 - 1)) / ((comp_f1 * comp_a1) - 1)) + 1; // +1 to make sure it won't overflow
1024
+ localparam comp_b1 = comp_x1 * comp_a1;
1025
+
1026
+ localparam [3:0] comp_f2 = 8;
1027
+ localparam [3:0] comp_a2 = 4;
1028
+ localparam comp_x2 = ((32767 * (comp_f2 - 1)) / ((comp_f2 * comp_a2) - 1)) + 1; // +1 to make sure it won't overflow
1029
+ localparam comp_b2 = comp_x2 * comp_a2;
1030
+
1031
+ always @(posedge clk) begin
1032
+ reg [15:0] v, v1, v2, v3;
1033
+ reg vs, vs1, vs3;
1034
+
1035
+ v <= inp[15] ? -inp : inp;
1036
+ vs <= inp[15];
1037
+
1038
+ v1 <= (v < comp_x1[15:0]) ? (v * comp_a1) : (((v - comp_x1[15:0])/comp_f1) + comp_b1[15:0]);
1039
+ v2 <= (v < comp_x2[15:0]) ? (v * comp_a2) : (((v - comp_x2[15:0])/comp_f2) + comp_b2[15:0]);
1040
+ vs1 <= vs;
1041
+
1042
+ v3 <= mode ? v2 : v1;
1043
+ vs3 <= vs1;
1044
+
1045
+ out <= vs3 ? -v3 : v3;
1046
+ end
1047
+
1048
+ endmodule
MiSTer-devel_ao486_MiSTer/clean.bat ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ del /s *.bak
3
+ del /s *.orig
4
+ del /s *.rej
5
+ del /s *~
6
+ rmdir /s /q db
7
+ rmdir /s /q incremental_db
8
+ rmdir /s /q output_files
9
+ rmdir /s /q simulation
10
+ rmdir /s /q greybox_tmp
11
+ rmdir /s /q hc_output
12
+ rmdir /s /q .qsys_edit
13
+ rmdir /s /q hps_isw_handoff
14
+ rmdir /s /q sys\.qsys_edit
15
+ rmdir /s /q sys\vip
16
+ for /d %%i in (sys\*_sim) do rmdir /s /q "%%i"
17
+ for /d %%i in (rtl\*_sim) do rmdir /s /q "%%i"
18
+ del build_id.v
19
+ del c5_pin_model_dump.txt
20
+ del PLLJ_PLLSPE_INFO.txt
21
+ del /s *.qws
22
+ del /s *.ppf
23
+ del /s *.ddb
24
+ del /s *.csv
25
+ del /s *.cmp
26
+ del /s *.sip
27
+ del /s *.spd
28
+ del /s *.bsf
29
+ del /s *.f
30
+ del /s *.sopcinfo
31
+ del /s *.xml
32
+ del *.cdf
33
+ del *.rpt
34
+ del /s new_rtl_netlist
35
+ del /s old_rtl_netlist
36
+ pause
MiSTer-devel_ao486_MiSTer/clean.sh ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ rm -rf *.bak
3
+ rm -rf *.orig
4
+ rm -rf *.rej
5
+ rm -rf *~
6
+ rm -rf db
7
+ rm -rf incremental_db
8
+ rm -rf output_files
9
+ rm -rf simulation
10
+ rm -rf greybox_tmp
11
+ rm -rf hc_output
12
+ rm -rf .qsys_edit
13
+ rm -rf hps_isw_handoff
14
+ rm -rf sys/.qsys_edit
15
+ rm -rf sys/vip
16
+ rm -rf sys/*_sim
17
+ rm -rf rtl/*_sim
18
+ rm -rf build_id.v
19
+ rm -rf c5_pin_morm_dump.txt
20
+ rm -rf PLLJ_PLLSPE_INFO.txt
21
+ rm -rf *.qws
22
+ rm -rf *.ppf
23
+ rm -rf *.ddb
24
+ rm -rf *.csv
25
+ rm -rf *.cmp
26
+ rm -rf *.sip
27
+ rm -rf *.spd
28
+ rm -rf *.bsf
29
+ rm -rf *.f
30
+ rm -rf *.sopcinfo
31
+ rm -rf *.xml
32
+ rm -rf *.cdf
33
+ rm -rf *.rpt
34
+ rm -rf new_rtl_netlist
35
+ rm -rf old_rtl_netlist
MiSTer-devel_ao486_MiSTer/files.qip ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ set_global_assignment -name SEARCH_PATH ./rtl/ao486
2
+ set_global_assignment -name QIP_FILE rtl/pll2.qip
3
+ set_global_assignment -name QIP_FILE rtl/ao486/ao486.qip
4
+ set_global_assignment -name QIP_FILE rtl/cache/cache.qip
5
+ set_global_assignment -name QIP_FILE rtl/soc/uart/uart.qip
6
+ set_global_assignment -name QIP_FILE rtl/soc/sound/sound.qip
7
+ set_global_assignment -name QIP_FILE rtl/soc/gus/gus.qip
8
+ set_global_assignment -name QIP_FILE rtl/common/common.qip
9
+ set_global_assignment -name VERILOG_FILE rtl/soc/iobus.v
10
+ set_global_assignment -name VERILOG_FILE rtl/soc/floppy.v
11
+ set_global_assignment -name VERILOG_FILE rtl/soc/ide.v
12
+ set_global_assignment -name VERILOG_FILE rtl/soc/cdda.v
13
+ set_global_assignment -name VERILOG_FILE rtl/soc/joystick.v
14
+ set_global_assignment -name VERILOG_FILE rtl/soc/dma.v
15
+ set_global_assignment -name VERILOG_FILE rtl/soc/pic.v
16
+ set_global_assignment -name VERILOG_FILE rtl/soc/pit.v
17
+ set_global_assignment -name VERILOG_FILE rtl/soc/pit_counter.v
18
+ set_global_assignment -name VERILOG_FILE rtl/soc/ps2.v
19
+ set_global_assignment -name VERILOG_FILE rtl/soc/rtc.v
20
+ set_global_assignment -name VERILOG_FILE rtl/soc/vga.v
21
+ set_global_assignment -name VERILOG_FILE rtl/system.v
22
+ set_global_assignment -name VERILOG_FILE rtl/hps_ext.v
23
+ set_global_assignment -name SDC_FILE ao486.sdc
24
+ set_global_assignment -name SYSTEMVERILOG_FILE ao486.sv
MiSTer-devel_ao486_MiSTer/releases/ao486_20170803.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27fa9484ba712fad6fc6a2da370742d57cf3bbcc5e55bf72b3cad8a8e7f66da6
3
+ size 4094256
MiSTer-devel_ao486_MiSTer/releases/ao486_20170805.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25b3b0318fcbb88a2300dc22115ae108c70da4494ce19c5c9bfd1ed73d9eacd1
3
+ size 4070808
MiSTer-devel_ao486_MiSTer/releases/ao486_20170806.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e59527a8e658215fe3259d1ba2ce2930bdbcc64bcb55250685155b0d4d0102f9
3
+ size 4072500
MiSTer-devel_ao486_MiSTer/releases/ao486_20170813.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db7ced8dcb38ac7275c3c8f5d726763910ac59978fb045de4708303ecd892e46
3
+ size 4088612
MiSTer-devel_ao486_MiSTer/releases/ao486_20170818.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71ebe7e3b4cde6c2da76706a384c654d9562b45c5669b381d65f893ac73d34e3
3
+ size 4188248
MiSTer-devel_ao486_MiSTer/releases/ao486_20170821.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1354d69b0b37be4b58b018ed1deda3dd59e262481756d583424a8b279f608588
3
+ size 4230112
MiSTer-devel_ao486_MiSTer/releases/ao486_20170824.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:037b0fd7281ce99bc8b9695f963bc6db39da6915ac5de3d4db84fe8e9d3452e9
3
+ size 4201236
MiSTer-devel_ao486_MiSTer/releases/ao486_20180101.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95351b978d1b98259a3d369778f7f92001ed2dcbc3ad1c8dbe44ac27c1d4725a
3
+ size 4254976
MiSTer-devel_ao486_MiSTer/releases/ao486_20180123.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53f7c0a5fa3ae50d12f5edaa5840768a4ad26783ee08b58663213de373a2e659
3
+ size 4269296
MiSTer-devel_ao486_MiSTer/releases/ao486_20180304.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86cd384552320b3133fbd2c8de762491c530580f990961487903939de80baa8f
3
+ size 4357236
MiSTer-devel_ao486_MiSTer/releases/ao486_20180407.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36adfd2487c511a5e011faffc1bcb77eed362543b32309644b7caf1b26609805
3
+ size 4323244
MiSTer-devel_ao486_MiSTer/releases/ao486_20180410.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b60c92fe4cfb7097a47f4e8ad2936df52bb5f9fed788bc12cedc216317d3f72f
3
+ size 4317444
MiSTer-devel_ao486_MiSTer/releases/ao486_20180426.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ce3ac65ee0b28b9585a65418f5055f5be358bb5498c428e8f5cd0ff63806bc5
3
+ size 4371224
MiSTer-devel_ao486_MiSTer/releases/ao486_20180617.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:988f0be08f0a9af718f9fca39f35986818acf67b3d00ad53efa4189d009fdb8a
3
+ size 4319764
MiSTer-devel_ao486_MiSTer/releases/ao486_20181215.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e33ad1bf5a50b5f833392042beddb2c9686c65e5f7f65f4dbab2c2144d178f7
3
+ size 4182044
MiSTer-devel_ao486_MiSTer/releases/ao486_20190117.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da5593a768f841317a3f71838e4a27b32e5bf71433df317640216ec66f4524a8
3
+ size 4232244
MiSTer-devel_ao486_MiSTer/releases/ao486_20190227.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d1e69ea60d5c5ff22ecbc64b4688c0a96c7ecce460fe1e387f500e1dd315b96
3
+ size 4215988
MiSTer-devel_ao486_MiSTer/releases/ao486_20190308.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8015c56016bc56ab93a4dcf5566727f4a9c843381181ec41bf7ebb1a9c1a1d7
3
+ size 4242096
MiSTer-devel_ao486_MiSTer/releases/ao486_20190425.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aedc94061bf347b34b3344f787d18f41a74dea1c1dec52cef72a740b74fa52ec
3
+ size 4162600
MiSTer-devel_ao486_MiSTer/releases/ao486_20190719.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7070aafc1d53970b0b4326814bc0abeca5f01c96e1f8988b21058975143ec8f8
3
+ size 4246728
MiSTer-devel_ao486_MiSTer/releases/ao486_20190927.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:387c23a5a03a8e5dc64dd33d4dcfe9aa6c96fbb6a1afa6b4e619bf123fb4b72c
3
+ size 4223868
MiSTer-devel_ao486_MiSTer/releases/ao486_20191221.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:968c18156699b01be542f0b40ee1f433a66fd0f06254f3092b6690a88b009d47
3
+ size 4264784
MiSTer-devel_ao486_MiSTer/releases/ao486_20200421.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81738ba2dbccd0be189238ccb411efb40678335ec193af3466d4dc92ca2d4701
3
+ size 4241400
MiSTer-devel_ao486_MiSTer/releases/ao486_20200510.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ca04bedf39b84ec966c6eafcc1034e9b501de6ee6aa5cb2d0d1ecea73ff678a
3
+ size 4278764
MiSTer-devel_ao486_MiSTer/releases/ao486_20200814.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67ae9ba0e83f2f24bbd0f112caa5cbaf4784807512d7a99e7f3258d1b20fa899
3
+ size 4188504
MiSTer-devel_ao486_MiSTer/releases/ao486_20200816.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6926b51b4baa8613e3f79f264ac247cecc9333ce05ad139d79d47814dc58a440
3
+ size 4182424
MiSTer-devel_ao486_MiSTer/releases/ao486_20200822.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00a7e67d52edf767239bc525af7497cd7453e29a4074a03bb83f7e7692abb3f8
3
+ size 4185160
MiSTer-devel_ao486_MiSTer/releases/ao486_20200831.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:021827614c901fa2d93cd4880f56e23809cd626d02a93f22f47a962bf7df2c89
3
+ size 4251688
MiSTer-devel_ao486_MiSTer/releases/ao486_20200907.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b61a91dc4b04defaaa39a123f26c859fb8a954242b34e88c3865bf89f59cba2
3
+ size 4200088
MiSTer-devel_ao486_MiSTer/releases/ao486_20200917.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:567fdc8788f9323ba63911f03570b5e8ebb93d9ff03035e5cb1611c1f7dd9fe0
3
+ size 4173312
MiSTer-devel_ao486_MiSTer/releases/ao486_20200922.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:210e575384a0b4881f4f0ce0f43fb3a4df90985739a61b285cedd58f0439adba
3
+ size 4233300
MiSTer-devel_ao486_MiSTer/releases/ao486_20201101.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0724ab6182a6021816d04a69834b737cb4821d144f6e5017bee66e89a81dd8c5
3
+ size 4176224
MiSTer-devel_ao486_MiSTer/releases/ao486_20201106.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d54d57dcd1df7974d4062e1e015917790cc6f32c21836515ce2b3c35d65b467
3
+ size 4154744
MiSTer-devel_ao486_MiSTer/releases/ao486_20210103.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c0f665f5ebf3b6380ed2a60841dce39239d37bc9880c8df2995058728ee9b75
3
+ size 4214804
MiSTer-devel_ao486_MiSTer/releases/ao486_20210107.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad3e2ea6f1073d8df413236386a4ea3d6ffab2177469cc0a0f2fb30854e92946
3
+ size 4199516
MiSTer-devel_ao486_MiSTer/releases/ao486_20210109.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fe840bdf64f95b687b93c85d444a694a46db62936ef4abd1d2c2f4aca2def17
3
+ size 4205416
MiSTer-devel_ao486_MiSTer/releases/ao486_20210117.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:323fe03492b5d3afa4adc502d358382ac32690b18ef51b97f82fc3c4b0db02e4
3
+ size 4210600
MiSTer-devel_ao486_MiSTer/releases/ao486_20210226.rbf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3db7c349cecf028e7512400b60e9495f0565ef0240f095e97599e607a4d8fd54
3
+ size 4192240