Commit 3e361d0b authored by Noémie Fong's avatar Noémie Fong
Browse files

fix bug

parent b0d74621
......@@ -33,20 +33,28 @@ end where
(* logical shifts *)
shift_by_const_n<n, m, shift_val>(input:[n], const:[m], is_right, keep_sign) =
shift_by_const_n<n, m, shift_val>(input:[n], cst:[m], is_right, keep_sign) =
(out:[n]) where
aux = mux(const[m-1],
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])),
extand_left_n<n - shift_val, shift_val>
(input[shift_val..])),
input);
if 2 * shift_val > n then
out = shift_by_const_n<n, m-1, n>(aux, const[..m-2], is_right, keep_sign);
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])),
extand_left_n<n - shift_val, shift_val>
(input[shift_val..])),
input);
out = shift_by_const_n<n, m-1, 2*shift_val>
(aux, const[..m-2], is_right, keep_sign);
(aux, cst[..m-2], is_right, keep_sign);
end if
end where
(* shift by shamt, either to the right or to the left. Arithmetic or not.*)
......@@ -55,9 +63,9 @@ shift_by_shamt_ALU(input:[32], shamt:[5], is_right, keep_sign) = (out:[32]) wher
end where
(* shift by value stored in reg, to the right or left, arithmetic or not *)
shift_by_reg_ALU(input:[32], const:[32], is_right, keep_sign) = (out:[32]) where
out = shift_by_const_n<32, 32, 1>(input, const, is_right, keep_sign)
shift_by_reg_ALU(input:[32], cst:[32], is_right, keep_sign) = (out:[32]) where
out = shift_by_const_n<32, 32, 1>(input, cst, is_right, keep_sign)
end where
(* ------------------------------------------------------------------------- *)
(* Opérations booléennes *)
......
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