EE-222 Microprocessor Systems: DE-41 (EE) Syn C
EE-222 Microprocessor Systems: DE-41 (EE) Syn C
DE-41(EE) Syn C
Instructor - Lec Aamir Javed
𝑑3 𝑑2 𝑑1 𝑑0
Value 4 5 7 8
Weight 103 = 1000 102 = 100 101 = 10 100 = 1
6
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Decimal Numbers
• Example: 4578 (n = 4)
𝑑3 𝑑2 𝑑1 𝑑0
Value 4 5 7 8
Weight 103 = 1000 102 = 100 101 = 10 100 = 1
• Value:
𝑛−1
7
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Binary Numbers
• A Binary Number can be represented by n binary digits (called bits)
• Each bit is allowed to take on only two possible values i.e. 0 and 1.
• 𝐵 = 𝑏𝑛−1 𝑏𝑛−2 … 𝑏1 𝑏0
8
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Binary Numbers
• Example: 1011 (n = 4)
𝑏3 𝑏2 𝑏1 𝑏0
Value 1 0 1 1
Weight 23 = 8 22 = 4 21 = 2 20 = 1
• Value:
𝑛−1
9
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Binary to Decimal Conversion
Convert 110010 2 to decimal
Answer: 110010 2 = 50 10
10
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Decimal to Binary Conversion
11
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Binary Numbers
12
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Octal and Hexadecimal Representation
• 𝐾 = 𝑘𝑛−1 𝑘𝑛−2 … 𝑘1 𝑘0
𝑛−1
𝑉 𝐾 = 𝑘𝑖 × 𝑟 𝑖
𝑖=0
• 𝑟 = 8 for octal numbers
• Values range from 0 to 7
• 𝑟 = 16 for hexadecimal numbers
• Values range from 0-15. 10, 11, 12, 13, 14 and 15 are represented by A, B, C, D, E, F
respectively
• Octal & Hexadecimal numbers serve as short hand notation for binary
numbers
13
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Binary to Octal & Octal to Binary
• Convert 101011010111 2 to Octal
14
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Binary to Hexadecimal & Hexadecimal to
Binary
• Convert 1010111100100101 2 to Hexadecimal
15
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Decimal to Hexadecimal
16
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Hexadecimal to Decimal
17
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Summary
• 𝐾 = 𝑘𝑛−1 𝑘𝑛−2 … 𝑘1 𝑘0
𝑛−1
𝑉 𝐾 = 𝑘𝑖 × 𝑟 𝑖
𝑖=0
• Unsigned numbers
• ≥0
• Binary numbers are used in computers
• Octal and hexadecimal numbers serve as shorthand
notation for binary numbers
18
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Addition of Unsigned Numbers
19
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Half Adder
20
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Full Adder
21
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Full Adder – Diagram
22
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Decomposed Full Adder – Diagram
ci s
si
s HA c
xi
HA c ci + 1
yi
ci
si
xi
yi
ci + 1
23
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
Ripple Carry Adder
xn – 1
yn – 1
x1 y1 x0 y0
c1
cn FA cn ” 1 c2 FA FA c0
sn –1
s1 s0
24
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir Javed
2’s Complement Representation
• Examine bits the number from right to left and taking the following action:
copy all bits that are 0 and the first bit that is 1; then simply complement
the rest of the bits.
• +5 = 0101 2
• −5 = 1011 2
• 10110100 2
• 01001100 2
• Low byte goes to low memory location and the high byte goes to high
memory address
• DS:1500 contains F3H
• DS:1501 contains 35H
• This convention is known as little endian
• In Big endian, low byte goes to high address and the high byte goes to low
memory address
• Intel processors use little endian convention
EE-222 Microprocessor Systems (Spring 2021) - Lec Aamir
73
Javed
Extra Segment
• ES is a segment register used as an extra data segment
• Essential for string operations