Commit 627713d5 authored by Noémie Fong's avatar Noémie Fong
Browse files

Merge branch 'master' of git.eleves.ens.fr:mpepin/sysdig

parents c4b9b2c1 e43a6bc8
......@@ -10,6 +10,11 @@ require alu/main
(* The global CPU architecture *)
(* --------------------------- *)
(*
main () = (instruction:[word], pc_value:[word], is_jr,
imm_addr:[word], is_jal, pc_incr:[word])
where
*)
main () = () where
(* Reading the next instruction from the ROM *)
(instruction, pc_incr) = next_instruction(
......@@ -58,8 +63,8 @@ main () = () where
read_data_mem = data_mem<32,word>(alu_result, read_data2, mem_read,
mem_write);
(* If is_jal is set, PC+4 is taken as input for registers *)
(* If is_jal is set, (PC+4)/4 is taken as input for registers *)
write_data = mux_n<word>(is_jal,
pc_incr,
0.0.(pc_incr[..word-3]),
mux_n<word>(mem_to_reg, read_data_mem, alu_result));
end where
......@@ -8,7 +8,6 @@ main:
jal print_1
# Affiche 2
la $ra, here
j print_2
here:
......@@ -22,7 +21,9 @@ here:
print_1:
li $a0, 1
add $t1, $zero, $ra
jal print_int
add $ra, $zero, $t1
jr $ra
# Ne devrait pas arriver !
......@@ -31,7 +32,9 @@ print_1:
print_2:
li $a0, 2
add $t1, $zero, $ra
jal print_int
add $ra, $zero, $t1
jr $ra
# Ne devrait pas arriver !
......@@ -40,7 +43,9 @@ print_2:
print_3_and_exit:
li $a0, 3
add $t1, $zero, $ra
jal print_int
add $ra, $zero, $t1
j exit
# Ne devrait pas arriver !
......
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