In order to use this algorithm for signed numbers save the xored "most

significant bit" of each operand; get the absolute value of each operand;

perform the multiplication or division; and finally complement the result if

the xored most significant bit is set.

{Quote hidden}> > 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