Commit 7572219c authored by Martin Pépin's avatar Martin Pépin
Browse files

Fix errors

parent 34b6f8e2
......@@ -35,22 +35,22 @@ end where
(* logical shifts *)
shift_by_const_n<n, m, shift_val>(input:[n], cst:[m], is_right, keep_sign) =
(out:[n]) where
if n + 1 <= (2 * shift_val) then (* remarque : seul <= est implémenté... *)
aux = mux(cst[m-1],
mux(is_right,
extand_right_n<n - shift_val, shift_val>
(input[..(n-1) - shift_val], mux(keep_sign, input[0])),
if (n + 1) <= (2 * shift_val) then (* remarque : seul <= est implémenté... *)
aux = mux_n<n>(cst[m-1],
mux_n<n>(is_right,
extand_left_n<n - shift_val, shift_val>
(input[shift_val..])),
(input[..(n-1) - shift_val], mux(keep_sign, input[0], 0)),
extand_right_n<n - shift_val, shift_val>
(input[shift_val..], 0)),
input);
out = shift_by_const_n<n, m-1, n>(aux, cst[..m-2], is_right, keep_sign);
else
aux = mux(cst[m-1],
mux(is_right,
extand_right_n<n - shift_val, shift_val>
(input[..(n-1) - shift_val], mux(keep_sign, input[0])),
aux = mux_n<n>(cst[m-1],
mux_n<n>(is_right,
extand_left_n<n - shift_val, shift_val>
(input[shift_val..])),
(input[..(n-1) - shift_val], mux(keep_sign, input[0], 0)),
extand_right_n<n - shift_val, shift_val>
(input[shift_val..], 0)),
input);
out = shift_by_const_n<n, m-1, 2*shift_val>
(aux, cst[..m-2], is_right, keep_sign);
......@@ -162,11 +162,7 @@ end where
(* Fonction d'addition, qui fait la soustraction si le drapeau vaut 1 *)
(* flag est le drapeau d'overflow, sub le drapeau de soustraction *)
add_ALU(a:[32], b:[32], sub) = (o:[32]) where
(o, flag) = adder_n<32>(a, mux(sub, change_sign_n<32>(b), b), 0);
end where
addi_ALU(a:[32], c:[16], sub) = (o:[32]) where
(o, flag) = add_ALU(a, extand_const_n<16,16>(c), sub);
(o, flag) = adder_n<32>(a, mux_n<32>(sub, change_sign_n<32>(b), b), 0);
end where
(* Une fonction multiplication absolument peu pratique *)
......
......@@ -40,7 +40,7 @@ control(instruction:[6]) = (reg_dst, jump, branch, mem_read, mem_to_reg,
Remarque : la gestion actuelle fait que 000 est attribué aux R-format*)
alu_op =
mux(instruction[0], 1,
mux(instruction[2] & (not instruction[3])), 1, 0) .
mux(instruction[2] & (not instruction[3]), 1, 0)) .
mux((instruction[2] & instruction[3]) & (instruction[4] xor instruction[5]),
1, 0) .
mux((instruction[2] xor instruction[5]) &
......
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