From 649032148d827e3d4fbe052828a4914f0d656406 Mon Sep 17 00:00:00 2001 From: inixyz Date: Mon, 16 Oct 2023 00:27:54 +0300 Subject: [PATCH] branch pointer fix --- src/tinyriscv.h | 2 +- tests/test.bin | Bin 28 -> 8 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tinyriscv.h b/src/tinyriscv.h index 5426ce9..adb24d8 100644 --- a/src/tinyriscv.h +++ b/src/tinyriscv.h @@ -45,7 +45,7 @@ static inline void store32(u8* mem, const u32 addr, const u32 val){ void tinyriscv_b_type(u32* pc, const u8 func3, const u32 x[32], const u8 rs1, const u8 rs2, const i16 imm){ - pc -= 4; + *pc -= 4; switch(func3){ case /*BEQ*/ 0: if(x[rs1] == x[rs2]) *pc += (i32)imm; break; diff --git a/tests/test.bin b/tests/test.bin index 3df3f69658441776d97df5fa7de918b86ee318b2..59da7b4c99a644f9f5b69aeb6376baec9a28eaa6 100644 GIT binary patch literal 8 PcmbQtu;G6)3j+fH4^slF literal 28 jcmbQt&|oLr$WS|(vGJgA6JzsarY1XaW(J0276t|Yd~^pW