Discussion:
[Simh] Implementing a floating point math accelerator simulator
Seth Morabito
2018-09-11 23:11:34 UTC
Permalink
Hello everyone,

I would like to solicit some advice from the group, especially from those with more experience writing simulators.

I have recently started toying with a simulation of the AT&T 3B2/400 Math Acceleration Unit (the WE32106 MAU). This was an optional co-processor that could be fitted into any 3B2/310 or 3B2/400 and supplied hardware acceleration for floating point math. It implements the IEEE 754-1985 spec faithfully. It offers fairly complex features, including instructions to cast any type to any other type (single precision, double precision, or extended precision). Internally, all operations are done on 80-bit extended precision values, but on output these can be cast to the appropriate type. And of course it handles all of the exceptional cases that you would expect it to (underflow, overflow, divide by zero, etc.)

For my prototype code, I've just done a nasty kludge and used C casting to convert between types -- it just so happens that on the platform and compiler I'm using, the standard C float, double, and long double types are stored in precisely the same IEEE-754 format that the WE32016 MAU uses. But of course the C standard doesn't require that, it's just lucky chance. Obviously this is not cross-platform code, and it's very brittle.

Floating point is not my cup of tea. I'm not an expert in IEEE-754, nor do I really want to reinvent the wheel. Nevertheless, I'd like to find a suitable cross-platform way to handle it, without leaning too much on assumptions about the compiler.

If you've done any work on floating point emulation, can you drop me a line? I'd like to figure out how best to proceed with this project.

All the best,

-Seth
--
Seth Morabito
Poulsbo, WA
***@loomcom.com
Bob Supnik
2018-09-12 23:47:44 UTC
Permalink
There's an IEEE-compliant floating point simulator in the Alpha code
base. However, it only implements what Alpha required, in particular:

- No gradual underflow.
- No 80b floating point (not needed to produce IEEE accurate results for
single- and double-precision).

You might find John Hauser's SoftFloat to be of more interest, as it is
very general and implements every possible useless goodie of the
standard as is existed in the 20th century. It does not have the fifth
rounding mode that was added more recently, but the chips of that era
wouldn't have it either.

Bob Supnik

Loading...