<<

2/5/2020

Chapter 2: Data Manipulation

• 2.1 Architecture • 2.2 Machine Language • 2.3 Program Execution • 2.4 Arithmetic/Logic Instructions (skip) • 2.5 Communicating with Other Devices • 2.6 Other Architectures

• To cover: pp. 81-87, 91-97, 103-108 th (12 ed) 2-1

Computer Architecture

(CPU) – Arithmetic/Logic unit – • System clock – Registers • General purpose • Special purpose • • Motherboard • Primary Memory (RAM and ROM) – = CPU and memory

2-2

1 2/5/2020

CPU and main memory connected via a bus

2-3

Another depiction

2-4

2 2/5/2020

The Central Processing Unit (CPU) Control Unit

• Control Unit: The part of the CPU that oversees and controls all computer activities according to the instructions it receives. – System clock • Electronic pulses measured in – Runs Fetch-Decode-Execute Cycle • Instructions: Detailed descriptions of the actions to be carried out during input, processing, output, storage, and transmission. – Must be encoded in binary

5

The Central Processing Unit (CPU) Arithmetic/Logic Unit (ALU)

• Arithmetic/Logic Unit (ALU): The part of the CPU that performs arithmetic and logical operations. – Arithmetic Operations: Addition, Subtraction, Multiplication, and Division. – Logical Operations: Greater Than (>), Less Than (<), Equal To (=)

6

3 2/5/2020

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.

2-7

Terminology of Instructions

• Machine instruction: An instruction (or command) encoded as a bit pattern recognizable by the CPU • Instruction set: The set of all instructions recognized by a machine – Small set of very commands o LOAD (from RAM to register in control unit) o STORE (from register to RAM) o ADD (value from RAM to value in register) o HALT, etc. – Different instruction set for every type of processor

2-8

4 2/5/2020

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

2-9

Parts of a Machine Instruction

• Op-code: Specifies which operation to execute – Assigned arbitrarily by the CPU manufacturer • Operand: Gives more detailed information about the operation – Interpretation of operand varies depending on op-code

2-10

5 2/5/2020

Example

Hypothetical instruction set Op Code Address/Data Action 0000 X STORE contents of register in X 0001 X LOAD contents of X into register 0010 X SET contents of register to X 0111 -- HALT execution 1001 X ADD contents of X to register 1100 X READ value from input into cell X 1101 X PRINT value in cell X to screen

Note: Processor designer must decide: How many bits for op code? How many bits for address/data (the operand)? Issues of finite range

2-11

Adding values stored in memory

2-12

6 2/5/2020

Machine language program

Sample machine language program (loaded in RAM at memory location 4) Location in RAM Instruction 0 2 4 0001000000001110 6 1001000000001111 8 0000000000010000 10 1101000000010000 12 0111000000000000 14 0000001100000101 16 0000100000000000

Note: Stored program concept – instructions and data together

2-13

Program Execution

• Controlled by two special-purpose registers – Program : address of next instruction – : current instruction • Machine Cycle – Fetch – Decode – Execute

2-14

7 2/5/2020

The machine cycle

2-15

Processing instructions

1. What happens when you start up a program like Dreamweaver or Word? a. Operating system loads object code from hard disk into RAM 1) Not necessarily in contiguous memory (fragmentation) b. Address of first instruction placed in (a register in the control unit) . Control unit fetches the instruction indicated by the PC into the instruction register d. Control unit reads op code to decode instruction e. Control unit uses operand from instruction to execute f. PC is incremented, return to (c.) g. Continue until HALT instruction reached

2-16

8 2/5/2020

Processing instructions

2. Note effects of a. Fragmentation b. Too little RAM 3. Note how computer interprets info the way it is instructed to a. E.g., what if HALT instruction missing? b. E.g., what if the LOAD instruction used the value to be loaded instead of an address? c. It’s all binary code!

2-17

Another Example (with animation)

2-18

9 2/5/2020

Another Example (with animation)

2-19

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 • Examples: input devices, output devices, secondary (mass) storage, etc.

2-20

10 2/5/2020

Controllers attached to a machine’s bus

2-21

Communicating with Other Devices (continued)

• Direct memory access (DMA): Main memory access by a controller over the bus • Handshaking: The of coordinating the transfer of data between components • Von Neumann Bottleneck: Insufficient bus speed impedes performance

2-22

11 2/5/2020

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

2-23

Processor Speed Terminology

• Millions of Instructions per Second (MIPS): – The number of instructions the processor can execute per second – a measure of processor speed.

• Megaflops: – Millions of floating point operations per second • a measure of how many detailed arithmetic calculations the computer can perform per second.

24

12 2/5/2020

Processor Speed Determining Processor Speed

• Four elements: – System Clock – Bus Width – Word Size – Available Memory

25

Processor Speed Determining Processor Speed (Continued)

• System Clock: A circuit that generates electronic impulses at a fixed rate to synchronize processing activities. – Megahertz (MHz): Millions of electric pulses per second – a measure of a computer’s speed. – Gigahertz (GHz): Billions of pulses per second.

26

13 2/5/2020

Processor Speed Determining Processor Speed (Continued)

• Bus Width – How much data can be transmitted at once (16 bits, 32 bits, 64 bits) – Every bus also has a clock speed measured in MHz • Word Size – Word: The number of bits a computer can process at one time – Usually the same as the bus width – In general, the longer the word length, the more the processor can do in a single operation • Memory – More RAM  greater speed (Why?)

27

Processor Speed Increasing Computer Speed

• Increased Chip Density and Integration: More transistors/circuits and shorter distances. • Memory: A form of high-speed memory that acts as a temporary holding/processing cell. • : A special-purpose chip mounted on a processor board; it is designed to handle common functions quickly and efficiently. • Accelerator Boards: An add-in circuit board that increases a computer’s processing speed.

28

14 2/5/2020

Processor Speed Increasing Computer Speed (Continued)

• 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

2-29

Processor Speed Increasing Computer Speed (Continued)

• Multi-core processors: More than one processor working together on the same chip • Grid Computing: A process that harnesses idle time on and then uses them to provide processing for an application that needs more speed and capability than may be available on a single computer, or even on a . – Called cluster computing when all machines are local and used intentionally as a unit

30

15