You are on page 1of 25

Chapter 2:

Data Manipulation

Computer Science: An Overview


Twelfth Edition

by
J. Glenn Brookshear
Dennis Brylow

Copyright © 2015 Pearson Education, Inc.


Chapter 2: Data Manipulation

• 2.1 Computer Architecture


• 2.2 Machine Language
• 2.3 Program Execution
• 2.4 Arithmetic/Logic Instructions
• 2.5 Communicating with Other Devices
• 2.6 Program Data Manipulation
• 2.7 Other Architectures

Copyright © 2015 Pearson Education, Inc. 2-2


2.1 Computer Architecture

• Central Processing Unit (CPU) or


processor
– Arithmetic/Logic unit versus Control unit
– Registers
• General purpose
• Special purpose
• Bus
• Motherboard

Copyright © 2015 Pearson Education, Inc. 2-3


CPU and main memory connected
via a bus

Copyright © 2015 Pearson Education, Inc. 2-4


Von-Neumann computer architecture
▪ Proposed in 1945
Historically there have been 2 types of Computers:

1. Fixed Program Computers – Their function is very specific and


they couldn’t be reprogrammed, e.g. Calculators.
2. Stored Program Computers – These can be programmed to
carry out many different tasks, applications are stored on
them, hence the name.

▪ Modern computers are based on a stored-program concept


introduced by John Von Neumann.
▪ In this stored-program concept, programs and data are stored
in a separate storage unit called memories and are treated the
same
Basic structure of the Von-
Neumann computer architecture
Basic structure of the Von-
Neumann computer architecture
➢ Also known as ISA (Instruction set architecture) computer and
is having three basic units:
▪ The Central Processing Unit (CPU)
▪ The Main Memory Unit
▪ The Input/Output Device Let’s consider them in detail.

1. Central Processing Unit-


The central processing unit is defined as the it is an electric
circuit used for the executing the instruction of computer
program.
➢ It has following major components:
▪ Control Unit(CU)
▪ Arithmetic and Logic Unit(ALU)
▪ variety of Registers
Basic structure of the Von-
Neumann computer architecture
▪ Control Unit – A control unit (CU) handles all processor control
signals. It directs all input and output flow, fetches code for
instructions and controls how data moves around the system.
▪ Arithmetic and Logic Unit (ALU) – The arithmetic logic unit is that
part of the CPU that handles all the calculations the CPU may need,
e.g. Addition, Subtraction and comparisons. It performs Logical
Operations, Bit Shifting Operations, and Arithmetic operations.
▪ Buses – Data is transmitted from one part of a computer to another,
connecting all major internal components to the CPU and memory,
by the means of Buses.
▪ Input/Output Devices – Program or data is read into main memory
from the input device or secondary storage under the control of CPU
input instruction. Output devices are used to output information
from a computer. I
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.

Copyright © 2015 Pearson Education, Inc. 2-9


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

Copyright © 2015 Pearson Education, Inc. 2-10


2.2 Machine Language

• 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

Copyright © 2015 Pearson Education, Inc. 2-11


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

Copyright © 2015 Pearson Education, Inc. 2-12


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

Copyright © 2015 Pearson Education, Inc. 2-13


The composition of an instruction for
the machine in Appendix C

Copyright © 2015 Pearson Education, Inc. 2-14


2.3 Program Execution

• Controlled by two special-purpose registers


– Program counter: address of next instruction
– Instruction register: current instruction
• Machine Cycle
– refers to a sequence of steps that a
computer’s central processing unit (CPU) goes
through in order to execute a single machine
language instruction. It is also known as the
instruction cycle.

Copyright © 2015 Pearson Education, Inc. 2-15


Machine Cycle
➢Steps of a machine cycle:
▪ Fetch
▪ Decode
▪ Execute
▪ Store
▪ Counter update

Copyright © 2015 Pearson Education, Inc.


The machine cycle
1. Fetch. The CPU must fetch the instructions from the memory
location indicated by the program counter, a register that keeps
track of the memory address of the next instruction to be executed.
2. Decode. The CPU decodes the instructions to determine what
operation needs to be performed and what data is required.
3. Execute. Instructions are executed with results stored in memory
or in a register.
4. Store. The CPU stores any results or changes to memory that
were made during the execution of the instruction.
5. Counter update. Once the machine cycle is complete, the
program counter is updated to point to the next instruction to be
executed.

Copyright © 2015 Pearson Education, Inc. 2-17


2.4 Arithmetic/Logic Operations

• Logic: AND, OR, XOR


– Masking
• Rotate and Shift: circular shift, logical shift,
arithmetic shift
• Arithmetic: add, subtract, multiply, divide
– Precise action depends on how the values are
encoded (two’s complement versus
floating-point).

Copyright © 2015 Pearson Education, Inc. 2-18


2.5 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

Copyright © 2015 Pearson Education, Inc. 2-19


A conceptual representation of memory-
mapped I/O

Copyright © 2015 Pearson Education, Inc. 2-20


Communicating with Other Devices
(continued)

• 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

Copyright © 2015 Pearson Education, Inc. 2-21


Communicating with Other Devices
(continued)

• Parallel Communication: Several


communication paths transfer bits
simultaneously.
• Serial Communication: Bits are
transferred one after the other over a
single communication path.

Copyright © 2015 Pearson Education, Inc. 2-22


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

Copyright © 2015 Pearson Education, Inc. 2-23


2.6 Programming Data Manipulation

• Programing languages shields users from


details of the machine:
– A single program statement might map to
one, tens, or hundreds of machine
instructions
– Assigning variables surely involves LOAD,
STORE, and MOVE op-codes

Copyright © 2015 Pearson Education, Inc. 2-24


2.7 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

Copyright © 2015 Pearson Education, Inc. 2-25

You might also like