Lecture #2 Yasmin Afzaal
Lecture #2 Yasmin Afzaal
YASMIN AFZAAL
Lecture Outline
Number Systems, Operations, and Codes:
Decimal Fractions
Binary Arithmetic
I's and 2's Complements of Binary
Bits And Bytes
Representations: About Bits
CHAPTER#2:
Book: Digital Fundamentals by Thomas L. Floyd, Prentice
Hall; 9th edition (2007)
Lect.Yasmin Afzaal 2
Decimal Fractions
Repeated multiplication by 2
Multiply the decimal fraction by 2
Write down the carry bit if more than 1
Continue process until you have the desired number
of bits or when the fractional part is all zeros.
Lect.Yasmin Afzaal 3
Cont..
(19.35)2 → ( 10011.0101)2 .35*2
19 ÷ 2 0.70 0
.35 * 2 .70 *2
1.40 1
2 19 .40*2 0101
2 9 1 .80 0
2 4 1 10011 .80*2
2 2 0 1.60 1
1 0 .60*2 …….
Lect.Yasmin Afzaal 4
Cont..
Convert 0.3125 to binary
Carry MSB LSB
0.0 1 0 1
0.3125 X 2 = 0.625 0
0.625 X 2 = 1.25 1
0.25 X 2 = 0.50 0
0.50 X 2 = 1.00 1
Lect.Yasmin Afzaal 5
Binary Arithmetic
Binary addition
Binary subtraction
Binary multiplication
Binary division
Lect.Yasmin Afzaal 6
Complements of Binary Numbers
1’s complements
2’s complements
Lect.Yasmin Afzaal 7
Complements of Binary
Numbers
1’s complement
Change all 1s to 0s and all 0s to 1s
Lect.Yasmin Afzaal 8
Complements of Binary
Numbers
2’s complement
Find 1’s complement and then add 1
Lect.Yasmin Afzaal 9
Bits And Bytes
Lect.Yasmin Afzaal 10
Representations: About Bits
When working with the low-level bits of a computer system,
we typically resort to the symbols 0 and 1 to represent all of the
values stored and states in the machine.
In fact, binary representation was a key to the invention of the
earliest computers.
Unfortunately, it is difficult to look at hundreds of zeroes and
ones and have them make any sense. They all seem to blend
into one another unless we can organize them in some useful
way.
The most common way to organize bits is by grouping them
into "half-bytes," or 4-bit, chunks. Then, each of those 16
possible patterns of 0/1 are represented by a hexadecimal digit
in the range of 0-F, as shown in the table.
Lect.Yasmin Afzaal 11
Lect.Yasmin Afzaal 12