Commit 899bc3a3 authored by Quentin Aristote's avatar Quentin Aristote
Browse files

corrected add

parent e6b8cde8
(* --------------------------- VARIABLES GLOBALES --------------------------- *)
const ops_nbr_length = 7 (* devrait suffire jusqu'à 128 lignes d'assembleur ;
est aussi la longueur du nombre d'opérations par
seconde *)
const ops_nbr_length = 7 (* devrait suffire jusqu'à 64 opérations par seconde *)
(* ---------------------------------- UAL ---------------------------------- *)
......@@ -159,20 +157,23 @@ addi(s:[16], imm:[16]) = o:[16] where
end where
bltz(s:[16], imm:[16], PC:[16]) = new_PC:[16] where
(tmp_PC, c) = add<16>(PC, imm, 0) ;
new_PC = multi_mux<16>(lz<16>(s), tmp_PC, PC)
(new_PC, c) = add<16>(PC,
multi_mux<16>(lz<16>(s), imm, 0b0000000000000100),
0)
end where
beq(s:[16], t:[16], imm:[16], PC:[16]) = new_PC:[16] where
(tmp_PC, c) = add<16>(PC, imm, 0);
e = sub<16>(s, t);
new_PC = multi_mux<16>(ez<16>(s), tmp_PC, PC);
e = sub<16>(s, t) ;
(new_PC, c) = add<16>(PC,
multi_mux<16>(ez<16>(e), imm, 0b0000000000000100),
0)
end where
bne(s:[16], t:[16], imm:[16], PC:[16]) = new_PC:[16] where
(tmp_PC, c) = add<16>(PC, imm, 0);
e = sub<16>(s, t);
new_PC = multi_mux<16>(ez<16>(s), PC, tmp_PC);
e = sub<16>(s, t) ;
(new_PC, c) = add<16>(PC,
multi_mux<16>(ez<16>(e), 0b0000000000000100, imm),
0)
end where
j(label:[26], PC:[32]) = new_PC:[32] where
......@@ -263,7 +264,19 @@ PC_access(new_PC:[32]) = old_PC:[32] where
end where
ops_to_do() = o:[ops_nbr_length] where
o = 0b1100100 (* 100 *)
o = 0b0110001 (* 50 *)
end where
ops_left(reset) = ops:[ops_nbr_length] where
(ops, c) = add<ops_nbr_length>(
ram<1, ops_nbr_length>(0,
1,
0,
multi_mux<ops_nbr_length>(reset,
ops_to_do(),
ops)),
0b1111111,
0)
end where
ops_done() = ops:[ops_nbr_length] where
......@@ -350,8 +363,8 @@ main() = (t0:[16],
t5:[16],
t6:[16],
t7:[16]) where
ops = ops_done () ;
reset = lz<ops_nbr_length>(sub<ops_nbr_length>(ops_to_do(), ops)) ;
ops = ops_left(reset) ;
reset = lz<ops_nbr_length>(ops) ;
PC = PC_access(multi_mux<32>(reset,
0b00000000000000000000000000000000,
new_PC)) ;
......
This diff is collapsed.
Supports Markdown
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