CS220 Assignments

Brief Table of Contents

  1. January 19
  2. January 21
  3. January 26
  4. January 28
  5. February 2
  6. February 4
  7. February 9
  8. February 11
  9. February 16
  10. February 18
  11. February 23
  12. February 25
  13. March 2
  14. March 4
  15. March 8-12 Spring Break
  16. March 16
  17. March 18
  18. March 23
  19. March 25
  20. March 30 - Exam 2
  21. April 1
  22. April 6
  23. April 8
  24. April 13
  25. April 15
  26. April 20
  27. April 22
  28. April 27
  29. April 29

Full Table of Contents

  1. January 19
    1. Read Chapter 1 in Hennessy and Patterson.
    2. Questions 1.1.1 - 1.1.26 (matching questions on terminology).
    3. Questions 1.2.1 - 1.2.3, 1.3.1, 1.3.2
    4. Short 10 minute quiz on Tuesday Jan 26
  2. January 21
    1. Quiz Tuesday
  3. January 26
    1. Reading Chapter 2.1 through 2.8
    2. Appendix B.1 - B.2
  4. January 28
    1. The following problems are study problems for Tuesday's quiz.
    2. Convert the decimal number -967 to a 32 bit binary number assuming a 2's complement representation for negative numbers. Express your answer in hexadecimal.
    3. What decimal number is represented by the hexadecimal number FFFFC73A.
    4. Page 59 Problems 1.3.1 and 1.3.2
    5. Page 60 Problems 1.4.4 and 1.4.5
    6. Page 180 Problems 2.1.1, 2.1.4. For 2.1.4 the C statement would be identical to the Java statement.
  5. February 2
    1. Reading Chapter 2.1 through 2.8
    2. Appendix B.1 - B.2
    3. Review sum.c
    4. Review how we converted to assembly C.
  6. February 4
    1. Reading Chapter 2.1 through 2.8
    2. Appendix B.1 - B.2
    3. Review sum.s, the MIPS assembly version of sum.c
    4. Quiz Tuesday Feb 9. Review MIPS assembly programming and Linux notes.
    5. Homework Problem
      1. Write a MIPS assembly program that determines whether an integer in register t1 is prime. Do this by putting a 1 in t2 if it is and a 0 in t2 if it is not. Do this by trying to divide the value in t1 by all of the integers up to the value in t1 divided by 2.
      2. Part 1: Write the program in C first. Name your file prime.c
      3. Part 2: Translate prime.c into an assembly C version. Name your file prime_assembly.c
      4. Part 3: Translate prime_assembly.c into a MIPS assembly language program that runs in xspim. Name your file prime.s
      5. Put all three of your files in a directory name prime in your 220 folder on the t drive.
      6. Test your programs on a variety of numbers such these primes; 2, 3, 5, 7, 443, and 104729. Also try on these numbers that are not prime; 4, 6, 667, 803123 (which is 1117*719)
  7. February 9
    1. MIPS program to compute the GCD of two numbers.
    2. pseudo instructions and the lui instruction.
  8. February 11
    1. Accessing main memory in MIPS, the lw and sw instructions.
    2. Adding up the elements of an array
    3. A sample Exam 1. Ignore question 10, 11, and 13. We didn't cover these topics fully yet.
    4. Here's the solution to the sample exam.
    5. Make sure you study the homework problems we have done so far.
    6. Make sure you know you Linux commands we have covered, such as ls, cd, mkdir, gcc, man. You should also know some of their options and arguments.
    7. Write a MIPS program that reads an integer from the keyboard and counts the number of times the integer can be divided by 2 and prints the results to the console.
  9. February 16 - Exam 1
  10. February 18
    1. On Tuesday turn in solutions to problems 7 and 8 on the Exam. You are to submit working SPIM programs. Turn in a printout and make sure two files exist in your student folder named exam1q7.s and exam1q8.s. Make sure your program is commented well.
    2. If you missed class make sure you install the new version of SPIM named PCSpim.
      1. cd /usr/local/cs/PCSPim
      2. Run the command msiexec /i Setup.msi
      3. You should now have an icon on your desktop for PCSpim. Right Click → Open and click on Mark as Trusted. The icon should change to a little picture of a PC.
  11. February 23
    1. We implemented a function read_array that read in an array. We reviewed function/procedure call conventions.
    2. For Thursday you are to have the print_array method complete and ready to go. This is based on the C file that we started to write sort.c
    3. Book: Read section 2.8 and appendix B.6
  12. February 25
    1. Study for quiz on Tuesday; Arrays and function call/return.
    2. On Tuesday we will continue with our MIPS selection Sort implementation.
  13. March 2
    1. We finished developing the selection sort algorithm in MIPS but did not have time to run it. There is a small bug, find it.
    2. On Thursday we will implement a recursive MIPS function.
    3. Reading: Through section 2.14 and Appendix B everything except section B.7.
    4. Reading: Section 5.1 through 5.6 in The C Programming Language (available on the T: drive).
  14. March 4
    1. We developed a recursive function in C that converts a decimal number to binary.
    2. We also developed the MIPS version of it.
  15. March 16
    1. Reading: Appendix C (on CD-ROM and on T: drive) sections C.1, C.2, C.3, and C.5 (skip C.4)
    2. Install MMLogic
    3. Introduction to Digital Logic Design
  16. March 18
    1. Reading: Appendix C (on CD-ROM and on T: drive) sections C.1, C.2, C.3, and C.5 (skip C.4)
    2. In class today we devloped a Full Adder and a ripple carry adder.
    3. MIPS Homework - Due Thursday March 25
      1. Write a MIPS assembly program that reads an array of ten integers from the console.
      2. After array is read write a function count that takes the address of the array, the length of the array, and an an integer x, and returns the number of times x occurs in the array.
      3. Make sure the main program prints the result not the count function.
      4. Turn in a printout that is commented and well formatted. Your file should be in your personal 220 directory in a file named hw3.s.
  17. March 23
    1. Reading: Appendix C (on CD-ROM and on T: drive) sections C.1, C.2, C.3, and C.5 (skip C.4)
    2. Multiplication Algorithm textbook section 3.3
  18. March 16
  19. March 18
  20. March 25
    1. Division Algorithm textbook section 3.4
    2. Sample Exam 2
  21. March 30 - Exam 2
  22. April 1
    1. Floating-Point Representation and programming MIPS using floating-point instructions.
    2. Reading: pages 242-250, 259-265
    3. Problems to look at (not to turn in) 3.10.1 through 3.10.4.
      1. For 3.10.1 - check your work using the Calculator in Linux.
      2. For 3.10.2 - check your work in SPIM by loading the file below in SPIM and seeing how SPIM disassembles the instructions.
             .text
          main: 
             .word 0x24A60004  # 3.10.2 part a
             .word 0xAFBF0000  # 3.10.2 part b
                    
      3. For 3.10.3 - check your work using SPIM by loading the following program into SPIM and check values that are in the single-precision register $f0 and $f1 at the end of the program execution.
             .text
          main:
             li $t0, 0x24A60004  # part a
             li $t1, 0xAFBF0000  # part b
             mtc1 $t0, $f0
             mtc1 $t1, $f1
             jr $ra
                   
      4. Check your work using the C program I showed you in class today.
  23. April 6
    1. Single Cycle Datapath
    2. Reading: Sections 4.1 - 4.6
  24. April 8
    1. Continued - Single Cycle Datapath
    2. Reading: Sections 4.1 - 4.4
    3. Do problems 4.1.1, 4.1.2, 4.1.3, 4.1.6
    4. Quiz on Tuesday on Floating-POint representation and the single cycle datapath.
  25. April 13
    1. Quiz
    2. Reading: Sections 4.5
    3. Pipelining
  26. April 15
    1. Reading: Sections 4.5
    2. Pipelining
    3. Exam 2 corrections due Tuesday April 27. Corrections should be type written and all MIPS program should run with copies of the files on the T: drive as well as printout. Code should be commented as well.
  27. April 20
    1. Reading: Sections 5.1-5.3
    2. Caches
    3. Direct Mapped Caches, spatial and temporal locality
  28. April 22
    1. Reading: Sections 5.1-5.3
    2. Caches
    3. Fully Associative cache
    4. Set Associative caches
    5. Cache Performance
    6. Pay attention to the worked problems in the book especially on pages 463, 477, 479, 486, 487
  29. April 27
    1. Reading: Sections 5.4
    2. Virtual Memory
  30. April 29
    1. Sample final exam