Вы находитесь на странице: 1из 46

Computer Architecture and Organization

What is a computer?
Simply put, a computer is a sophisticated electronic calculating machine that: Accepts input information, Processes the information according to a list of internally stored instructions and Produces the resulting output information. Functions performed by a computer are: Accepting information to be processed as input. Storing a list of instructions to process the information. Processing the information according to the list of instructions. Providing the results of the processing as output. What are the functional units of a computer?

Computers as Information Processors

Unlike previous inventions, computers are


Could be used to perform a variety of tasks.

special because they are general-purpose.

Computer = Hardware + Software.


Hardware: physical components for

computation/processing; should be simple, fast, reliable. Software: set of instructions to perform tasks to specifications; should be flexible, user-friendly, sophisticated.

Types of Computers
Supercomputers:
very fast (Gflops) but expensive machine, vector or

parallel processors, used in scientific applications and simulations.

Mainframes:

fast (>10mips) but expensive , high-throughput, used

in large commercial organisations, support many concurrent users interactively.

Mini-computers:

fast but affordable , used in medium-sized

organisations, support multiple users.

Types of Computers
Workstations:
Affordable and fast single-user systems, good

graphics capabilities, engineering, network-based computing.

Micro/Personal/Home Computers:
cheap and affordable , transportable, home use,

good for games and as educational tool, word processing, suitable for small enterprise.

Computer Configurations
Stand-alone computer system

Modem connection

Computer Configurations
Terminals-host connections

Computer Configurations
Network of computers

What is a computer?
Simply put, a computer is a sophisticated electronic calculating machine that: Accepts input information, Processes the information according to a list of internally stored instructions and Produces the resulting output information. Functions performed by a computer are: Accepting information to be processed as input. Storing a list of instructions to process the information. Processing the information according to the list of instructions. Providing the results of the processing as output. What are the functional units of a computer?

Functional units of a computer


Input unit accepts information: Human operators, Electromechanical devices Other computers Arithmetic and logic unit(ALU): Performs the desired operations on the input information as determined by instructions in the memory

Memory Input
Instr1 Instr2 Instr3 Data1 Data2

Arithmetic & Logic

Output I/O
Output unit sends results of processing: To a monitor display, To a printer

Control Processor
Control unit coordinates various actions Input, Output Processing
9

Stores information: Instructions, Data

Information in a computer -- Instructions


Instructions specify commands to:

Transfer information within a computer (e.g., from memory to ALU) Transfer of information between the computer and I/O devices (e.g., from keyboard to computer, or computer to printer) Perform arithmetic and logic operations (e.g., Add two numbers, Perform a logical AND).

A sequence of instructions to perform a task is called a program, which is stored in the memory. Processor fetches instructions that make up a program from the memory and performs the operations stated in those instructions. What do the instructions operate upon?

10

Information in a computer -- Data


Data are the operands upon which instructions operate. Data could be:

Numbers,

Encoded characters.

Data, in a broad sense means any digital information. Computers use data that is encoded as a string of binary digits called bits.

11

Input unit
Binary information must be presented to a computer in a specific format. This task is performed by the input unit: - Interfaces with input devices. - Accepts binary information from the input devices. - Presents this binary information in a format expected by the computer. - Transfers this information to the memory or processor.

Real world

Computer Memory

Keyboard Audio input

Input Unit

Processor

12

Memory unit
Memory unit stores instructions and data.

Recall, data is represented as a series of bits.

To store data, memory unit thus stores bits.

Processor reads instructions and reads/writes data from/to the memory during the execution of a program.

In theory, instructions and data could be fetched one bit at a time. In practice, a group of bits is fetched at a time. Group of bits stored or retrieved at a time is termed as word Number of bits in a word is termed as the word length of a computer.

In order to read/write to and from memory, a processor should know where to look:

Address is associated with each word location.

13

Memory unit (contd..)


Processor reads/writes to/from memory based on the memory address:

Access any word location in a short and fixed amount of time based on the address. Random Access Memory (RAM) provides fixed access time independent of the location of the word. Access time is known as Memory Access Time.

Memory and processor have to communicate with each other in order to read/write information.
In order to reduce communication time, a small amount of RAM (known as Cache) is tightly coupled with the processor. Modern computers have three to four levels of RAM units with different speeds and sizes: Fastest, smallest known as Cache Slowest, largest known as Main memory.

14

Memory unit (contd..)


Primary storage of the computer consists of RAM units.

Fastest, smallest unit is Cache. Slowest, largest unit is Main Memory.

Primary storage is insufficient to store large amounts of data and programs.

Primary storage can be added, but it is expensive.

Store large amounts of data on secondary storage devices:

Magnetic disks and tapes, Optical disks (CD-ROMS). Access to the data stored in secondary storage in slower, but take advantage of the fact that some information may be accessed infrequently.

Cost of a memory unit depends on its access time, lesser access time implies higher cost.

15

Arithmetic and logic unit (ALU)


Operations are executed in the Arithmetic and Logic Unit (ALU).

Arithmetic operations such as addition, subtraction. Logic operations such as comparison of numbers.

In order to execute an instruction, operands need to be brought into the ALU from the memory.

Operands are stored in general purpose registers available in the ALU. Access times of general purpose registers are faster than the cache.

Results of the operations are stored back in the memory or retained in the processor for immediate use.

16

Output unit
Computers represent information in a specific binary form. Output units: - Interface with output devices. - Accept processed results provided by the computer in specific binary form. - Convert the information in binary form to a form understood by an output device.

Computer Memory

Real world Printer Graphics display Speakers

Output Unit

Processor

17

Control unit
Operation of a computer can be summarized as:

Accepts information from the input units (Input unit). Stores the information (Memory). Processes the information (ALU). Provides processed results through the output units (Output unit).

Operations of Input unit, Memory, ALU and Output unit are coordinated by Control unit. Instructions control what operations take place (e.g. data transfer, processing). Control unit generates timing signals which determines when a particular operation takes place.

18

Execution of an instruction
Recall the steps involved in the execution of an instruction by a processor:

Fetch an instruction from the memory. Fetch the operands. Execute the instruction. Store the results.

Several issues:
Where is the address of the memory location from which the present instruction is to be fetched? Where is the present instruction stored while it is executed? Where and what is the address of the memory location from which the data is fetched? ......

Basic processor architecture has several registers to assist in the execution of the instructions.
19

Basic processor architecture


Address of the memory location to be accessed
Memory

Address of the next instruction to be fetched and executed.

Data to be read into or read out of the current location

MAR

MDR Control

PC

R0 R1

IR ALU R(n-1)
-

General purpose registers

Instruction that is currently being executed

n general purpose registers

Processor

20

Basic processor architecture (contd..)

Control Path

Data Path

MAR

MDR

Processor

Memory

Control path is responsible for: Instruction fetch and execution sequencing Operand fetch Saving results Data path: Contains general purpose registers Contains ALU Executes instructions
21

Registers in the control path


Instruction Register (IR):

Instruction that is currently being executed.

Program Counter (PC):

Address of the next instruction to be fetched and executed.


Address of the memory location to be accessed. Data to be read into or read out of the current memory location, whose address is in the Memory Address Register (MAR).

Memory Address Register (MAR):

Memory Data Register (MDR):

22

Fetch/Execute cycle
Execution of an instruction takes place in two phases:
Instruction fetch. Instruction execute.

Instruction fetch:
Fetch the instruction from the memory location whose address is in the Program Counter (PC). Place the instruction in the Instruction Register (IR).

Instruction execute:
Instruction in the IR is examined (decoded) to determine which operation is to be performed. Fetch the operands from the memory or registers. Execute the operation. Store the results in the destination location.

Basic fetch/execute cycle repeats indefinitely.


23

How are the functional units connected?


For a computer to achieve its operation, the functional units need to communicate with each other. In order to communicate, they need to be connected.

Input

Output

Memory

Processor

Bus
Functional units may be connected by a group of parallel wires. The group of parallel wires is called a bus. Each wire in a bus can transfer one bit of information. The number of parallel wires in a bus is equal to the word length of a computer

24

Basic Machine Software


Software is the key to making computers
general purpose.

Software are often built hierarchically, with


layers of software providing successive higher-level of abstractions. onion layer view of software.

This structure is reflected by the following

25

Basic Machine Software

Hardware Operating system System utilities

Applications/User programs

26

Software Languages
All programs will have to be coded in some The native language of machine is called
machine language.

programming language usually text-based.

This consists of a set of primitive instructions,


coded in numbers.

An example is 0310 0412 0512. But can you


understand what it does?

27

Software Languages
Possible to use more human-readable mnemonic
instructions. These are know as assembly language instructions.
Mnemonic ADD 10 SUB 12 STO 12 Description AC:=AC+C(10) AC:=AC-C(12) C(12)=AC

Normally, assembly language has a 1-to-1


correspondence with machine language.
28

Software Languages
Assembly language is still very primitive. Higher-level Languages, like Pascal, C, Fortran,
which are a little closer to English language have been developed.

29

Software Languages
An example Pascal program to find roots of
quadratic equation:
read(a,b,c); if a=0 then writeln ("not a quadratic equation") else begin d := sqr(b)-4*a*c; if d>0 then writeln ("complex roots") else if d=0 then writeln("single root =",-b/(2*a)) else writeln ("root1=",-b+sqrt(d)/(2*a), "root2=", -b-sqrt(d)/(2*a)); end;

30

Software Operating Systems


Operating System (OS) is situated directly Often, OS has special access privileges to User programs have to go through OS for
these privileges. above hardware. It controls and manages the available hardware resources. certain categories of instructions and certain hardware

31

Software Operating Systems


Associated Functions/Tasks:
boots up machine loads user program allocates main memory/storage space

schedules concurrent user programs


drivers to service various devices (terminals,

printers, etc.)

32

Software System Utilities


Above the OS, there is a set of frequently
Used by programmers/analyst to help develop

executed programs,called System Utilities. These utilities are often packaged with OS.
applications.

Some examples

Editor: compose/edit user programs or data files Assembler: translates assembly to machine code Compiler: translates high-level language to

assembler/machine code Spooler: temporary stores print files for queuing


33

Software System Utilities


Some examples (continued)
Mailer: forwards/receives mails between users
DBMS (Data-Base Management System): centralised

management of data at a more abstract level than files Window Management System: multiple windows can appear on single screen. These together with various graphical entities (e.g. menus,panels, buttons) can be managed by WMS.

34

Software Applications
Word-Processors: compose/edit
reports/articles

Accounting Package: keeps track of

accounting transactions, produces daily/weekly/monthly (profit/loss) reports

Inventory System: keeps track of stock levels Personnel/Payroll System: staff records,
monthly salary

35

System Software

36

Operating system (OS)

37

Multitasking

38

Applications programs

39

Organization of cache and main memory

Main memory

Cache memory Processor

Bus

Why is the access time of the cache memory lesser than the access time of the main memory?

40

Caching
Optimizing memory for speed (cache) Commonly used data are coppied to on-processor memory (cache) to reduce access time Small memories can be made higher speed than large ones In a computer, we need both.

41

Performance

42

Pipelining and Superscalar

43

CISC vs RISC

44

Compiler

45

Вам также может понравиться