CS2010.03/4 Dr. Zhizhang Shen Solutions of Some Problems in Chapter 5 Fall 2004 1. What would be the advantage and disadvantages of using a very large memory cell size, e.g., 64 bits instead of the standard 8 bits? A solution: The advantage of using a very large memory cell size is that the computer can store larger values in its memory cells. The disadvantage is that there would be fewer cells available. The largest positive integer that could be stored in a system using sign/magnitude notation, with 64-bit cells is 263. If two such cells were used to store integers, the largest integer that could be stored by the system is 2127. 2. At a minimum, how many bits would be needed in the MAR with each of the following memory sizes: (a) 1 million bytes (b) 10 million (c) 100 million (d) 1 billion A solution: The important thing as we discussed in the class is that with 2 bits, you can store at most 4 things, with 3 bits, you can store more than 5, but no more than 8 things, ..., with n bits, you can store more than 2n − 1, but no more than 2n things. Hence, to find out the number of bits you need, you have to find out how many things you have to store. (a) With a million bytes, assume each cell keeps one byte, that is 1 millions things, which is more than 1019 but less than 1020, hence, you need 20 bits. (b) Similarly, 24 bits. (c) 27 bits (d) 30 bits 3. A memory unit of 640 KB would actually contain how many memory cells? What about a memory of 512 MB? A solution: A memory unit with 640 KB has 640 * 210 memory cells, assuming the computer uses 8-bit cells, namely, each cell contains a byte (8 bits). A memory unit with 512 MB would contain 512 * 220 memory cells. 5. Assuming the square 2-d memory organization shown in Figure 5.6 in the book. What are the dimensions of a memory containing 1 MB bytes of storage? How large would the MAR be? How many bits would be sent to the row and the column decoders? How many output lines would there decoders have? A solution: The dimensions of a memory containing 1 MB of storage would be 210 × 210, namely, 1024 × 1024. The MAR would have to be 20 bits large, and 10 of those bits would be sent to the row decoder and the other 10 to the column decoder, and the decoders would have 2048 output lines combined. 1 6. Assume a 24-bit MAR that is organized as follows: 12 bits for the row decoders, and 12 bits for the column decoder. What is the maximum size of the memory on this machine? Wh at are the dimension of the memory, assuming further a 2-d architecture? A solution: The maximum size of the memory unit on this machine is 224 . The dimensions of the two-dimensional memory are 212 × 212, namely, 4096 × 4096. 7. Assume that the MAR contains 20 bits, so that we can get access to a memory of 1 MB, but our computer has 4 MB of memory. Explain how to address all the 4 MB cells using such an MAR. A solution: One could store 4 MB of memory using a 20 bit MAR if the memory was 2-dimensional. together with two more bits to indicate which block of 1 MB memory is being accessed. 9. Assume that we have an ALU that can carry out 20 distinct operations. Describe what kind of multiplexor circuit would be needed to select exactly one of those 20 operations. A solution: At the end of Chapter 4, we discussed a n × 2n multiplexor can be used to select one of 2n operations with n selection lines. Hence, we can use a 5 × 32 multiplexor. 16. Assume that the variables v, w, x, y and z are stored in memory locations 200, 201, 202, 203 and 204, respectively. Using any of the machine languages instructions in §2.4, translate the following algorithmic operations into their machine language equivalents: (a) (b) (c) (d) Set v to value of x − y + z. Set v to the value (w + x) − (y + z). If (v ≥ w) then Set x to y Else Set x to z. While (y < z) do Set y to (y + w + z) Set z to z + v A solution: (a) subtract 202, 203, 200 add 200, 204, 200 (b) add 201, 202, 200 subtract 200, 203, 200 subtract 200, 204, 200 (c) 1 compare 200, 201 2 jumpge 4 3 move 202, 204 4 move 202, 203 (d) 1 compare 203, 204 2 jumplt 4 3 jump 8 4 add 203, 201, 203 5 add 203, 204, 203 6 add 204, 200, 204 7 jump 1 8 next instruction goes here... 2 17. Explain why it wold be awkward to translate the following into machine language code. Set x to $y+19 A solution: The operation is cumbersome because one is adding a constant in this arithmetic operation. The operations provided in this chapter deal with memory addresses, not actual constants. One possible way to solve this problem is to locate a memory address that contains the constant, 19. 3