Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VHDL Fixed-point divider

Status
Not open for further replies.

GSRUS

Technical User
Nov 20, 2003
1
0
0
US
Does anyone have the algorithm or VHDL code that
will implement a fixed-point divider?
In my case, I have two integer numbers.

numerator = 15-bit signed
denominator = 15-bit unsigned.

By construction, the magnitude of numerator will always be less than magnitude of denominator.

Ideally would like the results in Signed 15-bit decimal output format of 1.14 where the MSB is the sign bit, and
the 14 LSB is the fractional value (not remainder).
I will then add half scale to convert this to
an unsigned decimal format of 1.14


 
I'm pasting it from a PDF file which is available online at it's a psuedo code which could be written in VHDL very easily. I have written the VHDL code just form this, but I don't have it now.

/* do [q := a div b] by */ {
q = 0 ;
int e = b << N ;
int f = 0 ;
while( e != b ) {
e = e >> 1 ;
q = q << 1 ;
const int g = f + e ;
if( a >= g {
q = q | 1 ;
f = g ; } } }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top