Professional Documents
Culture Documents
Các Ví D Chương 3 - Phepchia - Correct - 2
Các Ví D Chương 3 - Phepchia - Correct - 2
V d 1:
Thc hin php chia 50(8)/23(8) (s dng
s 6 bit khng du) theo cu trc phn
cng nh hnh
Sll Q, Q0=1
+
V d 1:
50(8)/23(8) = ?
Dividend = 508 = 101 0002
Divisor = 238 = 010 0112
Cu trc phn cng nh hnh v l ang lm vic trn php chia s 32
bits
C: thanh ghi divisor 64 bits
thanh ghi quotient l 32 bits
thanh ghi remainder l 64 bits
V d 1 yu cu php chia dng s 6 bits khng du, s dng cu trc
phn cng tng t nh hnh, vy cc thanh ghi trong v d cn c
khi tao vi s bit tng ng:
=> thanh ghi divisor 12 bits (gi tr khi tao 010011000000 6 bits
cao l gi tr ca divisor, 6 bits thp a 0 vo )
thanh ghi quotient l 6 bits (gi tr khi to 000000)
thanh ghi remainder l 12 bits (gi tr khi to 000000101000 - 6
bits cao a 0 vo, 6 bits thp a dividend vo)
Step
Action
Quotient
Divisor
Remainder
Initial Vals
(Gi tr khi to)
000 000
000000 101000
V d 1:
50(8)/23(8) =
?
Dividend =
508 =
101 0002
Divisor =
238 =
010 0112
Step
0
1
Action
Initial Vals
Rem = Rem Div
Rem < 0, R + D, Q<<
Rshift Div
Rem = Rem Div
Rem < 0, R + D, Q<<
Rshift Div
Rem = Rem Div
Rem < 0, R + D, Q<<
Rshift Div
Rem = Rem Div
Rem < 0, R + D, Q<<
Rshift Div
Rem = Rem Div
Rem < 0, R + D, Q<<
Rshift Div
Rem = Rem Div
Rem < 0, R + D, Q<<, Q0 = 1
Rshift Div
Rem = Rem Div
Rem < 0, R + D, Q<<
Rshift Div
Quotient
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 000
000 001
000 001
000 001
000 010
000 010
Divisor
010 011 000 000
010 011 000 000
010 011 000 000
001 001 100 000
001 001 100 000
001 001 100 000
000 100 110 000
000 100 110 000
000 100 110 000
000 010 011 000
000 010 011 000
000 010 011 000
000 001 001 100
000 001 001 100
000 001 001 100
000 000 100 110
000 000 100 110
000 000 100 110
000 000 010 011
000 000 010 011
000 000 010 011
000 000 001 101
Thng s
Remainder
000 000 101 000
101 101 101 000
000 000 101 000
000 000 101 000
110 111 001 000
000 000 101 000
000 000 101 000
111 011 111 000
000 000 101 000
000 000 101 000
111 110 010 000
000 000 101 000
000 000 101 000
111 110 111 100
000 000 101 000
000 000 101 000
000 000 000 010
000 000 000 010
000 000 000 010
111 111 101 111
000 000 000 010
000 000 000 010
Phn d
V d 2:
50(8)/23(8) = ?
Dividend = 508 =
101 0002
Divisor = 238 =
010 0112
Step
Action
Divisor
Remainder/Quotient
Initial Vals
010 011
Step
Action
Divisor
Remainder/Quotient
Initial Vals
010 011
R<<
010 011
010 011
Rem < 0, R + D
010 011
R<<
010 011
010 011
Rem < 0, R + D
010 011
R<<
010 011
010 011
Rem < 0, R + D
010 011
R<<
010 011
010 011
Rem < 0, R + D
010 011
R<<
010 011
010 011
Rem > 0, R0 = 1
010 011
R<<
010 011
010 011
Rem < 0, R + D
010 011
Phn d
Thng