Post Reply 
Accuracy of Saturn CPU emulators
01-27-2020, 03:29 PM
Post: #1
Accuracy of Saturn CPU emulators
Hello,

I am wondering what the most accurate Saturn CPU emulator is (I am talking of the CPU emulator accuracy rather than the full calculator one).

Reading Hrast page about his emulators on HP 49g+/HP 50, it looks like the Saturn emulator used by those calculators was not fully accurate, in particular for BCD computation.

Is Christoph Gießelink and Sébastien Carlier Emu48 the most accurate one? I think I read somewhere that Christoph ran many tests on his calc to ensure accuracy (but can't find the info any more). I wonder how far this was pushed.
Find all posts by this user
Quote this message in a reply
01-28-2020, 05:37 AM
Post: #2
RE: Accuracy of Saturn CPU emulators
Um, let's clarify.

'Accuracy' terminology somewhat implies that calculated values are generally correct but maybe there are rounding errors or differences, error accumulations in chain calculations differ somewhat, etc.

With emulation of CPUs like Nuts, Saturns or TI TMS01xx calc processors...

- a bad instruction (i.e, not fully emulated) may result in COMPLETELY WRONG ANSWER
or a trivially wrong one - there can be wide variation, depending on type of math
operation, value, etc.

- calculations not using those bad instruction(s) are NOT AFFECTED. You could have a
machine instruction error that conceivably might only affect the 'arc' trig functions,
say, but not others.

So such errors may be more pattern-based than size/scale based.

A proper CPU emulation with all relvant CPU instructions used in user math operations properly
translated will preserve accuracy 100% - and will also preserve original *inaccuracy* 100%.

As we see somehow on some Saturn ARM emulations, some instructions were not translated properly (or all their modes properly understood).

Testing for accuracy errors might be one way to find errors in instruction translation-mock execution. However, it's probably better to build a testbed for each instruction and its parameters [with poss dependence on prior instructions] and see those execute properly.


Bill Wiese
San Jose CA









(01-27-2020 03:29 PM)ldesnogu Wrote:  Hello,

I am wondering what the most accurate Saturn CPU emulator is (I am talking of the CPU emulator accuracy rather than the full calculator one).

Reading Hrast page about his emulators on HP 49g+/HP 50, it looks like the Saturn emulator used by those calculators was not fully accurate, in particular for BCD computation.

Is Christoph Gießelink and Sébastien Carlier Emu48 the most accurate one? I think I read somewhere that Christoph ran many tests on his calc to ensure accuracy (but can't find the info any more). I wonder how far this was pushed.
Find all posts by this user
Quote this message in a reply
01-28-2020, 06:01 AM
Post: #3
RE: Accuracy of Saturn CPU emulators
hello,

As far as I know, the emu48 one is the most accurate...
Even more accurate that the one in the 50g series calculators!
Among other things, he paid attention to what the saturn would do when BCD operations were executed on non decimal numbers...
He is also emulating and counting CPU cycles! even 1/2 cycles...

On the other hand, the Saturn is not a complex CPU, which makes is much easier to emulate than an ARM of (gash!) intel chip.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
01-28-2020, 03:38 PM
Post: #4
RE: Accuracy of Saturn CPU emulators
(01-28-2020 05:37 AM)bwiese Wrote:  Testing for accuracy errors might be one way to find errors in instruction translation-mock execution. However, it's probably better to build a testbed for each instruction and its parameters [with poss dependence on prior instructions] and see those execute properly.

Yeah, that's how I would do: concentrate on an instruction and iterate through its inputs. I could do it on a my 48GX... I need to find a RS-232 to USB cable to attach the kit.

(01-28-2020 06:01 AM)cyrille de brébisson Wrote:  As far as I know, the emu48 one is the most accurate...
Even more accurate that the one in the 50g series calculators!
Among other things, he paid attention to what the saturn would do when BCD operations were executed on non decimal numbers...
He is also emulating and counting CPU cycles! even 1/2 cycles...

Great Smile Thanks!

Quote:On the other hand, the Saturn is not a complex CPU, which makes is much easier to emulate than an ARM of (gash!) intel chip.

Indeed. Part of my day job is to write ARM CPU models, some of them being extremely complex as they have not only to be functionally accurate, but also cycle accurate. It's incredibly more difficult than writing a Saturn model (even though I think writing a good Saturn model is not an easy task).

And x86, no way, never. That's the most horrible instruction set I ever had the displeasure to use.
Find all posts by this user
Quote this message in a reply
01-28-2020, 04:07 PM
Post: #5
RE: Accuracy of Saturn CPU emulators
(01-28-2020 03:38 PM)ldesnogu Wrote:  Yeah, that's how I would do: concentrate on an instruction and iterate through its inputs. I could do it on a my 48GX... I need to find a RS-232 to USB cable to attach the kit.

I have a USB-to-serial converter and a matching serial-to-48 cable, which I used a long time ago to transfer data to and from my 48G. I no longer have that 48G and don't expect to ever use those cables again, and I'd be happy to give them to someone who would get good use out of them. Send me an email (use the www link below to find it) if you're interested.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-29-2020, 06:29 AM
Post: #6
RE: Accuracy of Saturn CPU emulators
Hello,

>Indeed. Part of my day job is to write ARM CPU models, some of them being extremely complex as they have not only to be functionally accurate, but also cycle accurate.

Cool, where do you work? Do you have to also do the GPU?
How important is cycle accuracy in our modern age of cache and cachemiss? is it really possible to be cycle accurate?
Also, there is buss sharing with periferials that can cause the buss to be buzzy at random times. Are you emulating this also?
In other terms are you doing a bull SOC emulator, or just the core CPU?

>And x86, no way, never. That's the most horrible instruction set I ever had the displeasure to use.
Not even talking about the 64 bit extentions!

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
01-29-2020, 07:02 AM
Post: #7
RE: Accuracy of Saturn CPU emulators
(01-29-2020 06:29 AM)cyrille de brébisson Wrote:  Cool, where do you work?

I work at ARM.

Quote:Do you have to also do the GPU?
How important is cycle accuracy in our modern age of cache and cachemiss? is it really possible to be cycle accurate?
Also, there is buss sharing with periferials that can cause the buss to be buzzy at random times. Are you emulating this also?
In other terms are you doing a bull SOC emulator, or just the core CPU?

My team only deals with CPU, that's enough work Smile Every tiny detail is simulated: pipeline, reorder buffer, caches, hardware prefetchers, bus contentions, etc. We use these models to design next generation CPUs so cycle accuracy is paramount to take a decision.

Quote:>And x86, no way, never. That's the most horrible instruction set I ever had the displeasure to use.
Not even talking about the 64 bit extentions!

I find x86-64 more readable though quite far from RISC processors or m68k. But implementing all of x86-64 would be crazy, there are piles of old stuff that still have to be supported (16-bit mode, come on).

Back to the subject, I'd like to write a Saturn emulator for ARM for the fun of it. I wanted to write it for HP Prime Cortex-A7 but I found that alas I can't run native programs on the G2 without opening it Sad
Find all posts by this user
Quote this message in a reply
01-29-2020, 09:06 AM
Post: #8
RE: Accuracy of Saturn CPU emulators
(01-29-2020 06:29 AM)cyrille de brébisson Wrote:  How important is cycle accuracy in our modern age of cache and cachemiss? is it really possible to be cycle accurate?

It is possible to be cycle accurate. Look at MAME/MESS for old video games. If they aren't cycle accurate, they often aren't playable.

Is it useful in this context, that's an entirely different question Smile


Pauli
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)