[comp.sys.nsc.32k] Running without an FPU

bert@Shiva.COM (Robert D. Vincent) (09/18/90)

I've had to struggle a bit, but I've managed to get MINIX up on my pc532
without an FPU. Some of the problems I encountered are:

* The ROM needed a fix to get RUN and STEP to work.
* MINIX saves FPU registers on a task switch
* _begsig also saves FPU registers, causing any process which intercepts
  signals to dump core.
* GCC uses floating point operations in global-alloc.c

So far I've been able to fix these problems in an ad-hoc manner, but I'd 
like to co-ordinate efforts with other FPU-less pc532 owners (if there are
any).
 
I have several questions for the NS32K wizards out there:

1) Is there some way to reliably detect the physical presence or absence 
   of an FPU?
2) Is there any way a user process can read the state of the F bit in 
   the CFG register, given that SPRi CFG,Rn is a privileged instruction?
3) Are there any free (or nearly so) floating point emulation libraries 
   for the NS32000 series? 
4) Are there other traps I haven't stumbled into yet?
	-bert

news@daver.bungi.com (09/18/90)

Bert:

> I've had to struggle a bit, but I've managed to get MINIX up on my pc532
> without an FPU. Some of the problems I encountered are:
> 
> * The ROM needed a fix to get RUN and STEP to work.
> * MINIX saves FPU registers on a task switch
> * _begsig also saves FPU registers, causing any process which intercepts
>   signals to dump core.
> * GCC uses floating point operations in global-alloc.c

ARGHHH!!!!!

> So far I've been able to fix these problems in an ad-hoc manner, but I'd 
> like to co-ordinate efforts with other FPU-less pc532 owners (if there are
> any).

Please post your changes!!!  I'll also be happy to help once I get my
to-be-FPU-less PC532 constructed.  (nearly finished)

> I have several questions for the NS32K wizards out there:
> 
> 1) Is there some way to reliably detect the physical presence or absence 
>    of an FPU?

yes, if the machine hangs on the setcfg instruction, you can be sure that
you don't have an FPU :-)

how about a jumper?

... etc.

(I consider my PC-532 to be "fpu-*FREE*" !)

amos@taux01.nsc.com (Amos Shapir) (09/18/90)

[Quoted from the referenced article by bert@Shiva.COM (Robert D. Vincent)]
> 
>I have several questions for the NS32K wizards out there:
>
>1) Is there some way to reliably detect the physical presence or absence 
>   of an FPU?

Put your hand into the box and feel the socket... Is that physical enough? :-)
Seriously, the 532 will get stuck if it tries to access a non-existent FPU
and the F bit in the CFG is set.  The only way to know whether the CFG
should be set is by a jumper or a switch (assuming whoever takes the FPU
out also remembers to put the jumper in or flip the switch).

>2) Is there any way a user process can read the state of the F bit in 
>   the CFG register, given that SPRi CFG,Rn is a privileged instruction?

Make a special system call, or have the kernel put a copy of the CFG
in a global variable.

>3) Are there any free (or nearly so) floating point emulation libraries 
>   for the NS32000 series? 

None that I know of, but there may be some for other processors which
are rather straightforward to convert.

>4) Are there other traps I haven't stumbled into yet?

I don't know much about Minix, but on Unix there aren't many utilities that
need FP; those who do are sure to let you know...

Good luck!

-- 
	Amos Shapir		amos@taux01.nsc.com, amos@nsc.nsc.com
National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
Tel. +972 52 522255  TWX: 33691, fax: +972-52-558322 GEO: 34 48 E / 32 10 N

dlr@daver.bungi.com (Dave Rand) (09/19/90)

[In the message entitled "Re: Running without an FPU" on Sep 18, 12:07, Amos Shapir writes:]
> >2) Is there any way a user process can read the state of the F bit in 
> >   the CFG register, given that SPRi CFG,Rn is a privileged instruction?
> 
> Make a special system call, or have the kernel put a copy of the CFG
> in a global variable.

This is what we did on the Definicon 32k kernel. A system call would permit
user-processes to examine the state of the CFG register (literally by
extracting the bits from the config instruction). A separate program would
permit the modification of the instruction prior to loading the kernel -
a similar ROM-based addition to the monitor would be a good idea.

> 
> >3) Are there any free (or nearly so) floating point emulation libraries 
> >   for the NS32000 series? 
> 
> None that I know of, but there may be some for other processors which
> are rather straightforward to convert.

At one point, National was releasing the (old, slow) NSX FP emulation
library in source form to its customers, with no restrictions on its
use. You may want to check with your local sales-type to see if this
is still the case. National does sell a FP emulation library now, but
I'm not sure of the restrictions on its use. It comes with the GNX
tools, as I recall. Either of these packages could be interfaced
with the kernel to provide FP services. One such port was done
in Japan for a large customer of NS - it offered multi-tasking
enhancements to make it useable in a real-time environment.


-- 
Dave Rand
{pyramid|mips|bct|vsi1}!daver!dlr	Internet: dlr@daver.bungi.com

gs@vw25.chips.com (George Scolaro) (09/20/90)

[In the message entitled "Re: Running without an FPU" on Sep 19, 22:30, Eyal Lebedinsky writes:]
> 
> Set a watchdog timer.
> try accessing the FPU.
> If the next instruction is reached - I have an FPU.
> If the timer interrupt arrives - I have no FPU.
> 
> Now, do we have a timer? will the interrupt be acknowledged if the FPU bus
> cycle is stuck?

The FPU access is treated as a slave access by the 32000 series. The slave
access is a non-interruptible transfer, hence no FPU -> system hang.

What we really need is an FPU emulation library for the 32000 which is
linked into the kernel. This does mean we need 2 versions of the kernel,
or at least one byte that is set/cleared to configure it.

And yes we have lots of timers, one in each DUART and a couple in the ICU.

regards,


-- 
George Scolaro (gs@vw25.chips.com)	Chips & Technologies
(408) 434-0600				3050 Zanker Road
					San Jose, CA  95134

rhyde@ucrmath.ucr.edu (randy hyde) (09/20/90)

>>> Are there any free fp emulation libraries?

I dunno if it's free, but back in the days that NS was selling the "16032" Les
Wilson (my local NS rep) had an FP emulation library that National Supported.
I don't know what happened to it.

eyal@echo.canberra.edu.au (Eyal Lebedinsky) (09/20/90)

Hello Everyone

Not yet having my pc532 going I did not dig deep into the hware design. But
I thought I'll throw in my approach to this situation:

Set a watchdog timer.
try accessing the FPU.
If the next instruction is reached - I have an FPU.
If the timer interrupt arrives - I have no FPU.

Now, do we have a timer? will the interrupt be acknowledged if the FPU bus
cycle is stuck?

Those in the know can answer this.
-- 
Regards
	Eyal