Professional Documents
Culture Documents
What is a computer?
1
3/14/2016
Motherboard (MB)
• The motherboard is
the main component
inside the case. It
serves to connect all
of the parts of a
computer together.
• The MB uses Buses to
transfer the data
between the
computer parts.
2
3/14/2016
Bus
• Bus: A bus, in computing, is a set of physical connections (cables,
circuits, etc.) which can be shared by multiple hardware
components in order to communicate with one another.
• A bus is simply a circuit that connects one part of the motherboard
to another.
• A bus is characterized by the amount of information that can be
transmitted at once. This amount, expressed in bits.
Input Unit
• Input units contain devices with the help of which we enter
data into computer. This unit is linked between user and
computer. Input devices translate the human-being information
into the form understandable by a computer.
• Examples of input devices:
• (1) Keyboard (2) Mouse (3) light pen (4) Scanner (5) Joystick (6)
Voice recognizer (7) Card reader (8) OCR (Optical Character
Reader) …etc.
3
3/14/2016
ALU
• Arithmetic and logic unit (ALU): The ALU does the actual
computation or processing of data.
4
3/14/2016
CU
Registers
10
5
3/14/2016
Primary Memory
• The primary memory (often referred to simply as memory) refers to
the electronic storage place for data and instruction where CPU can
access quickly. This unit supplies information to the other units of
the computer when needed.
• Primary memory is called RAM (Random Access Memory) because
you can randomly access any location directly in a memory.
• The CPU access the RAM in direct fashion, that is, the CPU can
access any location of this memory either to read information from
it or store information in it.
• RAM is the place in a computer where the operating system,
application programs, and data in current use are kept so that they
can be quickly reached by the computer's processor.
Cont.
• RAM volatile in nature, as soon as powered turned off, the
information stored in it will lost.
• There is another kind of memory called cache memory. The cache
logically positioned between the registers, and primary memory.
6
3/14/2016
13
Data Flow
7
3/14/2016
Cont.
• In the diagram, the arrows indicate the direction of data flow.
Some data flows in one direction only. In some cases it flows in
both directions.
• At the heart of the computer is the microprocessor, This contains
several REGISTERS to store data and an ARITHMETIC LOGIC UNIT
(ALU) which manipulates data. It acts as the central processing unit
(CPU) of the computer, carrying out a sequence of instructions,
called a program.
• The program may be stored in memory, as software, or written into
the memory from tape or disk.
• The computer needs to communicate with the outside world via
interfaces which are usually a plug or socket of some type.
15
Unit of Memory
• The various units used to measure computer memory, are as
follows:
– Bit: Bit, Abbreviation for binary digit, is basic unit of memory. It is
– smallest unit of information. Bit is represented by a lower case b.
– Byte: A unit of 8 bits is known as a byte. Hence, a byte is able to contain
– any binary number between 00000000 and 11111111. It is represented by
– uppercase B.
– Kilobyte: One KB is equal to 1024 bytes.
– Megabyte: One MB is equal to 1024 KB.
– Gigabyte: One GB is equal to 1024 MB.
– Terabyte: One TB is equal to 1024 GB.
8
3/14/2016
Numbering Systems
17
Numbering Systems
Decimal Binary Octal Hexadecimal
Base 10 Base 2 Base 8 Base 16
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10
17 10001 21 11
18 10010 22 12
18
9
3/14/2016
5 1 2 7 4
Cont.
• Digit Weight
– Weight = (Base) Position
100 10 1 0.1 0.01
• Magnitude
– Sum of “Digit x Weight”
500 10 2 0.7 0.04
• Formal Notation
d2*B2+d1*B1+d0*B0+d-1*B -1+d-2*B -2
(512.74)10
• Ex: 7392 = 7*10^3 + 3*10^2 + 9*10^1 + 2*10^0
10
3/14/2016
Binary Number
• A digital device works on two levels of signal, High and Low. The
High-level signal basically corresponds to some high-level signal
(say 5 Volt or 12 Volt) and Low-level signal basically corresponds
to Low-level signal (say 0 Volt).
• Since Computer is a digital electronic device, we have to deal
with two kinds of electrical signals. But while designing a new
computer system or understanding the working principle of
computer, it is always difficult to write or work with 0V or 5V.
• These two signals corresponds to two levels of electrical signals,
and symbolically we represent them as 0 and 1.
• Therefore, the Binary Number System come into picture, which
deals only with two numbers 0 and 1.
Cont.
• An Binary number, i.e. 110 is made of Binary digits (0, 1), the value
of each digit depends on its position.
• Base (also called radix) = 2
– 2 digits {0, 1}
• Digit Position
– Integer & fraction
2 1 0 -1 -2
1 0 1 0 1
11
3/14/2016
Cont.
• Digit Weight
Position
– Weight = (Base)
4 2 1 1/2 1/4
• Magnitude
– Sum of “Digit x Weight”
4 0 1 0/2 1/4
• Formal Notation
d2*B2+d1*B1+d0*B0+d-1*B -1+d-2*B -2
(101.01)2 =(5.25)10
• Ex: 110= 1*2^2 + 1*2^1 + 0*2^0= (6)10
12
3/14/2016
Special Powers of 2
210 (1024) is Kilo, denoted "K“
220 (1,048,576) is Mega, denoted "M“
230 (1,073, 741,824)is Giga, denoted "G"
240 (1,099,511,627,776 ) is Tera, denoted “T"
5 1 2 7 4
13
3/14/2016
Cont.
• Digit Weight
Position
– Weight = (Base)
64 8 1 1/8 1/64
• Magnitude
– Sum of “Digit x Weight”
320 8 2 7/8 4/64
• Formal Notation
d2*B2+d1*B1+d0*B0+d-1*B -1+d-2*B -2
(512.74)8 =(330.9375)10
1 E 5 7 A
14
3/14/2016
Cont.
• Digit Weight
Position
– Weight = (Base)
256 16 1 1/16 1/256
• Magnitude
– Sum of “Digit x Weight”
256 224 5 7/16 A/256
• Formal Notation
d2*B2+d1*B1+d0*B0+d-1*B -1+d-2*B -2
(1E5.7A)16 =(485.4765625)10
Homework
• List the octal and hexadecimal numbers from 16 to 32.
• What is the exact number of bytes in a system that contains (a) 32K
bytes, (b) 64M bytes, and (c) 6.4G bytes?
• Convert the following numbers with the indicated bases to
decimal: (435)8
• What is the largest binary number that can be expressed with 16
bits? What are the equivalent decimal and hexadecimal numbers?
30
15
3/14/2016
32
16
3/14/2016
Example1
MSB LSB
33
Example2
17
3/14/2016
36
18
3/14/2016
Cont.
37
Example1
38
19
3/14/2016
Example2
39
40
20
3/14/2016
Example1
MSB LSB
41
Example2
21
3/14/2016
43
44
22
3/14/2016
Cont.
• Ex1: Convert the Binary number 1010111 to decimal
23
3/14/2016
Cont.
• Conversion from binary to octal is done by reversing the
preceding procedure.
• Ex3:
24
3/14/2016
Cont.
• Conversion from binary to hexadecimal is done by reversing
the preceding procedure.
• Ex3:
25
3/14/2016
Why Hexadecimal?
• During communication between people (about binary
numbers in the computer), the octal or hexadecimal
representation is more desirable because it can be expressed
more compactly with a third or a quarter of the number of
digits required for the equivalent binary number. Thus, most
computer manuals use either octal or hexadecimal numbers
to specify binary quantities. The choice between them is
arbitrary, although hexadecimal tends to win out, since it can
represent a byte with two digits.
Homework
• Convert the hexadecimal number 64CD to binary, and then
convert it from binary to octal.
• Convert the decimal number 431 to binary.
• Convert the binary number 0110110011 to decimal, binary, and
hexadecimal.
26
3/14/2016
Homework
• Convert the decimal number 431 to binary in two ways: (a) convert
directly to binary; (b) convert first to hexadecimal and then from
hexadecimal to binary. Which method is faster?
• Express the following numbers in decimal: (10110.0101)2, (16.5)16,
(26.24)8, DADA.B)16, (1010.1101)2.
• Convert the following binary numbers to hexadecimal and to
decimal: (a) 1.10010, (b) 110.010. Explain why the decimal answer
in (b) is 4 times that in (a).
53
Complement of Numbers
54
27
3/14/2016
Complements
• Complements are used in digital computers to simplify the
subtraction operation and for logical manipulation. Simplifying
operations leads to simpler, less expensive circuits to implement
the operations.
• There are two types of Complements in binary:
– One’s complement.
– Two’s complement.
• There are two types of Complements in decimal:
– 10’s complement
– 9’s complement
One’s Complement
• The 1’s complement of a binary number is formed by changing
1’s to 0’s and 0’s to 1’s.
• Ex1: The 1’s complement of 1011000 is 0100111.
• Ex2: The 1’s complement of 0101101 is 1010010.
28
3/14/2016
Two’s Complement
• The 2’s complement of a binary number is formed by adding 1 to
its 1’s complement or by leaving all least significant 0’s and the
first 1 unchanged and replacing 1’s with 0’s and 0’s with 1’s in all
other higher significant digits.
• Ex1: The 2’s complement of 1011000 is 0100111+1= 0101000.
• Ex2: The 2’s complement of 0101101 is 1010010+1= 1010011.
• Ex3: The 2's complement of 1101100 is 0010100.
• Ex4: The 2's complement of 0110111 is 1001001.
9’s Complement
• The 9’s complement of a decimal number is obtained by
subtracting each digit from 9.
• Ex1: The 9’s complement of 546700 is 999999 - 546700 = 453299.
• Ex2: The 9’s complement of 012398 is 999999 - 012398 = 987601.
29
3/14/2016
10’s complement
• The 10’s complement of a decimal is obtained by adding 1 to the
9’s complement value or by leaving all least significant 0’s
unchanged, subtracting the first nonzero least significant digit
from 10, and subtracting all higher significant digits from 9.
• Ex1: The 10’s complement of 2389 is 7610 + 1 = 7611.
• Ex2: The 10’s complement of 012398 is 987602.
• Ex3: The 10’s complement of 246700 is 753300.
Complements Cont…
• In the previous definitions, it was assumed that the numbers did
not have a radix point. If the original number N contains a radix
point, the point should be removed temporarily in order to form
the r’s or (r - 1)’s complement. The radix point is then restored to
the complemented number in the same relative position.
• It is also worth mentioning that the complement of the
complement restores the number to its original value.
• The (r - 1)’s complement of octal or hexadecimal numbers is
obtained by subtracting each digit from 7 or F (decimal 15),
respectively.
30
3/14/2016
Homework
• Obtain the 1’s and 2’s complements of the following binary
numbers:
– (a) 00010000 (b) 00000000 (c) 11011010 (d) 10101010 (e) 10000101 (f)
11111111.
• Find the 9’s and the 10’s complement of the following decimal
numbers:
– (a) 25,478,036 (b) 63, 325, 600 (c) 25,000,000 (d) 00,000,000.
• (a) Find the 16’s complement of C3DF. (b) Convert C3DF to binary.
(c) Find the 2’s complement of the result in (b). (d) Convert the
answer in (c) to hexadecimal and compare with the answer in (a).
61
31
3/14/2016
32
3/14/2016
Binary Addition
• Binary addition performed using the same rules as decimal except
all numbers are limited to combinations of zeros (0) and ones (1).
The binary addition rules are shown in the following Table:
33
3/14/2016
Examples
Ex1:
Ex2:
Cont.
Ex3:
Ex4:
34
3/14/2016
Negative Numbers
• Not all integers are positive.
• What about negative numbers?
• What if we wanted to do: 1410 + ( - 210) = 1210
• Given the nature of the machine itself, how do we represent a
negative number?
35
3/14/2016
Example
• Ex: Find 1410 + ( - 610) = 810
1. Write the 2’s complement form for the numbers.
• Since 14 is positive then it is 0 0 0 0 1 1 1 0
• Negative numbers in the 2’s complement form need to be
obtained by:
Cont.
2. Add the numbers using the binary addition rule.
36
3/14/2016
Binary Subtraction
Examples
• Ex1:
• Ex2:
37
3/14/2016
38
3/14/2016
Example1
• Find 1410 – 610 1410 + ( - 610) = 810
1. Write the 2’s complement form for the numbers.
• Since 14 is positive then it is 0 0 0 0 1 1 1 0.
• Negative numbers in the 2’s complement form need to be obtained by:
Cont.
2. Add the numbers using the binary addition rule.
39
3/14/2016
Example2
• Find 1210 – 910 1210 + ( - 910) = 310
1. Write the 2’s complement for the numbers.
• Since 12 is positive then it is 00001100
• Finding -9 would require the following three steps:
Cont.
2. Add the numbers using the binary addition rule.
40
3/14/2016
Example3
• Find 2510 – 1410 2510 + ( - 1410) = 1110
1. Write the 2’s complement form for the numbers.
• Since 25 is positive then it is 00011001
• Finding -1410 would require the following three steps:
Cont.
2. Add the numbers using the binary addition rule.
41
3/14/2016
Example4
• Find 910 – 1410 910 + ( - 1410) = -510
1. Write the 2’s complement form for the numbers.
• Since 9 is positive then it is 00001001
• Finding -1410 would require the following three steps:
Cont.
2. Add the numbers using the binary addition rule.
• Since the answer starts with a “1” in its sign bit, it is a negative
number. We do the “flipping/adding 1” thing to convert any
positive 2’s complement number to its corresponding negative
number and vice versa):
42
3/14/2016
Example5
• Find -2510 + 1810 = -710
1. Write the 2’s complement form for the numbers.
• Since 18 is positive then it is 00010010
• Finding -2510 would require the following three steps:
Cont.
2. Add the numbers using the binary addition rule.
• Since the answer starts with a “1” in its sign bit, it is a negative
number.
43
3/14/2016
Example6
• Find -310 – (-410) = -310 + (410) = 110
1. Write the 2’s complement form for the numbers.
• The 2’s complement of -3 is 11111101
• The 2’s complement of 4 is 00000100
44
3/14/2016
Overflow
• In order to obtain a correct answer, we must ensure that the
result has a sufficient number of bits to accommodate the sum.
If we start with two n‐bit numbers and the sum occupies n + 1
bits, we say that an overflow occurs. When one performs the
addition with paper and pencil, an overflow is not a problem,
because we are not limited by the width of the page. We just
add another 0 to a positive number or another 1 to a negative
number in the most significant position to extend the number to
n + 1 bits and then perform the addition. Overflow is a problem
in computers because the number of bits that hold a number is
finite, and a result that exceeds the finite value by 1 cannot be
accommodated.
Homework
• Perform subtraction on the given unsigned binary numbers using
the 2’s complement of the subtrahend. Where the result should be
negative, find its 2’s complement and affix a minus sign.
– (a) 10011 - 10010, (b) 100010 – 100110 (c) 1001 - 110101 (d) 101000 - 10101
• Convert decimal +49 and +29 to binary, using the
signed‐2’s‐complement representation and enough digits to
accommodate the numbers. Then perform the binary equivalent of
(+29) + (-49), (-29) + (+49), and (-29) + (-49). Convert the answers
back to decimal and verify that they are correct.
90
45
3/14/2016
Binary Codes
91
Binary Codes
• Digital systems represent and manipulate not only binary
numbers, but also many other discrete elements of information.
• Any discrete element of information that is distinct among a group
of quantities can be represented with a binary code.
• An n‐bit binary code is a group of n bits that assumes up to 2n
distinct combinations of 1’s and 0’s, with each combination
representing one element of the set that is being coded.
46
3/14/2016
Cont.
• A number with k decimal digits will require 4k bits in BCD.
– Decimal 396 is represented in BCD with 12 bits as 0011 1001 0110, with each
group of 4 bits representing one decimal digit.
• Consider decimal 185 and its corresponding value in BCD and
binary: (185)10 = (0001 1000 0101)BCD = (10111001)2.
– The BCD value has 12 bits to encode the characters of the decimal value, but
the equivalent binary number needs only 8 bits. It is obvious that the
representation of a BCD number needs more bits than its equivalent binary
value.
• It is important to realize that BCD numbers are decimal numbers
and not binary numbers, although they use bits in their
representation. The only difference is that decimals are written
with the symbols 0, 1, 2, …, 9 and BCD numbers use the binary
code 0000, 0001, 0010, …, 1001.
47
3/14/2016
Cont.
• The standard binary code for the alphanumeric characters is the
American Standard Code for Information Interchange (ASCII),
which uses seven bits to code 128 characters, as shown in Table
1.7. The letter A, for example, is represented in ASCII as 1000001
(column 100, row 0001).
• ASCII is a seven‐bit code, but most computers manipulate an
eight‐bit quantity as a single unit called a byte. Therefore, ASCII
characters most often are stored one per byte.
• When we press a A, so actually A means immediately it is
converted to a 7 bit binary numbers. This is predefined this is a
predefined numbers say this 1000001, this is my capital A.
48
3/14/2016
Cont.
Cont.
49
3/14/2016
Error‐Detecting Code
• To detect errors in data communication and processing, an eighth
bit is sometimes added to the ASCII character to indicate its parity.
A parity bit is an extra bit included with a message to make the
total number of 1’s either even or odd. Consider the following two
characters and their even and odd parity:
Homework
• Convert decimal 6,514 to both BCD and ASCII codes. For ASCII, an
even parity bit is to be appended at the left.
• Decode the following ASCII code:
– 1010011 1110100 1100101 1110110 1100101 0100000 1001010 1101111
1100010 1110011.
• List the ASCII code for the 10 decimal digits with an even parity bit
in the leftmost position.
100
50
3/14/2016
Binary Multiplication
• 0×0=0
• 0×1=0
• 1×0=0
• 1×1=1
Binary Multiplication
• 0×0=0
• 0×1=0
• 1×0=0
• 1×1=1
51
3/14/2016
Binary Division
52
3/14/2016
Registers
• A binary cell is a device that possesses two stable states and is
capable of storing one bit (0 or 1) of information.
• A register is a group of binary cells. A register with n cells can store
any discrete quantity of information that contains n bits. Consider,
for example, a 16‐bit register with the following binary content:
1100001111001001.
• The same bit configuration may be interpreted differently for
different types of data depending on the application.
• For the particular example shown:
– For binary numbers the register contains the equivalent of the decimal
number 50,121.
– For the ASCII code the register contains the two characters C (the leftmost
eight bits) and I (the rightmost eight bits)
Registers Transfer
• In digital systems, a register transfer operation is a basic operation
that consists of a transfer of binary information from one set of
registers into another set of registers.
• The transfer may be direct, from one register to another, or may
pass through data‐processing circuits to perform an operation.
• Figure 1.1 illustrates the transfer of information among registers
and demonstrates pictorially the transfer of binary information
from a keyboard into a register in the memory unit.
53
3/14/2016
Cont.
54
3/14/2016
Cont.
55