June 20071R. Smith - University of St Thomas - Minnesota A spreadsheet-based simulation of CPU instruction execution R. E. Smith Computer & Computational Science University of St. Thomas St. Paul, MN
June R. Smith - University of St Thomas - Minnesota The Spreadsheet CPU Motivation – teaching about the CPUMotivation – teaching about the CPU Overview – using a spreadsheetOverview – using a spreadsheet Literacy VersionLiteracy Version Architecture VersionArchitecture Version Fetch CycleFetch Cycle Execute CycleExecute Cycle
June R. Smith - University of St Thomas - Minnesota Teaching about the CPU Literacy – how a CPU worksLiteracy – how a CPU works –Fetch-Execute Cycle – what the Gigahertz count –Registers and RAM –Machine language programming Architecture – how instructions workArchitecture – how instructions work –Mechanism for instruction decoding and execution –Modifying the instruction set – adding and changing
June R. Smith - University of St Thomas - Minnesota Using a spreadsheet Why: Students are familiar with themWhy: Students are familiar with them –Cells provide a visual representation of RAM –Functional semantics via the Value Rule –Contrast with machine language semantics How: Implementing the behaviorHow: Implementing the behavior –Use a column of cells as RAM –Separate columns for fetch and execute cycles –Use a macro to cycle the state machine –Separate cells for last state and next state –Each register has its own row
June R. Smith - University of St Thomas - Minnesota Literacy version
June R. Smith - University of St Thomas - Minnesota Architecture Version GoalsGoals –Better instruction set: conditionals, indexing –Easy for students to follow instruction execution –Easy for students to modify instructions First attemptFirst attempt –Instructions assigned to separate columns –Registers/cycles split into separate rows –Hard to explain and modify Current versionCurrent version –Separate sheets/tabs for each instruction cycle –Easier to add a defer cycle for indirection, if desired
June R. Smith - University of St Thomas - Minnesota Architecture Version: Fetch Cycle
June R. Smith - University of St Thomas - Minnesota Execute Cycle
June 20079R. Smith - University of St Thomas - Minnesota Demonstration
June R. Smith - University of St Thomas - Minnesota Instruction Set InstructionCodeExample TextExample Code Add xx1xxAdd Store xx2xxStore Jump xx3xxJump 5305 Stop0 0 Invert1 1 Clear2 2 Noop3 3