Solutions and Examples PowerPoint PPT Presentation

presentation player overlay
1 / 9
About This Presentation
Transcript and Presenter's Notes

Title: Solutions and Examples


1
Solutions and Examples
2
2.36
or t0, zero, zero i 0 li t1, 101 t1
101 for beq t0, t1, exit if (i101)
exit add t2, t0, a1 lw s1, 0(t2)
s1bi add s1, s1, s0 s1bic add
t2, t0, a0 sw s1, 0(t2) ais1 addi
t0, t0, 1 ii1 j for exit
3
2.36
  • Number of instructions executed
  • 2 1018 810
  • Memory data reference
  • 101 reads 101 writes

4
3.27 Add Sub (16 bits)
  • x 0000000001011011 91
  • y 0000000000001101 13
  • a) addition
  • xy 0000000001101000 104
  • b) subtraction
  • -y 1111111111110011 2s complement
  • x-y 0000000001001110 78

5
3.27 Multiplication (16 bits)
  • product multiplier
  • Init 0000000000000000 0000000000001101
  • x1 0000000001011011
  • 0000000001011011
  • Shift right 0000000000101101 1000000000000110
  • x0 0000000000000000
  • 0000000000101101
  • Shift right 0000000000010110 1100000000000011
  • x1 0000000001011011
  • 0000000001110001
  • Shift right 0000000000111000 1110000000000001
  • x1 0000000001011011
  • 0000000010010011
  • Shift right 0000000001001001 1111000000000000
  • ...
  • Final 0000000000000000 0000010010011111

6
3.27 Division (16 bits)
  • remainder dividend quotient
  • Init 0000000000000000 0000000001011011
  • divisor 1111111111110011
  • 1111111111110011
  • Restore 0000000000000000 0000000001011011 0
  • Shift left 0000000000000000 0000000010110110
  • divisor 1111111111110011
  • 1111111111110011
  • Restore 0000000000000000 0000000010110110 0
  • Shift left 0000000000000000 0000000101101100
  • ...
  • Shift left 0000000000001011 0110000000000000
  • divisor 1111111111110011
  • 1111111111110011
  • Restore 0000000000001011 0110000000000000 0

7
3.27 Division (contd)
  • remainder dividend quotient
  • Shift left 0000000000010110 1100000000000000
  • divisor 1111111111110011
  • 0000000000001001
  • Ok 0000000000001001 1100000000000000 1
  • Shift left 0000000000010011 1000000000000001
  • divisor 1111111111110011
  • 0000000000000110
  • Ok 0000000000000110 1000000000000001 1
  • Shift left 0000000000001101 0000000000000011
  • divisor 1111111111110011
  • 0000000000000000
  • Ok 0000000000000000 00000000000000111

8
3.42 Floating-point Addition
  • X 0101 1111 1011 1110 0100 0000 0000 0000
  • Exponent Fraction
  • 1011 1111 1011 1110 0100 0000 0000 0000
  • Y 1011 1110 1110 0000 0000 0000 0000 0000
  • Exponent Fraction
  • 0111 1101 1110 0000 0000 0000 0000 0000
  • Srl 0111 1110 0111 0000 0000 0000 0000 0000
  • Srl 0111 1111 0011 1000 0000 0000 0000 0000
  • ...
  • Srl 1011 1111 0000 0000 0000 0000 0000 0000
  • XY 1011 1111 1011 1110 0100 0000 0000 0000
  • IEEE 0101 1111 1011 1110 0100 0000 0000 0000

9
3.42 FP Multiplication
  • X 0101 1111 1011 1110 0100 0000 0000 0000
  • Exponent Fraction
  • 1011 1111 1011 1110 0100 0000 0000 0000
  • Y 1011 1110 1110 0000 0000 0000 0000 0000
  • Exponent Fraction
  • 0111 1101 1110 0000 0000 0000 0000 0000
  • XY
  • Exponent 1011 1111 0111 1101 0111 1111 1011
    1101
  • Fraction 1 0110 1100 1111 0000 0000 0000
  • Normalize 0 1011 0110 0111 1000 0000 0000,
    exp1011 1110
  • IEEE 1101 1111 0011 0110 0111 1000 0000 0000
Write a Comment
User Comments (0)
About PowerShow.com