Test 1: Homework
Consider the following MIPS code. Translate it in C. Assume that the variables a, b, c, I and j are assigned to Registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in Registers $s6 and $s7, respectively. addi $t0, $s6, 4 add $t1, $s6, $0 sw $t1, 0($t0) lw $t0, 0($t0) add $s0, $t1, $t0
2 * A[0]
Convert 0x4321A to decimal
274,970
What is 3576 in octo?
0776
With base address 0x1000, Show how the value 0x1234AB56 would be arranged in memory of a little-endian
0x1000 : 12 0x1001 : 34 0x1002 : AB 0x1003 : 56
With base address 0x1000, Show how the value 0x1234AB56 would be arranged in memory of a big-endian
0x1003 : 56 0x1002 : AB 0x1001 : 34 0x1000 : 12
What is 3576 in hex?
0xDF8
Suppose that the cost is not an issue. Would the memory be hierarchical?
-No -Speed would not be affected due to the functionalities of volatile/nonvolatile memory -Only factor left would be space, which isn't a hierarchy if there's only one level
Compute and express in hexadecimal the -0.3125 as an IEEE 754 floating number in simple precision.
1.
What is -3576 in hex over 32 bits?
1. Stretch to 32 bits in binary 2. convert to hex Answer: 0xFFFFF208
1) Consider the address 0xDF8 in a 64 KB memory organized in blocks of 512 bytes. If the blocks are numbered starting at 0, what the number of the block that contains Address 0xDF8?
1. blocks = address % block size Answer: 6
What is -3576 in hex?
1. convert to unsigned binary 2. apply 2s complement, convert to signed binary 3. convert binary to hex Answer: 0xF208
What is 3576 in binary?
1101 1111 1000
Do the following changes to a computer system increase throughput, decrease response time, or both? 1. Replacing the processor in a computer with a faster version 2. Adding additional processors to a system that uses multiple processors for separate tasks—for example, searching the web
Decreasing response time almost always improves throughput. Hence, in case 1, both response time and throughput are improved. In case 2, no one task gets work done faster, so only throughput increases.
What is 0xDF8 / 12 in binary?
Shift right by n bits. Answer: 110
What is 0xDF8 % 512?
Take the last n number of bits. Answer: 111111000
Provide the type and the hexadecimal representation of the following instruction: lw $t1, 32($t2)
Type: I-Type Assembly: lw $t1 32($t2) Binary: 100011 01010 01001 0000000000100000
Provide the type and assembly language instruction for the following binary value: 0000 0010 0001 0000 1000 0000 0010 0000
Type: R-Type Assembly: add $s0 $s0 $s0
Provide the type, assembly language instruction, and binary representation of the instruction described by the following MIPS fields: op = 0, rs = 3, rt = 2, rd = 3, shamt, and funct = 34.
Type: R-type Assembly: sub $v1 $v1 $v0 binary: 000000 00011 00010 00011 00000 100010
1) Consider a microprocessor with a 16-bit address bus. Assuming that each address referes one byte, what is the maximal size of the memory?
max size = 2 ^ (number of bits) 65536 = 2 ^ 16
Consider a microprocessor with a 16-bit address bus. What is the size of the address space?
size = 2 ^ (number of bits) 65536 = 2 ^ 16
Consider two binary input x and y. Implement (with NAND gates only) the function f(x,y) that is set to 1 when x and y are different. What is the formula?
~(x and y) Also know how to draw the circuit