Simulator
Software that graphically simulates the result of executing a given program, as if it was written in the ICMC processor's memory.
It is available in two versions:
-
"Original": has the
gtk2
andncurses
packages as dependencies, which must be installed (recommended with the package manager of your distribution) before it can be used. -
Browser: can be used directly in a graphical browser. This was tested on the Firefox (v129.0.1, 64-bit) and Chromium (v127.0.6533.119, 64-bit) browsers;
Only the original simulator needs to be installed to be used, the browser simulator is accessible at https://thiagoambiel.github.io/SimuladorICMC/. Nevertheless, the installation process for both versions is described below, so that they can be used locally.
Installation
Run the following commands in your terminal:
- Original
- Browser
wget https://github.com/de-abreu/Processador-ICMC/raw/master/simulator/original_simulator.zip
unzip original_simulator.zip
cd original
gcc *.c -o sim
With this, you will have the executable sim
. Take it to the directory where you are working, as convenient.
It is assumed by the open
command that the browser to be used is the one defined as the default for the user in question.
wget https://github.com/de-abreu/Processador-ICMC/raw/master/simulator/browser_simulator.zip
unzip browser_simulator.zip
open browser/index.html
Usage
Files required for simulation
The simulators require a pair of .mif
files to operate on: the first referring to the program - generated by the assembler - and the second to the corresponding charmap, respectively. For the original simulator, these can be passed according to the command
./sim programa.mif charmap.mif
While the browser simulator, when opened, presents a graphical interface that allows navigation through the file manager to select these same files.
Description of the graphical interface
Both simulators have similar interfaces, which should feature the following two components:
- Registers At the top, the values stored in the registers are described.
- Instructions The current instruction being read (first line) and the next instructions stored in memory.
To learn what the registers described by the simulator are and what they do, consult the section on registers in the processor page.
At the time of writing this document, there are several alternative simulators developed by ICMC students. Among them:
- OpenGL_Simulator by Breno Queiroz and Maria Eduarda Moreira;
- goICMCsim by Lucas Pulcinelli;
- ICMC's CPU Emulator by Vinicius Giroto (this is an IDE that contains its own simulator).