Computer Organisation (Estructura de computadors, EC)
Warning: The information on this page may be outdated. Students of this course should not use its contents as a reference and must consult el Racó instead.
MARS (MIPS Assembler and Runtime Simulator)
Installation
- Download and save this
Mars.jar version.
- Download and save this
startup.s version.
- Install a Java Runtime Environment (JRE) version 1.6 or above.
Initial setting (only once)
Settings tab (top left) → Exception handler ... (2nd from bottom):
Browse → Select the startup.s file.
- Select the chechbox ✓
Include this exception handler file in all assemble operations.
Usage
- Open a terminal (Linux:
Ctrl+Alt+T, Microsoft Windows: Win+X → WinX).
- Go to
Mars.jar directory (e.g. cd <DIR_FULL_PATH>).
- Run:
java -jar Mars.jar.
Script
#!/bin/bash
cd ~/UPC/EC/mars
java -jar Mars.jar
F1 help
C programming
- Complier: The GNU Compiler Collection (GCC), a free software compiler system capable of compiling several programming languages, including C and C++. Basic usage:
gcc -o BINARY_FILE_NAME C_FILE_NAME.c.
- C code check: GCC accepts a large number of options. Some of them are predefined selections of other options. The most relevant selections to detect code inaccuracies (like use types consistingly, etc.) are
-Wall, -Wextra and -Wpedantic, by order of severity, although not entirely inclusive.
- Creation and management of binary programs and object files and assembly source code: GNU Binary Utilities (a.k.a.
binutils).
- Resources:
GNU bc
GNU bc an arbitrary precision numeric processing language. It can be used as base converter and for algebraic integer operation.
- Special variables:
obase = <OUTPUT_BASE_in_current_ibase>, ibase = <INPUT_BASE_in_current_ibase> (in most cases you want to set obase before ibase), and scale = <NUMBER> (set scale to zero for integer / and %).
- Ivokation options:
-l preloads a math library and sets scale to 20.
[Parent page]
[Root page]
Last update: 2025/03/25