GithubHelp home page GithubHelp logo

belotti01 / cpu-visual-simulator Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 1.0 275 KB

Educational CPU Visual Simulator, interpreting a simplified but representative assembly language.

Java 95.64% HTML 4.36%
java awt education educational-software

cpu-visual-simulator's Introduction

Download

Direct link: https://github.com/Belotti01/CPU-Visual-Simulator/releases/download/v1.0.0/cpu-visual-simulator.jar

About

This CPU Visual Simulator allows you to enter and visualize the execution of assembly language code. Instructions and numeric data can be inserted or modified directly in RAM. It is possible to define "labels" (identifiers to be used in place of memory addresses) in the greyed table on the left of the RAM: these labels can then be used as parameters in jump instructions, or as variable identifiers. At any time, it is possible to switch between symbolic and binary representations. It is also possible to directly modify the Program Counter, in order to set the next instruction that will be executed.

Screenshot

How to run

This Educational CPU Visual Simulator is implemented in Java, and packaged as a single .jar file that you need to download from here. In addition to the .jar file, you’ll need the Java Runtime Environment (JRE) to run it. An easy way to find out if you have the JRE already installed, is to double-click the downloaded .jar file: if the simulator doesn't start or if you are prompted to select an application to open the file, you might download and install the JRE from Oracle's website - https://www.oracle.com/java/technologies/javase-jre8-downloads.html

Instruction set

Data Flow

Direct Operand Immediate Operand Description
LOD X LOD #X Load content of Memory Location X (or number #X) into the Accumulator.
STO X Store the value of the Accumulator into Memory Location X.

Control Flow

Direct Operand Immediate Operand Description
JMP P Unconditional jump to the instruction at location P.
JZ P Jump on Zero: if Flag Z is set, go to instruction number P, otherwise go to the next instruction.
JNZ P Jump on Not Zero: if Flag Z is cleared, go to instruction number P, otherwise, go to the next instruction.
JN P Jump on Negative: if Flag N is set, go to instruction number P, otherwise go to the next instruction.
JNN P Jump on Not Negative: if Flag N is cleared, go to instruction number P, otherwise go to the next instruction.
NOP No Operation, go to the next instruction.
HLT Halt execution.

Arithmetic-logic

Direct Operand Immediate Operand Description
ADD X ADD #X Add content of Memory Location X (or number #X) to the Accumulator. Flags are updated.
SUB X SUB #X Subtract content of Memory Location X (or number #X) from the Accumulator. Flags are updated.
MUL X MUL #X Multiply the Accumulator by the content of Memory Location X (or number #X). Flags are updated.
DIV X DIV #X Divide the Accumulator by the content of Memory Location X (or number #X). Flags are updated.
AND X AND #X Bitwise AND between the Accumulator and the content of Memory Location X (or number #X). Flags are updated.
CMP X CMP #X Subtract content of Memory Location X (or number #X) from the Accumulator. Flags are updated, but the content of the Accumulator is not modified.
NOT X NOT #X Bitwise NOT of the content of Memory Location X (or number #X). The result is stored in the Accumulator.

Examples

High level IF-THEN-ELSE example and its translation:

IF-THEN-ELSE

High-level WHILE-DO example and its translation:

WHILE-DO

Copyright notice

Cengage Learning Inc. Reproduced by permission. http://www.cengage.com/permissions

This simulator can be used exclusively for non-commercial, educational activities. This CPU Visual Simulator was derived (modified and extended - see credits) in 2021 from the original PIPPIN Applet (© 1998 PWS Publishing Company), with permission from Cengage Learning Inc. Other deletions, additions, edits, changes to, or derivatives of the Cengage Material can only be made with Cengage’s express written approval, email sufficing.

Credits

Original PIPPIN applet:

  • Prof. Stuart Hirshfield and Prof. Rick Decker (Designers)

CPU Visual Simulator extension, carried out with an Open Pedagogy / OER-enabled process:

  • Renato Cortinovis, PhD - Project coordinator
  • Nicola Preda - Porting to a Java application, initial new functionalities, and documentation
  • Jonathan Cancelli - Implementation of the great majority of new functionalities
  • Alessandro Belotti - Implementation of visualizations and animations
  • Davide Riva - Initial refactoring
  • MariaPia Cavarretta, Giordano Cortinovis, Giovanni Ingargiola, Alessandro Suru, Piero Andrea Sileo and others - Documentation

Additional information:

  • Cortinovis, R. (2021). An educational CPU Visual Simulator, Proceedings of the 32nd Annual Workshop of the Psychology of Programming Interest Group (PPIG).

cpu-visual-simulator's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mamunpw01

cpu-visual-simulator's Issues

Can't see the compiled .JAR file?

Hi,

I'm keen to take a local look at this but I cannot any sign of the single .jar file you refer to?

Do I need to use Java locally to package it up myself?
If so, then any instructions on doing so would be most welcome.

"This Educational CPU Visual Simulator is implemented in Java, and packaged as a single .jar file that you need to download from here...."

Thanks

Nick

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.