Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Help for Simple Coding of 32Bit Fixed-Point Divider in Verilog

Sorry if this post might be repeating questions asked in earlier posts (most I checked didn't really help). I am using Verilog to program.

My simple question is as following (it would be nice if the coding is as simple as possible):

given two 32bit fixed-point integers ([31] = signed, [30:10] = integer value, [10:0] = fractional part), divide both inputs (a/b) and return a variable c with the same format. note: i want the divider to be able to output fractional values (i.e. 1 / 4 = .25)

Thanks!

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    with fixed point, you treat the inputs simply as integers. You do not need to separate the integer and fractional parts, you just ensure the bits all align properly, and then the results will also be of the same values. note that a 21.11 / 21.11 number will result in a 42.22 result.

    There is a fixed point divider available in the megafunction blocks.