OPL3 Test

Lukage
Posts: 49
Joined: Wed Aug 05, 2020 7:34 pm
Been thanked: 55 times

OPL3 Test

Unread post 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 ?
Attachments
ao486-a6023474-opl3.zip
(1.94 MiB) Downloaded 310 times
jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Test

Unread post by jordi »

yes it does, nice to see even more progress in regards of sound card!!!
User avatar
Caldor
Top Contributor
Posts: 930
Joined: Sat Jul 25, 2020 11:20 am
Has thanked: 112 times
Been thanked: 111 times

Re: OPL3 Test

Unread post 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.
User avatar
Chris23235
Top Contributor
Posts: 982
Joined: Sun May 24, 2020 8:45 pm
Has thanked: 127 times
Been thanked: 197 times

Re: OPL3 Test

Unread post by Chris23235 »

Interesting, many thanks, I will try this for sure. Is it for the last official core or the recent test builds?
Lukage
Posts: 49
Joined: Wed Aug 05, 2020 7:34 pm
Been thanked: 55 times

Re: OPL3 Test

Unread post by Lukage »

This is one of the recent test builds.
AntialiasedPixel
Posts: 44
Joined: Mon May 25, 2020 2:17 am
Been thanked: 2 times

Re: OPL3 Test

Unread post 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?
Higgy
Posts: 91
Joined: Mon May 25, 2020 9:37 am
Has thanked: 7 times
Been thanked: 30 times

Re: OPL3 Test

Unread post 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
User avatar
SuperBabyHix
Posts: 152
Joined: Sun May 24, 2020 8:26 pm
Has thanked: 45 times
Been thanked: 36 times

Re: OPL3 Test

Unread post 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.
Lukage
Posts: 49
Joined: Wed Aug 05, 2020 7:34 pm
Been thanked: 55 times

Re: OPL3 Test

Unread post by Lukage »

This is corrected version, should be OK to test without any mixing errors. This is what I should have posted first.... :roll:
Attachments
ao486-a6023474-corr.zip
(1.94 MiB) Downloaded 292 times
Lukage
Posts: 49
Joined: Wed Aug 05, 2020 7:34 pm
Been thanked: 55 times

Re: OPL3 Test

Unread post 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.
Higgy
Posts: 91
Joined: Mon May 25, 2020 9:37 am
Has thanked: 7 times
Been thanked: 30 times

Re: OPL3 Test

Unread post 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
FPGAzumSpass
Core Developer
Posts: 385
Joined: Sat May 23, 2020 12:55 pm
Has thanked: 42 times
Been thanked: 414 times

Re: OPL3 Test

Unread post 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.
Lukage
Posts: 49
Joined: Wed Aug 05, 2020 7:34 pm
Been thanked: 55 times

Re: OPL3 Test

Unread post 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.
sofakng
Posts: 138
Joined: Fri Jun 19, 2020 12:52 am
Been thanked: 23 times

Re: OPL3 Test

Unread post 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.
jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Test

Unread post 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?
sofakng
Posts: 138
Joined: Fri Jun 19, 2020 12:52 am
Been thanked: 23 times

Re: OPL3 Test

Unread post 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?
ferropop
Posts: 52
Joined: Wed Jul 14, 2021 2:44 pm
Been thanked: 4 times

Re: OPL3 Test

Unread post 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.
sofakng
Posts: 138
Joined: Fri Jun 19, 2020 12:52 am
Been thanked: 23 times

Re: OPL3 Test

Unread post by sofakng »

I would be more than glad to donate as well!
synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Test

Unread post 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.

sofakng
Posts: 138
Joined: Fri Jun 19, 2020 12:52 am
Been thanked: 23 times

Re: OPL3 Test

Unread post 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!

Post Reply