DATA MANIPULATION
L EC T U R E S L I D ES A R E A DA P T E D / M O D I F I E D F RO M S L I D ES
P ROV I D E D BY T H E T E X T B O O K , C O M P U T E R S C I E N C E : A N
OV E RV I E W BY J. G L E N N B RO O K S H EA R A N D D E N N I S B RY LOW
P U B L I S H E R P EA RS O N
Data Manipulation
Computer Architecture
Machine Language
Program Execution
Arithmetic/Logic Instructions
Communicating with Other Devices
Other Architectures
2
Computer Architecture
Computer Architecture
Central Processing Unit (CPU) or processor
◦ Arithmetic/Logic unit versus Control unit
◦ Registers
◦ General purpose
◦ Special purpose
Bus
Motherboard
4
CPU and main memory connected via a bus
5
Motherboards
The motherboard
◦ is the main printed circuit board.
◦ contains the buses, or electrical
pathways found in a computer.
Buses allow data to travel
among the various components.
◦ accommodates CPU, RAM,
expansion slots, heat sink/fan
assembly, BIOS chip, chip set,
sockets, internal and external
connectors, various ports, and the
embedded wires that interconnect the
motherboard components.
6
Central Processing Unit
The Central Processing Unit (CPU) is known as the
brain of the computer. It is also referred to as the
processor.
The CPU executes a program, which is a sequence
of stored instructions.
7
Central Processing Unit
Some CPUs incorporate hyperthreading or
hypertransport to enhance the performance of the
CPU.
The amount of data that a CPU can process at one
time depends on the size of the processor data bus.
Speed of the CPU is measured in cycles per second
- megahertz (MHz) or gigahertz (GHz).
Overclocking is a technique used to make a
processor work at a faster speed than its original
specification.
8
Central Processing Unit
The latest processor technology has resulted
in CPU manufacturers finding ways to incorporate
more than one CPU core onto a single chip.
◦ Dual Core CPU - Two cores inside a single CPU
◦ Triple Core CPU - Three cores inside a single CPU
◦ Quad Core CPU - Four cores inside a single CPU
◦ Hexa-Core CPU - Six cores inside a single CPU
◦ Octa-Core CPU - Eight cores inside a single CPU
9
The Arithmetic/Logic Unit
Subsystem that performs addition, subtraction, and
comparison for equality
Components
◦ Registers, interconnections between components, and the
ALU circuitry
Register
◦ Storage cell that holds the operands of an arithmetic
operation and holds its result
Bus
◦ Path for electrical signals
10
The Arithmetic/Logic Unit
Registers are similar to RAM with following minor
differences
◦ They do not have a numeric memory address but are
accessed by a special register designator such as A, X or R0
◦ They can be accessed much more quickly than regular
memory cells
◦ They are not used for general purpose storage but for
specific purposes such as holding the operands for an
upcoming arithmetic computations.
A typical ALU has 16, 32 or 64 registers.
11
The Control Unit
Control unit
◦ Tasks: fetch, decode, and execute
12
Machine Language
Stored Program Concept
A program can be encoded as bit patterns and
stored in main memory.
From there, the CPU can then extract the
instructions and execute them.
In turn, the program to be executed can be altered
easily.
14
Terminology
Machine instruction: An instruction (or command)
encoded as a bit pattern recognizable by the CPU
Machine language: The set of all instructions
recognized by a machine
15
Machine Language Philosophies
Reduced Instruction Set Computing (RISC)
◦ Few, simple, efficient, and fast instructions
◦ Examples: PowerPC from Apple/IBM/Motorola and ARM
Complex Instruction Set Computing (CISC)
◦ Many, convenient, and powerful instructions
◦ Example: Intel
16
Machine Instruction Types
Data Transfer: copy data from one location to
another
Arithmetic/Logic: use existing bit patterns to
compute a new bit patterns
Control: direct the execution of the program
17
Adding values stored in memory
18
Dividing values stored in memory
19
An architecture of the machine
20
Parts of a Machine Instruction
Op-code: Specifies which operation to execute
Operand: Gives more detailed information about
the operation
◦ Interpretation of operand varies depending on op-code
21
The composition of an instruction
22
Decoding the instruction 35A7
23
A Simple Machine Language
Op-code Operand Description
1 RXY LOAD reg. R from cell XY.
2 RXY LOAD reg. R with XY.
3 RXY STORE reg. R at XY.
4 0RS MOVE R to S.
5 RST ADD S and T into R. (2’s comp.)
6 RST ADD S and T into R. (floating pt.)
24
A Simple Machine Language
Op-code Operand Description
7 RST OR S and T into R.
8 RST AND S and T into R.
9 RST XOR S and T into R.
A R0X ROTATE reg. R X times.
B RXY JUMP to XY if R = reg. 0.
C 0 HALT.
25
A Simple Machine Language
14A3: Load
◦ The contents of the memory cell located at address A3 to
be placed in register 4.
20A3: Load
◦ The value A3 to be placed in register 0.
35B1: Store
◦ The contents of register 5 to be placed in the memory cell
whose address is B1.
40A4: Move
◦ The contents of register A to be copied into register 4.
26
A Simple Machine Language
5726: Add
◦ The binary values in registers 2 and 6 to be added and the
sum placed in register 7.
634E: Add
◦ The values in registers 4 and E to be added as floating-
point values and the result to be placed in register 3.
27
A Simple Machine Language
7CB4: Or
◦ The result of ORing the contents of registers B and 4 to be
placed in register C.
8045: And
◦ The result of ANDing the contents of registers 4 and 5 to
be placed in register 0.
95F3: Xor
◦ The result of XORing the contents of registers F and 3 to
be placed in register 5.
A403: Rotate
◦ The contents of registers 4 to be rotated 3 bits to the right
in a circular fashion.
28
A Simple Machine Language
B43C:
◦ Compare the contents of register 4 with the contents of
register 0.
◦ If equal, the pattern 3C would be placed in the program
counter so that the next execution executed would be the
one located at that memory address.
◦ Otherwise, nothing would be done.
C000:
◦ Stop program execution.
29
An encoded version of the instructions
30
Quiz
The following are instructions written in the above
simple machine language. Rewrite in English.
◦ 368A
◦ BADE
◦ 803C
◦ 40F4
31
Quiz
What is the difference between the instructions 15AB
and 25AB in the simple machine language?
32
Quiz
Here are some instructions in English. Translate each
of them into the simple machine language.
◦ LOAD register number 3 with the hexadecimal 56.
◦ ROTATE register number 5 three bits to the right.
◦ AND the contents of register A with the contents of register
5 and leave the result in register 0.
33
Program Execution
Program Execution
Controlled by two special-purpose registers
◦ Program counter: address of next instruction
◦ Instruction register: current instruction
Machine Cycle
◦ Fetch
◦ Decode
◦ Execute
36
The machine cycle
37
Decoding the instruction B258
38
A program stored in main memory
39
The fetch step of the machine cycle
40
The fetch step of the machine cycle
41
Arithmetic/Logic Instructions
Arithmetic/Logic Operations
Logic: AND, OR, XOR
◦ Masking
Rotate and Shift:
◦ circular shift (rotation)
◦ logical shift
◦ arithmetic shift
Arithmetic: add, subtract, multiply, divide
◦ Precise action depends on how the values are encoded
(two’s complement versus floating-point).
43
Masking
44
Circular shift
45
Logical shift
46
Quiz
Identify both the mask and the logical operation
needed to accomplish each of the following
objectives:
• Put 1s in all but the most significant bit of an 8-bit
pattern without disturbing the most significant bit.
• Filter out all of the green color component from
an RGB bitmap image pixel in which the middle 8
bits of a 24-bit pattern store the green information.
• Invert all of the bits in a 24-bit RGB bitmap
• Set all the bits in a 24-bit RGB bitmap pixel to 1,
indicating the color “white”.
49
Quiz
Identify a logical operation (along with a
corresponding mask) that, when applied to an input
string of 8 bits, produces an output string of all 0s if
and only ifs the input string is 1000 0001.
50
Communicating with Other
Devices
Communicating with Other Devices
Controller: An intermediary apparatus that handles
communication between the computer and a device
◦ Specialized controllers for each type of device
◦ General purpose controllers (USB and FireWire)
Port: The point at which a device connects to a
computer
Memory-mapped I/O: CPU communicates with
peripheral devices as though they were memory
cells
52
Controllers attached to a machine’s bus
53
A conceptual representation of memory-
mapped I/O
54
Communicating with Other Devices
Direct memory access (DMA): Main memory
access by a controller over the bus
Von Neumann Bottleneck: Insufficient bus speed
impedes performance
Handshaking: The process of coordinating the
transfer of data between components
55
Communicating with Other Devices
Parallel Communication: Several communication
paths transfer bits simultaneously.
Serial Communication: Bits are transferred one
after the other over a single communication path.
56
Data Communication Rates
Measurement units
◦ Bps: Bits per second
◦ Kbps: Kilo-bps (1,000 bps)
◦ Mbps: Mega-bps (1,000,000 bps)
◦ Gbps: Giga-bps (1,000,000,000 bps)
Bandwidth: Maximum available rate
57
What’s on the Outside of the Box?
58
What’s on the Outside of the Box?
Connectors on a notebook may vary
59
Universal serial bus
USB (universal serial bus) ports
◦ Connects up to 127 peripheral devices
◦ USB 2.0 (high-speed USB)—fully compatible with USB 1.1
products, cables, and connectors
◦ Designed to replace older parallel and serial ports
◦ Connects a variety of devices to the computer, including:
◦ Keyboards
◦ Mice
◦ Printers
◦ Digital cameras
60
Universal serial bus
USB 2.0
◦ Uses an external bus
◦ Supports data transfer rates of 480 Mbps between the computer
and the peripheral device
◦ Supports hot swapping—ability to connect and disconnect devices
without shutting down the computer
◦ Plug-and-play (PnP)—allows computers to automatically detect
the device when you plug it in
USB 3.0 (2008): 5Gbps
USB 3.1 (2013): 10Gbps
USB hub
◦ Device that plugs into existing USB port
◦ Contains four or more additional ports
61
FireWire
FireWire (1395 ports)
◦ Created by Apple in 1995
◦ IEEE 1394 Higher Performance Serial Bus, also known as
Sony i.Link
◦ Offers high-speed connections for dozens of peripheral
devices (up to 63)
◦ Enables hot swapping and PnP
◦ Data transfer rates of FireWire
◦ FireWire 400—400 Mbps
◦ FireWire 800—800 Mbps
◦ Declared “dead” by Steve Jobs.
62
Video connectors
VGA (video graphics array)
◦ 15-pin male connector—works with standard monitor
cables
◦ Transmits analog video signals
◦ Used for legacy technology cathode ray (CRT) monitors
DVI (Digital visual Interface) port—lets LCD
monitors use digital signals
Onboard video—video circuitry built into the
motherboard where the video connector is on the
back of the system unit case
63
HDMI
High-Definition Multimedia
Interface
◦ A video/audio interface for transmitting
uncompressed video data, and
compressed/uncompressed audio data.
◦ Digital replacement for analog video
standards.
◦ Designed: 2002 (7 companies).
◦ HDMI 2.1: 48Gbps.
◦ Newer version: 3D, Ethernet data
connection, Consumer Electronics
Control (CEC) extensions.
64
Additional connectors
Telephone
Network
PC card slot
◦ PC card
◦ ExpressCard
Sound card
Game card
TV/sound capture
board
65
Other Architechtures
Other Architectures
Technologies to increase throughput:
◦ Pipelining: Overlap steps of the machine cycle
◦ Parallel Processing: Use multiple processors
simultaneously
◦ SISD: No parallel processing
◦ MIMD: Different programs, different data
◦ SIMD: Same program, different data
68
Pipelining
69
Parallel processing
◦ Method where more than one processor performs at the
same time—faster processing
70