diff options
author | Jonathan <jonathan@jonathan-VirtualBox.(none)> | 2014-01-12 11:32:48 +0100 |
---|---|---|
committer | Jonathan <jonathan@jonathan-VirtualBox.(none)> | 2014-01-12 11:32:48 +0100 |
commit | 930ca54aa228a340e9139def8c0e67dd5c175331 (patch) | |
tree | 203bad0a492c802d5b55401b7461e66534f446f1 /cpu | |
parent | d042116b7e74c919a3b8a378a9a5a9961219bc54 (diff) | |
download | SystDigit-Projet-930ca54aa228a340e9139def8c0e67dd5c175331.tar.gz SystDigit-Projet-930ca54aa228a340e9139def8c0e67dd5c175331.zip |
there's a strange bug in the division
e Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/alu.ml | 10 | ||||
-rw-r--r-- | cpu/os.asm | 4 |
2 files changed, 7 insertions, 7 deletions
@@ -190,7 +190,7 @@ let rec ndivu n a b start_signal = let next_busy, set_next_busy = loop 1 in let busy = start_signal ^| (reg 1 next_busy) in - let dd, set_dd = loop n in (* dividande *) + let dd, set_dd = loop n in (* dividende *) let q , set_q = loop n in (* quotient *) let r , set_r = loop n in (* reste *) @@ -210,15 +210,15 @@ let rec ndivu n a b start_signal = let r = mux start_signal (reg n r) (zeroes n) in (* A l'itération i (i = 0 ... n - 1) Le bit de poids fort de [dd] - correspond au bit (n-i-1) du dividande original *) + correspond au bit (n-i-1) du dividende original *) let dd = set_dd (mux start_signal (shiftl1 n (reg n dd)) a) in - (* On abaisse le bit (n-i-1) du dividande *) + (* On abaisse le bit (n-i-1) du dividende *) let r = (dd ** (n-1)) ++ (r % (0, n-2)) in (* Si r >= d alors r := r - d et q(n-i-1) := 1 *) let rq = mux (ule_n n b r) - (r ++ ((const "0") ++ (q % (0, n-2)))) + (r ++ ((const "0") ++ (q % (0, n-2)))) ((nsubber n r b) ++ ((const "1") ++ (q % (0, n-2)))) in let r = set_r (rq % (0, n-1)) in @@ -230,7 +230,7 @@ let rec ndivu n a b start_signal = set_next_busy (busy ^& work_remains) ^. (not work_remains) ^& busy in - dd ^. c ^. + dd ^. c ^. q, r, finished @@ -184,13 +184,13 @@ unit_test_1: # Unsigned multiplication unit_test_2: # Unsigned division li B 1 - li C 64 + li C 61 li D 5 divu C C D move D E sei A C 12 and B B A - sei A D 4 + sei A D 1 and B B A #li C 61 |