
2.4:
- MIPS word is 32 bits
- two's complement
- leading 0's = +
leading 1's = -
- 1000...000 is -2^31
- 1000...001 is -2^31 + 1
- 1111...111 is -1
- 0111...111 is 2^31 - 1
- MSB is sign bit in two's complement
- it's multiplied by -2^31 and the other bits are multiplied by 2^30, etc.
- negate number by flipping each bit and adding 1
- sign extend to place correct representation of number within register
- repeatedly copy sign bit to the front of the number (if signed)
- otherwise, repeatedly copy 0's
- one's complement
- 100...000 is most negative (-2^31+1)
- 011...111 is most positive (2^31-1)
- 000...000 is positive 0
- 111...111 is negative 0
- opposite sign number is simply negating each bit
- not good because we need to subtract each time (inefficient)
3.2:
- overflow causes an exception or interrupt
- EPC contains address of instruction that caused exception
- mfc0 is used to copy EPC into general register ($k0 or $k1)
3.5:
- MIPS floating point: 1 sign bit, 8 exponent bits, 23 fraction bits
- (-1)^S X F X 2^E
- IEEE 754 floating point: 1 sign bit, 11 exponent bits, 52 fraction bits
- biased notation: (-1)^S X (1 + fraction) X 2 ^(exponent - bias)
- HOW DO I CONVERT BINARY TO FLOATING POINT AND VICE VERSA
2.3:
- the MIPS load instruction transfers data from memory to a register
- lw $t0, 32($s3)
- loads the 8th element of the base of the array stored in $s3 into $t0
- $s3 is base register, 8 is offset
- byte-addressed means that the addresses of sequential words differ by 4
- 4 bytes in a 32-bit word
- MIPS is big-endian, which means that it uses the address of the leftmost byte as the
word address versus the rightmost (little endian)
- the MIPS store instruction transfer data from a register to memory
- sw $t0, 48($s3)
- stores the value from $t0 to the 12th element in the array contained in
$s3
2.5:
- $to to $t7 = $8 to $15
$s0 to