Page 1 of 1

OPL3 Test

Posted: Wed Aug 05, 2020 7:58 pm
by Lukage
I have adapted exact FPGA OPL3 core from Greg Taylor (https://github.com/gtaylormb/opl3_fpga) for MiSTer ao486 core, as I was curious if exact OPL3 is possible within the core. I am throwing here first version of it, there are some errors in conversion to 16-bit 48kHz output stream I am aware of. I tried to be exact, so the core runs on original OPL3 chip frequency and sample rate with exact same timings and oversampling. Resulting waveform should be really as close as it gets to original OPL3 core. I am putting resulting rbf for testing, any feedback is very welcome, please try it against original ao486 opl3 emulation on your favorite tracks and let me know.

You can certainly try https://github.com/gtaylormb/opl3_fpga/ ... re/opl3dro this files with IMFPLAY, as I do not know if OPL detection is working properly for now. Please note that OPL2/OPL3 switch in MiSTer menu does nothing, chip is always in OPL3 mode.

rbf is generated from dev branch, so it would be wise to compile yourself and update your MiSTer binary, if ao486 fails to boot from harddisk or floppy.

Core is somewhat hungry, original OPL3 core within ao486 is here:

Logic utilization (in ALMs): 32,428 / 41,910 ( 77 % )
Total registers: 28027
Total block memory bits: 3,520,771 / 5,662,720 ( 62 % )
Total RAM Blocks: 448 / 553 ( 81 % )
Total DSP Blocks: 40 / 112 ( 36 % )
Total PLLs: 3 / 6 ( 50 % )

Greg Taylor's core with ao486 modifications is here:

Logic utilization (in ALMs): 35,548 / 41,910 ( 85 % )
Total registers: 35662
Total block memory bits: 3,133,443 / 5,662,720 ( 55 % )
Total RAM Blocks: 401 / 553 ( 73 % )
Total DSP Blocks: 40 / 112 ( 36 % )
Total PLLs: 4 / 6 ( 67 % )

As you can see, OPL3 itself occupies about 8% of available ALMs. There is also a drawback with compile time, fitter took 3 hours 14 minutes to complete.

Is there some interest in this exact OPL3 emulation ?

Re: OPL3 Test

Posted: Wed Aug 05, 2020 8:06 pm
by jordi
yes it does, nice to see even more progress in regards of sound card!!!

Re: OPL3 Test

Posted: Wed Aug 05, 2020 8:22 pm
by Caldor
That is a lot more registers... but given we are limited by the size of this, I am thinking maybe the AO486 core could be given branches for special hardware, until maybe some other solution is found, with the main AO486 branch is one that tries to implement as much as possible by possibly cutting corners in the areas that it can like using a less accurate OPL3.

Re: OPL3 Test

Posted: Wed Aug 05, 2020 8:24 pm
by Chris23235
Interesting, many thanks, I will try this for sure. Is it for the last official core or the recent test builds?

Re: OPL3 Test

Posted: Wed Aug 05, 2020 8:29 pm
by Lukage
This is one of the recent test builds.

Re: OPL3 Test

Posted: Wed Aug 05, 2020 8:51 pm
by AntialiasedPixel
I love the strive for accuracy, do we have any idea how far off the existing a0486 implementation is from this one? I've seen some people show graphs comparing wave output on the various console cores, I wonder if something similar could be done for this core?

Re: OPL3 Test

Posted: Wed Aug 05, 2020 9:46 pm
by Higgy
Nice work. I have an OPL3 card in my Pentium III PC.

@Lukage You might know all this, but I will put it here in case there is new info. I was thinking the FPGA used in the tiny FleaOhm is much smaller than in the MiSTer so maybe the OPL3 implementation used is smaller? Anyway here is info:

https://opencores.org/projects/next186_soc_pc
https://github.com/Basman74/Next186

Re: OPL3 Test

Posted: Wed Aug 05, 2020 10:01 pm
by SuperBabyHix
@Higgy, maybe I'm misunderstanding, but on that first page it seems to indicate the Adlib/OPL3 was only on the Nexsys4 board, "An Adlib/OPL3 implementation was added on Nexys4 version." Not sure how it compares to the DE-10 Nano.

Re: OPL3 Test

Posted: Thu Aug 06, 2020 3:55 am
by Lukage
This is corrected version, should be OK to test without any mixing errors. This is what I should have posted first.... :roll:

Re: OPL3 Test

Posted: Thu Aug 06, 2020 4:18 am
by Lukage
Higgy wrote: Wed Aug 05, 2020 9:46 pm Nice work. I have an OPL3 card in my Pentium III PC.

@Lukage You might know all this, but I will put it here in case there is new info. I was thinking the FPGA used in the tiny FleaOhm is much smaller than in the MiSTer so maybe the OPL3 implementation used is smaller? Anyway here is info:

https://opencores.org/projects/next186_soc_pc
https://github.com/Basman74/Next186
This is the OPL3 core which is running in the original ao486.

Re: OPL3 Test

Posted: Thu Aug 06, 2020 7:22 am
by Higgy
Sorry this is where my poor understanding of FPGA's comes in. The OPL3 was ported/compiled also for the FleaOhm which uses a Lattice FPGA. I just thought that this OPL3 Core might be more mature/smaller than the original one mentioned at the beginning of this thread and it might be able to be ported to the DE-10 Nano.
Thanks

Re: OPL3 Test

Posted: Thu Aug 06, 2020 7:51 am
by FPGAzumSpass
I don't know if the OPL3 really needs like 8000FF...i wouldn't wonder if some of them can be packed into Blockram, so the ressource usage goes down.

Re: OPL3 Test

Posted: Thu Aug 06, 2020 2:47 pm
by Lukage
FPGAzumSpass wrote: Thu Aug 06, 2020 7:51 am I don't know if the OPL3 really needs like 8000FF...i wouldn't wonder if some of them can be packed into Blockram, so the ressource usage goes down.
It is not much susprising given that it is fully unrolled and there are no FPGA space conservation techniques. But still, it took those 8000 FFs. Original Z80 based OPL3 takes in total 1325.3 post-fitter ALMs. This version uses in total 5623.1 post-fitter ALMs, from which 4372.0 are for channels itself, 1198.2 ALMs are for register file and rest is glue logic, timers, etc.

It is very unpractical to use it in ao486 core.

I think that I will rather look over Nuked OPL3 software code, which is based on real YM262 chip decapsulation, and leans towards bit-perfect emulation in software (but still not there yet). In the end, there should be enough speed in FPGA to run it on some very small footprint suitable MCU (Z80 for instance ;) ), which is what really conserves FPGA space, and that should be the way to have perfect OPL3 emulation.

Re: OPL3 Test

Posted: Mon May 03, 2021 8:09 pm
by sofakng
Has there been any updates to this?

It sounds like it's impossible (due to FPGA space) to implement into the ao486 core, but I'd love a core with an accurate OPL3 just to play audio files, etc.

Re: OPL3 Test

Posted: Sat Sep 03, 2022 8:53 am
by jordi
Lukage wrote: Wed Aug 05, 2020 7:58 pm I have adapted exact FPGA OPL3 core from Greg Taylor (https://github.com/gtaylormb/opl3_fpga) for MiSTer ao486 core, as I was curious if exact OPL3 is possible within the core. I am throwing here first version of it, there are some errors in conversion to 16-bit 48kHz output stream I am aware of. I tried to be exact, so the core runs on original OPL3 chip frequency and sample rate with exact same timings and oversampling. Resulting waveform should be really as close as it gets to original OPL3 core. I am putting resulting rbf for testing, any feedback is very welcome, please try it against original ao486 opl3 emulation on your favorite tracks and let me know.

You can certainly try https://github.com/gtaylormb/opl3_fpga/ ... re/opl3dro this files with IMFPLAY, as I do not know if OPL detection is working properly for now. Please note that OPL2/OPL3 switch in MiSTer menu does nothing, chip is always in OPL3 mode.

rbf is generated from dev branch, so it would be wise to compile yourself and update your MiSTer binary, if ao486 fails to boot from harddisk or floppy.

Core is somewhat hungry, original OPL3 core within ao486 is here:

Logic utilization (in ALMs): 32,428 / 41,910 ( 77 % )
Total registers: 28027
Total block memory bits: 3,520,771 / 5,662,720 ( 62 % )
Total RAM Blocks: 448 / 553 ( 81 % )
Total DSP Blocks: 40 / 112 ( 36 % )
Total PLLs: 3 / 6 ( 50 % )

Greg Taylor's core with ao486 modifications is here:

Logic utilization (in ALMs): 35,548 / 41,910 ( 85 % )
Total registers: 35662
Total block memory bits: 3,133,443 / 5,662,720 ( 55 % )
Total RAM Blocks: 401 / 553 ( 73 % )
Total DSP Blocks: 40 / 112 ( 36 % )
Total PLLs: 4 / 6 ( 67 % )

As you can see, OPL3 itself occupies about 8% of available ALMs. There is also a drawback with compile time, fitter took 3 hours 14 minutes to complete.

Is there some interest in this exact OPL3 emulation ?
Has JTOPL the same size requirements?

Re: OPL3 Test

Posted: Tue Oct 11, 2022 7:14 pm
by sofakng
Any updates? I'd love to see JTOPL or FPGA OPL3 core from Greg Taylor implemented in the latest ao486 core. I think even if the NukedOPL3 code could be implemented it would be fantastic.

I think this would bring the core to nearly perfect 486, Adlib, and SoundBlaster functions?

Re: OPL3 Test

Posted: Thu Oct 13, 2022 6:01 pm
by ferropop
Would also be incredibly interested in this, would donate etc. It feels historically important to preserve this chip, and to experience that sound coming from a slightly noisy 1/8" output lol. We probably all share this weird sentiment given that we're here to begin with.

Re: OPL3 Test

Posted: Thu Oct 13, 2022 6:48 pm
by sofakng
I would be more than glad to donate as well!

Re: OPL3 Test

Posted: Fri Apr 05, 2024 5:07 pm
by synthop

FYI I've reduced the core size of https://github.com/gtaylormb/opl3_fpga in half and I've integrated it ao486_MiSTer. It's using 4% more ALMs than the NextZ80CPU implementation. But it fits, it's building, and it meets timing. I have some ideas to reduce the area even further.

My branch is at https://github.com/gtaylormb/ao486_MiST ... _opl3_fpga

I just ordered a DE10-Nano so once I get it I can verify/debug the core and PR it to the main repo.


Re: OPL3 Test

Posted: Fri Apr 05, 2024 6:33 pm
by sofakng

This is great, thank you so much for working on it!!

I'll give it a try when I get a chance and let you know how it works!