Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
16 views

Chapter 1 LogicCircuitDesign Lecture

Uploaded by

armanigarcia861
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Chapter 1 LogicCircuitDesign Lecture

Uploaded by

armanigarcia861
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Chapter 1

Number System

Computers have made possible many scientific,


industrial, and commercial advances in our society. It can
manipulate data and information given any form of input.
As discussed in Chapter 2, there are different input
devices that are available to handle data as numbers,
letters, sound, scanned images or even brain wave
signals. These input data are manipulated by a computer
through converting them into electrical signals, thus these
are called discrete elements. Discrete elements of
information are represented in a digital system by
physical qualities called signals. Electrical signals such as
voltages and currents are the most common. Today,
electronic digital systems have only two discrete values
and are said to be binary. Computers manipulate these
discrete elements of information or data in binary form
making it very important to study number systems.

Most modern computer systems do not represent numeric


values using the decimal system. Instead, they typically
use a binary or two's complement numbering system. To
understand the limitations of computer arithmetic, we
must understand how computers represent numbers.
Understanding these number systems is important
because their use simplifies other complex topics
including Boolean Algebra and logic design, signed
numeric representation, character codes, and packed
data.

Number system is a way or methodology on how


numbers are represented inside the computer’s memory.
Human beings think in decimal, while computers process
in binary. Technically, computer can accept data in
human readable form then convert them into acceptable
computer code to generate an output which can be
understood by man.

There are two (2) important concepts involved when


studying number systems, these are:

1. That all number systems follow the concept of


positional notation. This means that the
numerical value given to a digit is determined
by its relative position in a given number.

2. That all number systems follow a set of valid


values.

Numeral Base (N) Valid Values


System
1. Binary 2 0,1
2. Decimal 10 0-9
3. Octal 8 0-7

4. Hexadecimal 16 0-9,A,B,C,D,E,F
Note: A=10, B=11, C=12, D=13, E=14, F=15

The Binary Number Base Systems

Most modern computer systems (including the IBM PC)


operate using binary logic. The computer represents
values using two voltage levels (usually 0V for logic 0 and
either +3.3 V or +5V for logic 1). With two levels we can
represent exactly two different values. These could be any
two different values, but by convention we use the values
zero and one. These two values, coincidentally,
correspond to the two digits used by the binary number
system.

Since there is a correspondence between the logic levels


used by the computer and the two digits used in the
binary numbering system, it should come as no surprise
that computers employ the binary system. The binary
number system works like the decimal number system
except the Binary Number System:

▪ uses base 2

2
▪ includes only the digits 0 and 1 (any other digit
would make the number an invalid binary number)

The Octal Number Base System

Although this was once a popular number base, especially


in the Digital Equipment Corporation PDP/8 and other old
computer systems, it is rarely used today. The Octal
system is based on the binary system with a 3-bit
boundary. The Octal Number System:

▪ uses base 8
▪ includes only the digits 0 through 7 (any other digit
would make the number an invalid octal number)

The Decimal Number Base Systems

The Decimal Number System uses base 10. It includes the


digits from 0 to 9. For example, the number 123 is in
decimal. This is the sum of 100 + 20 + 3, wherein the
place values of each number determine the numerical
value of a number.

The Hexadecimal Number Base System

A big problem with the binary system is verbosity. To


represent the value 202 requires eight binary digits.

The decimal versions require only three decimal digits


and, thus, represent numbers much more compactly than
does the binary numbering system. This fact was not lost
by the engineers who designed binary computer systems.

When dealing with large values, binary numbers quickly


become too unwieldy. The hexadecimal (base 16)
numbering system solves these problems. Hexadecimal
numbers offer the two features:

▪ Hexadecimal numbers are very compact


▪ It is easy to convert from hex to binary and binary
to hex.

3
The Hexadecimal system is based on the binary system
using a Nibble or 4-bit boundary. In Assembly Language
programming, most assemblers require the first digit of a
hexadecimal number to be 0, and we place an H at the
end of the number to denote the number base.

The Hexadecimal Number System:

▪ uses base 16
▪ includes only the digits 0 through 9 and the letters
A, B, C, D, E, and F

NUMBER BASE CONVERSION

Our decimal number system is known as a positional


number system, because the value of the number
depends on the position of the digits. For example, the
number 123 has a very different value than the number
321, although the same digits are used in both numbers.

In a positional number system, the value of each digit is


determined by which place it appears in the full number.
The lowest place value is the rightmost position, and each
successive position to the left has a higher place value.

In our decimal number system, the rightmost position


represents the "ones" column, the next position
represents the "tens" column, the next position represents
"hundreds", etc. Therefore, the number 123 represents 1
hundred and 2 tens and 3 ones, whereas the number 321
represents 3 hundreds and 2 tens and 1 one.

1. Converting from decimal to other number bases

In order to convert a decimal number into its


representation in a different number base, we have to
repeatedly divide the decimal number by the base in
which it is to be converted, until the quotient becomes
zero. As the number is divided, the remainders in reverse
order form the digits of the number in the other base.

4
Example: Convert the decimal number 82 to base 6:
82/6 = 13 remainder 4
13/6 = 2 remainder 1
2/6 = 0 remainder 2
The answer is formed by taking the remainders in reverse
order: 2
1 4 base 6

Conversion from Decimal Number to Binary Number


(Base 10
to Base 2)

Example 1-1: Convert decimal 29 to binary. First 29 is


divided by 2 to give an integer quotient of 14 and a
remainder of 1. The quotient is again divided by 2 to give
a new quotient of 7 with a remainder of 1 again. Further
divide 7 by 2 which yields a quotient of 3 and a remainder
1. 3 is still divisible by 2, therefore divide it by 2 will give
1 remainder 1. The final answer is generated from the
value of the last quotient and all the remainder read from
bottom to top. Thus, 29 in decimal is equal to 11101 in
binary.

2910 - N2
Remainder

21 29
20 14
21
21 7
1 3
1
Therefore, 2910 =
111012

Conversion from Decimal Number to Octal Number


(Base 10 to

5
Base 8)

Example 1-2: Convert decimal 942 to octal. First 942 is


divided by 8 to give an integer quotient of 117 and a
remainder of 6. The quotient is again divided by 8 to give
a new quotient of 14 with a remainder of 5. Further divide
14 by 8 yields a quotient of 1 and a remainder 6. The final
answer is generated from the value of the last quotient
and all the remainder read from bottom to top. Thus, 942
in decimal is equal to 1656 in octal.

94210-N8

Remainder 942
86 117
85
86 14
1 1

Therefore, 94210 = 16568

Conversion from Decimal Number to Hexadecimal


Number (Base
10 to Base 16)

Example 1-3: Convert decimal 2598 to hexadecimal.


First 2598 is divided by 16 to give an integer quotient of
162 and a remainder of 6. The quotient is again divided
by 16 to give a new quotient of 10 with a remainder of 2.
10 is no longer divisible by 16, therefore, division process
should be stopped. The final answer is generated from the
value of the last quotient and all the remainder read from
bottom to top. Thus, 2598 in decimal is equal to A (10) 26
or A26 in hexadecimal.

259810 - N16

Remainder 2598
16 6 162
16 2
A 10

6
Therefore, 259810 = A2616

2. Converting from Other number bases to Decimal

There are two methods of converting numbers in other


bases to decimal numbers. The first method is multiply
and Add and the other one is Positional Value method.
Multiply and Add method involves two process namely
multiplication and addition while in Positional Value or
PVM, the value of the number is determined from its
relative position in the number.

Method 1. Multiply and Add Rules:


a. Multiply the leftmost digit by the base number n then
add the next digit to the product.
b. Multiply the sum of rule a by the base n and then add
again the next digit to the product.
c. If the rightmost digit is already added, the operation
will automatically stop and the resulting sum is the
actual decimal equivalent.

Conversion from Binary Number to Decimal number


(Base 2 to Base 10)
Example 2-1: Given 101 in binary, the leftmost digit 1 is
multiplied by 2 (base), the product is 2. Add the next digit
0 to the product, the sum is 2. Multiply 2 (product) by the
base 2, the product is 4. Add the last digit which is 1 to 4
which yields 5. Therefore, the decimal equivalent of
binary 101 is equal to 5.

1012-N10

1 * 2 = 2
2 + 0 = 2
2 * 2 = 4
4 + 1 = 5

7
Therefore, 1012 = 510

Conversion from Octal Number to Decimal number


(Base 8 to Base
10)

Example 2-2: Given 175 in octal, the leftmost digit 1 is


multiplied by 8 (base), the product is 8. Add the next digit
7 to the product, the sum is 15. Multiply 15 (product) by
the base 8, the product is 120. Add the last digit which is
5 to 120 which yields 125. Therefore, the decimal
equivalent of octal 175 is equal to 125.
1758 - N10

1 * 8 = 8 8 + 7
= 15
15 * 8 = 120 120 + 5
= 125

Therefore, 1758 = 12510

Conversion from Hexadecimal Number to Decimal


number (Base
16 to Base 10)

Example 2-3: Given 3AE in Hexa, the leftmost digit is


multiplied by 16 (base), the product is 48. Add the next
digit A (10) to the product, the sum is 58. Multiply 58
(product) by the base 16, the product is 928. Add the last
digit which is E (14) to 928 which yields 942. Therefore,
the decimal equivalent of 3AE is equal to 942.

3AE16 – N10

3 * 16 = 48
48 + 10 = 58
58 * 16 = 928
928 + 14 = 942

8
Therefore, 3AE16 = 94210

Method 2. Positional Value Method (PVM) Conversion


from Binary Number to Decimal number (Base 2 to
Base 10) Example 2-4:
1012-N10

1012
1 * 20 = 1
0 * 21 = 0
1 * 22 = 4

510

Conversion from Octal Number to Decimal number


(Base 8 to Base
10)
Example 2-5:

1758 - N10
1752
5 * 80 = 1
7 * 81 = 56
1 * 82 = 64

12510

Conversion from Hexadecimal Number to Decimal


number
(Base 16 to Base 10) Example
2-6:

3AE16
14 * 160 = 14
10 * 161 = 160
3 * 162 = 768
94210

9
3. Converting from Binary to Octal and Hexadecimal

A. Binary Number to Octal Number Rules:


1. Begin at the binary point (rightmost digit) and block off
groups of three binary digits.
2. Replace each group of three binary digits with its
equivalent octal digit. The digit will range from 0 – 7.

Example 3-1: Convert 1101011 in binary to Octal


number

11010112 – N8
421 421 421
001/101/011
1 5 3

T
h
er
ef
or
e,
1
1
0
1
0
1
12
is
1
5
3
8
B. Binary Number to Hexadecimal Number

Rules:
10
1. Begin at the binary point (rightmost digit) and block off
groups of four binary digits.
2. Replace each group of three binary digits with its
equivalent hexadecimal digit. The digit will range from 0
– 15.

Example 3-2: Convert 11101011 in binary to


hexadecimal number
111010112 – N16

8 4 2 18 4 2 1

1 1 1 01 011
14 11

Therefore, 111010112 is EA16

4. Converting from Octal and Hexadecimal to Binary

Rules:
Replace each Octal digit with the equivalent three
binary digit/ each Hexadecimal digit with the
equivalent four binary digit.

Examples 4-1: Convert 264 in octal to binary number


2648 to Base 2

264
0 1 01 1 01 0 0

Answer 0101101002
Chapter 1
Lecture Activity No. 1

11
Name: ______________________________ Rating: _________________
Instructor: _________________________ Schedule: _____________

1. Convert the following Decimal numbers to Binary, Octal


and Hexadecimal. Show the solution.

2 8 16
1.1 26510
2 8 16
1.2 23510
2 8 16
1.3 121071
0

2. Convert the given numbers using Multiply and Add


Method. Show the solution.

10
2.1 10000110112
10
2.2 65408
10
2.3 CA4D16

3. Convert the following numbers using Positional Value


Method.

3.1 111100012 10

10
3.2 3768
10
3.3 8A216

4. Convert the following Binary, Octal, and Hexadecimal


numbers to Decimal. Show the solution

12
4.1 11001112 10 8 16

2 16 10
4.2 73758
2 8 10
4.3 B49F16

ARITHMETIC OPERATIONS

Arithmetic operations in all number systems involve


Addition, Subtraction, Multiplication and Division.
Although it is said that computers can only add and
subtract, multiplication is done performing repeated
addition while division is actually repeated subtraction.

I. Addition of Number Systems. There are several rules to


follow in performing addition. It is very important to
take note of the valid values for each number system.
In binary, the sum should only be 0 or 1. In Octal
number system, it is from 0 to 7 only. Hexadecimal
sum should range from 0-15, thus 10 is letter A.

A. BINARY ADDITION.

Rules:
0+0=0
0+1=1
1+0=1
1 + 1 = 0 with a carry of 1 to the next digit to the left

Example 1-1: Add binary 101011 to 110010. Start from


the innermost digit of the addends. 1 plus 0 yields 1, based
on the rule stated above. Then add the digit to its left, 1
plus 1 is equal to 0, carry 1 to the next digit. The final
answer is 1011101 in binary.

1 1

13
1 0 1 0 1 1
+ 1 1 0 0 1 01 0
1 1 1 0 1

Answer: 1011101 (binary)

B. OCTAL ADDITION

Rules:
a. Add the rightmost digit and divide the sum by
8.
b. The quotient will be carried to the next digit to
the left and the remainder is brought down as
the actual sum.
c. Repeat the whole process until the leftmost
digits have been added.

Example 1-2: Add 755 and 165 in octal. Follow


the rule as stated above.

111 755
+ 1 6 5
1 1 4 2

Answer: 1142 (octal)

Example 1-3: Add 755 and 165 in octal. Follow


the rule as stated above.

1 1 2 1
7 6 4 3
+ 1 3 5 7
2 4 6 5

1 3 7 0 7

Answer: 13707 (octal)


14
C. HEXADECIMAL ADDITION
Rules:
a. Add the rightmost digit and divide the sum
by
16.
b. The quotient will be carried to the next digit
to the left and the remainder is brought
down as the actual sum.
c. Repeat the whole process until the leftmost
digits have been added.

Example 1-4: Get the sum of 9A4316 and


FACE16

1 1 1 1

9A43
+FACE

1 9 5 1 1

Answer: 19511 (hexa)


Example 1-5: Get the sum of A7A6216 and 1DEAC16

1 1 1
A 7 A 6 2

+ 1 D E A C C 5 9
0 E

Answer: C590E (hexa)

II. Subtraction of Number Systems. There are several


rules to follow in performing subtraction. It is very
important to take note of
the valid values for each number system. In
subtraction, the rule of complementation is used.

A. BINARY SUBTRACTION (using Complementation)

15
Rules:
a. Complement the subtrahend by converting 1’s
to 0’s and 0’s to 1’s.
b. Add the complemented subtrahend to the
minuend, using the rules in binary addition.
c. If there is no-carry over, re-complement the
result and a negative sign must be attached.
d. If there is a carry-over, add 1 to the unit
position of the result and the result is positive.

Examples:

There is a carry-over of 1, so apply rule d.

0 1 0 1
+ 1

0 1 1 02 Difference

1. 1 0 1 1 12
-
Complement of the subtrahend
+1 1 1 1 0 1 2 1 1 0
0 1 0

0 0
0 1 1
0
1
1
There is no carry-over, apply rule c.

16
11100 => 000112 or – 112
Differences

B. OCTAL SUBTRACTION
Rules:

a. If the minuend is greater than the subtrahend,


then subtraction is possible.
b. If the subtrahend is greater than the minuend,
borrow one (1 from the next digit to the left.
c. A borrow of one (1) in octal means adding eight
(8) to the digit to the right.

Example 1: 765 minus 473 is equal to 272 in


octal
Example 2: 7342 minus 1456 is equal to 5664 in
octal

1. 7 6 58 2. 7 3 4 28
- 4 7 38 - 1 4 5 6
8
2 7 28 5 6 6 48

C. HEXADECIMAL SUBTRACTION
Rules:

a. If the minuend is greater than the subtrahend,


then subtraction is possible.
b. If the subtrahend is greater than the minuend,
borrow one (1 from the next digit to the left.
c. A borrow of one (1) in hexadecimal means
adding sixteen (16) to the digit to the right.

Examples 1: 986 minus 469 is equal to 51E in


hexadecimal.

17
9 8 7
- 4 6 9

5 1 E16

Example 2: F879 minus ABCD is equal to 4CAC

F 8 7 916
- A B C D16

4 C A C16

III. Multiplication of Number Systems. Multiplication is


said to be repeated addition, wherein there are several
rules to follow. Performing binary, octal and hexadecimal
multiplication is the same process in ordinary
multiplication applied in decimal numbers.

A. BINARY MULTIPLICATION

Rules:

0 x 0 = 0 Follow
the given rules and then proceed to binary
addition

0 x 1 = 0
1 x 0 = 0
1 x 1 = 1

Example 1: 101 times 11 is equal to 1111 in binary.

Example 2: 1101 times 110 is equal to 1001110 in


binary.

18
1
.

+
x 0 + 1 1 0 1 1 02

B. OCTAL MULTIPLICATION

Rules:

a. Multiply the rightmost digit.


b. Divide the quotient by 8.
c. The quotient is carried to the next digit to the
left and the remainder is brought down as the
actual product.
d. Continue the process until the leftmost digit
has been multiplied.

Example: 467 multiplied to 12 in octal is equal to


6046.

1. 4 6 78

1
+ 4
6
x 1

28
1 5 6
6 7
0 4 68

C. HEXADECIMAL MULTIPLICATION

Rules:

a. Multiply the rightmost digit.


b. Divide the quotient by 16.
c. The quotient is carried to the next digit to the
left and the remainder is brought down as the
actual product.

19
d. Continue the process until the leftmost digit
has been multiplied.

Example: 987 multiplied to 43 in hexadecimal is


equal to 27E55.

1. 9 8 716

1 5
x 6
7
4 316
C 9
+ 2 1 C
2 E 5 51
6

IV. Division of Number Systems. Division is repeated


subtraction, wherein there are several rules to follow.
Performing binary, octal and hexadecimal division is the
same process in ordinary multiplication applied in decimal
numbers.

A. BINARY DIVISION
Rules:

1. Begin from the left on the dividend.


2. Perform a series of subtraction, wherein the
subtrahend is subtracted from the minuend.
3. If subtraction is possible, the quotient is 1.
4. If not, the quotient is 0.

Example: 1101 divided by 10 is equal to 110 remainder 1

20
1 0 x 1
- 1
0 0 1 0 0 0 02
r
0 0 0 1 1 1 0
1
Checking: 0
1 02 1 1 0 1 2 1 1
0
1 0

0 0 0

1
0
1 + 1
1 1 0 1

B. OCTAL DIVISION. To determine the quotient,


choose a number from 0 to 7 that when
multiplied to the divisor will not exceed the
value in the dividend. Follow the process of
decimal division. Check your answer by
performing multiplication.

Example: 452 divided by 5 in octal is equal to


73
7 3 8
remainder 3. r 3
4 5 2
Checking: 8
4 3
58 7 38
21 4 4
2 2
- 1 7
-

58
+
7
3
3 4 5 2

C. HEXADECIMAL DIVISION. To determine the


quotient, choose a number from 0 to 15 that
when multiplied to the divisor will not exceed
the value in the dividend. Follow the process of
decimal division. Check your answer by
performing multiplication.

Example: F25 divided by A is equal to 183


remainder 7.

1 8 316 r 7 Checking
A16 F 516 1 8 316
2 A x
A16 5
25 1
0 7
F E
+

5 F 2 5

E
7

Chapter 1
Lecture Activity No. 2

Name: ______________________________ Rating: _________________


Instructor: _________________________ Schedule: _____________

22
Perform addition for the following sets of integer numbers:

1. B C A E D16
+ 1 B F A C E16

2. 6 7 8 2 2 910
+ 5 6 7 8 9 810

2. 6 7 5 5 68
+ 7 6 7 7 58

Chapter Lecture
Activity No. 3

Name: ______________________________ Rating: _________________


Instructor: _________________________ Schedule: _____________

23
1. Subtract (ADFA816) from (FF25D16)

2. Subtract (78889) from (76889)

3. Subtract (BA9812) from (AAB712)

4. Subtract (767558) from (567568)

Chapter 1
Lecture Activity No. 4

Name: _______________________________ Rating:_________________


Instructor: _________________________ Schedule: _____________

Perform the indicated operation:


24
1. 123459
X 1239
---------

2. BFAD16 X 13516
--------------

3. 76558
X 1238
------

Chapter 1
Lecture Activity No. 5

Name: ______________________________ Rating: _________________


Instructor: _________________________ Schedule: _____________

Perform the indicated operation:

25
1.(123459) / (1239) 4. (1011102) / (11012)

2.(BFAD16 ) / (13516) 5. (256779) / (32119)

3.(76558) / (1238) 6. (4589112) / (43212)

26

You might also like