350151 – Digital Circuit 1 Choopan Rattanapoka Binary Arithmetic 350151 – Digital Circuit 1 Choopan Rattanapoka
Binary Arithmetic Addition ( + ) Subtraction ( - ) Multiplication ( x ) Division ( / )
Binary Addition (1) Recall decimal addition
Binary Addition (2) Binary addition
Example Add the following binary numbers : 10010011 + 01001011 1 1 10010011 + 01001011 1 1 1 0 0 1 0 0 1 1 + 0 1 0 0 1 0 1 1 1 1 0 1 1 1 1 0
Exercise 1 Add the following binary numbers (answer in binary and decimal number) : 1010 + 1001 11011 + 00111 101101 + 100100 11010101 + 01101011 10001111 + 11000001
Binary Subtraction (1) Recall decimal subtraction 100 – 28 9 0 10 10 0 10 10 1 0 0 - 2 8 7 2
Binary Subtraction (2) 0 - 0 = 0 0 borrow 0 0 - 1 = 1 1 borrow 1 1 - 0 = 1 1 borrow 0 1 - 1 = 0 0 borrow 0 0 2 10 – 01 1 0 - 0 1
Example 11011 – 10101 0 2 1 1 0 1 1 - 1 0 1 0 1 0 0 1 1 0
Exercise 2 Subtract the following binary numbers (answer in binary and decimal number) : 1010 - 1001 11011 - 00111 101101 - 100100 11010101 - 01101011 10000000 - 01000001
Binary Multiplication (1) Recall decimal multiplication 125 x 12 1 2 5 x 1 2 2 5 0 1 5 0 0 +
Binary Multiplication (2) A basic rules for binary multiplication 0 x 0 0 0 x 1 0 1 x 0 0 1 x 1 1
Example 1000011 x 1101 1 0 0 0 0 1 1 x 1 1 0 1 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 1 1 + + +
Exercise 3 Multiply the following binary numbers: 110 x 10 0110 x 1010
Binary Division Recall decimal devision 125 / 5 2 5 5 1 2 5 1 0 - -
Example 100011 / 101 0 0 0 1 1 1 101 1 0 0 0 1 1 1 0 1 1 1 1 1
Exercise 4 Divide in binary: 10001101 / 110 110000011 / 1011 1110100 / 1010
Exercise 5 (TODO) Add, Subtract, and multiply in binary: Divide in binary: 11101001 / 101 110000001 / 1110 1110010 / 1001