CSCI 2321 (Computer Design), Spring 2019:
Homework 7

Credit:
30 points.

Reading

Be sure you have read, or at least skimmed, Chapter 4 up through section 4.4.

Problems

Answer the following questions. You may write out your answers by hand or using a word processor or other program, but please submit hard copy, either in class or in one of my mailboxes (outside my office or in the ASO).

  1. (30 points) In this problem your mission is to trace through what happens during execution of different instructions using the single-cycle implementation of the MIPS architecture as represented in Figure 4.17 in the textbook. You are to assume that at the beginning of a clock cycle the following is true for each of the instructions. (As usual, a value of the form 0xN denotes a base-16 value of N, e.g., 0x10 denotes 16 in base 10.) At the point at which values are written into state elements, what values will the following have? For 32-bit values it's okay to just give the value in either base 10 or hexadecimal (e.g. for 10 you can either write 10 or 0xa); for all other values show the binary form with the correct number of bits. Or if a value doesn't make any difference to what is saved into the state elements, just write ``not used'' (e.g., if RegWrite is zero, the values of Write register and Write data are not used). RESOURCES below includes a template file that lists everything you need to fill in, plus the examples from the April 3 lecture. Note that in order to determine output of the ALU you have to know what the various values of ALU control mean. This information is shown in Figure 4.12, and also in Appendix B.

    RESOURCES:

    HINTS:

    (Yes, this is tedious, but I think it's the only way to really understand how this all works.)

    Instructions to trace:

    1. sub $t2, $t0, $t1, if $t0 contains the value 0x6 and $t1 contains the value 0x2. (In machine language this is 0x01095022.)

    2. lw $t0, 4($s0), if $s0 contains the value 0x10000000, and the data memory starting at 0x10000000 contains the values 0x1, 0x2, 0x3, and 0x4 (with each value occupying 4 bytes). (In machine language this is 0x8e080004.)

    3. sw $t0, 4($s0), if $s0 contains the value 0x10000000, $t0 contains the value 0x10, and the data memory starting at 0x10000000 contains the values 0x1, 0x2, 0x3, and 0x4 (with each value occupying 4 bytes). (In machine language this is 0xae080004.)

    4. beq $t0, $t1, LBL, if $t0 contains the value 0x2, $t1 contains the value 0x1, and LBL corresponds to the instruction at location 0x18 in instruction memory (offset of 0x10 from updated PC). Also say what if anything would change if $t1 contained the value 0x2 instead of 0x1. (In machine language this is 0x11090004.)

Honor Code Statement

Include the Honor Code pledge or just the word ``pledged'', plus at least one of the following about collaboration and help (as many as apply).1Text in italics is explanatory or something for you to fill in. For programming assignments, this should go in the body of the e-mail or in a plain-text file honor-code.txt (no word-processor files please).

Essay

Include a brief essay (a sentence or two is fine, though you can write as much as you like) telling me what about the assignment you found interesting, difficult, or otherwise noteworthy. For programming assignments, it should go in the body of the e-mail or in a plain-text file essay.txt (no word-processor files please).



Footnotes

... apply).1
Credit where credit is due: I based the wording of this list on a posting to a SIGCSE mailing list. SIGCSE is the ACM's Special Interest Group on CS Education.



2019-04-20