a) $t0 = 0x50000000 b) yes, there was an overflow Very detailed Explanation: --------------------------- Hexadecimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Use this table to convert from hexadecimal to binary Converting 80000000 to binary 8 => 1000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 So, in binary 80000000 is 10000000000000000000000000000000 Hexadecimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Use this table to convert from hexadecimal to binary Converting D0000000 to binary D => 1101 0 => 0000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 So, in binary D0000000 is 11010000000000000000000000000000 Adding 10000000000000000000000000000000 and 11010000000000000000000000000000 in binary 10000000000000000000000000000000 11010000000000000000000000000000 ------------------------------------- (1)01010000000000000000000000000000 ------------------------------------- Sum produces a carry of 1. We can ignore that carry. So, sum of these numbers in binary is 01010000000000000000000000000000 let's convert 01010000000000000000000000000000 back to hexadecimal Converting 01010000000000000000000000000000 to hexadecimal 0101 => 5 0000 => 0 0000 => 0 0000 => 0 0000 => 0 0000 => 0 0000 => 0 0000 => 0 So, in hexadecimal 01010000000000000000000000000000 is 0x50000000 so, value of $t0 is 0x50000000 Verification --------------- first = 10000000000000000000000000000000 since left most bit is 1, this number is negative number. so, follow these steps below to convert this into a decimal value. I. first flip all the bits. Flip all 0's to 1 and all 1's to 0. 10000000000000000000000000000000 is flipped to 01111111111111111111111111111111 II. Add 1 to above result 01111111111111111111111111111111 + 1 = 10000000000000000000000000000000 III. Now convert this result to decimal value => 10000000000000000000000000000000 => 1x2^31+0x2^30+0x2^29+0x2^28+0x2^27+0x2^26+0x2^25+0x2^24+0x2^23+0x2^22+0x2^21+0x2^20+0x2^19+0x2^18+0x2^17+0x2^16+0x2^15+0x2^14+0x2^13+0x2^12+0x2^11+0x2^10+0x2^9+0x2^8+0x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0 => 1x2147483648+0x1073741824+0x536870912+0x268435456+0x134217728+0x67108864+0x33554432+0x16777216+0x8388608+0x4194304+0x2097152+0x1048576+0x524288+0x262144+0x131072+0x65536+0x32768+0x16384+0x8192+0x4096+0x2048+0x1024+0x512+0x256+0x128+0x64+0x32+0x16+0x8+0x4+0x2+0x1 => 2147483648+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0 => 2147483648 Answer: -2147483648 second = 11010000000000000000000000000000 since left most bit is 1, this number is negative number. so, follow these steps below to convert this into a decimal value. I. first flip all the bits. Flip all 0's to 1 and all 1's to 0. 11010000000000000000000000000000 is flipped to 00101111111111111111111111111111 II. Add 1 to above result 00101111111111111111111111111111 + 1 = 00110000000000000000000000000000 III. Now convert this result to decimal value => 110000000000000000000000000000 => 1x2^29+1x2^28+0x2^27+0x2^26+0x2^25+0x2^24+0x2^23+0x2^22+0x2^21+0x2^20+0x2^19+0x2^18+0x2^17+0x2^16+0x2^15+0x2^14+0x2^13+0x2^12+0x2^11+0x2^10+0x2^9+0x2^8+0x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0 => 1x536870912+1x268435456+0x134217728+0x67108864+0x33554432+0x16777216+0x8388608+0x4194304+0x2097152+0x1048576+0x524288+0x262144+0x131072+0x65536+0x32768+0x16384+0x8192+0x4096+0x2048+0x1024+0x512+0x256+0x128+0x64+0x32+0x16+0x8+0x4+0x2+0x1 => 536870912+268435456+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0 => 805306368 Answer: -805306368 sum = 01010000000000000000000000000000 since left most bit is 0, this number is positive so, we can directly convert this into a decimal value => 1010000000000000000000000000000 => 1x2^30+0x2^29+1x2^28+0x2^27+0x2^26+0x2^25+0x2^24+0x2^23+0x2^22+0x2^21+0x2^20+0x2^19+0x2^18+0x2^17+0x2^16+0x2^15+0x2^14+0x2^13+0x2^12+0x2^11+0x2^10+0x2^9+0x2^8+0x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0 => 1x1073741824+0x536870912+1x268435456+0x134217728+0x67108864+0x33554432+0x16777216+0x8388608+0x4194304+0x2097152+0x1048576+0x524288+0x262144+0x131072+0x65536+0x32768+0x16384+0x8192+0x4096+0x2048+0x1024+0x512+0x256+0x128+0x64+0x32+0x16+0x8+0x4+0x2+0x1 => 1073741824+0+268435456+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0 => 1342177280 Answer: 1342177280 -2147483648+-805306368 must be -2952790016 This is not correct since we can verify that -2147483648+-805306368 not equals 1342177280 So, there was an overflow.
Assume that 32-bit registers $80 and $1 hold values 80000000nex and D0000000mex respectively, (a) What is...
Assume that registers $s0 and $s1 hold the values 8000000016 and D000000016, respectively. a. What is the value of $t0 for the following assembly code? add $t0, $s0, $s1b. Is the result in $t0 the desired result, or has there been overflow?c. For the contents of registers $s0 and $s1 as specified above, what is the values of $t0 for the following assembly code? sub $t0, $s0, $s1d. Is the result in $t0 the desired result, or has there been...
2.11 Assume that registers X0 and X1 hold the values 0×8000000000000000 and 0×D000000000000000, respectively. 2.11.1 [5] <§2.4> What is the value of X9 for the following assembly code? ADD X9, X0, X1 2.11.2 [5] <§2.4> Is the result in X9 the desired result, or has there been overflow? 2.11.3 [5] <§2.4> For the contents of registers X0 and X1 as specified above, what is the value of X9 for the following assembly code? SUB X9, X0, X1 2.11.4 [5] <§2.4>...
Please answer all the questions! Thank you. For the following C statement, what would be the corresponding MIPS assembly code? Assume that the variables a, b, c, and d are given and were declared as 32-bit integers a - b - (c + 7)+ d; 1. 2. Show how the value 0xB47CA034 would be arranged in a little-endian and big-endian machine Assume the data is being stored starting with address 0 3. Convert the following base-16 numbers to base-2 a....
Registers in RISC-V are 64-bit. For the sake of simplicity, consider the following instructions operating on 32-bit registers. Assume that registers x5 and x6 hold the values 0xEEEEEEEE and 0x00000000, respectively. • (2 points) – What is the value in x6 for the following slli x6, x5, 6 • (2 points) – Using the result from the part above, what is the value in x6 for the following instruction. srli x6, x6, 6
For the following C statement, what is the corresponding MIPS assembly code? Assume the arrays hold 16-bit integer values, $ s0 is the base for array X, $ s1 is the base for array Y, and $ t0 and $ t1 are index variables i and j respectively. Comment code X [j] = Y [i + j];
The relative time ratings of exercises are shown in square brackets after each exercise number. On average, an exercise rated [10] will take you twice as long as one rated [5]. Sections of the text that should be read before attempting an exercise will be given in angled brackets; for example, <1.3> means you should have read Section 1.3, Under the Covers, to help you solve this exercise. 2.1 [5] For the following C statement, what is the corresponding MIPS...
You are given a homework processor (HPro) capable of addressing 32 8-bit (1 byte) wide registers. However, it has only 29 physical registers. Register RO, R1 and R31 are not physically implemented. Instead, every read from RO, R1 and R31 will return a constant zero (00000000), constant one (00000001) and all ones (11111111), respectively. Every write to RO, R1 and R31 will go to null (dummy write). Assume that all other registers have initially unknown (X) state (This in fact...
Please answer the following questions involving MIPS assembly code: A) For the C statement below, what is the corresponding MIPS assembly code? Assume f, g are stored in S1 and S2. f = g + (-f -5) B) For the C statement below, what is the corresponding MIPS assembly code? Assume i and j are assigned in registers S1 and S2 respectively and base of address of arrays A and B are in registers S6 and S7. B[8] = A[i...
Translate the following C code to MIPS assembly. Assume that the values of a, b, i, and j are in registers $s0, $s1, $t0, and $t1, respectively. Also assume that $s2 holds the base address of the array D. for (i = 0: i < a: i++) for (j = 0: j < b: j++) D[2 * j] = i + j;
Assume that you have a 32-bit MIPS processor with a direct mapped data cache with the capacity 4096 bytes and a block size of 16 bytes. The cache is initially empty (all valid bits are 0). Which sets of the cache have been updated after that the following program has been executed? For each of the sets, specify the set number, the value of the valid bit, and the tag value of the data cache. 1 lui $t0,0x12ff 2 lw...