CPUsim



  1. Cousimal
  2. Cousimano's
  3. Flight Sim Cpu
  4. Cozumel

Wombat 1CPU SIM Wombat 1CPU SIM Write another machine language program that takes a binary number and computes the decimal equivalent. The program should prompt user to enter the binary number bit by bit and then compute and display. Download CppSim CppSim/VppSim is free for academic and commercial use, and the install file includes all files necessary to run CppSim/VppSim along with supporting programs such as NGspice and the PLL Design Assistant.

CPU Sim 3.1
An Interactive Java-based CPU Simulator for CS3 Courses

Dale Skrien
Department of Computer Science
Colby College
Waterville ME 04901

Abstract

I will demonstrate CPU Sim 3.1, a Java application written by me for use in CS3 courses that allows users to design simple computer CPU's at the microcode level and to run machine-language or assembly-language programs on them through simulation. CPU Sim is a fully-integrated development environment that includes a text editor for writing assembly language programs and a debugger for stepping forward and backward through the execution of such programs, inspecting and optionally changing the machine state after each step.

Cousimal

I will discuss the features of the package and sample student assignments using it. I intend to bring a laptop to the presentation so that I can demonstrate the software in action. If other faculty are interested in using the package in their courses, I will make the software, the sample assignments, and my solutions to those assignments freely available to them.

Background

In the early 1990's I wrote the first version of CPU Sim. Version 2 of the software won a 1993 EDUCOM Higher Education Software and Curriculum Innovation Award for 'Best Engineering Software (Computer Science)'. Versions 1 and 2 were written in Macintosh Common Lisp and ran only on Macintosh computers. They were discussed in the two references mentioned below and the package was used at more than a dozen colleges around the country. To enable the package to be used on other platforms, CPU Sim has been rewritten in Java using the Swing package. Furthermore, many enhancements were added to CPU Sim to give the user more flexibility and to provide more features when designing new machines and when editing or executing machine-language or assembly-language programs on them.

Features of CPU Sim 3.1

CPU Sim uses the Java Swing GUI package to provide the application interface. It uses windows to display the state of the registers and RAM and dialog boxes to display the parameters of the registers, RAM, microinstructions, and machine instructions. All the state and parameter values are editable in these windows.

CPU Sim is one of very few computer architecture simulators that allow users to modify architectures given to them or to create new architectures and then write and run machine language or assembly language programs on those architectures. In CPU Sim, the user creates a hypothetical CPU by first specifying, through the dialog boxes, the number and properties of the basic hardware components, including the registers, register arrays, and memory. The user then creates microinstructions using the set of hardware components. Next, the user constructs a machine instruction set, including, for each instruction, a name, an opcode, the number and size of operands, and the semantics of the instruction, which is specified by a sequence of microinstructions. The user can then write programs in assembly language with the built-in text editor. Finally, the user can assemble, load, and run the assembly programs they have written. They can run the programs without stopping or they can use the built-in debugger to step forward or backward through the instructions.

Sample Student Assignments

I have developed a series of assignments that allow the students to enhance gradually some simple architectures. In the process, the students receive exposure to accumulator-based, RISC-like, and stack-based architectures.

CPUsim

Cousimano's

The first assignment introduces the students to the CPU Sim package. They are given a simple accumulator-based architecture with only 12 machine instructions and are asked to write small programs for it or make simple modifications to existing programs. Then the students are given a hypothetical machine to run in CPU Sim that is more RISC-like in that it includes a register array, uniform instruction formats, and load and store instructions for accessing memory. The students are then asked to rewrite the previous assignments using the new machine in ways that minimize memory accesses.

The students are then given an assignment that can only be done on the given machine using self-modifying code due to the lack of a stack or an indirect addressing mode. Then the students are asked to add a stack and push and pop instructions to the machine and redo the assignment without any self-modifying code.

In the next several assignments, the students are asked to enhance the given architecture by adding more features, including indirect, stack-relative, and immediate addressing modes for load and store instructions, procedure call and return instructions, and additional arithmetic, logical, and shift instructions. In each assignment, the students are required to implement the features in microcode and then write assembly programs, including recursive programs, that use these new features.

Flight Sim Cpu

About midway through the semester, the students are given an architecture that implements a small subset of the JVM (Java Virtual Machine) instruction set. For the rest of the semester the students enhance this mini-JVM by adding more features, including procedure calls. These new assignments force the students to think about a CPU architecture that is very different from the previous accumulator-based or RISC-like architectures.

References

  1. Skrien, D. and Hosack, J. 'A multilevel simulator at the register transfer level for use in an introductory machine organization class'. SIGCSE Bulletin (Papers of the 22nd ACM/SIGCSE Technical Symposium on Computer Science Education), March 1991, Vol. 23, No. 1, pp. 347-351.
  2. Skrien, D. 'CPU Sim: A Computer Simulator for Use in an Introductory Computer Organization Class'. Journal of Computing in Higher Education, Fall 1994, Vol. 6(1), pp. 3-13.
CpuCPUsim

Cozumel

CSC 103, Fall 2007
How Computers Work

Professor: Judith Cardell, e-mail jcardell@smith.edu
Office: EGR 105B (green engineering building)
Office Hours: : Monday 10:30-11:30, Thursday 2-3, in EGR 105b

Class Time: MW 9:00 - 10:20 in Seelye 212
Prerequisites: none

TA: Allison Bellew, Jordan Crouser
TA hours: On Wednesday and Thursday before HW is due:
Wednesday 7-9pm, Jordan, room 212 Seelye
Thursday 7-9pm, Allie, room 212 Seelye

Text: The Most Complex Machine, A Survey of Computers and Computing, by David Eck, AK Peters Publishing.

Course Overview and Objectives
This course is intended to introduce students to the history, theory and use of digital computers. Students from all majors are welcome - though there is some math and computer programming during the semester, the course is designed assuming students have no previous computer experience. Through the material presented in this course, students will be introduced to:

  1. A brief history of computers
  2. Binary numbers, and understanding how and why computers use them
  3. The mighty transistor - the basic building blocks of computers
  4. Assembly programming - communicating with the computer in its native language
  5. Javascript programming - which you may find you'll like to use beyond this course!
  6. The purpose and use of many standard applications (such as word processors, text editors, spreadsheets and databases)
  7. A better understanding of how the computer does everything you direct it to do.
A great number of topics are discussed in this seven week period, with the purpose not to explore any one topic fully or in depth. Rather the purpose is to provide a high level view of how a computer works - from the most fundamental hardware component (the transistor) through the sophisticated programs we all use every day (such as word processors). Hopefully this first look at all these topics will encourage students to take additional courses in areas that are of most interest.

Assignments

Homework
There are weekly homework assignments which will expand upon the class material and in-class exercises. Homework must be neatly typed with your name, and is due before the beginning of class (9:00am) on the day indicated.

Quizzes
There are weekly, take-home quizzes that focus on the reading and in-class discussions. These quizzes will be available on the course webpage by Monday each week, and are due by midnight (via e-mail) on Sunday the following week. The material covered on each quiz will be from the previous week (for example, the quiz due on September 17 will be based on material from the readings in the text and from class on September 10 and 12). You can use any book or reference material you like for the quizzes (though none other than the text and class notes should be needed!) You may not discuss the quizzes with any person.

Final Paper
There is a final research paper to be done on a topic of current interest in computer science or computer engineering. Chapters 9 through 12 of the text may provide some ideas for the paper. Possibilities could include supercomputing, flash memory, phontonic memory, electronic paper, voice recognition and many more. Topics can be selected from journals (Wired, MIT's Technology Review) and online sources (You could start scanning the 'Sci/Tech' news link on Google now, and you'll have a good chance of coming across an interesting topic). The site How Stuff Works has a wealth of information and is likely to give you additional ideas as you browse through their suggested links to your initial topic. The same holds for the following (which are slightly more along the lines of dictionaries/encyclopedias, but also have good articles, descriptions, and ideas): WhatIs.com, Foldoc, Wikipedia, and Webopedia.

Note that you need to have selected your topic by September 19 (you can change your topic later if needed), and have an outline and list of references by October 3 (1 week before Fall Break). Each student will make a short, informal presetation to the class on your paper either October 22 or October 24 (the topics tend to be quite interesting, and this way everyone gets to hear each other's ideas).

Exams
There are no exams.

Grading
Grades in this course are designed to represent your achievement of the objectives listed above. The course components that will make up your grade are listed below. Note that class participation is a significant part of the grade. This element includes attendence, and also evidence of preparation for class discussions (especially toward the end of the course).

Late Policy
All homework assignments are to be submitted at the beginning of class. Late assignments will be penalized at the rate of 5 points for any assignment handed in late, but before 5pm on the day it is due. After that, assignments will lose one full grade per day (10 points per day). However, each student will have one free late assignment (i.e., one assigment can be one day, or partial day, late without penalty).

Honor Code
The weekly homework assignments that you submit must be your own work. You are encouraged to discuss the problems with your classmates and TAs and work on them together, but each student must work out her own solutions. It is not okay to copy answers from another student's homework - doing so is a violation of the Honor Code. Note that it is a violation of the honor code to 1) use or copy another student's work, and 2) provide another student with your work. Do not hesitate to ask any questions that you may have concerning the honor code!

CSC 103 Class and Assignment Schedule, Fall 2004

Week TopicReadingAssignment *DUE*
Sept 10 Course Introduction:
- Introduction to Computers;
- Course Topics
- Binary numbers and Boolean algebra
Chapter 1 (of textbook),
Article on Computer Science
ASCII Characters
Sept 12 - Transistors, logic circuits, in-class circuit exercise
- Exercise 1: Building logic circuits
SimCir applet
Copyright 1998-2000 Kazuhiko Arase
(Note, the simulator will not work in Linux)
(Open winzip and then simcir.jar)

Exercise 1: Binary adder circuits
Class slides
Chapter 2 (pp 29-48)
Boolean Logic Tutorial
Digital Logic notes
Sept 17 - The Half & Full Adder
- Video clip: 'The Machine That Changed the World'
Class Slides
Chapter 2 (pp 58-63)Quiz 1
Quiz 1 Solution
Sept 19 - Control, control circuits, storage and memory circuits Chapter 3 (skip §3.2.1; Skim §3.2.6) Final Paper
* Paper topic due *
HW 1: Binary adder circuits Due Friday Sept. 21, by 4:00pm to room EGR 105B
Sept 24 - Computer Architecture, fetch-execute cycle; assembly language
The PIPPIN Simulator
Class Slides
Full Adder Circuit
RAM Circuit
Quiz 2
Quiz 2 Solution
Sept 26 - Continuing with Assembly language and Pippin
Exercise 2:Adding with PIPPIN
(Note, the simulator will not work in Linux)
Class Slides
Decoder Circuit
PIPPIN User's Guide
Oct 1 - A brief history of computers
- Video clip
- Operating Systems
- Exercise 3: Windows Tour
Chapter 5
A History of Operating Systems
Quiz 3 due by Sunday, midnight
Quiz 3 Solution
Oct 3 - Operating Systems
- A Short History of Computers
- Windows Tour exercise
Chapter 1, §1.3;
Chapter 6 (§6.1.1 concepts are important, specific subroutine names are not; Skip §6.2.2, 6.3.1, 6.3.2, 6.3.3) Haverford Tutorial
Internet Classrooms
iBoost Tutorial
HW 2 due FRIDAY: Pippin
HW 2 Solution
Final Paper outline and references DUE at the beginning of class
- References Formatting Guidelines
Oct 8
Fall Break
Quiz 4 Due FRIDAY October 12, 4pm to EGR 105B
Quiz 4 Solution
Oct 10 - Programming with Dreamweaver - HTML and Javascript;
- Simple statements and variables, if-else decisions;
- Exercise 4: Example text page 185
- Exercise 5: JavaScript and Dreamweaver
Class Slides
Javascript tutorials:
  • Variables and Functions
- Quiz 4 - See Above
Oct 15 - Continuing with Javascript programming;
Class Slides
- 'The World is Flat' Discussion
- JavaScript & HTML examples:
if-else
if-else-if
for loop
while loop
isEmpty
noneChecked
Chapter 9 through page 284; Chapter 10 (skip §10.1.1 & 10.1.2)
Chapter 12 (AI)
-The World is Flat assignment
-'The World is Flat' link
- Bring discussion questions (or short memo) on 'The World is Flat' to class
Oct 17 Artificial Intelligence: What is intelligence?
Where is AI now?
AI Is Lost In The Woods Technology Review;
optional, interesting reading
- Bring questions for AI discussion
HW 3: JavaScript due Friday, Oct 19, 4pm to EGR 105B
- HW 3 Solution
Oct 22 Final paper presentations Quiz 5 Due Sunday, Oct 21 at Midnight;
Quiz 5 solution
Oct 24 Course Summary & Final paper presentations Papers due by 4pm on Friday Oct 26 to EGR 105B