### --------------xxxxx--------------

Digital Electronics Tutorial II: More on the Number System

### An outline of what this tutorial contains

Here's a quick look at the topics which will be covered in this tutorial

There are four basic rules for binary addition--
0+0= 0
0+1 = 1
1 +0= 1
1 + 1 = 10

Let's add two binary numbers say- 10011 and 01000. Binary addition is also carried out the same way as you normally add two numbers

10011
01000
--------
11011

### BINARY SUBTRACTION

Basic Rules for binary subtraction are-

0-0=0
1-0 =1
1-1 =1
10-1 = 1

How will you subtract 01001 from 11011 ?

### BINARY MULTIPLICATION

Multiplication is done by repeatedly adding one number by number of times equal to the second number. eg. 8x4=8+8+8+8

For binary multiplication also, we do the same thing. eg 0101 x 0011
The decimal equivalent of 0011 is 3. So to find the product, we can add 0101 to itself 3 times

0101
+ 0101

1010
+ 0101
1111

So, the product of 0101 and 0011 is 1111. We can check our result by looking at the decimal equivalents of these numbers.

0101 ---> 5
0011 ---> 3
1111 ---> 15

### BOOTH'S MULTIPLICATION ALGORITHM

Consider that we have to find the product 'm x r'.
Here 'm' is called 'multiplicand' and 'r' is called 'multiplier'.
Let, number of bits in 'm' is 'x' and number of bits in 'r' is 'y'.

### The Algorithm :

1. Define 3 values namely A, S, and P of length 'x+y+1' as-
A: fill left-most bits with value of 'm' and rest bits with '0'.
S: fill left-most bits with value of '-m' and rest bits with '0'.
P: fill left-most 'x' bits with '0', then 'y' bits with value of 'r'
and right-most bit with value '0'.

2. Determine two right-most bits of P
i) If they are 01, then add A to P
ii) If they are 10, then add S to P
iii) If they are 00 or 11, then jump to next step.

3. Shift the value of P to right by a single bit.

4. Repeat steps 2 and 3 'y' times
5. Drop right-most bit from P, leftover is the required product.

The tutorial explains this with the help of an example.

### MCQ Quiz

Companion MCQ Quiz for Number Systems- test how much you know about the topic. Your score will be e-mailed to you at the address you provide.