CS 1111
Computing Fundamentals and Ethics
Chapter 3
Computer Components
3.1 Gates and Circuits
3.2 Computing Components
(Book: Chapter 4 & 5)
Modified by T. Shams AL-Shamasi
1
3.1 Gates and Circuits
(Book: Chapter 4)
2
Chapter Goals
• Identify the basic gates and describe the
behavior of each
• Describe how gates are implemented
using transistors
• Describe the behavior of a gate
3
Hardware Abstraction Layers *
•Binary Data is processed by physical layers of hardware
Motherboard
10s or 100s of ICs
wikipedia
Integrated circuit (IC)
Millions of logic gates
Billions of transistors
Utml
Logic gate
A few transistors
[Link]
Transistor
* Mobile CSP Web page
[Link]
4
Zoom into an IC ( aka Microchip )
5
Constructing Gates
Most of logic gates are constructed using Transistors.
What is Transistor ?
A device that acts either as a wire that conducts electricity
or as a resistor that blocks the flow of electricity, depending
on the voltage level of an input signal.
Transistors are made of a semiconductor material,
which is neither a particularly good conductor of
electricity nor a particularly good insulator.
The Transistor has no moving parts, yet act like
a switch.
6
Computers and Electricity (1 of 2)
Gate
A device that performs a basic operation on
electrical signals
Circuits
Gates combined to perform more
complicated tasks
7
Integrated Circuits
Integrated Circuit (also called a chip)
A piece of silicon on which multiple gates have
been embedded
Silicon pieces are mounted on a plastic or ceramic
package with pins along the edges that can be
soldered onto circuit boards or inserted into
appropriate sockets
[Link]
8
CPU Chips
The most important integrated circuit
in any computer is the central processing
unit, or CPU
Each CPU chip has a large number of pins
through which essentially all communication
in a computer system occurs
[Link]
9
Computers and Electricity
How do we describe the behavior of gates and
circuits?
Boolean Expressions
Uses Boolean algebra, a mathematical notation for
expressing two-valued logic
Logic Diagrams
A graphical representation of a circuit; each gate has its
own symbol
Truth Tables
A table showing all possible input values and the associated
output values
10
Gates
Six types of gates:
– NOT
– AND
– OR
– XOR
– NAND
– NOR
Typically, logic diagrams are black and white with gates
distinguished only by their shape
We use color for clarity (and fun)
NOT Gate
A NOT gate accepts one input signal (0 or 1) and returns
the complementary (opposite) signal as output
FIGURE 4.1 Representations of
a NOT gate
AND Gate
An AND gate accepts two input signals
If both are 1, the output is 1; otherwise,
the output is 0
FIGURE 4.2 Representations of an
AND gate
OR Gate
An OR gate accepts two input signals
If both are 0, the output is 0; otherwise,
the output is 1
FIGURE 4.3 Representations of
an OR gate
XOR Gate (1 of 2)
An XOR gate accepts two input signals
If both are the same, the output is 0; otherwise,
the output is 1
FIGURE 4.4 Representations of
an XOR gate
XOR Gate (2 of 2)
Note the difference between the XOR gate
and the OR gate; they differ only in one
input situation
When both input signals are 1, the OR gate produces a 1
and the XOR produces a 0
XOR is called the exclusive OR because its output is 1 if
(and only if):
• Either one input or the other is 1
• Excluding the case that they both are
NAND Gate
The NAND (“NOT of AND”) gate accepts two input signals
If both are 1, the output is 0; otherwise,
the output is 1
FIGURE 4.5 Representations of a
NAND gate
NOR Gate
The NOR (“NOT of OR”) gate accepts two inputs
If both are 0, the output is 1; otherwise,
the output is 0
FIGURE 4.6 Representations of a
NOR gate
Combinational Circuits
Gates are combined into circuits by using the output of one
gate as the input for another
This same
circuit using a
Boolean
expression is
AB + AC
3.2 Computing Components
(Book: Chapter 5)
20
Chapter Goals (1 of 2)
• List the components and their function
in a von Neumann machine
• Describe the fetch-decode-execute cycle
of the von Neumann machine
• Describe how computer memory is
organized and accessed
21
Chapter Goals (2 of 2)
•Name and describe different auxiliary
storage devices
•Explain the concept of embedded systems
and give examples from your own home
22
Units (Time & Storage)
Powers of 10 for time, powers of 2 for storage
23
CPU Clock Speed
• Hz stands for hertz, a unit of frequency that
measures cycles per second
• In a computer, a centrally generated series
of electrical pulses, called the clock, is used
to ensure that all of its actions are
coordinated
• The clock of a 3.2 GHz CPU pulses 3.2
billion times per second
24
The von Neumann architecture
Instructions and data are both stored in memory unit
(Stored Program Concept)
25
Memory (1 of 2)
Memory
A collection of cells, each with a
unique physical address
Most computers are byte-
addressable
Cell at address 11111110
contains 10101010
Memory (2 of 2)
Memory
What does 10101010 mean?
No way to answer that without
applying an interpretation.
Could be an instruction, a
natural number, a signed
integer, a character, part of an
image, …
Arithmetic/Logic Unit
Performs basic arithmetic operations such as
addition and subtraction.
Performs logical operations such as AND, OR,
and NOT.
Most modern ALUs have a small amount of
special storage units called registers that can be
accessed faster than main memory.
Registers can store limited amount of data (e.g.,
16 bits, 32 bits, 64 bits) in comparison with the size
of main memory (e.g., 4GB or 8GB).
28
Control Unit
Control Unit
The organizing force in the computer
– Instruction Register (IR)
Contains the instruction that is being executed
– Program Counter (PC)
Contains the address of the next instruction to be executed
Central Processing Unit (CPU)
ALU and the control unit called the Central
Processing Unit, or CPU
29
Input/Output Units
Input Unit
A device through which data and programs from
the outside world enter the computer system
Examples: Keyboard, Mouse, Scanner
Output Unit
A device through which results stored in the
computer memory are made available outside the
computer system
Examples: Screen and Printer
30
Flow of Information
Bus
In general: A communication system that transfers data between components inside a computer
or between computers; the medium (wires, optical fiber, etc.) and the protocols (rules for sharing
the medium nicely)
“The” bus: Connects the CPU, main memory, I/O devices, and possibly other components (e.g.,
hard disk drive)
Data flow through a von Neumann machine
31
The Fetch-Execute Cycle
Fetch-Execute Cycle consists of 4 main steps:
1. Fetch the next instruction.
2. Decode the instruction.
3. Get data if needed.
4. Execute the instruction.
Why is it called a cycle?
32
The Fetch-Execute Cycle
•Fetch
– The CPU retrieves an instruction from the computer's memory
(RAM). The location of the instruction is stored in the Program
Counter (PC), and the instruction itself is then loaded into the
Instruction Register (IR). The PC is then updated to point to
the next instruction.
•Decode
– The CPU's Control Unit (CU) interprets the instruction to
figure out what operation to perform and which data to use. It
translates the instruction's code into a command that the CPU
can understand. The CU sends the necessary signals to other
parts of the CPU to prepare for the action.
33
The Fetch-Execute Cycle
•Execute
– The CPU carries out the instruction, performing the action
specified in the decode stage. This could be a calculation, a data
transfer, or a logical operation. The results are then stored in a
register or memory location, and the cycle begins again with the
next instruction.
34
The Fetch-Execute Cycle
The fetch-execute cycle
35
RAM and ROM
1. Random Access Memory (RAM)
Memory in which each location can be accessed and changed
2. Read Only Memory (ROM)
Memory in which each location can be accessed but not
changed
RAM is volatile, ROM is not.
What does volatile mean?
Volatile: Data stored in RAM vanishes as soon as the
electricity is turned off.
36
Secondary Storage Devices
Why is it necessary to have secondary storage
devices?
Secondary storage devices are used to permanently store data
separate from the computer system itself while main memory is used
by the computer to temporarily store instructions and data.
Examples of secondary storage devices:
Hard disk drive, optical disk, and USB flash drive.
37
Memory Hierarchy
• A structured arrangement of a computer's
storage components based on their speed,
capacity, and cost per bit
38
Memory Hierarchy
•Level 0: Registers
– Registers are the smallest and fastest storage
locations. They are located directly on the CPU and
hold data that is being actively processed. They are
extremely fast but have a very limited capacity.
•Level 1: Cache Memory
– Cache is a small, high-speed memory that stores
copies of data from main memory that the CPU is
likely to need next. It is much faster than RAM but
also much more expensive.
39
Memory Hierarchy
•Level 2: Main Memory (RAM)
– The computer's primary working memory. It's much
larger than cache and is used to hold the data and
programs that the CPU is currently using
•Level 3: Secondary Storage
– This level includes non-volatile storage devices like
Hard Disk Drives (HDDs) and Solid-State Drives
(SSDs)
40
Memory Hierarchy
•Level 4: Tertiary/Offline Storage
– This level is for very large-scale, long-term data
archiving and backups. It includes devices like
magnetic tapes and optical disks (CDs, DVDs).
This storage is the slowest and has the highest
capacity and lowest cost per bit.
41
Embedded Systems
Embedded Systems: Computers that are dedicated to
perform a specific narrow range of functions as part of a larger
system.
Examples:
1. Automobiles:
Modern cars consist of many computers, or embedded systems, designed to
perform different tasks within the vehicle.
2. Mobile phones:
Mobile phones consist of many embedded systems, including GUI software and
hardware, operating systems, cameras, and microphones.
3. Medical equipment:
Medical equipment include some embedded systems like sensors and control
mechanism.
42
For more information:
[Link]
43