From d7356d4b39455ac68d33ebb12037d7fd2351772e Mon Sep 17 00:00:00 2001 From: xnumad <34810600+xnumad@users.noreply.github.com> Date: Fri, 24 Mar 2023 21:33:35 +0100 Subject: Correct comment the s in the mnemonic slt is not for signal but for set slt = "Set on Less Than" according to the manual --- mips.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mips.html.markdown') diff --git a/mips.html.markdown b/mips.html.markdown index 31f735b0..b5e35525 100644 --- a/mips.html.markdown +++ b/mips.html.markdown @@ -162,7 +162,7 @@ gateways and routers. blt $t0, $t1, t0_gt_t1 # Branches when $t0 < $t1 ble $t0, $t1, t0_gte_t1 # Branches when $t0 <= $t1 bltz $t0, t0_lt0 # Branches when $t0 < 0 - slt $s0, $t0, $t1 # Instruction that sends a signal + slt $s0, $t0, $t1 # "Set on Less Than" # when $t0 < $t1 with result in $s0 # (1 for true) -- cgit v1.2.3 From f1a149c86036a7686ac1cfae3983370e9347d6e6 Mon Sep 17 00:00:00 2001 From: xnumad <34810600+xnumad@users.noreply.github.com> Date: Fri, 24 Mar 2023 21:35:30 +0100 Subject: Fix branching example Was only wrong in the Java code, assembly code seems fine. --- mips.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'mips.html.markdown') diff --git a/mips.html.markdown b/mips.html.markdown index b5e35525..6f48dc33 100644 --- a/mips.html.markdown +++ b/mips.html.markdown @@ -186,6 +186,7 @@ gateways and routers. # else # max = c; # else + # if (b > c) # max = b; # else # max = c; -- cgit v1.2.3 From d1d1c4af865fdbcfa23225bc4d3b193f0d399b5f Mon Sep 17 00:00:00 2001 From: xnumad <34810600+xnumad@users.noreply.github.com> Date: Fri, 24 Mar 2023 21:43:38 +0100 Subject: Fix off-by-one error Iterate from 0..9, i.e. while $t0 is < 10 --- mips.html.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mips.html.markdown') diff --git a/mips.html.markdown b/mips.html.markdown index 6f48dc33..3add0c5b 100644 --- a/mips.html.markdown +++ b/mips.html.markdown @@ -213,8 +213,9 @@ gateways and routers. # instruction to continue its execution li $t0, 0 while: - bgt $t0, 10, end_while # While $t0 is less than 10, + bgt $t0, 9, end_while # While $t0 is less than 10, # keep iterating + #actual loop content would go here addi $t0, $t0, 1 # Increment the value j while # Jump back to the beginning of # the loop -- cgit v1.2.3