computer structure higher unit 1 – computer systems st kentigern’s academy

57
COMPUTER Structure Higher Unit 1 – Computer Higher Unit 1 – Computer Systems Systems St Kentigern’s Academy St Kentigern’s Academy

Upload: muriel-cole

Post on 03-Jan-2016

220 views

Category:

Documents


1 download

TRANSCRIPT

COMPUTER Structure

Higher Unit 1 – Computer Higher Unit 1 – Computer SystemsSystems

St Kentigern’s AcademySt Kentigern’s Academy

What I need to know…• Detailed description of the purpose of the ALU and control unit;

• Description of the purposes of registers: – to hold data being processed, – instructions being executed, and – addresses to be accessed;

• Description of the function of the data bus and the address bus;

• Description of the read, write and timing functions of the control lines;

• Identification of other control lines, including reset and interrupt lines;

• Simple description, referring to the appropriate buses and control lines, of the steps in the fetch-execute cycle;

What I need to know…

• Description of the following elements of computer memory:

– registers,

– cache,

– main memory,

– backing storage;

• Distinction between the above elements of memory according to function and speed of access;

• The concept of addressability;

What I need to know…

• Description and evaluation of the following measures of performance: – clock speed, – MIPS, – FLOPS, and – application based tests

• Description of the effect the following factors have on system performance: – data bus width, – use of cache memory, – rate of data transfer to and from peripherals

• Description of current trends in computer hardware, including increasing clock speeds, increasing memory and backing storage capacity

Two State Machine

• Two-state machine– a computer system is a two state machine as the

processor and devices can either be on or off. This is represented using the digits 1 and 0 in the binary system.

– A voltage is either being sent between processor and memory/device or it is not.

• Advantages of a two-state machine– simple architecture in designing a system which

only uses two voltages (on and off)

– good tolerance level

– simplifies calculations

Input - Process - Output

Input Device

Output DeviceCPU

Backing Storage

Central Processing Unit

Main Memory

Other Registers

Memory Data

RegisterControl Unit

Address Bus Data Bus Control lines

Processor

RAM ROM

Memory Address Register

ALU

Central Processing Unit

• the Central Processing Unit is the brain of the computer. It consists of:– The processor

• Control Unit: controls the order in which instructions are executed and synchronises the other parts of the CPU

• ALU: performs all the calculations and logical operations

• Registers – temporary storage locations within the CPU

– Main Memory• RAM: stores data and program files when in use.

• ROM: stores the bootstrap loader

The Processor - Registers

• Registers are storage locations that are internal to the processor.

• They are used to:– Hold data that is being transferred to or from

memory;

– Hold the address of the location in memory which the processor is accessing to read or write data;

– Hold the instructions that are being carried out.

The Processor – Control Unit

• At Intermediate 2 we learned that the main functions of the Control Unit are:1.To control the timing of operations within the

processor

2.To send out signals that fetch instructions from the main memory

3.To interpret these instructions

4.To carry out instructions that are fetched from main memory.

The Processor – Control Unit

• We will now go into this in more depth

• The Control Unit (CU) sends out control signals:

– Within the processor to move data from one register to another and to activate specific ALU functions;

– To the control bus to read or to write from memory;

– To I/O modules

The Processor – ALU

• The ALU is part of the Processor where the following take place:– Calculations;

– Boolean logic operations (AND, OR, NOT); &

– Comparisons.

Internal Bus structure

Main Memory

MAR MDR CU

PC

SP

IR

ALU

ACC

Y

X

SR

Address Bus Data Bus Control lines

bus structure

• The Data Bus– The data bus allows data to be transferred between

the processor and memory.

– It is bi-directional as data must go both ways.

– The width of the data bus is measured by the number of lines on the bus. Each line can carry one bit. A 32-bit data bus (word) can transfer 32 bits at one time.

– The width of the data bus is important in determining system performance. Increasing the number of wires on the data bus will increase the quantity of data which the bus can carry.

bus structure

• The Address Bus– The address bus holds the address of the memory

location being accessed.

– The address bus is uni-directional .

– The more wires on the address bus, the more storage locations the system can, in theory, address.

– The maximum number of addresses = 2 to the power width of the address bus

Address bus question

Q. A computer has a 24-bit data bus, 32-bit address bus and a 16 line control bus. Calculate the maximum amount of memory that can be addressed by this computer. Show all your working and express your answer in appropriate units.

A. Will have 232 locations ,

Each of 24 bits (or 3 bytes)

Hence, has 232 * 3 = 12 Gigabytes

bus structure

• The Control Bus (Lines)

– The control bus is a series of lines that all perform different function in the controlling of the system:

• A read signal on the control lines instructs data to place data from the specified memory address on the data bus.

• A write signal on the control lines instructs memory to take data on the data bus and place it in the location specified by the address bus

bus structure

• The Control Bus (Lines)• The Clock line is used to synchronise all the

operations of the CPU. The pulses control when each step in the fetch-execute cycle takes place. These timing pulses coordinate and regulate the activities of the processor.

• A signal on the reset line returns the system to its initial state, stops all processes, clears the registers and RAM.

bus structure

• The Control Bus (Lines)• A signal on the interrupt line causes the

current routine being carried out to be suspended and gives control of the processor to another routine.

Question time1. A processor has three main parts. Name them.

2. What is a bus in a computer?

3. A microcomputer has 3 buses. Name them.

4. Which bus is uni-directional? Why?

5. State one effect of increasing the width of:1. The data bus;2. The address bus.

6. What is a WORD?

7. What is the purpose of the “reset” button on a pc?

Computer memory

• The elements of computer memory are:

– Regisers;

– Main Memory;

– Cache; &

– Backing Storage.

Registers

• Registers are a group of temporary storage locations within the processor.

• They are used to hold:– data being processed;

– Instructions being executed; &

– Addresses to be accessed.

• Since registers are on the processor, their speed of access is immediate.

Main Memory

• Main memory is used to store data and instructions while the processor is running a program.

• The processor can access main memory by reading from and writing to memory storage locations, each of which is identified by a unique address.

• The ability of the processor to identify each storage location is called its addressability.

• Each storage location can hold a quantity of data called a word. A word is the number of bits that can be processed by the processor in a single operation.

Main Memory

• There are two types of main memory:

– Random Access Memory (RAM), &

– Read Only Memory (ROM).

Random Access Memory

• the processor can:

– read data from RAM

– write or change RAM data

• RAM is volatile i.e. data stored in RAM is lost when the computer is turned off

• the purpose of RAM is to hold data or programs while they are being used or processed. When a user loads a program or data the file is copied from backing storage to RAM

• direct access medium

Random Access Memory

• There are two main types of RAM:– Static RAM

• SRAM is a type of RAM that doesn’t need to be constantly refreshed. It retains its contents as long as the power is on.

• It has a very fast access speed.

• It is used for the processor’s cache.

– Dynamic RAM• DRAM’s contents have to be continually

refreshed or any data contained in it will be lost.

• Slower access than SRAM.

Random Access Memory

• Other main type of RAM:– Video RAM

• VRAM id designed to hold the data which is to be displayed on the computer screen or monitor.

• The amount of VRAM in the computer is directly related to the number of colours and the available resolution.

• VRAM is sometimes contained in a separate graphics card (VGA card). E.g. GE Force 512mb graphics card has 512mb of RAM on board.

Read Only Memory

• is permanently written into the ROM microchip at manufacturing

• cannot be changed

• data is not lost when the computer is turned off

• must be replaced if upgraded

• direct access medium

Read Only Memory

• Main types of ROM– Programmable ROM

• PROM is empty when manufactured and may be permanently programmed by the user.

– Erasable PROM• EPROM can be programmed, erased and

reprogrammed.

– Flash ROM• Flash ROM has the advantage that is may be

reprogrammed while it is still inside the computer.• Flash ROM is now a very popular backing storage

medium.• Flash ROM is used in USB Drives and Memory cards.

Uses of Read Only Memory

• Bootstrap Loader– most computers use ROM to store a small

part of the operating system called the bootstrap loader

– CPU uses this program at power-on to load the rest of the OS from the hard disc

– as the program in ROM, it is available instantly and cannot be lost / damaged

Links between processor & Memory

• stored program concept

– peripheral devices slow the processor down so to speed the system up data that the processor is going to use is taken from the hard disk and put in memory which works at the same speed as the processor.

– data and programs are stored in RAM until required by the processor.

• unique memory location

– to find information each memory location has a unique address

Fetch execute cycle

• This describes how the processor fetches instructions from memory then carries them out, it divides nearly into two parts:– Fetch

• this part of the cycle reads the next instruction from main memory into the processor;

– Execute• this part interprets and performs the instruction.

Fetch execute cycle

• Fetch– The memory address of the next instruction is

placed on the address bus;

– A read signal is activated on the Read Lines;

– The data stored at the addressed memory location is placed on the data bus and transferred to a register which holds it until it is executed.

• Execute– The processor decodes the instruction;

– The processor executes the instruction.

Writing to memory

• processor sets up address bus with address;

• processor sets up data bus with data to be written on;

• processor activates write line on Control Bus; &

• Data is transferred from processor to memory location

Reading from memory

• processor sets up address bus with address

• processor activates read line on Control Bus; &

• memory releases data from that memory location onto data bus.

Computer Memory - REgisters

o Registerso These are temporary memory locations

within the processor which are accessed by the processor during the execution of instructions.

o They are used to hold data, instructions and addresses.

Computer memory - Cache

o This is a small fast memory unit which the processor checks for data and instructions before accessing MM.

o Logically cache memory lies between MM and the processor. (though some processors have cache built into them)

o When the processor attempts a read from memory, it checks cache first. If the data is already stored there it is transferred directly to the processor. This saves a read operation which is much slower than accessing cache.

Computer memory - Main Memory

o This is the main internal storage area for the computer where instructions and data are stored.

o It is divided into RAM and ROM sections.

o Reading from MM is slower than accessing either registers or cache memory

Computer Memory - Backing Store

o Backing Storage

o This is the slowest form of memory and is used to store user data and software.

o It retains the data when the power is switched off, unlike RAM.

Comparison of memory

Type Function Speed of Access

Register Internal to the processor Immediate; internal

Holds data while being to the processor

processed.

Cache Stands between the Slower access than a

processor and MM. register but faster than

Processor checks the cache accessing MM.

memory for data first

Main Memory Stores user data and s/w in Next in terms of speed

RAM and sys s/w in ROM. Accessing data in MM is

slower than cache or

registers.

Backing Storage Stores data, s/w. Retains Slowest of all memory.

the data when power off.

Addressability

• Computer memory is organised into units of equal size called memory or storage locations.

• Instructions or data eg numbers, characters, and bitmaps are kept inside these storage locations as binary patterns

• Each memory storage location has its own unique address, just like houses in a street.

• The CPU uses the address to identify a memory location and access the data stored there.

01010110011001110100

00111101110111010011

11110001010111000010

11001101000110100001

storage locationaddress

01010110011001110100

00111101110111010011

11110001010111000010

11001101000110100001

storage locationaddress

Addressability

• a word is the amount of data that a processor can address, transfer or manipulate in a single operation

• computers typically work with 32 bit or 64 bit words.

e.g. a 32-bit word size computer would store 32 bits in each memory location

• a larger word size makes a CPU more powerful

• the number of memory locations that a processor can address is, in theory, limited by the number of lines on the address bus.

Storage location

1100110100011010

16 bit word size

Concept of addressability

Address Memory Location Contents

100000000000001 0101 0101 1111 0000 1111 0000 1111 0000

100000000000010 1101 0101 1111 0000 1111 0000 1111 0011

100000000000011 0111 0101 1111 0000 1111 0110 1111 0011

16 bit addresses = 16 line address bus

Each location stores a 32-bit number

Measuring performance

• You need to be about to describe and evaluate the following measures of performance:

– Clock Speed

– MIPS

– FLOPS

– Application based tests

Clock speed

• The clock pulses regulate and coordinate the activities of the processor.

• These pulses are measured in megahertz and gigahertz.

• 1 MHz = 1 million pulses per second,

• 1 GHz = 1000 MHz

Clock speed

• How good a measure of performance is it?

– The clock speed does give you an indication of the performance of the processor which is at the heart of system.

– But the performance of a processor is not dictated by the speed of the clock alone.

– Other factors such as the size of the data bus must be considered.

MIPS

• MIPS is short for millions of instructions per second.– This is based on the measurement of the

number of machine code instructions that can be processed in a second.

• How good a measure of performance is it?– It does not take into account the size and

complexity of the instructions being carried out and is a rough indication of performance.

FLOPS

• FLOPS is short for floating point operations per second.– This measures how many floating point operations a

processor can carry out in a second.

• How good a measure of performance is it?– Seen as the most reliable indicator of system

performance. This is because it is an objective approach measuring the number of clearly definable, arithmetical tasks that can be carried out per second.

Application-based tests

• Most magazines use application-based tests (bench mark tests) to compare system performance.

• They set out a series of practical tasks using a range of standard application packages and award scores for the performance in each task and then use these scores to make overall comparisons.

Application-based tests

• How good a measure of performance is it?– The other ways of measuring performance are

reasonable indicators of how well a system will actually perform.

– However, they do not provide us with evidence of how well a system will actually perform any given practical task.

– Using application-based tests provides us with actual evidence of system performance in carrying out complex operations at high speed.

– These are seen as a very reliable way of measuring performance.

System performance

• You need to be able to understand the effect on system performance of:

– Memory

– The width of the data bus;

– The use of cache memory; &

– The rate of data transfer to and from peripherals.

Memory

• Data in RAM does not have to be fetched from slower disc.

• Some memory chips enable faster memory reads.

• More RAM allows more/larger programs, more multi-tasking.

• Easier option for users.

Data bus width

• The width of the data bus (word size) indicates the number of bits that can be transferred in parallel to and from memory.

• A 32-bit data bus can transfer 32 bits in one operation.

• PS2 - 128-bit data bus - fast

• PS3 - 256-bit data bus - dead fast (2x)

Data bus width

• Processors with longer word size process larger instruction codes and larger data values in each CPU cycle, more powerful.

• Increasing the address bus enables more storage locations to be accessed.

Cache memory

• Cache memory is located between the processor and main memory.

• Usually made up of fast acting SRAM.

• Holds copies of data and instructions that are commonly used by the processor.

• Processor can get this data quicker than locating it in main memory.

Data transfer between processor and peripherals

• All peripherals operate at slower speeds than the processor.

• This slows down processing if reading from a disk/cd etc.

• Selecting a drive with a faster transfer rate can improve the overall performance of your system.

System Performance Summary

Tactic Effect of System Performance

Increase Clock Speed Increase

Increase data bus Increase

Increase cache memory Increase

Increase address bus None

Increase number of processors Increase

Increase RAM Slight Increase in performance

Increase VRAM Increase Graphics performance

Increase data transfer rate Increase