Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fall 20041R. Smith - University of St Thomas - Minnesota Extending the Spreadsheet to Illustrate Basic CPU Operations in a Computer Literacy Course Richard.

Similar presentations


Presentation on theme: "Fall 20041R. Smith - University of St Thomas - Minnesota Extending the Spreadsheet to Illustrate Basic CPU Operations in a Computer Literacy Course Richard."— Presentation transcript:

1 Fall 20041R. Smith - University of St Thomas - Minnesota Extending the Spreadsheet to Illustrate Basic CPU Operations in a Computer Literacy Course Richard E. Smith, Ph.D. Department of Quantitative Methods and Computer Science University of St. Thomas This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.0/

2 Fall 2004 2R. Smith - University of St Thomas - Minnesota The Problem How do we teach non-experts about the internals of the computers central processing unit (CPU)?How do we teach non-experts about the internals of the computers central processing unit (CPU)? Option: Dont botherOption: Dont bother Option: Use a software simulation programOption: Use a software simulation program Option: use the Excel-based Simple CPUOption: use the Excel-based Simple CPU

3 Fall 2004 3R. Smith - University of St Thomas - Minnesota The Simple CPU Display

4 Fall 2004 4R. Smith - University of St Thomas - Minnesota Operating Features RAM appears in Column A on the leftRAM appears in Column A on the left One-address instruction setOne-address instruction set –Some instructions refer to a single memory location –Calculations use a single accumulator register Each instruction requires two cyclesEach instruction requires two cycles –Fetch cycle – get the instruction thats to be executed –Execute cycle – perform the calculation or other action This cycle may fetch or store data in RAMThis cycle may fetch or store data in RAM Very Simple Instruction setVery Simple Instruction set –Three instructions refer to memory locations: Add, Store, Jump –Based on the TX-0 computer built in the 1950s

5 Fall 2004 5R. Smith - University of St Thomas - Minnesota The TX-0 Not your grandfathers laptop.Not your grandfathers laptop. Transistor Experiment computer, version 0 –Built in 1955-56 by MITs Lincoln Laboratory Absurdly simple instruction set –Focus on testing the transistorized computer circuits –Easier to build, easier to test, easier to fix

6 Fall 2004 6R. Smith - University of St Thomas - Minnesota A Simple CPU program In Assembly Language (text) format: 1.Clear 2.Add 5 3.Store 5 4.Jump 2 5.1 (data) In Machine Language (numeric) format: 1.2 2.105 3.205 4.302 5.1

7 Fall 2004 7R. Smith - University of St Thomas - Minnesota Concepts to Convey A program as a sequence of instructionsA program as a sequence of instructions Instructions in a highly coded formInstructions in a highly coded form Processor cyclesProcessor cycles CPU is separate from its RAMCPU is separate from its RAM

8 Fall 2004 8R. Smith - University of St Thomas - Minnesota Use in Class Demonstrate on a projection display.Demonstrate on a projection display. Explain the notion of the processor cycle.Explain the notion of the processor cycle. Demonstrate a simple program.Demonstrate a simple program. Explain how to translate simple add-and- subtract calculations into the right sequence of add-invert-add, etc.Explain how to translate simple add-and- subtract calculations into the right sequence of add-invert-add, etc. Assignment to write their own programs in numeric form.Assignment to write their own programs in numeric form.

9 Fall 2004 9R. Smith - University of St Thomas - Minnesota Final Points Integration into the spreadsheetIntegration into the spreadsheet –Relies on concepts the students learned in Excel training –Seems like a follow-on to Excel, not a major topic change –Easy to modify and extend for other classes, like computer architecture Simulator conveys concepts more effectivelySimulator conveys concepts more effectively –Pre-simulator training relied on rote learning of concepts with discussion but no hands-on work or live demonstrations –Simulator lets students demonstrate an understanding of machine level instructions by doing homework assignments –Success on CPU-oriented exam questions went from (estimate) 1 out of 3 to 7 out of 8.

10 Fall 2004 10R. Smith - University of St Thomas - Minnesota Thank You! Questions? My contact information:My contact information: –Dr. Rick Smith –University of St. Thomas –resmith@stthomas.edu resmith@stthomas.edu Getting the SimpleCPU Simulator:Getting the SimpleCPU Simulator: –Go to Google –Search for smith simple cpu demo http://www.cs.stthomas.edu/faculty/resmith/c/qmcs110/m/cpudemo1.html

11 Fall 2004 11R. Smith - University of St Thomas - Minnesota The Simple CPU Display

12 Fall 2004 12R. Smith - University of St Thomas - Minnesota Future Work Extensions to simplify programmingExtensions to simplify programming –Add conditional jumps –Add an index register Make easier to modify and maintainMake easier to modify and maintain –Rearrange calculations to minimize reliance on memorized cell identities –Move critical functions into VBasic modules to improve readability Try using to teach computer architectureTry using to teach computer architecture –Extension to multiple cycles, multiple address modes –Modifications by students to prototype their own processors, instruction sets

13 Fall 2004 13R. Smith - University of St Thomas - Minnesota Executing a Program First, reset the CPUFirst, reset the CPU –Program address (PC) starts at 1 –AC register starts at 0 Next, perform the Fetch cycleNext, perform the Fetch cycle –Calculate new values for the AC, PC, and IR in locations E3-E5, based on the contents of D5-E5 and data fetched from memory –At the end of the cycle, copy the new values of the AC, PC, and IR from cells E3-E5 to D3-D5. Finally, perform the Execute cycleFinally, perform the Execute cycle –Use the IR, Instruction, and Address cells (D5, D10, D11) to identify and execute the instruction –At the end of the cycle, copy the new values of the AC, PC, and IR from cells E3-E5 to D3-D5. –If storing a result in memory, do that, too. Start next instruction at the Fetch Cycle aboveStart next instruction at the Fetch Cycle above

14 Fall 2004 14R. Smith - University of St Thomas - Minnesota Example: part of the ADD calculation Calculates the contents of the AC at the end of the Execute cycle (D4):Calculates the contents of the AC at the end of the Execute cycle (D4): =IF(D2,D3,=IF(D2,D3, –IF(D10=1,D3+D9, IF(D5=1,-D3,IF(D5=1,-D3, –IF(D5=2,0, D3))))D3)))) If its the Fetch cycle (D2 is TRUE), –leave the AC (D3) unchanged. Else if its an ADD instruction (D10=1) –Add the data from memory to the AC Else if its a Negate instruction (D5=1) –Negate the data in the AC Else if it a Clear instruction (D5=2) –Clear the data in the AC


Download ppt "Fall 20041R. Smith - University of St Thomas - Minnesota Extending the Spreadsheet to Illustrate Basic CPU Operations in a Computer Literacy Course Richard."

Similar presentations


Ads by Google