Page 1 of 1
Replacement of ao486?
Posted: Thu Mar 02, 2023 11:29 pm
by thorr
I came across this and found it interesting: https://ieeexplore.ieee.org/document/9435812 I wonder if any of those developers would share their work here.
While ao486 is awesome, it is sort of a big hack in that it doesn't replicate any real-world CPU's. It would be great if we could replace it with a real CPU that is clock cycle accurate. In the above article, they claim to have replicated a Pentium computer in FPGA. If the code won't fit and/or be shared for use on the MiSTer, at least there are references linked at the bottom that might be useful to help make this possible. A Pentium may be asking too much, however, if it was properly developed, it might fit. A 486 has about 1.1 to 1.2 million transistors and a Pentium has about 3.3 million. A lot of that is used for cache. Perhaps a Pentium with a smaller cache is possible. ao486 has a lot of extra cache to make it faster, so with a better CPU design, less cache may be necessary. Just some random thoughts.
Also, I just looked and the above article says they got it to fit in a Cyclone IV, and the MiSTer is a Cyclone V. That is encouraging.
Re: Replacement of ao486?
Posted: Fri Mar 03, 2023 12:18 am
by Newsdee
Wihout source code, it's going to be a difficult rewrite.
There is code availabble for a 186 class CPU,
https://github.com/jamieiles/80x86
But it is not cycle acciratr like the CPU behind PCXT (MCL86), so its doubtlful if will be beneficial to port that core, versus just slowing ao486 down (as can currently be done)
Re: Replacement of ao486?
Posted: Fri Mar 03, 2023 12:36 am
by thorr
At least it shows it is possible to do a Pentium 50MHz with 32kb cache and a Sound Blaster and VGA card, and we have the names and country of the authors, so maybe we can find and ask them.
Re: Replacement of ao486?
Posted: Fri Mar 03, 2023 2:01 am
by Mr. Encyclopedia
Unlike say, the Nintendo 64, I don't think anyone has ever given a serious argument that a Pentium PC was impossible on MiSTer. The problem is ao486 already exists and is largely good enough for 90% of what folks want. It would be a large undertaking, at least as much work as Playstation and Saturn, to produce something that's only marginally better than what we have right now. This isn't a very appealing project for a developer community largely driven by personal interest.
One thing this does show, however, is how unlikely a Pentium processor coupled with a mid-90s accelerated graphics card would be. Like ao486, their project's FPGA is dominated by its emulated sound hardware, leaving little room for more than the most basic VGA card. The Cyclone IV they used is comparable to the Cyclone V in the De-10 Nano so I wouldn't expect any miracles on that front.
Don't get me wrong, I would love a less janky PC core on MiSTer, and a proper Pentium with better performance than ao486's bastard CPU would open the doors for a handful of games that run poorly or not at all in the current core, but I'd be surprised if it could get as far as late 90s 2D classics like Baldur's Gate, Age of Empires, or Rollercoaster Tycoon.
Re: Replacement of ao486?
Posted: Fri Mar 03, 2023 4:20 am
by throAU
Mr. Encyclopedia wrote: ↑Fri Mar 03, 2023 2:01 am
Don't get me wrong, I would love a less janky PC core on MiSTer, and a proper Pentium with better performance than ao486's bastard CPU would open the doors for a handful of games that run poorly or not at all in the current core, but I'd be surprised if it could get as far as late 90s 2D classics like Baldur's Gate, Age of Empires, or Rollercoaster Tycoon.
The other thing is that PC classics of that era can be run pretty well via either Dosbox, a pre-packaged version via GOG or whatever. The PC in general is less timing sensitive between components. ESPECIALLY when you get to performance levels beyond the 386/486 era.
I get that some people want a "do everything all in one" box, but that's more niche (I suspect) than those who just want to run old games as they used to play back in the day.
Not saying I'd say "no" to a better PC emulator if it was on the table, but in terms of "need" I think its several steps down the priority list in terms of providing an option that isn't already covered pretty well outside of the MiSTer project. But I'm not a core dev. If someone with the talent decides they want to take it on, win...
Re: Replacement of ao486?
Posted: Fri Mar 03, 2023 6:03 pm
by thorr
Sure we can run emulators, and sometimes that is the only option, and it is often a great option. However, we have some awesome high end cores on the MiSTer such as the PSX, so why not a Pentium. I mean, how cool would that be? As far as the effort goes, if the authors port their already existing work to the MiSTer, the effort may be minimal to get it up and running, and then it can be further developed from there to integrate all the bells and whistles that are implemented in ao486.
Re: Replacement of ao486?
Posted: Fri Mar 03, 2023 8:04 pm
by dmckean
There would be nothing minimal about this effort even if it's already written. Everything in the PCXT core was already written and it still took 6 months for it to be put together and debugged.
Re: Replacement of ao486?
Posted: Tue Jun 27, 2023 6:45 pm
by szhach
Mr. Encyclopedia wrote: ↑Fri Mar 03, 2023 2:01 am
Unlike say, the Nintendo 64, I don't think anyone has ever given a serious argument that a Pentium PC was impossible on MiSTer. [...]
One thing this does show, however, is how unlikely a Pentium processor coupled with a mid-90s accelerated graphics card would be. Like ao486, their project's FPGA is dominated by its emulated sound hardware, leaving little room for more than the most basic VGA card.
I wonder if it would be possible to do a Pentium core and offload the sound to an external device, whether that's something like MT32-Pi or a USB device. These external sound units seem pretty popular anyway, and I'd already be using one for DOS on the MiSTer if I could.
If that freed up space on the FPGA for plausible graphics, I think this would be amazing.
Re: Replacement of ao486?
Posted: Tue Jun 27, 2023 9:14 pm
by rhester72
It might be worth reading the myriad of other threads on the subject that make abundantly clear that neither the awesome complexity of the Pentium nor any sort of 3D-accelerated Pentium-era graphics card is remotely feasible on the DE10 FPGA.
Re: Replacement of ao486?
Posted: Wed Jun 28, 2023 4:04 am
by thorr
Respectfully and entirely disagree. I believe that a fast, compatible x86 plus Voodoo compatible graphics card is possible. We don't need a Pentium. We need a compatible CPU that can be designed from scratch with the latest CPU technology and optimized for the MiSTer hardware. PC's are the most flexible computers and there are an infinite number of ways to design them and a very finite amount of CPU instructions they need to accomplish to achieve compatibility. Given FPGAzumspass's track record, I think he could make a core that can run Windows 98 era 3D games with a CPU running at or near 100MHz, a simple FPU, and an early Voodoo compatible 3D card. Also, I think it would be a fun core to work on because it would be a unique design and not have to reproduce something existing exactly.
Re: Replacement of ao486?
Posted: Wed Jun 28, 2023 9:37 am
by Hodor
thorr wrote: ↑Wed Jun 28, 2023 4:04 am
Respectfully and entirely disagree. I believe that a fast, compatible x86 plus Voodoo compatible graphics card is possible. We don't need a Pentium. We need a compatible CPU that can be designed from scratch with the latest CPU technology and optimized for the MiSTer hardware. PC's are the most flexible computers and there are an infinite number of ways to design them and a very finite amount of CPU instructions they need to accomplish to achieve compatibility. Given FPGAzumspass's track record, I think he could make a core that can run Windows 98 era 3D games with a CPU running at or near 100MHz, a simple FPU, and an early Voodoo compatible 3D card. Also, I think it would be a fun core to work on because it would be a unique design and not have to reproduce something existing exactly.
It would be a whole new core made from scratch. Feasable? Most likely, but with a huge amount of work behind.
Re: Replacement of ao486?
Posted: Wed Jun 28, 2023 9:54 am
by breiztiger
if we can have a more accurate 386dx with fpu ...
Re: Replacement of ao486?
Posted: Wed Jun 28, 2023 2:30 pm
by rhester72
thorr wrote: ↑Wed Jun 28, 2023 4:04 am
Respectfully and entirely disagree. I believe that a fast, compatible x86 plus Voodoo compatible graphics card is possible. We don't need a Pentium. We need a compatible CPU that can be designed from scratch with the latest CPU technology and optimized for the MiSTer hardware. PC's are the most flexible computers and there are an infinite number of ways to design them and a very finite amount of CPU instructions they need to accomplish to achieve compatibility. Given FPGAzumspass's track record, I think he could make a core that can run Windows 98 era 3D games with a CPU running at or near 100MHz, a simple FPU, and an early Voodoo compatible 3D card. Also, I think it would be a fun core to work on because it would be a unique design and not have to reproduce something existing exactly.
...and what you'd wind up with at the CPU level would look shockingly like ao486, since that's precisely the design approach that resulted in its creation. It's "mostly" compatible...and that's where it's at.
With complete respect, I think you're describing total fantasy, and it's not a matter of developers being clever or not...it's bog-simple physics. You are, of course, absolutely welcome to believe otherwise.
Re: Replacement of ao486?
Posted: Wed Jun 28, 2023 3:39 pm
by Neocaron
It should be doable to create a cleaner and less cluttered version of the ao486 with additional features like an FPU or a low to mid-tier GPU. The current implementation was evolved into something it never was suppose to be. However, if a new iteration is planned with a specific focus on these features right from the beginning, maybe there's a good chance they can be successfully implemented. Of course, it depends on whether anyone feels inclined to undertake a project like this. I definitely feel like if the N64 is possible this is too. Then again I'm happy with the current core as well, I get to run it at 100mhz stable and we even have now emulated fpus so it's definitely a nice package that exist.
Re: Replacement of ao486?
Posted: Wed Jun 28, 2023 6:40 pm
by thorr
What Neocaron said reflects my thoughts as well, and he said a lot of what I was going to say, so sorry if this is repetitive. I will just make a list of points:
- We will never know for sure unless it is attempted, and we have our own feelings about whether it is possible in the meantime. (I believe I am right in this case though, lol)
- ao486 was adapted from the Bochs software implementation trying to create an x86 CPU. This is just one design. This is very far from what a fresh CPU designed from scratch with the MiSTer' strengths and weaknesses in mind would be.
- I have an Electrical Engineering degree specializing in Computer Engineering, so I know quite a bit about how CPU's work. Designing a basic x86 CPU is not that hard (for someone who knows the technology and can leverage existing work that has already been done and documented). Making it faster is also not that hard, especially if the designer is "lazy" about it and doesn't care about the number of transistors, etc. that they use. There are many well known and documented techniques to make things faster. This is where it starts to take up space on the FPGA. Just like with software, hardware can be lazy and take up lots of space, or time can be put in to make it smaller, more efficient, faster, and more cleverly designed. For a good real-world example of what I am talking about, just look at how capable the Atari 2600 is with the clever techniques used by the software programmers to make the impossible possible in such a small space. Watch the video from David Crane on how he created Pitfall. Every little ounce of juice was squeezed out of the Atari 2600 to make Pitfall possible and fit on the cartridge. Making things small, efficient and amazing all at the same time takes time and creativity on the part of the designer.
- Besides the above point, we already have the Playstation and Saturn cores as real-world examples of what the MiSTer is capable of. These systems have the exact same components (CPU, 2D and 3D video, memory, sound, CDROM support, controller support, etc.) that we are talking about here for an ao486 replacement and they fit and are working great on the MiSTer.
- The first N64 emulator, UltraHLE, used Glide to almost directly map the N64 3D graphics calls to 3DFX Voodoo cards and it worked at full speed when it was released in January, 1999. Imagine that, a PC from January 1999, the era we are talking about here that we are suggesting to create on the MiSTer, was capable of a full speed N64 emulator. If a PC of that era can emulate an N64, and the MiSTer can have an N64 core (still to be determined, but I have faith), then I see no reason why a PC with the equivalent power of an N64 could not be created on the MiSTer. The CPU would be different, but both have CPU's. The memory would be different, but the advantage here goes to the PC because it can be made with MiSTer technology, and not have to emulate N64 memory technology. The graphics would be very similar as evidenced by the UltraHLE / Glide interoperability.
Basically to sum it all up. If the MiSTer can do a PSX, Saturn and N64, it can do a PC with Voodoo. The technology behind all four is very similar. That is my opinion.
Re: Replacement of ao486?
Posted: Wed Jun 28, 2023 7:09 pm
by rhester72
- The first point is like arguing that gravity didn't exist until someone proved it. Even an attempt will prove nothing if it fails. Did it fail because the hardware couldn't do it or the programmer couldn't? (However, we do know very real facts about gate operating speeds, work units, etc. associated with the DE10-Nano that pretty conclusively demonstrates what is and isn't possible without need for conjecture.)
- I'm aware...and that's why I made that point. Bochs is a SUPER simplistic design, and about as close as you'll ever get to the design you described. MiSTer has no inherent strengths when it comes to basic CPU emulation except where parallel multiprocessing (read: Amiga) is involved. x86 is very literally the antithesis of that.
- I was designing CPUs two decades ago, so you should understand all too well the design constraints, especially on a prototyping/lab system. However, your statements (about x86 CPU design, speed, et al) are COMPLETELY at odds with processor design, especially on FPGA. x86 compatibility beyond a basic level is a challenge because it requires absolute compatibility going all the way back to the 8088 - if you think Pentium's 3.1MM transistors were 'mostly unnecessary' and can just be 'simplified' by orders of magnitude and still be compatible, you should be a Research Fellow at Intel, not hanging out on retrogaming forums. You cannot alter a fixed gate speed, and thus there's only so much speed you can get...you're conflating cache expansion (as happened with ao486) with compute throughput, and they are not even remotely the same thing. Faster also usually does NOT equate to more gates, but less. I think you're mixing clever software design with hardware...they do not equate, even a little bit. Again, as a CPE, you should know all this already, and the 'mythical designer' argument has been baseless from the start. There are no miracles in compute.
- The Playstation - arguably more complex than the Saturn - was not particularly surprising in reality, given the 'runs on a potato' nature of equivalently compatible software solutions like DuckStation. They do not contain anything approaching the same components as a PC with Voodoo, nor the complexity, by at least two orders of magnitude. You're basically saying "well, a Pinto is a car, and a Ferrari is a car, so you ought to be able to build a Pinto with the handling characteristics and performance of a Ferrari" if only you're mythologically clever enough/want it badly enough. I'm sorry...no.
- What does GLide have to do with it? The two APIs were similar enough that doing that sort of 'thunking' wasn't terribly difficult at all. Your mention of the N64 emulator kind of cuts to the chase though - while architecturally as different from an x86 rig as it could possibly get in every meaningful way, the MiSTer hardware just doesn't seem fast enough to achieve N64. There's no magic pixie dust. The rest just harkens back to the 'all ducks are birds, but not all birds are ducks' argument.
Thus, I again could not possibly disagree more with your argument, logic, or comparisons if I tried...and engineering does not involve opinion, it's solidly rooted in the world of facts and physics.
All that being said, I'm not trying to rain on your parade, but I can't make a good-faith statement like "I wish I were wrong" because I objectively know that I'm not. The main reason I responded in the first place is because I don't want less technical readers to see your fantasies-masked-as-claims and think such things are ACTUALLY possible, and be terribly disappointed when they never come to fruition. That being said...feel free to wish and want to your heart's content, and I won't contribute further (because I truly have nothing further to add) nor bother you about it. Dreams have value...but have to be tempered with reality to achieve any actual result. The DE10 simply cannot do this, full stop. AMD's release of the most badass 'prosumer' FPGA on the planet this week should be able to do such a thing, with a number of boards in parallel, and it is many MANY times larger and more powerful than MiSTer.
Re: Replacement of ao486?
Posted: Wed Jun 28, 2023 8:00 pm
by thorr
Thanks for your feedback. I am not trying to disappoint anyone with unreasonable claims. I am simply challenging the idea that what I am saying is impossible. I am absolutely ok with being proven wrong and would not take offense to it. Here are a few points related to your latest post:
You are right about 8088 compatibility being a huge limiting factor in the design that does rain on my parade of being free to design as you want. Thanks for making that point.
I am not knowledgeable about the specifics of the current ao486 CPU design. What I do know is that different CPU instructions can take multiple clock cycles to complete. Parallelism, pipelining and branch prediction might possibly be used to try to improve efficiency of each clock cycle. You mentioned parallelism is difficult/impossible with x86. Maybe you are right. I don't know. I am not an x86 expert (or any other CPU expert for that matter). I learned about CPU design more generically.
FPGAzumSpass who is knowledgeable about ao486 wrote the following in another thread:
Still, the CPU could use some other improvements that are hard to integrate in the current design:
branch prediction: Would be very useful with such a long pipeline
real Level 1 caches: The current level 1 cache is behind the (slow) TLB and therefore takes like 5 cycles to deliver a result when the TLB is used(e.g. all windows programs)
operand forwarding: result registers from a calculation cannot be used for 2 cycles until the next calculation. With so few registers as the 486 has this is a serious issue and can bring down the cpu to 1/3 speed in some situations.
The above goes back to my point that a new CPU design might lead to something faster than what we have now. What we have now is already almost fast enough for early Voodoo 3D games. The above might give it the extra push that is needed to make it be fast enough. Then we just need to fit the Voodoo on the FPGA. Other things can be removed to make room for it when compared to ao486. Since the idea is a new design, there would be nothing to remove in that case. Just put in the necessary stuff and leave out the other things (extra sound cards, etc.).
A large chunk of the Pentium's transistor count goes to caches. L1 and L2 cache sizes can be adjusted. My thought is that the designer would fit everything they need to on the MiSTer FPGA chip first, then whatever is left would be used for the caches. Another thought I had is perhaps the MiSTer SDRAM could be used for cache as well at a higher layer. It probably is a lot faster than the RAM on the computers back then and might serve well to improve performance. I don't know if this would be possible though since it is outside the FPGA.
I do know that less gates are usually simpler and faster. That is why there are longer pipelines. When a long pipeline fails, it is a huge hit to performance. The thing is in the case of the MiSTer, it is limited to 100MHz or so. That is fixed. With a fixed frequency, perhaps the pipelines can be shorter with more gates and still be able to run at 100MHz. When the pipeline fails, it won't be as big of a hit to the performance. With a good balance act of complexity within the 100MHz speed limit, shorter pipelines and improved performance might be achievable. Edit: I had to leave when I wrote this and didn't have time to fully explain. What I am trying to say is that by using more gates, it might be possible to complete the more complex CPU instructions in less but slower cycles. Since the MiSTer is limited to 100MHz which is relatively slow, more of the CPU instruction might be able to be done within a clock cycle with more gates than the current simple ao486 design that might be broken into multiple clock cycles for each instruction.
My point about Glide was basically saying that the Voodoo and the N64 3D hardware is probably similar in capability and performance, and if the N64 core works for 3D, then a Voodoo might too.
Thanks again for your thoughts.
Re: Replacement of ao486?
Posted: Fri Jun 30, 2023 1:19 am
by HarborSeal
I'm not so sure that ao486 needs to be replaced with a Pentium core. When I had a Pentium MMX CPU in the late 90's, it struggled to run Apogee shareware games from the early 90's, since they often ran too fast or simply weren't compatible with DOS 7 included with Win9x. I believe it would be better to have separate cores for Pentium and 486/386. Similar as having the PC XT separate from ao486. Devs and users would be better off not worrying about whether a Pentium core will run pre-win9x DOS games or not.
ao486 needs improvement or a replacement that does what it currently excels at. Which is 386/486 era titles from late 80's to mid-90's. It's biggest problem is memory management. Games like Duke Nukem 3D cannot run without crashing unless they are using dos32a.exe instead of the dos4gw.exe they are bundled with. It's also somewhat inefficient and bloated. Clocking the core at 90mhz and a larger cache is necessary in order to achieve similar performance to a 33mhz 486 chip. CD Audio support and Math co-processor would also be beneficial.
Re: Replacement of ao486?
Posted: Fri Jun 30, 2023 9:22 am
by cursedverses
I personally would love to see a more accurate 486DX2 implementation with a proper architecture. Whilst someone like fpgazumspass has been able to architect the PSX core to do crazy things (like PSX 2x) I wouldn't expect him to take this on unless it was a labour of love (like the N64 clearly is to him)
Unless someone bites and actually makes the core, I'm mostly fine with what we have.
Re: Replacement of ao486?
Posted: Fri Jun 30, 2023 2:06 pm
by dmckean
Implementing operand forwarding into the current core would go a long way into making it behave and feel more like a real i486.
Re: Replacement of ao486?
Posted: Mon Jul 03, 2023 5:29 am
by Caldor
A new x86 PC project could probably be great, but I also think that unless it is some highly experienced and skilled FPGA developer it could take a year or more to implement well. This core was made early on by converting some emulator code to FPGA code, and a lot of time was spent simply cleaning up that code since it meant it had a lot of junk code from that conversion process that was not really needed.
So for this core the developers as I understand it, had to go over the FPGA code and clean it up whenever a new feature was to be added.
But as others have said, adding FPU would help this core a lot, CD audio and maybe some other things. Although it might not actually be possible to add FPU without running out of logic space again. There might also be the option to add L3 CPU cache. No idea if that might actually help in any way.
We have seen some important improvements to this core over the years already. Even after the L1 and L2 CPU cache implementations. I think you can know play mouse games without eventually the mouse beginning to seemingly get self awareness and decide to jump around like a jumping jack. I also think a lot of other compatibility issues where fixed.
Re: Replacement of ao486?
Posted: Fri Jul 07, 2023 9:58 pm
by rhester72
I'm not sure what a FPU is supposed to solve. The 486SX was very much a thing and didn't seem to inhibit gaming too much.
Re: Replacement of ao486?
Posted: Fri Jul 07, 2023 11:22 pm
by thorr
rhester72 wrote: ↑Fri Jul 07, 2023 9:58 pm
I'm not sure what a FPU is supposed to solve. The 486SX was very much a thing and didn't seem to inhibit gaming too much.
Better Windows 98 compatibility is the main thing that comes to mind.
Re: Replacement of ao486?
Posted: Fri Jul 07, 2023 11:22 pm
by thorr
Besides my idea of designing a new core with a new CPU design from scratch that may or may not ever happen, I agree fully with the idea of making ao486 better with compatibility than it is today and/or making a cycle accurate 486 core that replicates a real CPU. That would be very cool.
As linked in the first post in this topic, a cycle accurate 50MHz Pentium was made on an FPGA similar to the MiSTer's, so at least that is proven to be possible.
Re: Replacement of ao486?
Posted: Sat Jul 08, 2023 6:21 am
by Newsdee
Caldor wrote: ↑Mon Jul 03, 2023 5:29 am
A new x86 PC project could probably be great, but I also think that unless it is some highly experienced and skilled FPGA developer it could take a year or more to implement well
I forgot how long it took for the PCXT core to mature but it was probably around a year... for something even simpler than a 386. Spark2k06 did a great job writing new features and also combining the work from multiple developers (kitune-san, MicroCoreLabs, and more) to make the core really nice.
So I'd expect a full ao486 replacement (or at least a highly clocked 386 CPU) will take at least as much people and time to pull off.
Hopefully any dev who would be interested will find that they have lots of support and eager testers from this crowd
Re: Replacement of ao486?
Posted: Sat Jul 08, 2023 1:02 pm
by bazza_12
I don't really understand much of this thread, but my first pc was a 486dx2/66 back in 1994, I'd love that as a core.