www.piclist.com/techref/method/math.htm?key=multiply

> How do you Divide two binary numbers

>

> "long division"

>

> Say you have 1234 / 6. Long division says:

>

> _______

> 6 / 1234 2

> 12

> 03 0

> 00

> 34 5

> 30

> 4

Yes, this works. But how about for negative numbers?

There's a slow algorithm in text books that's very applicable here. And

when I say slow, I mean it's 1 "operation" per bit. (You can do better.)

It's just about as much work as the algorithm described above and works

for all values. Perfect for a PIC which has adds and subtracts with the

exception that the registers are only 8-bits.

I used it for an IEEE 754 divider in Verilog. If anyone wants I'll

dig up the references. It came from a horribly well known book which

I can't remember the title of at the moment.

It'd be really easy for me to replace a $1.50 PIC with a $90 FPGA.. :)

Chris

In reply to: <CMM.0.90.4.941222107.billw@flipper.cisco.com> from William Chops Westfield at "Oct 29, 1999 11:35: 7 am"

See also: www.piclist.com/techref/method/math.htm?key=multiply