Вы находитесь на странице: 1из 6

20/3/2019

LESSON OUTCOMES

❑ At the end of this lesson, the students should be able to:

THE CPU AND MEMORY:


▪ Briefly explain about the CPU/microprocessor
 The CPU components

ORGANIZATION
 The machine cycle
▪ Briefly explain about memory
CHAPTER 3  Volatile vs non-volatile
 Example of memory
 Memory operation
 Memory capacity

1 2

1 2

CPU/Microprocessor

❑ What is the central processing unit (CPU)?


▪ Similar to the human brain
▪ Interprets and carries out basic instructions that operate a computer
What is ▪ It controls the action, performs the calculations, & manipulates the
data
microprocessor? ▪ Also called the processor
❑ What is a microprocessor?
▪ With the advent of integrated circuit technology, the entire CPU of
today, resides in a micro chip
▪ Miniature silicon chip found in computers that is the heart of the
computer

3 4

3 4

CPU Components Control Unit (CU)

❑ Directs and coordinates operations in computer (the brain of


the CPU)

CPU Components ❑ It contains the microprogram (contains the entire instruction


set, resides in an internal ROM)
❑ Controls and interprets the execution of instructions, by
Control Unit (CU) following a sequence of actions that corresponds to fetch-
execute instruction cycle
Arithmetic/Logic Unit ( ALU) ❑ Retrieve instructions from memory then movement of data or
address from one part of the CPU to another
Register ❑ To determine which instruction to be executed, CU reads the
contents of the program counter (PC) / instruction pointer
Clock (IP).

** CU and ALU which work together to perform processing operations. 5 6

5 6

1
20/3/2019

Arithmetic/Logic Unit (ALU) Register

❑ Performs arithmetic and logical operations on input data. ❑ Temporary storage area that holds data and instructions
❑ It performs these operations as directed by the CU. ❑ Data registers (or general purpose registers)
▪ Used for a variety of operations & as temporary storage areas for data
before processing
▪ The number of general purpose registers available depends on the
manufacturer’s design
❑ Address registers
▪ Specifically for addressing
▪ When data is read from memory, the address of the data must be
placed on the address bus
▪ Include index, page and stack registers

7 8

7 8

Register Register

❑ The CU contains several important registers: ❑ The CU also contain several 1-bit registers, known as
▪ Program counter (PC) register - holds address of current instruction status register or flags.
being executed
▪ Instruction register (IR) - holds actual instruction being executed
❑ This flags allow computers to keep track of special
currently by the computer condition such as:
▪ Memory address register (MAR) - holds address of a memory location
Arithmetic
Memory data register (MDR) - holds a data value that is being stored

to or retrieved from the memory location currently addressed by MAR
carry and Power failure
overflow
❑ Although the MAR and MDR are part of the CPU, operationally
these two registers are more closely associated with memory
itself (will discussed in more detail in memory section) Internal
computer
9
error 10

9 10

Register Clock

❑ Most registers support four primary types of operations: ❑ A device that produces periodic sequence of pulses to control the
timing of all computer operations
❑ These pulses define machine cycles
Loaded with values from other locations ❑ Each tick is a clock cycle that determines when the next machine
cycle will occur
❑ The clock speed is measured by the number of ticks per second
Added or subtracted ❑ The faster the clock speed, the more instructions the processor can
execute per second
❑ MHz - one million ticks per second of system clock
Shifted or rotated right or left by one or more bits
- theoretically, capable of executing one million instructions per
Can be tested for certain conditions (zeros, second
negative, etc). ❑ GHz – one billion ticks per second of system clock
11 12

11 12

2
20/3/2019

Machine Cycle Machine Cycle

❑ An instruction is fetched by the Control Unit during instruction time


(i-time) and executed by the ALU during execution time (e-time)
❑ Together, both steps make up a single machine cycle & the process is
repeated until the program is finished
❑ The clock drives the process by generating pulses at precisely timed
intervals

13 14

13 14

Machine Cycle Bus

❑ All of the CPU elements are connected together in a bus


structure
❑ Bus
▪ parallel electrical lines or paths connecting a source to a destination
▪ a common path used for specific exchange of data between various
parts of CPU

15 16

15 16

Memory Volatile Memory

❑ Memory / main memory / primary storage / working ❑ Random Access Memory (RAM)
storage ▪ Temporary storage and working space for the operating system and
❑ Holds programs/instructions and data for access by the applications
CPU ▪ Used to store program and user data.

❑ Made up of a large number of cells, each with its own ▪ Readable and rewritable (volatile).
address ▪ Two types of RAM: Static RAM (SRAM) Dynamic RAM (DRAM)

❑ Can be divided into two: ◼ Faster & requires less power ◼ Slower & needs more power
(additional circuitry)
Volatile Nonvolatile ◼ Does not require refreshing ◼ Data needs to be refreshed
periodically
Loses contents when power is Retains contents when power is
removed removed ◼ More expensive ◼ Less expensive
◼ Often used as “cache memory” ◼ Used as main memory
17 18

17 18

3
20/3/2019

Non-Volatile Memory Non-Volatile Memory

❑ Magnetic Core Memory ❑ Read Only Memory (ROM) (cont.)


▪ Uses small core of magnetic material to hold a bit of data ▪ To store firmware that contain special instructions:
▪ Magnetism remains after current is removed (non-volatile)
 Needed to start a computer
▪ Expensive & slow in comparison
 Give keyboard keys their special capabilities
▪ Has been replaced by RAM except for few computers where loss of data
would be severely damaging  Put characters on screen
▪ Newer ROMs can be erased & rewritten:
 EEPROM (Electrically Erasable Programmable ROM)
❑ Read Only Memory (ROM)
 Flash ROM
▪ Used for programs that are permanent and unchanged
▪ The program can only be read.
▪ Example: operating system routine.
▪ The programs on ROM were prewritten when it was manufactured. 19 20

19 20

Non-Volatile Memory Memory Hierarchy

EEPROM Flash ROM


Similar to EEPROM (the way it is erased
Contents can be programmed and and written).
erased by the user

The only difference is that it is faster


and more flexible than EEPROM.
Non-volatile, writable memory
Can erase and write data in blocks
rather than one byte at a time.
Rewriting can be done by erasing
memory cells selectively, then writing Used in handphones, digital camera and
new data into those cells. MP3 players.

21 22

21 22

Little Man Computer (LMC) Memory Operation

❑ Real memory, like the mailboxes in the Little Man


Computer, consists of cells, each of which can hold a
single value, and each of which has a single address.
❑ Two registers, the memory address register and the
memory data register (also known as memory buffer
register), act as an interface between the CPU and
memory.

23 24

23 24

4
20/3/2019

Memory Operation: Relationship between Memory Operation: Relationship between


MAR, MDR and Memory MAR, MDR and Memory
Address Data
❑ Each cell in memory unit holds one bit of data
❑ Cells are organized in rows
❑ Each row consists of a group of one or more bytes (word)
❑ Each group represents the data cells for one or more
consecutive memory addresses (000, 001, . . . , 2n − 1)
❑ MAR holds address in memory that is to be “opened” for data
❑ MAR connected to a decoder that interprets the address &
activates a single address line in memory

25 26

The Relationship Between the MDR, the MAR, and Memory

25 26

Memory Operation: Relationship between Memory Operation: Relationship between


MAR, MDR and Memory MAR, MDR and Memory
❑ There is a separate address line for each group of cells in
the memory; thus, if there are n bits of addressing, there
will be 2n address lines
❑ The memory data register is designed such that it is
effectively connected to every cell in the memory unit.
❑ Each bit of the MDR is connected in a column to the
corresponding bit of every location in memory.
❑ However, the addressing method assures that only a single
row of cells is activated at any given time.
❑ Thus, only one memory location is addressed at any one
time. 27 28

MAR – MDR Example

27 28

Memory Operation: Relationship between Memory Capacity


MAR, MDR and Memory
❑ 2 factors determine the capacity of memory in a
computer:
1. Number of bits in the MAR (determines how many different
address locations can be decoded)
 For a MAR of width k bits, the number of possible memory addresses is

M = 2k
2. Number of bits in the address field of the instruction set
(determines how many memory locations can be directly
addressed from the instruction)

29 30

A Visual Analogy for Memory


A Simple 32-bit Instruction Format

29 30

5
20/3/2019

Memory Capacity Memory Capacity

❑ The size of the instruction word, in bits, depends on the ❑ Example:


particular CPU, particularly the design of its instruction ▪ Given a computer’s memory specification is 128MB RAM. Calculate
set the:
❑ Modern computers usually have a word size of 16, 32, or a) Memory capacity in bytes
64 bits. Many other sizes have been used in the past, b) Address size
including 8, 12, 18, 24, 36, 39, 40, 48, and 60 bits c) Largest address

Memory Size In Bytes Formula


1 kilobyte (KB) 1024 210

1 megabyte (MB) 1024 x 1024 220


1 gigabyte (GB) 1024 x 1024 x 1024 230
31 32
1 terabyte (TB) 1024 x 1024 x 1024 x 1024 240

31 32

Memory Capacity Memory Capacity

❑ Solution: ❑ Solution (cont.):


a) Memory capacity in bytes b) Address size

1KB = 1024 bytes = 210 128 MB = 128 * 220


= 27 * 220
1MB = 1024 x 1024 = 210 x 210 = 220
= 227
128MB = 128 * 1024 * 1024
= 27 bits
= 134217728 bytes

c) Largest address
128 MB = capacity in bytes - 1
= 134217728 –1

33
= 134217727 34

33 34

Exercise

❑ Given a computer’s memory specification is 32KB RAM.


Calculate the:
a) Memory capacity in bytes
Address size
END OF CHAPTER 3
b)

c) Largest address

35 36

35 36

Вам также может понравиться