Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division/sqrt algorithm #23

Open
sally-aha opened this issue Dec 26, 2017 · 8 comments
Open

Division/sqrt algorithm #23

sally-aha opened this issue Dec 26, 2017 · 8 comments

Comments

@sally-aha
Copy link

Which algorithm does hardfloat use for division and square root?

@aswaterman
Copy link
Member

There are two. DivSqrtRecF64 uses a quadratically convergent iterative algorithm, using a pre-multiplication to get a 10-ish-bit initial approximation. DivSqrtRecFN_small uses a straightforward one-bit-at-a-time algorithm.

@sally-aha
Copy link
Author

Then how can I choose which one to use? Which performs better?
And does DivSqrtRecFN_small use SRT? If so, which radix?
Thank you very much for your reply.

@aswaterman
Copy link
Member

It's too dependent on your application for me to provide an answer. The first option has latency of 25-ish cycles and throughput of 1/3 operations per cycle, but the area cost is high and the clock rate might be limited. The second option has latency of S-ish cycles (where S is the width of the significand) and has throughput of 1/S operations per cycle, but the area cost is low and it can run at higher clock rate.

@aswaterman
Copy link
Member

DivSqrtRecFN_small doesn't use SRT; it's just one bit at a time.

@JonnySmith0011
Copy link

Does DivSqrtRecF64 use algorithm of Goldschmidt or Newton-Raphson? @aswaterman
And did you consider using the mainstream SRT algorithm?

@liwt07
Copy link

liwt07 commented Mar 22, 2018

Hi, I want to generate the Verilog of the division. Could you please tell me how to generate Verilog from hardfloat files? Thank you so much.

@aamartin0000
Copy link

The original Verilog code is still available here: http://www.jhauser.us/arithmetic/HardFloat.html

@sequencer
Copy link
Contributor

FYI. I had a bare configurable SRT in sequencer/arithmetic. I'll find some time to PR hardfloat this year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants