Transcript
Page 1: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Computer Architecture and Computer Architecture and the Fetch-Execute Cyclethe Fetch-Execute Cycle

Von Neumann ArchitectureVon Neumann Architecture

Page 2: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Learning ObjectivesLearning Objectives

Describe basic Von Neumann architecture, identifying the need for and the uses of special registers in the functioning of a processor.

Page 3: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Stored ProgramStored Program

John Von Neumann introduced the idea. John Von Neumann introduced the idea.

Previously data and programs were stored Previously data and programs were stored in separate memories. in separate memories.

Von Neumann realised that data and Von Neumann realised that data and programs are indistinguishable and can, programs are indistinguishable and can, therefore, use the same memory. therefore, use the same memory.

This led to the introduction of compilers This led to the introduction of compilers which accepted text as input and produced which accepted text as input and produced binary code as output.binary code as output.

Page 4: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Von Neumann ArchitectureVon Neumann Architecture

Program is stored in memory along with data.

Programs and data are indistinguishable.

Uses a single processor.

Sequential carrying out of instructions.

Page 5: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

RegistersRegisters

SSmall, permanent storage locations within the mall, permanent storage locations within the CPU used for a particular purpose.CPU used for a particular purpose. They are only storage locations and do not They are only storage locations and do not dodo

anything themselves.anything themselves.

Page 6: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Von Neumann ArchitectureVon Neumann ArchitectureUses a single processor which follows a linear Uses a single processor which follows a linear sequence of sequence of fetch-decode-executefetch-decode-execute. .

In order to do this, the processor has to use In order to do this, the processor has to use some special registers. some special registers.

RegisterRegister MeaningMeaning

PC PC / SCR/ SCR Program Counter Program Counter / Sequence Control Register / Sequence Control Register

CIR CIR Current Instruction Register Current Instruction Register

MARMAR Memory Address RegisterMemory Address Register

MDR MDR / MBR/ MBR Memory Data Register Memory Data Register / Memory Buffer Register/ Memory Buffer Register

ACC ACC Accumulator - Holds resultsAccumulator - Holds results

Page 7: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 8: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

CCentral entral PProcessor rocessor UUnit (CPU)nit (CPU)

Contains:Contains: AArithmetic - rithmetic - LLogic ogic UUnit (nit (ALUALU) ) (also known as the (also known as the

arithmetic unit)arithmetic unit)Holds the accumulator.Holds the accumulator.But also has other circuitry to do its job.But also has other circuitry to do its job.

CControl ontrol UUnit nit Holds PC & CIRHolds PC & CIRBut also has other circuitry to do its job.But also has other circuitry to do its job.

MMemory emory DData ata RRegister (egister (MDRMDR)) MMemory emory AAddress ddress RRegister (egister (MARMAR).).

Remember the registers are simply storage locations. The Control unit and the ALU hold some of these registers but they also have extra circuitry which actually do “things”.

Page 9: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 10: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Control UnitControl Unit

Has circuitry which fetches instructions Has circuitry which fetches instructions from memory, decodes them and from memory, decodes them and synchronises the operations before synchronises the operations before sending signals to other parts of the sending signals to other parts of the computer.computer.

Also contains the Also contains the instruction registers (instruction registers (PCPC & & CIRCIR).).

Page 11: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 12: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

PProgram rogram CCounter (ounter (PCPC)) / /

SSequence equence CControl ontrol RRegister (egister (SCRSCR))

Stores the address of Stores the address of (so that the control unit (so that the control unit

can keep track of where to find)can keep track of where to find) the next the next instruction to be accessed so that a copy instruction to be accessed so that a copy of the instruction can be placed in the of the instruction can be placed in the current instruction register.current instruction register. The initial contents of the PC is the address of The initial contents of the PC is the address of

the first instruction of a program and it is the first instruction of a program and it is copied in by the copied in by the Loader Loader (see (see

Memory Management PresentationMemory Management Presentation))..

Page 13: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

PProgram rogram CCounter (ounter (PCPC))

After the address is copied into the MAR After the address is copied into the MAR the PC is incremented by 1.the PC is incremented by 1. At this point it could be said to hold the At this point it could be said to hold the

address of the instruction after the next address of the instruction after the next instruction instruction (as we have not technically started executing the (as we have not technically started executing the

next instruction we should still refer to it as the next instruction)next instruction we should still refer to it as the next instruction)..Assumes that the instructions will be in Assumes that the instructions will be in consecutive locations but if it is a jump instruction consecutive locations but if it is a jump instruction the PC will be altered again at the end of the cycle.the PC will be altered again at the end of the cycle.

Page 14: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

PC / SCRPC / SCR

Sometimes the program counter is called Sometimes the program counter is called the the SSequence equence CControl ontrol RRegister (SCR) as egister (SCR) as the control unit uses its contents to control the control unit uses its contents to control the sequence of instruction execution.the sequence of instruction execution.

Page 15: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 16: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

MMemory emory AAddress ddress RRegister (egister (MARMAR))

Also used to hold / store the memory Also used to hold / store the memory address address (copied from the PC)(copied from the PC) that contains that contains the instruction to be used next but can the instruction to be used next but can also hold the memory address also hold the memory address of data of data needed to execute the next instructionneeded to execute the next instruction.. After the address has been copied from the After the address has been copied from the

PC into the MAR the PC is incremented by 1.PC into the MAR the PC is incremented by 1.Assumes that the instructions are in consecutive Assumes that the instructions are in consecutive locations but if it is a jump instruction the PC will locations but if it is a jump instruction the PC will be altered again at the end of the cycle.be altered again at the end of the cycle.

Page 17: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

MARMAR

You may be wondering: why the address is You may be wondering: why the address is copied into the MAR when it is already in the copied into the MAR when it is already in the PC? Why not use the address straight from the PC? Why not use the address straight from the PC? You will find out the answer to this in the PC? You will find out the answer to this in the next presentation next presentation ((Fetch-Decode-Execute-Reset Cycle PresentationFetch-Decode-Execute-Reset Cycle Presentation)).. Basically the MAR may have to be used to store an Basically the MAR may have to be used to store an

address of data needed to execute the next address of data needed to execute the next instruction. As no register can hold more than one instruction. As no register can hold more than one “thing”“thing” at a time the control unit may copy an address at a time the control unit may copy an address of data needed to execute the next instruction over of data needed to execute the next instruction over the address of the next instruction in the PC. the address of the next instruction in the PC.

Page 18: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 19: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

MMemory emory DData ata RRegister (egister (MDRMDR))//

MMemory emory BBuffer uffer RRegister (egister (MBRMBR))

Acts like a buffer and holds anything that Acts like a buffer and holds anything that is copied from the memory ready for the is copied from the memory ready for the processor to use it.processor to use it. This could be the next instruction copied from This could be the next instruction copied from

the memory address held in the MAR but it the memory address held in the MAR but it could also be a piece of data could also be a piece of data (copied in from an (copied in from an address in memory address in memory or back from the instruction in the CIR – or back from the instruction in the CIR –

see next slidesee next slide)) needed to execute the next needed to execute the next instructioninstruction..

Page 20: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

MDR / MBRMDR / MBR

Sometimes the memory data register is Sometimes the memory data register is called the called the MMemoryemory B Bufferuffer R Register (egister (MBRMBR) ) as it acts as a buffer between the primary as it acts as a buffer between the primary memory and the processor.memory and the processor.

Page 21: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 22: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

CCurrent urrent IInstruction nstruction RRegister (egister (CIRCIR))

Holds the instruction while it is being Holds the instruction while it is being executed.executed.

The binary code held in the CIR is split The binary code held in the CIR is split into an operation code and an address.into an operation code and an address.

Page 23: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

CIRCIR

Again you may be wondering why the instruction Again you may be wondering why the instruction is copied into the CIR when it is already in the is copied into the CIR when it is already in the MDR?MDR? Again you will find out the answer to this in the next Again you will find out the answer to this in the next

presentation (presentation (Fetch-Decode-Execute-Reset Cycle PresentationFetch-Decode-Execute-Reset Cycle Presentation). ).

Basically the MDR may have to be used to store data Basically the MDR may have to be used to store data needed to execute the next instruction. As no register needed to execute the next instruction. As no register can hold more than one can hold more than one “thing”“thing” at a time the control at a time the control unit may copy data needed to execute the next unit may copy data needed to execute the next instruction over the current instruction in the MDR. So instruction over the current instruction in the MDR. So it would no longer “know” what it was supposed to do.it would no longer “know” what it was supposed to do.

Page 24: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 25: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

AArithmetic - rithmetic - LLogic ogic UUnit (nit (ALUALU))

Internal circuitry processes data here Internal circuitry processes data here (arithmetic and logical operations). (arithmetic and logical operations).

Arithmetic operations are those that add and Arithmetic operations are those that add and subtract numbers, and so on. subtract numbers, and so on.

Logical operations involve comparing binary Logical operations involve comparing binary patterns and making decisions.patterns and making decisions.

Also contains the accumulator.Also contains the accumulator.

Page 26: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 27: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Accumulator Accumulator ((ACCACC))

Stores results of calculations.

All input to and output from processor pass through the accumulator.

Page 28: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

ResetReset

Cycle is reset (restarted) by passing Cycle is reset (restarted) by passing control back to the PC.control back to the PC.

Page 29: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Control Unit & ALUControl Unit & ALU

Remember the registers are simply Remember the registers are simply storage locations and do storage locations and do not “do”not “do” anything.anything.

The Control Unit “The Control Unit “doesdoes” everything ” everything described in this presentation except for described in this presentation except for arithmetic and logical operations which is arithmetic and logical operations which is donedone by the ALU, but even then the by the ALU, but even then the Control Unit tells it what to do Control Unit tells it what to do (i.e. add this (i.e. add this to this, compare this with this, etc…)to this, compare this with this, etc…)..

Page 30: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Example CycleExample Cycle

Page 31: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 32: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 33: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 34: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 35: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Typical Layout Typical Layout

1

2

34

Page 36: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

PlenaryPlenary

What is Von Neumann architecture?What is Von Neumann architecture?

Page 37: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Von Neumann ArchitectureVon Neumann Architecture

Program is stored in memory along with data.

Programs and data are indistinguishable.

Uses a single processor.

Sequential carrying out of instructions.

Page 38: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

PlenaryPlenary

Explain the purpose of each of the Explain the purpose of each of the following special registers in a processor.following special registers in a processor. Program Counter (Sequence Control Program Counter (Sequence Control

Register).Register). Current Instruction Register.Current Instruction Register. Memory Address Register. Memory Address Register. Memory Data Register. Memory Data Register. Accumulator. Accumulator.

Page 39: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

PProgram rogram CCounter (ounter (PCPC)) / /

SSequence equence CControl ontrol RRegister (egister (SCRSCR))

Stores the address of Stores the address of (so that the control unit (so that the control unit

can keep track of where to find)can keep track of where to find) the next the next instruction to be accessed so that a copy instruction to be accessed so that a copy of the instruction can be placed in the of the instruction can be placed in the current instruction register.current instruction register. The initial contents of the PC is the address of The initial contents of the PC is the address of

the first instruction of a program and it is the first instruction of a program and it is copied in by the copied in by the Loader Loader (see (see

Memory Management PresentationMemory Management Presentation))..

Page 40: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Common confusions with the PCCommon confusions with the PC

The PC The PC DOES NOTDOES NOT:: Keep track of the number of programs Keep track of the number of programs

running.running.

OrOr Keep the order in which programs have been Keep the order in which programs have been

called.called.

Page 41: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

MMemory emory AAddress ddress RRegister (egister (MARMAR))

Also used to hold / store the memory address Also used to hold / store the memory address (copied from the PC) that contains the (copied from the PC) that contains the instruction to be used next but can also hold the instruction to be used next but can also hold the memory address memory address of data needed to execute the of data needed to execute the next instructionnext instruction.. After the address has been copied from the PC into After the address has been copied from the PC into

the MAR the PC is incremented by 1.the MAR the PC is incremented by 1.Assumes that the instructions are in consecutive locations Assumes that the instructions are in consecutive locations but if it is a jump instruction the PC will be altered again at but if it is a jump instruction the PC will be altered again at the end of the cycle.the end of the cycle.

Page 42: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

MMemory emory DData ata RRegister (egister (MDRMDR)) //

MMemory emory BBuffer uffer RRegister (egister (MDRMDR))

Acts like a buffer and holds anything that Acts like a buffer and holds anything that is copied from the memory ready for the is copied from the memory ready for the processor to use it.processor to use it. This could be the next instruction copied from This could be the next instruction copied from

the memory address held in the MAR but it the memory address held in the MAR but it could also be a piece of data could also be a piece of data (copied in from an (copied in from an address in memory address in memory or back from the instruction in the CIR – or back from the instruction in the CIR –

see next slidesee next slide)) needed to execute the next needed to execute the next instructioninstruction..

Page 43: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

CCurrent urrent IInstruction nstruction RRegister (egister (CIRCIR))

Holds the instruction while it is being Holds the instruction while it is being executed.executed.

The binary code held in the CIR is split The binary code held in the CIR is split into an operation code and an address.into an operation code and an address.

Page 44: Computer Architecture and the Fetch-Execute Cycle Von Neumann Architecture

Accumulator (Accumulator (ACCACC))

Stores results of calculations.

All input to and output from processor pass through the accumulator.


Top Related