Lecture 10 Binary Numbers
Lecture 10 Binary Numbers
Lecture
10
Binary Numbers & Logic Operations
Learning Goals for Today
1. To become familiar with number system used by
the microprocessors - binary numbers
0 1 2 3 4
5 6 7 8 9
Binary (base 2) number system
consists of just two symbols
01
Other popular number systems
• Octal
– base = 8
– 8 symbols (0,1,2,3,4,5,6,7)
• Hexadecimal
– base = 16
– 16 symbols (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)
Decimal (base 10) numbers are
expressed in the positional notation
1’s multiplier
Decimal (base 10) numbers are
expressed in the positional notation
10
10’s multiplier
Decimal (base 10) numbers are
expressed in the positional notation
100
100’s multiplier
Decimal (base 10) numbers are
expressed in the positional notation
1000
1000’s multiplier
Binary (base 2) numbers are also
expressed in the positional notation
1’s multiplier
Binary (base 2) numbers are also
expressed in the positional notation
2’s multiplier
Binary (base 2) numbers are also
expressed in the positional notation
4’s multiplier
Binary (base 2) numbers are also
expressed in the positional notation
8’s multiplier
Binary (base 2) numbers are also
expressed in the positional notation
16
16’s multiplier
Counting Counting
in Decimal in Binary
0 10 20 30 000000 001010 010100 011110
1 11 21 31 000001 001011 010101 011111
2 12 22 32 000010 001100 010110 100000
3 13 23 33 000011 001101 010111 100001
4 14 24 34 000100 001110 011000 100010
5 15 25 35 000101 001111 011001 100011
6 16 26 36 000110 010000 011010 100100
7 17 27 . 000111 010001 011011 .
8 18 28 . 001000 010010 011100 .
9 19 29 . 001001 010011 011101 .
Why binary
Because this system is natural for digital computers ?
The fundamental building block of a digital computer – the switch – possesses two
natural states, ON & OFF.
It is natural to represent those states in a number system that has only two symbols,
1 and 0, i.e. the binary number system
Right from our young years we are taught to count using our 10 fingers. It feels
natural. It creates an easy, instant, long lasting bond with numbers.
bit
binary digit
Byte = 8 bits
Decimal Binary
conversion
Convert 75 to Binary
2 75 remainder
2 37 1
2 18 1
2 9 0
2 4 1
2 2 0
2 1 0
0 1
1001011
Check
1100100
That finishes our first topic - introduction
to binary numbers and their conversion
to and from decimal numbers
Off On
Low High
False True
We define the following logic operations
or functions among the Boolean variables
x y = x´
0 1
1 0
Truth Table for the AND Operation
(z true when both x & y true)
x y z=x·y
0 0
0 1
1 0
1 1
Truth Table for the AND Operation
x y z=x·y
0 0 0
0 1 0
1 0 0
1 1 1
Truth Table for the OR Operation
(z true when x or y or both true)
x y z=x+y
0 0
0 1
1 0
1 1
Truth Table for the OR Operation
x y z=x+y
0 0 0
0 1 1
1 0 1
1 1 1
Truth Table for the XOR Operation
(z true when x or y true, but not both)
x y z=xy
0 0
0 1
1 0
1 1
Truth Table for the XOR Operation
x y z=xy
0 0 0
0 1 1
1 0 1
1 1 0
Those 4 were the fundamental logic operations.
Here are examples of a few more complex situations
z = (x + y)´
z = y · (x + y)
z = (y · x)
w
STRATEGY: Divide & Conquer
z = (x + y)´
x y x + y z = (x + y)´
0 0 0 1
0 1 1 0
1 0 1 0
1 1 1 0
z = y · (x + y)
x y x + y z = y · (x + y)
0 0 0 0
0 1 1 1
1 0 1 0
1 1 1 1
z = (y · x) w
x y w y · x z = (y · x)
w
0 0 0 0 0
0 0 1 0 1
0 1 0 0 0
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 1 1
1 1 1 1 0
Number of rows in a truth table?
n
2
n = number of input variables
Assignment # 1
A. Convert the following into binary numbers:
i. The last three digits of your roll number
ii. 256
B. x, y & z are Boolean variables. Determine the truth tables for the following
combinations:
i. (x · y) + y
ii. (x y)´ + w
iii. Examine the truth table of (ii) and describe its relationship with C.
C. What is X. NOR gate. Explain through truth table.
D. What is nand and noR gate? explain through truth table