Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Von Neumann Architecture.

Similar presentations


Presentation on theme: "CSCI N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Von Neumann Architecture."— Presentation transcript:

1 CSCI N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Von Neumann Architecture

2 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Goals Understand how the von Neumann architecture is constructed.Understand how the von Neumann architecture is constructed. Understand how the von Neumann architecture works.Understand how the von Neumann architecture works. Understand how to program in basic a assembly language.Understand how to program in basic a assembly language.

3 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Where Are We? We have spent several weeks now, building our understanding of computer organization.We have spent several weeks now, building our understanding of computer organization. We started with transistors, moved up a level to gates, and then up a level to circuits.We started with transistors, moved up a level to gates, and then up a level to circuits. Our next step is a key one: we will combine circuits together to build functional units of computer operation.Our next step is a key one: we will combine circuits together to build functional units of computer operation.

4 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Ladder of Abstraction It is worth reminding ourselves how we got here:It is worth reminding ourselves how we got here: –Climbing up the ladder of abstraction, the process is to take the functional units of one level, combine them, and move this combined unit to the next unit of abstraction –As we move to this new level, the level of sub- components, we need to remember that this level is built from the components of previous levels

5 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Sub-Components At the onset, computers required hardware changes to work on new problems; some historians say that this early stage of “programming” was wiring.At the onset, computers required hardware changes to work on new problems; some historians say that this early stage of “programming” was wiring. Clearly, requiring hardware changes with each new programming operation was time- consuming, error-prone, and costlyClearly, requiring hardware changes with each new programming operation was time- consuming, error-prone, and costly If you recall from the movie The Machine That Changed the World, one of the key contributors to computer evolution was John von NeumannIf you recall from the movie The Machine That Changed the World, one of the key contributors to computer evolution was John von Neumann

6 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science The Stored Program Concept Von Neumann’s proposal was to store the program instructions right along with the dataVon Neumann’s proposal was to store the program instructions right along with the data This may sound trivial, but it represented a profound paradigm shiftThis may sound trivial, but it represented a profound paradigm shift The stored program concept was proposed about fifty years ago; to this day, it is the fundamental architecture that fuels computers.The stored program concept was proposed about fifty years ago; to this day, it is the fundamental architecture that fuels computers. Think about how amazing that is, given the short shelf life of computer products and technologies…Think about how amazing that is, given the short shelf life of computer products and technologies…

7 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science The Stored Program Concept and its Implications The Stored Program concept had several technical ramifications:The Stored Program concept had several technical ramifications: –Four key sub-components operate together to make the stored program concept work –The process that moves information through the sub- components is called the “fetch execute” cycle –Unless otherwise indicated, program instructions are executed in sequential order

8 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Four Sub-Components There are four sub-components in von Neumann architecture:There are four sub-components in von Neumann architecture: –Memory –Input/Output (called “IO”) –Arithmetic-Logic Unit –Control Unit While only 4 sub-components are called out, there is a 5 th, key player in this operation: a bus, or wire, that connects the components together and over which data flows from one sub-component to anotherWhile only 4 sub-components are called out, there is a 5 th, key player in this operation: a bus, or wire, that connects the components together and over which data flows from one sub-component to another Let’s look at each sub-component in more detail …Let’s look at each sub-component in more detail …

9 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Memory As you already know, there are several different flavors of memoryAs you already know, there are several different flavors of memory Why isn’t just one kind used?Why isn’t just one kind used? Each type of memory represents cost/benefit tradeoffs between capability and cost …Each type of memory represents cost/benefit tradeoffs between capability and cost …

10 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Memory Types: RAM RAM is typically volatile memory (meaning it doesn’t retain voltage settings once power is removed)RAM is typically volatile memory (meaning it doesn’t retain voltage settings once power is removed) RAM is an array of cells, each with a unique addressRAM is an array of cells, each with a unique address A cell is the minimum unit of access. Originally, this was 8 bits taken together as a byte. In today’s computer, word-sized cells (16 bits, grouped in 4) are more typical.A cell is the minimum unit of access. Originally, this was 8 bits taken together as a byte. In today’s computer, word-sized cells (16 bits, grouped in 4) are more typical. RAM gets its name from its access performance. In RAM memory, theoretically, it would take the same amount of time to access any memory cell, regardless of its location with the memory bank (“random” access).RAM gets its name from its access performance. In RAM memory, theoretically, it would take the same amount of time to access any memory cell, regardless of its location with the memory bank (“random” access).

11 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Memory Types: ROM It gets its name from its cell-protection feature. This type of memory cell can be read from, but not written to.It gets its name from its cell-protection feature. This type of memory cell can be read from, but not written to. Unlike RAM, ROM is non-volatile; it retains its settings after power is removed.Unlike RAM, ROM is non-volatile; it retains its settings after power is removed. ROM is more expensive than RAM, and to protect this investment, you only store critical information in ROM …ROM is more expensive than RAM, and to protect this investment, you only store critical information in ROM …

12 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Memory Types: Registers There is a third, key type of memory in every computer – registers.There is a third, key type of memory in every computer – registers. Register cells are powerful, costly, and physically located close to the heart of computing.Register cells are powerful, costly, and physically located close to the heart of computing. We will see later that among the registers, several of them are the main participants in the fetch execute cycle.We will see later that among the registers, several of them are the main participants in the fetch execute cycle.

13 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Memory Types: Other Modern computers include other forms of memory, such as cache memory.Modern computers include other forms of memory, such as cache memory. Remember, memory types exist at different trade offs.Remember, memory types exist at different trade offs. The study of memory organizations and access schemes is an innovative one within Computer Science. In your life time, you should expect to see numerous innovations in memory types and capabilities.The study of memory organizations and access schemes is an innovative one within Computer Science. In your life time, you should expect to see numerous innovations in memory types and capabilities.

14 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science What’s Up with Memory Regardless of the type of memory, several concepts apply in this key component.Regardless of the type of memory, several concepts apply in this key component. Cell size or cell width: a key concept within memory is how many individual memory cells (which we now know are switches!) are addressed at a time.Cell size or cell width: a key concept within memory is how many individual memory cells (which we now know are switches!) are addressed at a time. At a minimum, this is a byte (8 bits) in today’s computers, but to support all data types and operations, cell size can be larger (a word, for instance, at 16 bits).At a minimum, this is a byte (8 bits) in today’s computers, but to support all data types and operations, cell size can be larger (a word, for instance, at 16 bits).

15 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science What’s Up with Memory Cell address and contents: another key concept is to recognize that all cells have an address, and can contain data contents.Cell address and contents: another key concept is to recognize that all cells have an address, and can contain data contents. The cell address is a label (like a zip code) that identifies a particular cell.The cell address is a label (like a zip code) that identifies a particular cell. The cell contents are whatever data is stored at a given address location.The cell contents are whatever data is stored at a given address location.

16 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science What’s Up with Memory Two other key concepts in the study of memory are memory size and address space.Two other key concepts in the study of memory are memory size and address space. Memory size refers to the number of addressable cells – how many different memory locations a computer has.Memory size refers to the number of addressable cells – how many different memory locations a computer has. Address space refers to the range of addressable cell labels. Cell labels begin with the number 0. So, if you had a computer with 2 n memory size, its address space would be 2 n -1.Address space refers to the range of addressable cell labels. Cell labels begin with the number 0. So, if you had a computer with 2 n memory size, its address space would be 2 n -1.

17 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science What’s Up with Memory Don’t forget that the memory labels are themselves binary numbers!Don’t forget that the memory labels are themselves binary numbers! One of the special registers we talked about earlier is a register whose job it is to hold address locations.One of the special registers we talked about earlier is a register whose job it is to hold address locations. Engineers need to know how big to make this register, so that it could hold the address of any given memory location, even the one with the biggest address.Engineers need to know how big to make this register, so that it could hold the address of any given memory location, even the one with the biggest address.

18 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science What’s Up with Memory The special register is called the MAR – the machine address register.The special register is called the MAR – the machine address register. For a machine with 2 n address cells, the MAR must be able to hold a number 2 n - 1 big.For a machine with 2 n address cells, the MAR must be able to hold a number 2 n - 1 big.

19 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Memory Operations Two basic operations occur within this subcomponent: a fetch operation, and a store.Two basic operations occur within this subcomponent: a fetch operation, and a store. The fetch operation:The fetch operation: –A cell address is loaded into the MAR. –The address is decoded, which means that thru circuitry, a specific cell is located. –The data contents contained within that cell is copied into another special register, called a Machine Data Register (MDR). –Note that this operation is non-destructive – that is, the data contents are copied, but not destroyed.

20 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Memory Operations The second memory operation is called a store.The second memory operation is called a store. –The fetch is like a read operation; the store is like a write operation –In the store, the address of the cell into which data is going to be stored is moved to the MAR and decoded. –Contents from yet another special register, called an accumulator, are copied into the cell location (held in the MAR). –This operation is destructive, meaning that whatever data was originally contained at that memory location is overwritten by the value copied from the accumulator.

21 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science I/O: Input and Output There is both a human-machine interface and a machine-machine interface to I/O.There is both a human-machine interface and a machine-machine interface to I/O. –Examples of the human-machine interface include a keyboard, screen or printer. –Examples of the machine-machine interface include things like mass storage and secondary storage devices. Input and output devices are the least standardized of the various sub-components, which means that you have to pay extra special attention to make certain that your input or output devices are compatible with your machine.Input and output devices are the least standardized of the various sub-components, which means that you have to pay extra special attention to make certain that your input or output devices are compatible with your machine.

22 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science The ALU The third component in the von Neumann architecture is called the Arithmetic Logic Unit.The third component in the von Neumann architecture is called the Arithmetic Logic Unit. This is the subcomponent that performs the arithmetic and logic operations for which we have been building parts.This is the subcomponent that performs the arithmetic and logic operations for which we have been building parts. The ALU is the “brain” of the computer.The ALU is the “brain” of the computer.

23 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science The ALU It houses the special memory locations, called registers, of which we have already considered.It houses the special memory locations, called registers, of which we have already considered. The ALU is important enough that we will come back to it later, For now, just realize that it contains the circuitry to perform addition, subtraction,multiplication and division, as well as logical comparisons (less than, equal to and greater than).The ALU is important enough that we will come back to it later, For now, just realize that it contains the circuitry to perform addition, subtraction,multiplication and division, as well as logical comparisons (less than, equal to and greater than).

24 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Control Unit The last of the four subcomponents is the Control Unit.The last of the four subcomponents is the Control Unit. The control unit is the work horse that drives the fetch and execute cycle.The control unit is the work horse that drives the fetch and execute cycle. Remember we said that in memory, a cell address is loaded into the MAR – it is the control unit that figures out which address is loaded, and what operation is to be performed with the data moved to the MDR.Remember we said that in memory, a cell address is loaded into the MAR – it is the control unit that figures out which address is loaded, and what operation is to be performed with the data moved to the MDR. We will come back and look in detail at how the Control Unit performs this task.We will come back and look in detail at how the Control Unit performs this task.

25 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Stored Program Concept We saw that it was von Neumann’s organizational scheme that was adopted in computer architecture.We saw that it was von Neumann’s organizational scheme that was adopted in computer architecture. This architecture was largely driven by the decision to store program code along with data.This architecture was largely driven by the decision to store program code along with data. Once this decision was made, several by- product engineering requirements emerged.Once this decision was made, several by- product engineering requirements emerged.

26 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Engineering Needs We indicated that for cost/benefit reasons, data and program instructions are translated into binary form and stored in RAM.We indicated that for cost/benefit reasons, data and program instructions are translated into binary form and stored in RAM. As the information is needed, it is moved to the high speed, costlier registers where it is processed.As the information is needed, it is moved to the high speed, costlier registers where it is processed. This process occurs in a cycle: fetch information to the registers, and execute it there, fetch the next information from the registers, and execute it, etc.This process occurs in a cycle: fetch information to the registers, and execute it there, fetch the next information from the registers, and execute it, etc. The cycle is referred to as the “fetch execute” cycle.The cycle is referred to as the “fetch execute” cycle.

27 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Engineering Needs Once we know on which data we should be working, we know how to build circuitry to perform processing operations. (We can add, subtract, divide and compare).Once we know on which data we should be working, we know how to build circuitry to perform processing operations. (We can add, subtract, divide and compare). One of the things we glossed over in our first discussion, however, is how we figure out what data to be working on, and exactly which operation to performOne of the things we glossed over in our first discussion, however, is how we figure out what data to be working on, and exactly which operation to perform Specifically, this is what we need to be able to do:Specifically, this is what we need to be able to do: –Build a circuit that will allow us to take whatever number is in the MAR, and use this number to access a specific memory cell. –Build a circuit that will allow us to choose which data results should be placed in the MDR. This magic happens in the Control UnitThis magic happens in the Control Unit

28 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Choosing a Memory Location Let’s tackle the initial requirement first: how do we determine which address location holds the data on which we need to operate.Let’s tackle the initial requirement first: how do we determine which address location holds the data on which we need to operate. Remember we said that there is a special register, called the MAR that holds an address -- a binary number.Remember we said that there is a special register, called the MAR that holds an address -- a binary number. We need some circuitry to read that number, and based on its value, find exactly the correct address location to read.We need some circuitry to read that number, and based on its value, find exactly the correct address location to read. The circuit is called a decoder …The circuit is called a decoder …

29 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Decoder Circuits The MAR is connected to a decoder circuit.The MAR is connected to a decoder circuit. This circuitry will identify the correct memory cell.This circuitry will identify the correct memory cell. Let’s figure out how this works …Let’s figure out how this works …

30 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Decoder Circuits Initially, think about the decoder circuit as a black box.Initially, think about the decoder circuit as a black box. Going into the black box are N input lines, (which emerge from the MAR).Going into the black box are N input lines, (which emerge from the MAR). Going out of the black box are 2 n output lines (with each output line connecting to a specific memory cell in RAM).Going out of the black box are 2 n output lines (with each output line connecting to a specific memory cell in RAM).

31 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Decoder Circuit: An Example Let’s start small: imagine a computer with 4 memory cells in RAM, where our formula now is: 2 n, thus n = 2 so that 2 n =4.Let’s start small: imagine a computer with 4 memory cells in RAM, where our formula now is: 2 n, thus n = 2 so that 2 n =4. The MAR will need to be N cells big, and the biggest number it would have to hold is the address range, 2 n -1=3.The MAR will need to be N cells big, and the biggest number it would have to hold is the address range, 2 n -1=3. Let’s build the decoder circuit …Let’s build the decoder circuit …

32 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science First, the Problem Statement Design a circuit with 2 input lines (a, b) and 4 output lines (d 0,d 1,d 2,d 3 )Design a circuit with 2 input lines (a, b) and 4 output lines (d 0,d 1,d 2,d 3 ) The output lines are uniquely high if and only if the following conditions are met:The output lines are uniquely high if and only if the following conditions are met: –d 0 is high IFF both inputs are low –d 1 is high IFF a is low and b is high –d 2 is high IFF a is high and b is low –d 3 is high IFF both a and b are high

33 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Next, the Truth Table INPUT LINES OUPUT LINES ab d0d0d0d0 d1d1d1d1 d2d2d2d2 d3d3d3d

34 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Next, the Boolean Sub-Expressions For those places in our output chart with high values (1’s), we have the following a,b input conditions:For those places in our output chart with high values (1’s), we have the following a,b input conditions: –d 0 = ~a * ~b –d 1 = ~a * b –d 2 = a * ~b –d 3 = a * b

35 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Circuit Diagram – Decoder Circuit aabb d0d0d0d0 d0d0d0d0 d1d1d1d1 d1d1d1d1 d2d2d2d2 d2d2d2d2 d3d3d3d3 d3d3d3d3 To the MDR MARMAR

36 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Decoder Circuit Example Assume the contents of the MAR are 01.Assume the contents of the MAR are 01. Which line would fire?Which line would fire? –Remember the Boolean expression: (~a b) This would cause the d1 line to fire, which in turn is connected to the d1 memory location.This would cause the d1 line to fire, which in turn is connected to the d1 memory location. The d1 memory location is read non- destructively, and a copy of its contents (let’s assume the contents equal 61), is copied to the MDR.The d1 memory location is read non- destructively, and a copy of its contents (let’s assume the contents equal 61), is copied to the MDR.

37 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Circuit Diagram – Decoder Circuit aabb d0d0d0d0 d0d0d0d0 d1d1d1d1 d1d1d1d1 d2d2d2d2 d2d2d2d2 d3d3d3d3 d3d3d3d MARMAR

38 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science 4 * 16 decoder

39 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Scaling Issue We have built a viable decoder circuit, and illustrated how this control circuit could perform in translating between the address label contained in the MAR and obtaining contents of the referenced location.We have built a viable decoder circuit, and illustrated how this control circuit could perform in translating between the address label contained in the MAR and obtaining contents of the referenced location. At some point, however, the model isn’t scaleable – too much space required for a linear layout.At some point, however, the model isn’t scaleable – too much space required for a linear layout. Computers utilize a 2-dimensional approach in decoder operation, using a row/column MAR addressing scheme to identify specific address locations.Computers utilize a 2-dimensional approach in decoder operation, using a row/column MAR addressing scheme to identify specific address locations. A 2-D grid is illustrated on the next slide …A 2-D grid is illustrated on the next slide …

40 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science 2-D Memory Access

41 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science 2-D Memory Operation

42 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science One Problem Solved Well, we have figured out how to use circuitry to decode the contents of the MAR to identify a specific memory location.Well, we have figured out how to use circuitry to decode the contents of the MAR to identify a specific memory location. We still need to figure out how to interpret the results of the ALU circuitry to load a correct process answer into the MDR.We still need to figure out how to interpret the results of the ALU circuitry to load a correct process answer into the MDR.

43 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Multiplexor Circuits Remember, we said that the ALU actually performs all operational processing on 2 given inputs.Remember, we said that the ALU actually performs all operational processing on 2 given inputs. Thus, if the inputs are 4 and 2, calculations for 4 + 2, 4 * 2, 4-2, 4 >= 2, etc. are all performed in parallel.Thus, if the inputs are 4 and 2, calculations for 4 + 2, 4 * 2, 4-2, 4 >= 2, etc. are all performed in parallel. What we need to be able to do is to select the correct answer from among all those calculated.What we need to be able to do is to select the correct answer from among all those calculated.

44 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Multiplexor Circuits A multiplexor is a circuit with 2 n input lines and 1 output line.A multiplexor is a circuit with 2 n input lines and 1 output line. The function is serves is to select exactly one of its input lines and copy the binary value on that input line to its single output line.The function is serves is to select exactly one of its input lines and copy the binary value on that input line to its single output line.

45 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Multiplexor Magic The multiplexor chooses the correct input line to pass thru to the output line by using a second set of N lines called selector lines.The multiplexor chooses the correct input line to pass thru to the output line by using a second set of N lines called selector lines. So, the total number of input lines in a multiplexor are 2 n + N.So, the total number of input lines in a multiplexor are 2 n + N. The first set of input lines are numbered from 0 to 2 n -1, while the selector lines are numbered from 0 to N, such that there is exactly one selector line for each input line.The first set of input lines are numbered from 0 to 2 n -1, while the selector lines are numbered from 0 to N, such that there is exactly one selector line for each input line. Each selector line can be set to either a 1 or a 0.Each selector line can be set to either a 1 or a 0. Thus, the binary number that appears on the selector lines can be interpreted as the identification number of the input line to be passed thru.Thus, the binary number that appears on the selector lines can be interpreted as the identification number of the input line to be passed thru.

46 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Multiplexor Circuit

47 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Where We’ve Been We have been touring the von Neumann architecture of 4 sub-components.We have been touring the von Neumann architecture of 4 sub-components. We have figured out how to build the appropriate circuitry to perform arithmetic and logic operations on the data contained at specific memory locations.We have figured out how to build the appropriate circuitry to perform arithmetic and logic operations on the data contained at specific memory locations. What we don’t know how to do is to figure out which arithmetic or logic operations need to be performed and in what order.What we don’t know how to do is to figure out which arithmetic or logic operations need to be performed and in what order.

48 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science The Control Unit The mastermind behind these final pieces of our operational model is the Control UnitThe mastermind behind these final pieces of our operational model is the Control Unit It is the Control Unit that fuels the stored program conceptIt is the Control Unit that fuels the stored program concept To do its job, the Control Unit has several toolsTo do its job, the Control Unit has several tools –Special memory registers –“Wired” understanding of an Instruction Set

49 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Toolset Let’s look at the toolset first, and then how it is deployedLet’s look at the toolset first, and then how it is deployed Special Memory RegistersSpecial Memory Registers –The Control Unit must keep track of where it is within a program, and what it should do next –Two special registers are used to accomplish this: A program counter, typically referred to as a PC, holds the address of the NEXT instruction to be executedA program counter, typically referred to as a PC, holds the address of the NEXT instruction to be executed An instruction register, typically referred to as an IR, holds an instruction fetched from memoryAn instruction register, typically referred to as an IR, holds an instruction fetched from memory

50 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Toolset (Two) Along with the special registers, the Control Unit utilizes special circuitry, called an instruction decoderAlong with the special registers, the Control Unit utilizes special circuitry, called an instruction decoder The instruction decoder is a typical decoder circuit, and its purpose is to read an instruction from the IR, and activate the appropriate circuit lineThe instruction decoder is a typical decoder circuit, and its purpose is to read an instruction from the IR, and activate the appropriate circuit line

51 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science How this Works Remember, we are trying to figure out how the stored program concept works.Remember, we are trying to figure out how the stored program concept works. In this model, the program and the data upon which it operates are stored in memory locations.In this model, the program and the data upon which it operates are stored in memory locations. We know how to encode the data.We know how to encode the data. We need to learn how to encode the programming instructions.We need to learn how to encode the programming instructions.

52 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science The Instruction Set At the heart of all programming are a few, building block instructions.At the heart of all programming are a few, building block instructions. The set of instructions is remarkably small, and particular to a given processor.The set of instructions is remarkably small, and particular to a given processor. The power of the instruction set is that by identifying a definite, bounded, simple task, an instruction can be executed with appreciable speed – typically within a few billionths of a second.The power of the instruction set is that by identifying a definite, bounded, simple task, an instruction can be executed with appreciable speed – typically within a few billionths of a second.

53 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science In Binary (Of Course!) The instruction set is something like the ASCII alphabet encoding scheme.The instruction set is something like the ASCII alphabet encoding scheme. The specific instructions are given unique binary codes.The specific instructions are given unique binary codes. Obviously, the IR must be big enough to hold any instruction within the numbered set.Obviously, the IR must be big enough to hold any instruction within the numbered set.

54 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Sample Instructions Instructions fall into several main categories: data transfer, arithmetic, comparisons, and branchingInstructions fall into several main categories: data transfer, arithmetic, comparisons, and branching Some typical instructions might include:Some typical instructions might include: –Load –Storeh –Move –Add –Compare –Branch –Halt Each of these instructions would be given a unique code, such as 000, 001, 010, etc.Each of these instructions would be given a unique code, such as 000, 001, 010, etc.

55 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Sample Instruction Format The format of a typical instruction is in machine code, and looks something like this:The format of a typical instruction is in machine code, and looks something like this: Operation Code Address Field 1 Address Field 2 Etc.

56 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Interpreting an Instruction Imagine a machine with an instruction set of 8 individual instructions, numbered from 000 to 111.Imagine a machine with an instruction set of 8 individual instructions, numbered from 000 to 111. Our IR would need to be 3 bits big.Our IR would need to be 3 bits big. More realistically, a modern pc today is likely to have instructions,but we will keep our model simple.More realistically, a modern pc today is likely to have instructions,but we will keep our model simple.

57 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Typical Instructions Imagine the following instructionImagine the following instruction – Let’s say the 100 means to perform an ADD operation.Let’s say the 100 means to perform an ADD operation. The would refer to the address location of the first data element to be added.The would refer to the address location of the first data element to be added. The would refer to the address location of the second data element to be added.The would refer to the address location of the second data element to be added. So… this instruction would mean: Add the contents of address location to So… this instruction would mean: Add the contents of address location to

58 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Following the Fetch Execute Cycle Let’s trace an execution cycleLet’s trace an execution cycle To make the trace more manageable, we will manipulate instructions whose format has the instruction itself in abbreviated words instead of binary codesTo make the trace more manageable, we will manipulate instructions whose format has the instruction itself in abbreviated words instead of binary codes Remember, though, that the instruction set entries are really encoded into binary format just like everything else!Remember, though, that the instruction set entries are really encoded into binary format just like everything else!

59 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Fetch, Decode, Execute Imagine that you have written a computer program that has been translated into a set of machine language instructions and placed into memoryImagine that you have written a computer program that has been translated into a set of machine language instructions and placed into memory Each instruction will pass through three phases: fetch, decode and executeEach instruction will pass through three phases: fetch, decode and execute These 3 steps will be repeated, over and over for every instruction until a HALT instruction is reached (or a fatal error occurs)These 3 steps will be repeated, over and over for every instruction until a HALT instruction is reached (or a fatal error occurs) Let’s step through the cycleLet’s step through the cycle

60 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Phase One: Fetch The Control Unit gets the next instruction from memory and moves it into the Instruction Register (IR)The Control Unit gets the next instruction from memory and moves it into the Instruction Register (IR) This is accomplished by the following steps:This is accomplished by the following steps: –The address in the Program Counter (PC) is moved to the MAR –A fetch is initiated, which brings the contents of the cell referenced by the PC to the MDR –Move the instruction from the MDR to the Instruction Register (IR) for decoding –Increment the PC to point to the next instruction

61 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Phase Two: Decode The operation code portion of the contents of the instruction register is read from the IRThe operation code portion of the contents of the instruction register is read from the IR The binary number is fed to a decoder circuit, which activates the appropriate circuitry for the operationThe binary number is fed to a decoder circuit, which activates the appropriate circuitry for the operation

62 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Phase Three: Execution Phase Once the decoder identifies what operational circuitry should be activated, the particular instruction set member is executedOnce the decoder identifies what operational circuitry should be activated, the particular instruction set member is executed Here is a typical series of steps carried out to perform a LOAD operation (which moves contents from main memory to a register)Here is a typical series of steps carried out to perform a LOAD operation (which moves contents from main memory to a register) –Send the address held in the IR to the MAR –Fetch the contents of the cell whose address is now in the MAR and place the contents into the MDR –Copy the contents of the MDR into some designated register Obviously, each instruction set member will require a unique series of steps to be carried outObviously, each instruction set member will require a unique series of steps to be carried out

63 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Completing a Program When one instruction has been executed, the fetch execute cycle moves to the next addressWhen one instruction has been executed, the fetch execute cycle moves to the next address It can do this because the PC was incremented to reflect the address location of the next executable addressIt can do this because the PC was incremented to reflect the address location of the next executable address In this way, a series of machine level instructions can be executed, one at a timeIn this way, a series of machine level instructions can be executed, one at a time

64 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Why Not Quit Here? We could, actuallyWe could, actually The process we just outlined is a fairly accurate description of how early programming occurredThe process we just outlined is a fairly accurate description of how early programming occurred Programmers wrote lines of code that looked something like this:Programmers wrote lines of code that looked something like this: –

65 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Too Error Prone As you can imagine, writing computer programs in machine language was time-consuming and error proneAs you can imagine, writing computer programs in machine language was time-consuming and error prone The short cut that we took in our example – substituting English like abbreviations for the operation codes – was soon adopted by computer programmers, and the era of assembly language coding was ushered inThe short cut that we took in our example – substituting English like abbreviations for the operation codes – was soon adopted by computer programmers, and the era of assembly language coding was ushered in We will look at this next level of abstraction in our next lectureWe will look at this next level of abstraction in our next lecture

66 N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Questions?


Download ppt "CSCI N301: Fundamental Computer Science Concepts Copyright ©2004  Department of Computer & Information Science Von Neumann Architecture."

Similar presentations


Ads by Google