Usage Guide¶
Supported Instructions¶
ASMsim supports the following MIPS32 instructions:
R-Format Instructions¶
add $rd, $rs, $rt
- Add registerssub $rd, $rs, $rt
- Subtract registersand $rd, $rs, $rt
- Bitwise ANDor $rd, $rs, $rt
- Bitwise ORslt $rd, $rs, $rt
- Set less thansll $rd, $rt, shamt
- Shift left logicalsrl $rd, $rt, shamt
- Shift right logicaljr $rs
- Jump register
I-Format Instructions¶
addi $rt, $rs, imm
- Add immediatelw $rt, offset($rs)
- Load wordsw $rt, offset($rs)
- Store wordbeq $rs, $rt, label
- Branch if equalbne $rs, $rt, label
- Branch if not equal
J-Format Instructions¶
j label
- Jumpjal label
- Jump and link
Program Features¶
Code Editor¶
- Syntax highlighting
- Real-time error checking
- Line numbers
- File loading support
Code Execution¶
- Step Mode: Execute one instruction at a time
- Shows current instruction
- Updates registers and memory
-
Displays PC counter
-
Run Mode: Execute entire program
- Runs to completion
- Shows final state
- Displays execution status
Memory View¶
- Instruction memory display
- Data memory display
- Word-aligned addressing
- Binary/Hex display options
Register View¶
- All 32 MIPS registers
- Real-time value updates
- Register naming conventions
Code Examples¶
Basic Arithmetic¶
# Add two numbers
addi $s0, $zero, 5 # s0 = 5
addi $s1, $zero, 3 # s1 = 3
add $s2, $s0, $s1 # s2 = 8
Memory Operation¶
# Store and load a number
addi $t0, $zero, 100 # t0 = 100
sw $t0, 0($sp) # Store 100 at stack pointer
lw $t1, 0($sp) # Load value into t1
Branching¶
# Branch example
addi $t0, $zero, 5
addi $t1, $zero, 5
beq $t0, $t1, equal # Branch if t0 = t1
j exit
equal:
addi $t2, $zero, 1
exit: