{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# l03 - Multiply/Divide mult rs rt start signed multiply...

This preview shows pages 1–6. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Multiply/Divide mult rs , rt # start signed multiply multu rs , rt # start unsigned multiply # lo, bottom 32 bits div rs , rt # start signed divide divu rs , rt # start unsigned divide # lo = quotient, hi = remainder mfhi rd # rd = hi mflo rd # rd = lo mthi rs # hi = rs mtlo rs # lo = rs Special registers used to handle 64-bit result. Arithmetic Instructions C Code int a, b, c, d; a = b - (2*c + 7); c = (a < 0) ? 1 : 0; Assembly # a in reg 16, b in reg 17, c in reg 18 addu \$8, \$18, \$18 # temp = 2*c addiu \$8, \$8, 7 # temp = temp + 7 subu \$16, \$17, \$8 # a = b - temp = b - (2*c+7) slt \$18, \$16, \$0 # c = (a < 0) Logical Operations AND: both bits must be 1 (C operator & ) 0 1 0 1 0 0 1 1 0 0 0 1 OR: either bit is 1 (C operator | ) 0 1 0 1 0 0 1 1 0 1 1 1 Logical Operations eXclusive OR: bits must be different (C operator ^ ) 0 1 0 1 0 0 1 1 0 1 1 0 NOR: OR followed by NOT 0 1 0 1 0 0 1 1 1 0 0 0 Logical Operations and rd , rs , rt # rd = rs & rt andi rt , rs , imm # rt = rs & imm nor rd , rs , rt # rd = ~(rs | rt) lui rt , imm # rt = imm << 16 or rd , rs , rt # rd = rs | rt ori rt , rs , imm # rt = rs | imm sll rd , rt , shamt # rd = rt << shamt sllv rd , rt , rs # rd = rt << (rs&0x1f) sra rd , rt , shamt # rd = rt >> s shamt srav rd , rt , rs # rd = rt >>...
View Full Document

{[ snackBarMessage ]}

### Page1 / 23

l03 - Multiply/Divide mult rs rt start signed multiply...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online