0% found this document useful (0 votes)
4 views

L4

The document provides an overview of computer architecture, focusing on the Central Processing Unit (CPU) and its components, including the von Neumann architecture, logic gates, and transistors. It explains the fetch-execute cycle, the role of the Arithmetic Logic Unit (ALU), Control Unit (CU), and various registers, as well as factors affecting CPU performance such as clock speed and cache size. Additionally, it introduces the Little Man Computer (LMC) as a model for teaching basic CPU operations.

Uploaded by

1457981717
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

L4

The document provides an overview of computer architecture, focusing on the Central Processing Unit (CPU) and its components, including the von Neumann architecture, logic gates, and transistors. It explains the fetch-execute cycle, the role of the Arithmetic Logic Unit (ALU), Control Unit (CU), and various registers, as well as factors affecting CPU performance such as clock speed and cache size. Additionally, it introduces the Little Man Computer (LMC) as a model for teaching basic CPU operations.

Uploaded by

1457981717
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

COMP 30660: Computer Architecture and Organization (CONV)

Lecture 4: Processor/Central
Processing Unit (CPU)
http://www.flickr.com/photos/sarahseverson/

Madhusanka Liyanage
School of Computer Science
University College Dublin, Ireland
[email protected]
1
Learning Objectives

• Understand the von Neumann architecture


• Understand the operation of a simple LMC program
• Understand the Common CPU Components
• Understand relationship between instruction sets &
assembly language
• Able explain the factors that impact on program
execution time
• Able explain the difference between CISC and RISC

2
How we create Logic Gates and Also
Logic Circuits?

3
Transistor
• The basic building block of complex electronic devices
• A semiconductor device for amplifying, controlling, and
generating electrical signals.

4
Transistor
• Ideally suited for Binary operation
– Acts as a Switch which is On or
Off
• Combined to implement logic gates
– AND, OR, NOT
• Combined to build higher-level
structures
– E.g. Adder
• Combined to build processor
– more powerful computers
• Huge progress on miniaturisation:
– cheaper, quicker, smaller

5
The first working transistor (1947)

• Invented at Bell (AT&T)


Laboratories in 1947
• First commercially successful
transistor was produced by
Texas Instruments in 1954.
• The first IC (Integrated
Circuits: Several transistors
on 1 chip) was produced in
1958 at Texas Instruments.

6
Evolution of the Transistor

7
Integrated Circuits (IC)

• Set of electronic components on a single unit


• Also called chip, microchip
• Microprocessor
– Computer processor that implements the functions
of a CPU (central processing using) on a single IC

8
Transistor is the building block of modern CPUs

9
Transistor size and density

• Manufacturing process
– 10 micrometers (10-6) in 1971
– 800 nm (10-9) in 1987
– 20-28 nm in 2010
– Intel 14nm in 2014
– Nvidia 11nm in 2015
– 3nm in 2022
• Reaching physically possible
limitations using current
technologies?
• Atom size 0.1nm - 0.5nm

10
The new 2-nanometer
(nm) tech allows the
company to cram a
staggering 50 billion
transistors onto a chip
the size of a fingernail.

11
Moore’s Law

Transistor is the building block of modern CPUs 12


Structure of a Computer

16
Components of a Computer System

• Every computer system has the following three


basic components:
– Input unit
– Central processing unit
– Output unit

17
Central Processing Unit (CPU)

• After receiving data


and commands
from users, a
computer system
has to process it
according to the
instructions
provided.
• Here, it has to rely
on a component
called the central
processing unit.
18
This Computer

• CPU: Intel Core i9-11900H


– 2.5GHz
– 1 Processor, x64-based processor
– 8 cores
– 16 threads
– 24 MB L3 cache

19
But, how this CPU has designed?

20
Von Neumann Architecture

• Developed in 1945 by John von Neumann and others


• Also known as the von Neumann model or Princeton
architecture 21
Von Neumann architecture

• In most computer systems, the


CPU receives instructions and data
from an input or memory.
• The instructions and data are
processed by the CPU and the
results are either sent to an output
or transferred to secondary
storage.
• Computer 'Architecture' is the
design that enables the
instructions and data to reach and
be processed by the CPU.
• Von Neumann architecture is the
design upon which many general
purpose computers are based.

22
Von Neumann architecture

• The architecture has


three elements:
– Control Unit
– Arithmetic and Logic
Unit (ALU)
– Memory Unit

23
Von Neumann architecture: CPU Components
• Memory Unit
– Once a user enters data using input devices, the computer
system stores this data in its memory unit.
– Data will remain here until other components of CPU process it.
– The memory unit uses a set of pre-programmed instructions to
further transmit this data to other parts of the CPU.
• Arithmetic and Logic Unit (ALU)
– Performs arithmetic operations.
– Do basic mathematical calculations like addition, subtraction,
division, multiplication, etc.
– Can even perform logical functions like the comparison of data.
• Control Unit
– The backbone of computers.
– Responsible for coordinating tasks between all components of a
computer system.
– Collects data from input units and sends it to processing units
depending on its nature.
– Also further transmits processed data to output units for users.

24
Von Neumann architecture – Registers
• A processor based on Von Neumann
architecture has five special registers
which it uses for processing:
– Program counter (PC) - holds
the memory address of the next
instruction to be fetched from
main memory.
– Memory address register
(MAR) - holds the address of the
current instruction that is to be
fetched from memory, or the
address in memory to which data
is to be transferred.
– Memory buffer register (MBR)
- holds the contents found at the
address held in the MAR, or data
which is to be transferred to main
memory. It is also referred to as
the Memory Data Register (MDR).
– Current Instruction Register
(CIR) - holds the instruction that
is currently being decoded and
executed.
– Accumulator (ACC) - holds the
data being processed and the
results of processing. 25
Von Neumann architecture:
The fetch-execute cycle

• The fetch-execute
cycle (also known as
fetch-decode-execute
cycle) is followed by a
processor to process
an instruction.

26
Von Neumann architecture - Key Features
• The key features of Von
Neumann architecture are:
– Data and instructions are
both stored as binary.
– Data and instructions are
both stored in main
memory.
– Instructions are fetched
from memory one at a time
and in order - serially.
– The processor decodes and
executes an instruction,
before cycling around to
fetch the next instruction.
– The cycle continues until no
more instructions are
available.
27
Von Neumann architecture: The fetch-execute cycle Example
• The cycle consists of several stages.
1. The memory address held in the
program counter is copied into the
MAR.
2. The address in the program
counter is then incremented -
increased - by one. The program
counter now holds the address of
the next instruction to be fetched.
3. The processor sends a signal along
the address bus to the memory
address held in the MAR.
4. The instruction/data held in that
memory address is sent along the
data bus to the MBR.
• Program counter (PC)
5. The instruction/data held in the
• Memory Address Register (MAR) MBR is copied into the CIR.
Memory Buffer Register (MBR)/ Memory

Data Register (MDR) 6. The instruction/data held in the
• Current instruction register (CIR) CIR is decoded and then executed.
• Accumulator (ACC)
Results of processing are stored in
the ACC.
7. The cycle then returns to step one.
28
Little Man Computer
• The Little Man Computer (LMC) is
an instructional model of a
computer, created by Dr. Stuart
Madnick in 1965.
• The LMC is generally used to teach
students, because it models a
simple von Neumann architecture
computer—which has all of the
basic features of a modern
computer.
• It can be programmed in machine
code (albeit in decimal rather than
binary) or assembly code.
• The original concept was that
inside the CPU is a tiny man who
runs around executing instructions
encoded in a list.

29
Little Man Computer

30
Little Man Computer
• Inside the CPU there are:
– 100 Memory locations (numbered 0 to 99), that can each contain a 3 digit
instruction or data (ranging from 000 to 999)
– An Arithmetic Unit to do calculations.
– An Accumulator to store the result of the last operation or
calculation.
– A Program Counter to store the address (in memory) of the next
instruction to do.
– An Instruction Register to hold the top digit of the instruction read
from memory.
– An Address Register to hold the bottom two digits of the instruction
read from memory.
– An Input tray into which a number can be typed when needed.
– An Output area where any numbers output are printed.

The Program Counter holds


only 2 digits (0 to 99) and the
Accumulator holds 3 digits
and a sign (-999 to 999)

31
LMC Cycle

• Two stages:
– The fetch portion of the cycle, in which the Little
Man finds out what instruction he is to execute,
– The execute portion of the cycle, in which he
actually performs the work specified in the
instruction

32
Little Man Computer : Instruction Set

33
LMC – Addition Example (Add Two
Inputs)

34
Exercise: Simulate on LMC
http://peterhigginson.co.uk/LMC/

Step 1: Enter
the assembly
code

Step 2:
Assemble Step 3:
into RAM Run

35
Real CPU

36
Common CPU Components

• The Central Processing


Unit (CPU) consists of
six main components:
• Control Unit (CU)
• Arithmetic Logic Unit
(ALU)
• Registers
• Cache
• Buses
• Clock
• All components work
together to allow
processing and system
control.
37
Control Unit (CU)

• The CU provides several functions:

– It fetches, decodes and executes instructions


– It issues control signals that control hardware
– It moves data around the system

38
Arithmetic Logic Unit (ALU)

• The ALU has two main functions:

– It performs arithmetic and logical operations


(decisions).
• The ALU is where calculations are done and
where decisions are made.
– It acts as a gateway between primary memory and
secondary storage.
• Data transferred between them passes through
the ALU.

39
Registers

• Registers are small amounts of high-speed memory


contained within the CPU.
• Used by the processor to store small amounts of data
that are needed during processing, such as:
– The address of the next instruction to be executed
– The current instruction being decoded
– The results of calculations
• Manipulated directly by the Control Unit
• Wired for a specific function
• Size in bits or bytes (not in MB like memory)
• Can hold data, an address, or an instruction
40
Registers in LMC

• How many registers does the LMC


have?
• What are the registers in the LMC?
– Program Counter Register (PC)
• Also called instruction pointer
(IP)
– Instruction Register (IR)
• Stores instruction fetched from
memory
– Address Register (AR)
• Stores Address fetched from
memory
– Accumulator Register
• Stores results of arithmetic &
logical calculations

41
Registers
• Different processors have different numbers of
registers for different purposes, but most have some,
or all, of the following:
– Program Counter
– Memory Address Register (MAR)
– Memory Data Register (MDR)
– Current Instruction Register (CIR)
– Accumulator (ACC)

42
Cache
• Cache is a small amount of high-speed Random-
Access Memory (RAM) built directly within the
processor.
• It is used to temporarily hold data and
instructions that the processor is likely to reuse.
• This allows for faster processing as the processor
does not have to wait for the data and
instructions to be fetched from the RAM.

43
Buses
• A bus is a high-speed internal
connection.
• Buses are used to send control
signals and data between the
processor and other components.
• Three types of bus are used:
– Address bus - carries memory
addresses from the processor to
other components such as primary
memory and input/output devices.
– Data bus - carries the actual data
between the processor and other
components.
– Control bus - carries control
signals from the processor to other
components. E.g. clock's pulses.

44
Bus Width and Speed

• Bus width refers to the number of bits that


can be sent to the CPU simultaneously
– Width of Address bus
• Size of addressable memory
– Width of Data bus
• how much data can be fetched in one go from
the memory

• Bus speed refers to the number of times a


group of bits can be sent each second.

45
Clock

• The CPU contains a clock which is used to coordinate all


the computer's components.
• The clock sends out a regular electrical pulse which
synchronises (keeps in time) all the components.
• The frequency of the pulses is known as the clock speed.
• Clock speed is measured in hertz.
• The higher the frequency, the more instructions can be
performed in any given moment of time.
• In the 1980s, processors commonly ran at a rate of
between 3 megahertz (MHz) to 5 MHz, which is 3 million
to 5 million pulses or cycles per second.
• Today, processors commonly run at a rate of 3 gigahertz
(GHz) to 5 GHz, which is 3 billion to 5 billion pulses or
cycles per second. 46
Factors affecting CPU performance

• Even though today's processors are


tremendously fast, their performance can be
affected by several factors:
– Clock speed
– Cache size
– Number of cores
– Word Size
– Number of Threads

47
CPU performance : Clock speed

• Clock speed is the number of pulses the CPU


clock generates per second.
• The more pulses per second, the more fetch-
decode-execute cycles that can be performed
– More instructions that are processed in each space
of time.
• CPU clocks can sometimes be speed up slightly
by the user.
• This process is known as overclocking.
• Overclocking can cause long term damage to the
CPU as it is working harder and producing more
heat.
48
CPU performance: Cache size

• Cache is a small
amount of high-speed
Random Access
Memory (RAM) built
directly within the
processor.
• The bigger its cache,
the less time a
processor must wait
for instructions to be
fetched.

49
CPU performance: Number of cores
• A processing unit within a CPU
is known as a core.
• Each core is capable of
fetching, decoding and
executing its own instructions.
• The more cores a CPU has,
the greater the number of
instructions it can process in
each space of time.
• Many modern CPUs are dual
(two) or quad (four) core
processors.
• This provides vastly superior
processing power compared to
CPUs with a single core.
50
CPU performance: Word Size

• Word size of the machine is


how many bits the CPU can
manipulate in one go.
• Can consider it the basic unit of
data that moves around the
computer.
• CPU specifications indicate if
you have a 32-bit or 64-bit
machine.
– This tells that the CPU has a
32-bit or 64-bit word size.
– It can process 32-bits or 64-
bits on a single machine
code instruction.

Higher word size = more data processed quicker


51
CPU performance: Threads
• A thread is a virtual version of a CPU core.
• Threading process is breaking up physical cores
into virtual cores (threads) to increase
performance.
• Usually, 2 Threads per each physical CPU.
• More threads means faster CPU

52
CPU performance: Threads

53
Instruction Set Architectures (ISA)

• Allows communication hardware to software


• Defines how the CPU is controlled by the software
54
Assembly Language
• Low-level programming language
which has a very strong
correspondence (1 to 1) between
assembly language instruction and
binary (machine) language instruction
• Assembly language usually has one
statement per machine instruction
(1:1)
• Specific to a CPU
• Used when programmer needs precise
control over hardware, e.g., device
drivers
• Assembly code is converted into
executable machine code by a utility
program referred to as an assembler

55
Machine code
• A computer programming
language consisting of binary
(or hexadecimal) instructions
which a computer can respond
to directly
• The machine language contains
only two symbols 1 & 0
• Usually, assembly code is
converted into executable
machine code

56
Instruction Set Architectures (ISA)

• A protocol that defines how a


computing machine appears
to a machine language
programmer or compiler.
• The ISA describes the
1. Memory model
2. Instruction format, types
and modes
3. Operand registers, types,
and data addressing
• Examples: X86, Mips, ARM,
Alpha, AMD64 / x86-64

57
Instruction Format

58
Instruction Format - e.g. x86

59
Runtime - Speed

60
Performance Metrics : Runtime

• Time it takes the program to run

61
What can be done to speed up execution
at ISA Level?

62
CISC vs. RISC

63
More here: https://cs.stanford.edu/people/eroberts/courses/soco/projects/risc/risccisc/
Summery

• The components in the von Neumann architecture


• The operation of a simple LMC program
• Common CPU Components
• Instruction sets & assembly
• The factors that impact on program execution time
• Able explain the difference between CISC and RISC

66
Thank You

67

You might also like