http://en.wikipedia.org/wiki/Booth%27s_multiplication_algorithm http://en.wikipedia.org/wiki/Booth%27s_multiplication_algorithm
example : 5 * 4
A = 101 000 0 // binary of 5 is 101
S = 011 000 0 // 2 s complement of 5 is 011
P = 000 100 0 // binary of 4 is 100
x = 3 number of bits in m
y = 3 number of bits in r
m = 5
-m = 2 s complement of m
r = 4
- After right shift of P by 1 bit 0 000 100
- After right shift of P by 1 bit 0 000 010
- P+S = 011 001 0
- Discarding the LSB 001100
UPDATE after @ ruakh answer
5 * 4 = 20
m = 0101 is 5
r = 0100 is 4
A = 0101 0000 0
S = 1010 0000 0
P = 0000 0100 0
- shift P right by 1 bit : 0 0000 0100
- shift P right by 1 bit : 0 0000 0010
- P+S = 10100010
- P+A = 1 0010 0001 here 1 is the carry generated
Leave the LSB : 11001000 (not equal to 20)