an introduction chapter 1. 2301274 chapter 1 introduction2 computer systems programmable machines ...

28
An Introduction Chapter 1

Upload: leo-jennings

Post on 11-Jan-2016

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

An Introduction

Chapter 1

Page 2: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 2

Computer Systems Programmable machines Hardware + Software (program)

Hardware Program

Page 3: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 3

Classes of Computing Applications Desktop computers

Personal computers Servers

Accessed by network Handle large workloads

Embedded computers Microprocessors embedded in devices

Page 4: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 4

Program Performances Algorithm

Number of high-level instructions & I/O operations

Programming languages, compiler and architecture Number of machine instructions

Processor and memory systems Number of clocks for each instruction

I/O systems Time for each I/O operations

Page 5: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 5

Representation of Data and Programs

Bits: 0 or 1 Bytes: string/sequence of bits e.g.

10010110 Normally, a byte is composed of 8 bits.

Words: sequence of bytes A word can be composed of 4 or 8 bytes.

There are standard formats of data stored in a computer. ASCII code, Unicode

Page 6: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 6

Languages and Programs A program is a sequence of instructions for

computer. A format of instructions = a language Computer languages

High-level languages Java, Python, C, ASP, HTML, …

Low-level languages Assembly languages

Machine languages

Page 7: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 7

Examples of Languages High-level

languages

C

swap(int v[], int k)){ int temp;

temp=v[k];v[k]=v[k+1];v[k+1]=temp;return;

}

Assembly languages

MIPS assembly

swap:muli $2, $5, 4add $2, $4, $2lw $15, 0($2)lw $16, 4($2)sw $16, 0($2)sw $15, 4($2)jr $31

Page 8: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 8

Examples of Languages

swap:muli $2, $5, 4add $2, $4, $2lw $15, 0($2)lw $16, 4($2)sw $16, 0($2)sw $15, 4($2)jr $31

Machine languages00000000101000010000000000011000000000000001100000011000001000011000110001100010000000000000000010001100111100100000000000000100101011001111001000000000000000001010110001100010000000000000010000000011111000000000000000001000

Page 9: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 9

Advantages of high-level languages Easy to understand Improve productivity Machine-independent

Page 10: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 10

Hardware-Software interface

Application software

System software

Hardware

Page 11: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 11

System Software Provide services to application software

and users Examples

Operating systems Compilers Assemblers

Page 12: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 12

Compilers A compiler is a program which translates a

program in one language into another language.

Usually, the source language is a high-level language, and the target language is a low-level language.

compilerSource program

Target program

Source language Target language

Page 13: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 13

Assembler Assembly language

Symbolic representation of machine instructions.

Assembler A compiler which translates from an assembly

language to a machine language.

Page 14: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 14

Components of computers

Processor

Output Unit

Memory

Input Unit datapath control

Page 15: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 15

Memory Linear storage Addressable in words “Random access” Data/program can be read from/ write to

memory, one word at a time. To write data d to memory addressed a ,

data d and address a must be specified. To read data from memory addressed a ,

address a must be specified.

Page 16: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 16

Components of a computer: More detail

registers ALU

Control units

Instruction register

Program counter

program

data

data

address

memoryprocessor

Page 17: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 17

Components of Processors Arithmetic-logic unit (ALU)

Performs arithmetic and logic functions: add, substract, multiply, divide, and, or, not, etc.

Registers Fast-access memory used by a processor to store

intermediate results. Program counter (PC)

Keeps track where the current instruction is. Normally, incremented to point to the next instruction. Changed by instructions that alter the flow of control of

a program (if-then-else, loop, and function call).

Page 18: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 18

Components of Processors Instruction register (IR)

Store the current instruction fetched from memory.

Its content (the instruction) signals the control unit to initiate the execution of that instruction.

Control unit Most complex part of a processor. Send control signals to all parts in the

processor to co-ordinate their activities. A large finite state machine.

Page 19: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 19

How a computer system works Fetch-execute cycle Fetch: get an instruction (addressed by

PC) from memory and store in IR, and update PC.

Execute: work according to the instruction in IR If the instruction causes PC changed, PC is

updated again.

Page 20: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 20

Instruction Execution Cycle

registers ALU

Control units

Instruction register

Program counter

program

data

data

address

memoryprocessor

increment

Page 21: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 21

Levels of descriptions of computer systems

Applications

Operating systems

Instruction set

Functional units

Finite state machine

Logic gates

Electronics

Page 22: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 22

Levels of descriptions of computer systems

Applications

Operating systems

Instruction set

Functional units

Finite state machine

Logic gates

Electronics

Application level is what a user typically sees a computer system, running his/her application programs.

An application is usually written in a computer language which used many system functions provided by the operating system.

Page 23: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 23

Levels of descriptions of computer systems

Applications

Operating systems

Instruction set

Functional units

Finite state machine

Logic gates

Electronics

An operating system is abstraction layers that separate a user program from the underlying system-dependent hardware and peripherals.

Page 24: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 24

Levels of descriptions of computer systems

Applications

Operating systems

Instruction set

Functional units

Finite state machine

Logic gates

Electronics

• computer architecture begins at the instruction set.

• An instruction set is what a programmer at the lowest level sees of a processor

• one instruction set with different level of performance for many models, based on the implementation of a control unit via “microprogram”.

• Present day processor designs converge, their instruction sets become more similar than different.

Page 25: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 25

Levels of descriptions of computer systems

Applications

Operating systems

Instruction set

Functional units

Finite state machine

Logic gates

Electronics

Units are divided by their functions, e.g. ALU, control unit, etc. The interconnection between units are described.

registers ALU

Control units

Instruction register

Program counter

processor

data

address

mem

ory

Page 26: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 26

Levels of descriptions of computer systems

Applications

Operating systems

Instruction set

Functional units

Finite state machine

Logic gates

Electronics

Mathematical description of the behavior of a system.

Important tool for verification of the correct behavior of the hardware.

Page 27: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 27

Levels of descriptions of computer systems

Applications

Operating systems

Instruction set

Functional units

Finite state machine

Logic gates

Electronics

Logic gates (e.g. and, or, not gates) are used to build functional units.

Page 28: An Introduction Chapter 1. 2301274 Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram

2301274 Chapter 1 Introduction 28

Levels of descriptions of computer systems

Applications

Operating systems

Instruction set

Functional units

Finite state machine

Logic gates

Electronics

Electronic circuits are used to build logic gates.