Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT
Apply appropriate method to solve arithmetic problem in numbering system and sequential logic circuit Course Information Outline
Define decimal, binary, octal, and hexadecimal number Perform arithmetic operation(addition and subtraction) on different number bases. Convert decimal, binary, octal, and hexadecimal numbers to different bases and vice-versa. By the end of topic, the students should know:
Numbering System refers to the methods used internally to represent information stored in a computer. Computers store lots of different types of information: numbers text graphics of many varieties (stills, video, animation) sound Numbering System
ALL types of information stored in a computer are stored internally in the same simple format: a sequence of 0's and 1's. Numbering System Representing Real Data in the Computer
Numbering System
DEFINE DECIMAL, OCTAL, HEXADECIMAL AND BINARY NUMBER
Composed of 10 symbols or numerals(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) Base 10 It is positional-value system : value of digits depends on its position Example : 453₁₀ DATA REPRESENTATION IN COMPUTER MEMORY DECIMAL NUMBER/ BASE carries the most weight refer MOST SIGNIFICANT DIGIT (MSD) 3 carries the most weight refer LEAST SIGNIFICANT DIGIT(LSD)
Example : 27.35₁₀ = (2 X 10 )+ (7 X 1 )+ (3 X 0.1 )+ (5 X 0.01) = = 2 X X X X X 10 DATA REPRESENTATION IN COMPUTER MEMORY DECIMAL NUMBER/ BASE
Composed of 8 symbols or numerals(0, 1, 2, 3, 4, 5, 6, 7) Base 8 Example : / ₈ DATA REPRESENTATION IN COMPUTER MEMORY OCTAL NUMBER/ BASE
Composed of 16 symbols or numerals (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F ) Symbol alphabets represent A = 10, B = 11, C = 12, D = 13, E = 14, F = 15 Example : 7A₁₆ DATA REPRESENTATION IN COMPUTER MEMORY HEXADECIMAL NUMBER/ BASE 16
Digits are 0 or 1 Binary numbers are in base 2 Example : 101₂ DATA REPRESENTATION IN COMPUTER MEMORY BINARY NUMBER/ BASE 2
PERFORM ARITHMETIC OPERATION IN DIFFERENT NUMBER BASES (ADDITION AND SUBSTRACTION)
Add two octal digits as usual If the sum less is 7 or less, it can be expressed as octal digit If the sum is greater than or equal 8, subtract 8 and carry a 1 to the next digit position OCTAL (ADDITION)
When minuend value is smaller than the subtrahend, borrow 8 value from the column before OCTAL (SUBTRACTION)
OCTAL (SUBSTRACTION)
Add the following numbers Subtract the following numbers EXERCISE
ANSWER i ii.343 8
Add two hex digits as usual If the sum less is 15 or less, it can be expressed as hex digit If the sum is greater than or equal 16, subtract 16 and carry a 1 to the next digit position HEXADECIMAL (ADDITION)
When minuend value is smaller than the subtrahend, borrow 16 value from the column before HEXADECIMAL (SUBTRACTION)
Add the following numbers Subtract the following numbers EXERCISE
Answer
Only four cases can occur in adding the two binary digits (bits) in any position: BINARY ( ADDITION) CARRY
BINARY ( ADDITION)
When minuend value is smaller than the subtrahend, borrow 2 value from the column before BINARY ( SUBTRACTION) borrow
BINARY ( SUBTRACTION)
Add the following numbers i ii iii i – 111 ii EXERCISE
CONVERSIONS
1.Set up the problem. For this example, let's convert the decimal number to binary. 2. Write the integer answer (quotient) under the long division symbol, and write the remainder (0 or 1) to the right of the dividend. DECIMAL BINARY
3. Continue downwards, dividing each new quotient by two and writing the remainders to the right of each dividend. Stop when the quotient is Starting with the bottom remainder, read the sequence of remainders upwards to the top. DECIMAL BINARY Answer:
BINARY DECIMAL EXAMPLE 1 EXAMPLE 2
Example: Convert to octal DECIMAL OCTAL Answer : ₈
Converted to decimal equivalent by multiplying each octal digit by its positional weight OCTAL DECIMAL EXAMPLE 1
Using repeated division by 16. Example : convert 423 to hexadecimal DECIMAL HEXADECIMAL remainder remainder remainder 1 Answer : 1A7 ₁₆
Convert each octal digit to its 3 bits binary Example : Convert 472₈ to binary OCTAL BINARY Octal Digit Binary Equivalent
Converted to its decimal equivalent by using the fact that each hex digit position has weight that is power of 16. Example : convert 14₁₆ to decimal HEXADECIMAL DECIMAL
The bits of the binary number are grouped into groups of 3 bits. Example : Convert ₂ into octal BINARY OCTAL
The number is grouped into groups of 4 bits Example : Convert ₂ to hex BINARY HEXADECIMAL A6
Each hex digit converted to its 4 bit binary Example : 9F2₁₆ to binary HEXADECIMAL BINARY 9F