Machine Architecture An Introduction to Computer Components

advertisement
Machine Architecture
An Introduction
to
Computer Components
CMSC 104, Lecture 02
1
Major Computer Components
•
•
•
•
•
Central Processing Unit (CPU)
Bus
Main Memory (RAM)
Secondary Storage
I / O Devices
CMSC 104, Lecture 02
2
CPU
•
•
•
Central Processing Unit
The Brain
Controls all other computer functions
CMSC 104, Lecture 02
3
The Bus
•
•
Computer components are connected
by a bus
A bus is a group of parallel wires that
carry control signals and data between
components
CMSC 104, Lecture 02
4
Main Memory
•
•
•
•
•
Main memory is made up of capacitors
If the capacitor is charged, then its state
is said to be 1 or ON.
We could also say the the bit is set.
If the capacitor does not have a charge,
then its state is 0 or OFF.
We could also say that the bit is reset
or cleared.
CMSC 104, Lecture 02
5
Size of Capacitors
•
•
•
Has decreased dramatically over the last 20
years.
Now we can fit several million capacitors on
a chip the size of a dime.
As this technology becomes older, we can
expect the price of memory to decrease. Is
it already decreasing ? ABSOLUTELY !
CMSC 104, Lecture 02
6
Memory, the Continuing Saga
•
•
•
•
Memory is divided into cells, where
each cell contains 8 bits (a 1 or a 0).
Eight bits is called a byte.
Each of these cells is numbered.
The number associated with a cell is
known as its address.
Volatile storage
CMSC 104, Lecture 02
7
Reading & Writing
•
In addition to the circuitry that holds the
bits, there are other circuits that allow
other components to
o Get the value of the data held at a
particular address - known as a READ.
o OR store data at that address - known as a
WRITE.
CMSC 104, Lecture 02
8
Memory Access
•
•
•
•
All addresses in memory can be
accessed in the same amount of time.
We DO NOT have to start at address 0
and read everything until we get to the
address we really want.
We can go directly to the address we
want and access the data.
That is why we call Main Memory RAM
- Random Access Memory
CMSC 104, Lecture 02
9
Secondary Storage
•
•
•
•
Disks -- floppy, hard, removable
Tapes (sequential access)
CDs
Stores files
o programs
o data files (binary, text)
o directory structure
•
Persistent storage
CMSC 104, Lecture 02
10
I/O
•
•
•
I/O is handled by peripheral devices.
A peripheral device is some machine that is
not an integral part of the computer.
Examples:
o
o
o
o
o
o
monitor
keyboard
mouse
disk drive
printer
scanner
CMSC 104, Lecture 02
11
Media vs. Devices
• Many I/O devices work in conjunction with media
• A medium holds information (programs, data, text
files)
• Examples:
• floppy disk (not the drive itself)
• hard disk (not the drive itself)
• magnetic tape (not the drive itself)
CMSC 104, Lecture 02
12
Bits, Bytes, and Words
•
•
•
•
•
•
A byte is 8 bits
A word is 32 bits or 4 bytes
Long word = 8 bytes = 64 bits
Quad word = 16 bytes = 128 bits
Programming languages use these standard
number of bits when organizing data storage
and access.
What do you call 4 bits ??
(hint: it is a small byte)
CMSC 104, Lecture 02
13
The Binary Number System
•
•
•
The on and off states of the capacitors
in RAM can be thought of as the values
1 and 0
Therefore, thinking about how
information is stored in RAM requires
knowledge of the binary number
system
Let’s investigate the decimal number
system first
CMSC 104, Lecture 02
14
The Decimal Number System
The decimal number system is a
positional number system
 Example:
5621
1 X 100
1000 100 10 1
2 X 101
6 X 102
5 X 103

CMSC 104, Lecture 02
15
What is the Base ?
The decimal numbering system is also
known as base 10. The values of the
positions are calculated by taking 10 to
some power.
 Why is the base 10 for decimal numbers ?

Because we use 10 digits. The digits 0
through 9.
CMSC 104, Lecture 02
16
What is the Base ?
The binary number system is called
binary because it uses base 2. The
values of the positions are calculated by
taking 2 to some power.
 Why is the base 2 for binary numbers ?

Because we use 2 digits. The digits 0
and 1.
CMSC 104, Lecture 02
17
The Binary Number System
The Binary Numbering System is also a
positional numbering system.
 Instead of using ten digits, 0 - 9, the
binary system uses only two digits, the
0 and the 1.
 Example of a binary number & the
values of the positions.
1 0 0 0 0 0 1
26 25 24 23 22 21 20

CMSC 104, Lecture 02
18
Converting from Binary to Decimal
1 0 0 0 0 0 1
26 25 24 23 22 21 20
20 = 1
21 = 2
22 = 4
23 = 8
CMSC 104, Lecture 02
24 = 16
25 = 32
26 = 64
1 X 20 = 1
0 X 21 = 0
0 X 22 = 0
0 X 23 = 0
0 X 24 = 0
0 X 25 = 0
1 X 26 = 64
6519
Converting From Decimal to Binary
First make a list of the values of 2 to the
powers of 0 to 8, then use the
subtraction method.
20 = 1, 21 = 2, 22 = 4, 23 = 8, 24 = 16,
25 = 32, 26 = 64, 27 = 128, 28 = 256
 Example:
42
42 10 2
- 32 - 8 - 2
1 0 1 0 1 0
5 24 23 22 21 20
2
20
CMSC 104, Lecture 02

Counting in Binary

Binary
0
1
10
11
100
101
110
111
CMSC 104, Lecture 02

Decimal equivalent
0
1
2
3
4
5
6
7
21
Working with Large Numbers
0101000010010111 = ?
Humans can’t work well with binary
numbers. We will make errors.
 Shorthand for binary that’s easier for us
to work with - hexadecimal

CMSC 104, Lecture 02
22
Hexadecimal
Binary 0 1 0 1 0 0 0 0 1 0 0 1 0 1 1 1
Hex
5
Written:
509716
CMSC 104, Lecture 02
0
9
7
23
Download