Comments (12)
@nibrunieAtSi5 Ah, yes, that makes sense, thank you for the explanation (typo in the 4th case for posterity).
@aamartin0000 I agree, that makes sense, thanks.
from berkeley-hardfloat.
I think this is a well known issue when using a FMA to execute FMUL only and is generally handled by an external wrapper. (Some people do not need / want to handle FMUL in an FMA and so the extra input should be optional and it makes more sense to have a proper FMA with the extra complexity and let people handle FMUL during the integration).
from berkeley-hardfloat.
Thanks for the reply, that makes sense. I'll close the issue.
from berkeley-hardfloat.
You may want to wait for others to chip in (I don't pretend to have the definitive answer on your relevant question).
from berkeley-hardfloat.
In my wrapper code that steers/modifies the source operands, the C operand can be a signed zero, the sign bit modified as needed. Determining the use of negative zero is not much logic, and has minimal impact to the timing.
An extra input, or any modification of mulAddRecFN, for this case is not needed.
from berkeley-hardfloat.
I see. So, you determine C based on the sign of A * B (and the rounding mode) that you recompute in your wrapper?
We ended up going with the HardFloat modification -- do you see any obvious issue with it?
from berkeley-hardfloat.
I think the sign of C=0 only depends on the rounding mode as -0
is the identity for addition for anything but rounding down (rounding towards minus infinity) and +0
is the identity of the addition when rounding down.
from berkeley-hardfloat.
If AB compute to 0 or -0, and that is all the operation is, then sign of C depends on sign of AB and the rounding mode -- right?
from berkeley-hardfloat.
I don't think so,
- if
A.B=+0
- if rounding mode is down, then
C=+0
andA.B + C = +0 + +0 = +0
(Ok) - if rounding mode is not down, then
C=-0
andA.B + C = +0 + -0 = +0
(Ok,as +0 + -0 = +0
when not rounding down)
- if rounding mode is down, then
- if
A.B=-0
- if rounding mode is down, then
C=+0
andA.B + C = -0 + +0 = -0
(Ok, ,as -0 + +0 = -0
in rounding down) - if rounding mode is not down, then
C=-0
andA.B + C = -0 + -0 = -0
(Ok,as -0 + -0 = -0
when not rounding down)
- if rounding mode is down, then
so C
does not depend on sign of A.B
just on rounding mode.
from berkeley-hardfloat.
IMHO, this modification should be local to your implementation, and not released to the main code branch. My wrapper around mulAddRecFN involves steering/modifying the operands for fadd/fsub, NaN boxing, and different sized operands (e.g. using a single instance for dp and sp). No modifications to mulAddRecFN, other than to add pipeline flops.
Having said that, my starting point was the Verilog code, not the scala code. So even if you change the Scala, I won't need to make any local changes.
from berkeley-hardfloat.
(Thx, posterity is important)
from berkeley-hardfloat.
In my wrapper, the code is essentially
sZero = (rs1 != rs2) ? neg_zero : pos_zero
and then this is chosen for "C" if it's fmul. Although doing a full comparison is somewhat expensive, its latency is buried by "fNToRecFN" source operand recoding being done in parallel. Note that the equation doesn't include the rounding mode.
from berkeley-hardfloat.
Related Issues (20)
- Recode format
- Printing value
- Do you plan to upload a document of the implementation details of this FPU? HOT 1
- Question about arbitrary precision support HOT 5
- Can you provide a detailed explanation of floating point division? The code is too hard to read. HOT 2
- Where is hardfloat code HOT 1
- Mult for Mantissa HOT 1
- make error
- compilation error HOT 4
- Why RawModule instead of Module? HOT 3
- chisel3.Driver.execute is deprecated HOT 4
- Recoded format HOT 3
- The algorithm used in DivSqrtRecF64_mulAddZ31 to calculate square-root HOT 1
- Is Recoded Format more hardware-friendly for denormal numbers than IEEE754 format?
- How to compile it to verilog! HOT 1
- sbt test fail HOT 1
- "Recoded Format" table in README.md is incorrect
- How to include in my own projects? HOT 2
- dependencies issue HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from berkeley-hardfloat.