Seattle, Washington
June 28, 1998
June 28, 1998
July 1, 1998
2153-5965
5
3.16.1 - 3.16.5
10.18260/1-2--7251
https://peer.asee.org/7251
2356
Session 2220
A Java-based Computer Simulator and its Applications
John K. Estell Bluffton College
Abstract
This paper describes a learning philosophy for computer science that is based on having students write a simulation of a computer system, then adding features to the initial simulation that are appropriate for learning concepts being presented in a particular course. In the past the author has successfully utilized this method in teaching concepts related to CPU processor scheduling in an operating systems course1; however, as the simulation was written in a structured language using platform-dependent code it was not portable to other platforms nor was it possible to adapt the code to examine different concepts without a major rewrite being made necessary. The development and rapid growth of Java, a platform-independent object-oriented language, has provided a facility with which to better serve students. The fundamental components of a computer system, such as registers and memory, can be modeled as objects. Each component is written up into a Java class containing both data elements and methods for operating upon the data elements. As these classes need only be written once, for subsequent assignments students have only to import the appropriate classes and instantiate the required objects in order to create models of the components tailored to whatever specifications are provided. These components are then used as part of the new simulation. Because of Java’s design, code can be ported from one platform to another and both graphics and graphical user interfaces can be incorporated into the simulator.
The Introductory Assignment
The introductory assignment occurs at the end of the first object-oriented programming course, which for our students is the third programming course that is taken. At this point the students have been exposed through both lecture and programming assignments to such topics as objects, GUIs, and events. Now the students are introduced to the problem of computer simulation via a brief explanation of a simple von Neumann architecture. The design features a single 8-bit register (the accumulator) for data processing and I/O, one flag (the zero flag) for conditional testing, an 8-bit register for use as the program counter, and a 256-byte memory store. A very simplistic instruction set containing a minimal amount of features is then provided. This instruction set, shown in Figure 1, allows for simple processing of integer values through the use of load, store, add, branch, input, and output operations. The load and add operations can be performed with either immediate or stored values. Both the input and output operations interact with the user through use of TextField objects. The instruction set also includes an end operation so that the simulation can be halted when execution is complete. At a minimum the students are instructed to implement classes for the memory, register, and flag modules, implement the main
Estell, J. K. (1998, June), A Java Based Computer Simulator & Its Applications Paper presented at 1998 Annual Conference, Seattle, Washington. 10.18260/1-2--7251
ASEE holds the copyright on this document. It may be read by the public free of charge. Authors may archive their work on personal websites or in institutional repositories with the following citation: © 1998 American Society for Engineering Education. Other scholars may excerpt or quote from these materials with the same citation. When excerpting or quoting from Conference Proceedings, authors should, in addition to noting the ASEE copyright, list all the original authors and their institutions and name the host city of the conference. - Last updated April 1, 2015