[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [fpu] FPU operations





>From: owner-fpu@opencores.org [mailto:owner-fpu@opencores.org]On Behalf
>Of Jamil Khatib
>
> > All the FPU has to provide, is status outputs. All
> > the masking
> > and dealing with the status/exceptions, is done by
> > the CPU internally.
> > > Here is a rough outline of the FPU IOs as I presume
> > the CPU
> > would want to see them:
> > > INPUT	[31:0]	operand A
> > INPUT [31:0]	operand B
> > INPUT [3:0]		operation type (TBD, perhaps more bits
> > ?)
> > OUTPUT [31:0]	result
> > OUTPUT		larger then ( A > B )
> > OUTPUT		smaller then (A < B)
> > OUTPUT		equal ( A == B )
> > OUTPUT		unordered ( A == NAN | B == NAN )
> > OUTPUT		overflow
> > OUTPUT		underflow
> > OUTPUT		SNAN
> > OUTPUT		INE
> > OUTPUT		INF (not sure we need this)
>
>what do you mean by INF? Infinity ? if so we do not
>need it.

Yes.

I think we should keep it around for now, we can always
remove it later. Perhaps we should add a infinity flag
to the compare operations, which would work just like
unordered but for infinity ?

I can see the need to test for infinity at some point ...

Look at the change below, may be that is better.

>you missed teh divide by zero exception

right

>We need also an interface to rounding modes which
>should be an input to the FPU if we want to support
>more rounding modes. another alternative is to put as
>part of teh operation.

right, I missed that as well

>Anyhow I suggest to have a register to store teh mode
>to avoid having different instructions only one will
>be needed that sets teh rounding mode

No, I disagree, there should be no register in the FPU to
hold those values, it should be a simple input, which
propagates through the FPU pipeline, so that the rounding
mode can be changed between operations.
The CPU should keep those values in it's 'FPU config'
register.

So the FPU interface looks now something like this:

		Main FPU Interface
		==================
INPUT	[31:0]	operand A
INPUT [31:0]	operand B
INPUT [3:0]		operation type (TBD, perhaps more bits ?)
INPUT [1:0]		rounding mode, something like:
			0 - To nearest (DEFAULT)
			1 - To +INF
			2 - To -INF
			3 - To ZERO
OUTPUT [31:0]	result

		Compare Result (Mutually exclusive)
		===================================
OUTPUT		larger then ( A > B )
OUTPUT		smaller then (A < B)
OUTPUT		equal ( A == B )
OUTPUT		unordered ( A == NAN | B == NAN )
OUTPUT		infinity ( A == INF | B == INF )

		Exceptions
		==========
OUTPUT		overflow
OUTPUT		underflow
OUTPUT		divide by zero
OUTPUT		SNAN
OUTPUT		INE


>Regards
>Jamil KHatib

rudi

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com