From 21a10c7d97f3986376c7af5f7d6891c49390aade Mon Sep 17 00:00:00 2001 From: vftable <59777379+vftable@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:44:59 +0100 Subject: [PATCH 1/2] Add "slti" instruction support --- cpu/instruction_executer.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cpu/instruction_executer.py b/cpu/instruction_executer.py index c5cacd1..157238e 100644 --- a/cpu/instruction_executer.py +++ b/cpu/instruction_executer.py @@ -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: From f474fd0bc722c4a5c422d70c0de910e38d177562 Mon Sep 17 00:00:00 2001 From: vftable <59777379+vftable@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:46:55 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfe255f..0e2972e 100644 --- a/README.md +++ b/README.md @@ -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