Monday, June 24, 2024

Create Virtual CPUs Using CPU Sim

- Advertisement -

Understanding the concepts of computer organisation and architecture is difficult by just reading about it. Hands-on experience is required to fully grasp the subject. Unfortunately, providing this experience can be difficult due to the lack of availability and high cost in setting up labs with necessary hardware. Moreover, the time required by the users to familiarise with the tools for working with hardware is also significant. In order to solve this problem, some central processing unit (CPU) simulator programs were developed. But most of these software packages could simulate only fixed architectures.

Why you should learn to use CPU Sim
The idea that you should have exposure to as many different architectures as possible and hands-on experience to design your very own simple architectures is what led to the development of CPU Sim. It is an interactive simulator that allows you to understand computer architectures and organisations, design your own architectures from scratch, or modify the given architectures. You can write the programs using machine language or Assembly language and run them on the virtual CPU. You can also specify details of the CPU to be simulated, such as register set, microinstruction set, machine instruction set, memory and Assembly language instructions. The software was based on STARTLE simulator developed by JM Kerridge of the University of Sheffield.

Main window
Main window

What the user gets
By using CPU Sim, you can get hands-on experience on the following subjects of computer organisation and architecture:
1. Representation of numeric data and their number bases
2. Non-numeric data representation
3. Microprogrammed realisation of the CPU (where control signals are generated by a microcode/microprogram stored in the control read-only memory)
4. Operation of control unit: instruction fetch, decode and execution
5. Instruction types (data manipulation, memory architecture, registers, interrupt, control, external I/O)
6. Instruction formats
7. Assembly language programming and machine language programming
8. Addressing modes of CPU
9. Main memory organisation and operations

- Advertisement -

Understanding and using CPU Sim does not require in-depth knowledge of a high-level language, but an appreciation of concepts involved in high-level language programming is an advantage.

What you can do with it
CPU Sim is a complete development environment. This software allows creating or modifying a simulated CPU including units such as registers, microinstructions, machine instructions and RAM, and specifying its features.

You can create, edit and execute Assembly language programs for this virtually created CPU. It has built-in features and dialogue boxes that help you design CPU architecture, text editor where you can write and edit the Assembly language program, assembler and separate displays for viewing RAM and registers during execution.

CPU_Sim_FactsIt has several features that make debugging easier. For instance, you can execute the assembled programs either continuously or step-by-step. It allows inspecting or changing any of the values in the register or RAM windows and resuming execution or stepping forward or backward during the execution. If an error is detected during assembling in the program to be run, it is highlighted in the text editor.

What makes it special
The architecture of CPU Sim is designed at register-transfer level. This means the basic units of the hypothetical CPU are registers, condition bits and memory (RAM). The user does not have to deal with logic gates or transistors on the digital logic level of the machine.

CPU Sim is developed purely using Java Swing package. This makes the program run on any computer with Java runtime environment (JRE) installed in it, irrespective of the platform (Windows, Linux or OSX) it runs on.


When you start CPU Sim, the window comes with a loaded hypothetical CPU known as Wombat1. Here you can assemble and run a program for that architecture. You can also create a new virtual CPU from scratch by going to File > New Machine.

Why CPU Sim

Sample assembly language
Sample assembly language

XSIM Computer Simulator, DLX Simulator, HiRISC Simulator, Simple Computer Emulator and TOM (Thoroughly Obedient Moron) Computer Simulator are some of the CPU simulator tools we found online that have features similar to CPU Sim. Though most of these are available for free, they lack many of the features available in CPU Sim. This software is simple enough for self-learning and to work with, yet rich enough to thoroughly understand the concepts and build on them. An easy user interface and appealing view are additional advantages.

CPU Sim has a very comprehensive help guide provided in the menu bar (Help > General CPU Sim Help). The installation package also contains a PDF document (CPUSim3.4UserManual.pdf) that explains how various functions are performed using this software. It also includes tutorials with sample assignments that can be run on CPU Sim. Questions and comments can be directly sent to the author Dale Skrien by e-mail. Visit CPU Sim home page for details.

The author is a technical correspondent at EFY


Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components