REED MATH 121 - A Simple von Neumann Machine

Unformatted text preview:

Math 121: Introduction to Computing Handout #19Introduction to MiniSimA Simple von Neumann MachineProgramming languages—like C, C++, Java, or even Karel—are called high-levellanguages because they allow you to express algorithmic processes at a high level ofabstraction. The advantage of such languages is that they enable you to focus on theconcepts of algorithmic design and problem solving rather than the nitty-gritty details ofcomputer architecture. At the same time, it is often useful to understand how computerswork on a more detailed level. For one thing, learning about the internal structure of acomputer helps to demystify its operation, which in turn makes computing moreaccessible. For another, learning about the structure of a typical machine gives youadditional insight and intuition into how certain features of high-level languages—such asthe concepts of arrays and pointers—actually work.As useful as it is to know something about the architecture of the underlying machine,it isn’t feasible to introduce these concepts in the context of a highly sophisticatedmachine like the PC or the Macintosh. The structure of any modern computer is muchtoo complex to cover in an introductory course. It is therefore traditional to introduce theconcepts of machine architecture using a hypothetical machine. This handout describesMiniSim, a very simple machine that is nonetheless powerful enough to illustrate thebasic concepts of digital computer architecture.Overview of the MiniSim architectureAlthough modern computers differ significantly in their internal architecture, mostcomputer systems in use today share the same basic organizational structure. The typicalcomputer consists of a central processing unit (CPU), some amount of memory, and someconnection to input/output (I/O) devices so that the machine can communicate with theoutside world. These components are connected by a bus so that data can flow betweenthe separate units, as shown in the diagram below:– 2 –busCPUmemoryI/O devices........................................................................................................................................................................................................................The memory of a computer system is typically broken down into individual memorycells of a fixed size. Each individual cell is called a memory word and is identified by anumeric address. MiniSim has 100 words of memory, numbered from address 00 to 99.To make it easier to catch various common programming errors, MiniSim makes it illegalto use address 00, which means that the usable memory of the machine actually begins ataddress 01.Each of MiniSim’s memory words contains a integer consisting of three decimal digitsplus a sign, so that the range of each memory word is –999 to +999. The followingdiagram therefore shows a possible configuration of MiniSim’s memory, thoughdisplaying only a few words:+3 5 001+5 5 102+4 5 003-0 4 250+0 6 551+0 0 099In the diagram, the word at address 01 contains the number +350, the word at address 50contains the number –42, and so forth.Even though MiniSim memory locations always contain three-digit signed integers, itis important to recognize that you can interpret those integers in different ways. Forexample, the value 65 in location 51 might be a decimal number or the ASCII charactercode for the character 'A'. Each of these values has the internal representation 65. Thecorrect interpretation depends on how the value is used.– 3 –In addition to the addressable memory, most computers include several memory cellsthat live in faster memory inside the processor. These special memory cells are generallycalled registers. MiniSim has the following five registers:AC the accumulatorPC the program counterIR the instruction registerXR the index registerSP the stack pointerEach of these registers has is own purpose, to be introduced in context.– 4 –The stored programming conceptIn the earliest days of computing, programs wereusually represented in a form that made them entirelyseparate from data. Typically, instructions werepunched on paper tape and then fed into the machine,which would execute the instructions in sequence. Ifyou wanted to change the program, you had to puncha new tape. One of the most important characteristicsof modern computers is that the same memory wordsused to store data value can also be used to representinstructions. Machines that store their instructionsinternally as data are called von Neumann machines,after the mathematician John von Neumann (1903-1957), shown here with the machinehe developed at the Institute for Advanced Study in Princeton.In order to represent instructions inside a machine, there needs to be some encodingscheme that allows the hardware to interpret the contents of some memory location as anexecutable instruction. In the MiniSim machine, instructions are encoded in two separateparts. The first digit of the memory word—along with the sign—indicates whatinstruction is being performed, and the last two digits indicate an address in memory.Thus, an instruction in MiniSim is logically divided into the following fields:operation code address fieldFor example, if MiniSim were to execute the value in address 01 above as an instruction,it would take the value +350 and breaks it down into two components:3 5 0+The first digit—along with the sign if necessary—specifies the code for the particularinstruction to be performed. The last two digits specify the address of the word inmemory on which the operation will be performed. In this case, the +3 specifies aninstruction called LOAD, and the LOAD instruction will operate on the word at address 50.– 5 –Simple instructions by exampleYou can write a wide range of programs using just a few simple operations. Toillustrate the operation of MiniSim, let’s start with the following set of instructions:code name operation+1 INPUT xx Reads a line containing an integer value from theterminal and stores it in memory address xx.+2 OUTPUT xx Displays the value in memory address xx.+3 LOAD xx Loads the AC with the value in the memory address xx.The contents of the memory word are not changed.+4 STORE xx


View Full Document

REED MATH 121 - A Simple von Neumann Machine

Download A Simple von Neumann Machine
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view A Simple von Neumann Machine and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view A Simple von Neumann Machine 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?