Skip to main content

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 and ncurses 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;

info

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:

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.

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.

tip

After installation, consider downloading the HelloMom program and its charmap and running the simulator with these to test if it is working.

Description of the graphical interface

Both simulators have similar interfaces, which should feature the following two components:

Frogger Demake game running on the original simulator

  • 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.
note

To learn what the registers described by the simulator are and what they do, consult the section on registers in the processor page.

Do you want to know more?

At the time of writing this document, there are several alternative simulators developed by ICMC students. Among them: