Architecture

DIV

Divide

DIV

 

31

26 25

21 20

16 15

 

6 5

0

 

 

 

SPECIAL

 

rs

 

rt

 

0

 

 

DIV

 

 

 

000000

 

 

 

 

 

00 0000

0000

 

011010

 

 

 

6

 

5

 

5

 

10

 

 

6

 

Format :

DIV rs, rt

Description :

Divides the contents of general register rs by the contents of general register rt, treating both operands as two's complement integers. An overflow exception is never raised. If the divisor is zero, the result is undefined.

Ordinarily, instructions are placed after this instruction to check for zero division and overflow.

The quotient word is loaded into special register LO, and the remainder word into special register HI. When an attempt is made to read the division result using MFHI, MFLO, MADD or MADDU before the divide operation is completed, the read operation is delayed by an interlock.

Divide operations are executed in an independent ALU and can be carried out in parallel with the execution of other instructions. For this reason, the ALU can continue executing instructions even during a cache miss or other delay cycle in which ordinary instructions cannot be processed.

If either of the two preceding instructions is MFHI, MFLO, MADD or MADDU, the results of those instructions are undefined. For the DIV operation to be carried out correctly, reads of HI or LO must be separated from writes by two or more instructions.

Operation :

T 2: LO undefined

HI undefined

T 1: LO undefined

HI undefined

T:LO GPR[rs] div GPR[rt] HI GPR[rs] mod GPR[rt]

Exceptions :

None

139

Page 150
Image 150
Toshiba TX39 user manual Div