Sunteți pe pagina 1din 43

Computer System

Computer Systems May 16,2011

Module: Computer System Learning Unit: Computer System Components

The contents here are for Aricent internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 2

Objective
Computation & Computers Computer Hardware Instruction Set Assembly & High Level Language

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 3

Computation & Computers


A Program is a set of instructions however unless the instructions from this set can be executed it is not useful. The set of instructions to achieve a task. Consider the following problem:
A person wants to buy pearls to make necklaces. He has to make five necklaces and each necklace requires 10 pearls. How many pearls does he need to buy? Consider Me as a machine who can provide him the result to this problem. Let us say the Machine does not know how to find the answer to this question.
However it can be instructed to do so through a program using Multiplication Operation. How would the program for this machine look like?
No of Pearls = Multiply 5 by 10

The Machine (I) knows how to do multiplication so it can provide the result. This is a program written in a set of instructions which can be executed by the Machine called Me.

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 4

Computation & Computers


Let us change to a machine which does not understand Multiplication. Change it to a child who knows counting, addition, subtraction but not multiplication.
What will be the program that needs to be written?
No_of_pearls = 0; no_of_necklace = 10; While (no_of_necklace > 0){
no_of_pearls = no_of_pearls + 5; no_of_necklace = no_of_necklace - 1

The program changes, because the programming language changes because the machine changes
You can't have multiplication instruction in a program written for the child

Conclusion:
With every machine you have an instruction set which can be used to instruct the machine

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 5

Computation & Computers


What is a machine?
Everything that we see is a machine
or is capable of behaving like a machine

Mostly you can change a program written in a language to an equivalent program in another language as it happened in our previous example and both will give you the desired result How will you ask the machine to execute multiple instructions in a program
There has to be an interface through which you instruct the machine
Car has parts like clutch, gear, accelerator, brake and you can operate these devices to do the required thing

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 6

Computation & Computers


How does a car move ?
Put the Car in the Neutral state Start it Press the Clutch Take the gear to state One Press Accelerator

The Car starts moving A Simple Model of a Car ?


States how many ? Inputs how many ? State Transition how many transitions ? Finite State Machine

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 7

Computation & Computers


Computation
~Information Processing
Information : Data
e.g., Temperature measured in Celsius

Processing
Take the value measured in Celsius Convert from Celsius to Farenheit Show the value in Farenheit

Computer
Equipment which can do Information Processing by an algorithmic process
Algorithm
Is a finite list of well-defined instructions for accomplishing some task that, given an initial state, will terminate in a defined end-state

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 8

Computation & Computers


Calculator vs Computer?
Are they same?
No, why not

The defining feature of modern computers:


They can be programmed
A list of instructions (algorithm or the program) can be stored in the computer and can be carried out any time in the future

Distinguishes them from all other machines

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 9

Computation & Computers


How will you Design a computing machine? which components are required?
Machines has to provide interface to enter the Instructions and data Machine has to have an Instruction Set which would be used to process data
Mostly computer instructions are simple, e.g.:
add one number to another move some data from one location to another

Machines has to provide interface to provide/display the result to the user Provide capability to store data and instructions, the defining feature

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 10

Structure - Top Level


Computer
Central Processing Unit Computer Main Memory

Peripherals

Systems Interconnection

Input Output Communication lines

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 11

Computer Hardware
CPU
Register1 Register2 Registern Stack Pointer Program Counter Instruction Register

Arithmetic and Logic Unit

Program Control Unit

Memory-I/O BUS

Device 1 (DISK)

Device 2

Device n

Main Memory

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 12

Components
The Control Unit and the Arithmetic and Logic Unit constitute the Central Processing Unit Data and instructions need to get into the system and results out
Input/output

Temporary storage of code and results is needed


Main memory

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 13

What is a program?
A sequence of steps For each step, an arithmetic or logical operation is done For each operation, a different set of control signals is needed

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 14

Function of Control Unit


For each operation a unique code is provided
e.g. ADD, MOVE

A hardware segment accepts the code and issues the control signals We have a computer!

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 15

Instruction Cycle
Two steps:
Fetch Execute

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 16

Fetch Cycle
Program Counter (PC) holds address of next instruction to fetch Processor fetches instruction from memory location pointed to by PC Increment PC
Unless told otherwise

Instruction loaded into Instruction Register (IR) Processor interprets instruction and performs required actions

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 17

Execute Cycle
Processor-memory
data transfer between CPU and main memory

Processor I/O
Data transfer between CPU and I/O module

Data processing
Some arithmetic or logical operation on data

Control
Alteration of sequence of operations e.g. jump

Combination of above

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 18

Interrupts
Mechanism by which other modules (e.g. I/O) may interrupt normal sequence of processing Program
e.g. overflow, division by zero

Timer
Generated by internal processor timer Used in pre-emptive multi-tasking

I/O
from I/O controller

Hardware failure
e.g. memory parity error

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 19

Interrupt Cycle
Added to instruction cycle Processor checks for interrupt
Indicated by an interrupt signal

If no interrupt, fetch next instruction If interrupt pending:


Suspend execution of current program Save context Set PC to start address of interrupt handler routine Process interrupt Restore context and continue interrupted program

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 20

Multiple Interrupts
Disable interrupts
Processor will ignore further interrupts while processing one interrupt Interrupts remain pending and are checked after first interrupt has been processed Interrupts handled in sequence as they occur

Define priorities
Low priority interrupts can be interrupted by higher priority interrupts When higher priority interrupt has been processed, processor returns to previous interrupt

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 21

Connecting
All the units must be connected Different type of connection for different type of unit
Memory Input/Output CPU

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 22

Memory Connection
Receives and sends data Receives addresses (of locations) Receives control signals
Read Write Timing

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 23

Input/Output Connection
Similar to memory from computers viewpoint Output
Receive data from computer Send data to peripheral

Input
Receive data from peripheral Send data to computer

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 24

CPU Connection
Reads instruction and data Writes out data (after processing) Sends control signals to other units Receives (& acts on) interrupts

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 25

Buses
There are a number of possible interconnection systems Single and multiple BUS structures are most common e.g. Control/Address/Data bus (PC) e.g. Unibus (DEC-PDP)

Ask what is a bus error ?

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 26

What is a Bus?
A communication pathway connecting two or more devices Usually broadcast Often grouped
A number of channels in one bus e.g. 32 bit data bus is 32 separate single bit channels

Power lines may not be shown

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 27

Data Bus
Carries data
Remember that there is no difference between data and instruction at this level

Width is a key determinant of performance


8, 16, 32, 64 bit

different set of control signals is needed

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 28

Address bus
Identify the source or destination of data e.g. CPU needs to read an instruction (data) from a given location in memory Bus width determines maximum memory capacity of system
e.g. 8080 has 16 bit address bus giving 64k address space

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 29

Control Bus
Control and timing information
Memory read/write signal Interrupt request Clock signals

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 30

Instruction Set
Instruction Set of a Machine
Operands & Operators
Operators are those operations that are supported on the machine, e.g., add, subtract

What are the operands of Compute hardware C example


int a,b,c; a = b + c; These are variables

Can Operands be Variables for Machine Instructions?


No, these are symbolic names and a general purpose hardware can not work with symbolic names Operands have to be memory locations
Either Registers or Memory Addresses

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 31

Instruction Set
Instruction Set of a Machine Types of Instructions
Instructions to perform fundamental Arithmetic/Logical Operations
Add/subtract operation Example a = b + c //sum of b and c is placed in a Converted into machine language of a particular machine
00000010001100100100000000100000 Basically means: add $R1, $R2, $R3, i.e., sum of values kept in CPU registers R2 and R3 is to be placed in register R1 Similarly sub $R1, $R2, $R3 Value kept in register $R3 subtracted from value in $R2 is placed in register $R1

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 32

Instruction Set
Instruction Set of a Machine
Data Movement Instructions
Load and Store Instructions 10001101001010000000010010110000
Load $R1, ($A1) //Load data from memory location M1 into Register R1

10101101001010000000010010110000
Store $R1, ($A1) //Store data from Register R1 into memory location M1

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 33

Instruction Set
Instruction Set of a Machine
Logical Operations
AND
Instruction looks as follows: AND $R1, $R2, $R3 // $R1 = $R2 & $R3

Bit-by-bit OR NOT Shift left Shift right

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 34

Instruction Set
Instruction Set of a Machine
What Distinguishes a Computer from a Calculator? Instructions for making Decisions
Conditional Branch Instructions, an example
Branch on equal beq $R1, $R2, L1 //go to the statement labelled L1 if value in R1 == R2

Unconditional Branch an example


Jump L2 // jump to the statement labelled L2

Other such instructions


Branch if not equal Set on less than

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 35

Instruction Set
An Issue
CPU Instruction Set is in the binary form as the CPU understands only 0s and 1s
very difficult for human beings to read/write such instructions Programming is very difficult

Solution
Assembly Language
Symbolic Representation of CPU Instruction Set
Symbolic name for operators and operands add $R1, $R2, $R3 sub $R1, $R2, $R3

One statement in Assembly produces exactly one machine instruction


There is one-to-one correspondence between machine instructions and statements in the program

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 36

Instruction Set
Assembly Language
Symbolic Representation of CPU Instruction Set How do you write a program in this language
Start an Editor Type characters corresponding to instructions These characters are saved in ascii format
e.g., Assembly language statement: add $R1, $R2, $R3 Stored form: a d d $ R 01100001011001000110010000100000001001000101 00100011 0001

Can you execute this statement?

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 37

Instruction Set
Assembly Language
program written in this language can not run as it is in not in binary format You need a converter from Assembly language to machine language
Assembler

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 38

Programming in High Level Languages


Assembly Language
Is difficult to write programs in Assembly Language also Not Portable can run on only one type of machine Very Difficult to Debug and very hard to maintain Performance can be much better if you write in Assembly performance critical applications especially which are small in size can be written in this language Some programs require detailed access to hardware, like device controllers in some embedded applications so those programs can be written in Assembly only Many times in time critical systems a mixed program is a necessity (80-20 principle)

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 39

Programming in High Level Languages


High level Language
Better Maintainability
Closer to language like English Easier to understand Easier to write, test & debug programs

Portable across platforms


You need a tool called compiler to convert into native machine language

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 40

Disclaimer
Aricent Group makes no representations or warranties with respect to contents of these slides and the same are being provided as is. The content/materials in the slides are of a general nature and are not intended to address the specific circumstances of any particular individual or entity. The material may provide links to internet sites (for the convenience of users) over which Aricent Group has no control and for which Aricent Group assumes no responsibility for the availability or content of these external sites. While the attempt has been to acknowledge sources of materials wherever traceable to an individual or an institution; any materials not specifically acknowledged is purely unintentional

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 41 41

Revision History
Version No. Date of Release Author Reviewer Approver Changes

3.0

16-May-11

Soma Tiwari

BS

Aligned as per new template

The contents here are for Aricent Group internal training purposes only and do not carry any commercial value

Restricted Aricent Group 2011 42

Thank You

S-ar putea să vă placă și