Commit 1ec43716 authored by Daru13's avatar Daru13
Browse files

Branch adress issue fixed: not adding PC anymore, but directly setting PC from imm<<2

parent 25e140f3
......@@ -26,7 +26,8 @@ where
jump_addr = incr_addr[0..3] . partial_jump_addr . 0.0;
(* Branch address *)
(branch_addr, c1) = adder_n<word>(incr_addr, (imm.0.0)[2..], 0);
(* (branch_addr, c1) = adder_n<word>(incr_addr, (imm.0.0)[2..], 0); *)
branch_addr = (imm.0.0)[2..];
(* Computing the next value of PC *)
after_branch = mux_n<word>(branch, branch_addr, incr_addr);
......
.text
main:
addi $a0,$zero,10
add $v0,$zero,$zero
addi $t0, $zero, 5 # Nombre d'itérations de la somme
xor $a0, $a0, $a0 # Mise à zéro de l'accumulateur
f:
beq $zero,$a0,end
add $v0,$v0,$a0
addi $a0,$a0,-1
j f
beq $zero, $t0, end
add $a0, $a0, $t0 # $a0 = $a0 + $t0
addi $t0, $t0, -1 # ($t0)--
j f
end:
addi $v0,$zero,1
li $v0, 1 # Appel système pour afficher le résultat ($a0)
syscall
.data
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment