FPU present, or not?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

FPU present, or not?

Post by Combuster »

I've been trying to manually detect FPU presence on old 32-bit chips, but so far it doesnt seem to work.
Since i dont have 386s of my own, I compiled a version of bochs without FPU, but the sample test i got from here (modified) reads as if the emulator does have one.

So i'm wonder if anybody knows how to solve the following problem:
How can I detect the presence of an 80287, 80387 or compatible, as well as distinguishing a 486 with onboard fpu, from a 486 without one.

Thanks in advance
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: FPU present, or not?

Post by Brendan »

Hi,

Can you post your FPU present/not-present code?
Combuster wrote:How can I detect the presence of an 80287, 80387 or compatible, as well as distinguishing a 486 with onboard fpu, from a 486 without one.
Once you know if an FPU is present or not, then you can use the CPU's type to determine most of them - for e.g. an 8086 can only be used with an 8087, and an 80286 can only be used with an 80287. For 80386 comparing positive and negative infinity should work to decide between an 80287 and 80387 (it's the same method used by Intel themselves).

AFAIK for 80486, there never was a chip containing the FPU and nothing else - the "FPU" contained an entire CPU too and was very similar to a 80486DX. If you've got a motherboard with an 80486SX, then plugging in the "FPU" disabled the 80486SX completely and everything was done by the "FPU". :)


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

oh well, stupid me
i forgot to add an N to an JE instruction resulting in bogus output :oops:

Thanks anyway for the history lesson :)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Re: FPU present, or not?

Post by carbonBased »

Brendan wrote: AFAIK for 80486, there never was a chip containing the FPU and nothing else - the "FPU" contained an entire CPU too and was very similar to a 80486DX. If you've got a motherboard with an 80486SX, then plugging in the "FPU" disabled the 80486SX completely and everything was done by the "FPU". :)
Are you telling me that the 486 copro was actually a full 486 processor with floating point instructions enabled? ie, the floating point unit was also an integer unit, mmu, etc? This seems odd to me... that would mean that a math copro for a 486 would cost more then an actual 486 sx chip, no? Was this actually the case?

Please excuse my skepticism, but that sounds unreal to me! :)

--Jeff
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: FPU present, or not?

Post by Brendan »

Hi,
carbonBased wrote:
Brendan wrote: AFAIK for 80486, there never was a chip containing the FPU and nothing else - the "FPU" contained an entire CPU too and was very similar to a 80486DX. If you've got a motherboard with an 80486SX, then plugging in the "FPU" disabled the 80486SX completely and everything was done by the "FPU". :)
Are you telling me that the 486 copro was actually a full 486 processor with floating point instructions enabled? ie, the floating point unit was also an integer unit, mmu, etc? This seems odd to me... that would mean that a math copro for a 486 would cost more then an actual 486 sx chip, no? Was this actually the case?
AFAIK, yes.

Take a look in Intel's CPUID application note at Table 3-3. For family 4 model 3 it lists 3 CPUs - Intel 80486DX2, Intel 80486DX2 OverDrive and Intel80487. The Intel80487 is the "FPU".

Part of the reason for this (IMHO) is that 80486 and later CPUs support "Native Mode" FPU exception reporting, where an FPU exception is delivered directly to the CPU core, rather than being sent to the PIC chip and delivered as an IRQ.

For pricing, it probably costs Intel around $4 to produce a CPU. The real costs are designing the chip and setting up the factory to produce them. If they don't need to bother designing an FPU and configuring the factory to produce them, then the cost of production is drastically reduced. In this case, they get to sell an 80486SX initially and an 80486DX (or 80487) later, and have 2 chances of recouping the same design costs.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post by JAAman »

This seems odd to me... that would mean that a math copro for a 486 would cost more then an actual 486 sx chip, no? Was this actually the case?
what? do you think that the 486SX was different from the 486DX? (well later it was but...)

in chip manufacturing, most chips have flaws, but much/most of the chip exists in duplicate, so if one part is flawed, another is taken

with the 486, intel originally made only one chip, if the FPU was broken, instead of throwing the chip away, they simply disabled it and sold it as a 486SX, then for the 487 they just add a full 486DX and disabled the original chip (many hobbyists expiremented with re-enabling the original SX chip, to give them a dual-CPU system)

this technique allowed them to design and manufacture only a single chip design, which not only reduces the significant cost of design, it also gives extra advantage in scale -- producing more identical chips, reduces the per-chip cost

however, late-era chips were separate -- the 487 was rebuilt to stop attempts to re-enable the SX chip, and the SX chip was later redesigned to eliminate the FPU, reducing the die size, but by that time, most people were just getting the DX anyway as prices had been reduced

the same thing is also done (by both intel and AMD) with clock speeds -- the chips are made then tested under extreme conditions, and the best chips are labeled as higher clock speeds, and iirc the same is done with cache on newer chips -- most of the transistors in modern chips are actually part of the cache, and when a flaw appears in the cache, part of it is disabled, and its sold as a cheaper model with less cache (actually, itanium is designed to auto-disable cache if it goes bad and the chip keeps running, so you never know how much cache you are getting when you buy the chip) this is also how the original celeron came to be -- disable the cache on a PII/PIII and you have a celeron
Post Reply