Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You may think that the emulator is unreasonably slow, but if you take a look at
## Technical details

CPU emulates:
* All RV32I instructions except for "slti"
* All RV32I instructions
* All RV32M instructions except for "mulhsu"
* All RV32A instructions except for xor, max, min
* All Zicsr instructions
Expand Down
13 changes: 13 additions & 0 deletions cpu/instruction_executer.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ def execute_instruction(instruction, registers, CSR_registers, trap_and_interrup
logger.register_executed_instruction(f"slli x{destination_reg}, x{source_reg}, {immediate_val} (Shift Left Logical - Immediate)")
pass

# --- instruction "SLTI" ---
elif instruction_subtype == 2:

if (source_reg_value & ((1 << 32) - 1)) - ((source_reg_value & (1 << (32 - 1))) << 1) < immediate_val:
result = 1
else:
result = 0

registers.x[destination_reg] = result

logger.register_executed_instruction(f"slti x{destination_reg}, x{source_reg}, {immediate_val} (Set Less Than - Immediate)")
pass

# --- instruction "SLTIU" ---
elif instruction_subtype == 3:

Expand Down