Skip to content

Commit c3aaeb2

Browse files
committed
Release
0 parents  commit c3aaeb2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+6324
-0
lines changed

CPU Visual Simulator.jar

136 KB
Binary file not shown.

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
## About
2+
3+
This CPU Visual Simulator allows you to enter and visualize the execution of assembly language code.
4+
Instructions and numeric data can be inserted or modified directly in RAM. It is possible to define "labels"
5+
(identifiers to be used in place of memory addresses) in the greyed table on the left of the RAM: these labels
6+
can then be used as parameters in jump instructions, or as variable identifiers. At any time, it is possible to
7+
switch between symbolic and binary representations. It is also possible to directly modify the Program Counter,
8+
in order to set the next instruction that will be executed.
9+
10+
![Screenshot](images/screenshot.png?raw=true)
11+
12+
## How to run
13+
14+
This Educational CPU Visual Simulator is implemented in Java, and packaged as a single .jar file that you need to download from here.
15+
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:
16+
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
17+
18+
19+
## Instruction set
20+
21+
#### Data Flow
22+
23+
| Direct Operand | Immediate Operand | Description |
24+
|:--------------:|:-----------------:|:------------|
25+
| LOD X | LOD #X | Load content of Memory Location X (or number #X) into the Accumulator. |
26+
| STO X | | Store the value of the Accumulator into Memory Location X. |
27+
28+
#### Control Flow
29+
30+
| Direct Operand | Immediate Operand | Description |
31+
|:--------------:|:-----------------:|:------------|
32+
| JMP P | | Unconditional jump to the instruction at location P. |
33+
| JZ P | | Jump on Zero: if Flag Z is set, go to instruction number P, otherwise go to the next instruction. |
34+
| JNZ P | | Jump on Not Zero: if Flag Z is cleared, go to instruction number P, otherwise, go to the next instruction. |
35+
| JN P | | Jump on Negative: if Flag N is set, go to instruction number P, otherwise go to the next instruction. |
36+
| JNN P | | Jump on Not Negative: if Flag N is cleared, go to instruction number P, otherwise go to the next instruction. |
37+
| NOP | | No Operation, go to the next instruction. |
38+
| HLT | | Halt execution. |
39+
40+
#### Arithmetic-logic
41+
42+
| Direct Operand | Immediate Operand | Description |
43+
|:--------------:|:-----------------:|:------------|
44+
| ADD X | ADD #X | Add content of Memory Location X (or number #X) to the Accumulator. Flags are updated. |
45+
| SUB X | SUB #X | Subtract content of Memory Location X (or number #X) from the Accumulator. Flags are updated. |
46+
| MUL X | MUL #X | Multiply the Accumulator by the content of Memory Location X (or number #X). Flags are updated. |
47+
| DIV X | DIV #X | Divide the Accumulator by the content of Memory Location X (or number #X). Flags are updated. |
48+
| AND X | AND #X | Bitwise AND between the Accumulator and the content of Memory Location X (or number #X). Flags are updated. |
49+
| 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. |
50+
| NOT X | NOT #X | Bitwise NOT of the content of Memory Location X (or number #X). The result is stored in the Accumulator. |
51+
52+
## Examples
53+
54+
High level IF-THEN-ELSE example and its translation:
55+
56+
![IF-THEN-ELSE](images/if-then-else-example.png?raw=true)
57+
58+
High-level WHILE-DO example and its translation:
59+
60+
![WHILE-DO](images/while-do-example.png?raw=true)
61+
62+
## Copyright notice
63+
64+
Cengage Learning Inc. Reproduced by permission.
65+
http://www.cengage.com/permissions
66+
67+
This simulator can be used exclusively for non-commercial, educational activities.
68+
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.
69+
70+
## Credits
71+
72+
Original PIPPIN applet:
73+
* Prof. Stuart Hirshfield and Prof. Rick Decker (Designers)
74+
75+
CPU Visual Simulator extension, carried out with an Open Pedagogy / OER-enabled process:
76+
* Renato Cortinovis, PhD - Project coordinator
77+
* Nicola Preda - Porting to a Java application, initial new functionalities, and documentation
78+
* Jonathan Cancelli - Implementation of the great majority of new functionalities
79+
* Alessandro Belotti - Implementation of visualizations and animations
80+
* Davide Riva - Initial refactoring
81+
* MariaPia Cavarretta, Giordano Cortinovis, Giovanni Ingargiola, Alessandro Suru, Piero Andrea Sileo and others - Documentation
82+
83+
Additional information:
84+
85+
* Cortinovis, R. (2021). An educational CPU Visual Simulator, Proceedings of the 32nd Annual Workshop of the Psychology of Programming Interest Group (PPIG).

images/if-then-else-example.png

11.7 KB
Loading

images/screenshot.png

16.4 KB
Loading

images/while-do-example.png

14.4 KB
Loading

src/META-INF/MANIFEST.MF

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Manifest-Version: 1.0
2+
Main-Class: pippin.Main

src/pippin/Main.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
Copyright notice
3+
4+
Cengage Learning Inc. Reproduced by permission. http://www.cengage.com/permissions
5+
6+
This simulator can be used exclusively for non-commercial, educational activities.
7+
This CPU Visual Simulator was derived (modified and extended - see credits) in 2021
8+
from the original PIPPIN Applet (© 1998 PWS Publishing Company), with permission from
9+
Cengage Learning Inc. Other deletions, additions, edits, changes to, or derivatives of
10+
the Cengage Material can only be made with Cengage’s express written approval, email sufficing.
11+
12+
Credits
13+
14+
Original PIPPIN applet:
15+
Prof. Stuart Hirshfield and Prof. Rick Decker (designers)
16+
CPU Visual Simulator extension, carried out with an Open Pedagogy / OER-enabled process:
17+
18+
Renato Cortinovis, PhD - project coordinator
19+
Nicola Preda - porting to a Java application, initial new functionalities, and documentation
20+
Jonathan Cancelli - implementation of the great majority of new functionalities
21+
Alessandro Belotti - implementation of visualizations and animations
22+
Davide Riva - initial refactoring
23+
MariaPia Cavarretta, Giordano Cortinovis, Giovanni Ingargiola, Alessandro Suru, Piero Andrea Sileo and others - documentation.
24+
*/
25+
package pippin;
26+
27+
import pippin.stage.NEWCPUSim;
28+
29+
public class Main {
30+
31+
public static void main(String[] args){
32+
NEWCPUSim newcpuSim = new NEWCPUSim();
33+
newcpuSim.setTitle("CPU Visual Simulator");
34+
newcpuSim.setVisible(true);
35+
}
36+
37+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Copyright notice
3+
4+
Cengage Learning Inc. Reproduced by permission. http://www.cengage.com/permissions
5+
6+
This simulator can be used exclusively for non-commercial, educational activities.
7+
This CPU Visual Simulator was derived (modified and extended - see credits) in 2021
8+
from the original PIPPIN Applet (© 1998 PWS Publishing Company), with permission from
9+
Cengage Learning Inc. Other deletions, additions, edits, changes to, or derivatives of
10+
the Cengage Material can only be made with Cengage’s express written approval, email sufficing.
11+
12+
Credits
13+
14+
Original PIPPIN applet:
15+
Prof. Stuart Hirshfield and Prof. Rick Decker (designers)
16+
CPU Visual Simulator extension, carried out with an Open Pedagogy / OER-enabled process:
17+
18+
Renato Cortinovis, PhD - project coordinator
19+
Nicola Preda - porting to a Java application, initial new functionalities, and documentation
20+
Jonathan Cancelli - implementation of the great majority of new functionalities
21+
Alessandro Belotti - implementation of visualizations and animations
22+
Davide Riva - initial refactoring
23+
MariaPia Cavarretta, Giordano Cortinovis, Giovanni Ingargiola, Alessandro Suru, Piero Andrea Sileo and others - documentation.
24+
*/
25+
package pippin.exceptions;
26+
@SuppressWarnings("serial")
27+
public class AbortedException extends Exception {
28+
29+
public AbortedException() {}
30+
31+
public AbortedException(String s) {
32+
super(s);
33+
}
34+
}
712 Bytes
Loading
704 Bytes
Loading

0 commit comments

Comments
 (0)