LARS - LoongArch Assembly and Runtime Simulator

Release 4.5

May 2024

Introduction

LARS, the LoongArch Assembly and Runtime Simulator, will assemble and simulate the execution of LoongArch assembly language programs. It can be used either from a command line or through its integrated development environment (IDE). LARS is written in Java and requires at least Release 1.5 of the J2SE Java Runtime Environment (JRE) to work. It is distributed as an executable JAR file.

As of Release 4.0, LARS assembles and simulates approximately 50 basic instructions of the LoongArch-32 instruction set, 13 pseudo-instructions or instruction variations, the 22 syscall functions mainly for console and file I/O defined by SPIM, and an additional 18 syscalls for other uses such as MIDI output, random number generation and more. These are listed in separate help tabs. It supports seven different memory addressing modes for load and store instructions: label, immed, label+immed, ($reg), label($reg), immed($reg), and label+immed($reg), where immed is an integer up to 32 bits. A setting is available to disallow use of pseudo-instructions and extended instruction formats and memory addressing modes.

Our guiding reference in implementing the instruction set has been Fundamentals of Assembly Language Programming Based on LoongArch' (by Sun Guoyun, Ao Qi, and Wang Rui) summarizes the integer instructions of LoongArch-32 in Chapter 3, which focuses on the basic integer instructions of LoongArch. At the same time, the 'la-asm-manual' summarizes the pseudo-instructions of LoongArch-32.

The LARS IDE provides program editing and assembling but its real strength is its support for interactive debugging. The programmer can easily set and remove execution breakpoints or step through execution forward or backward (undo) while viewing and directly editing register and memory contents.