CS411 Details of homework assignments HW1..HW6 and Midterm

    The most important item on all homework is YOUR NAME!
    No name, no credit. ALSO, put last 4 digits of SS#.
    Staple or clip pages together.

Homework must be submitted when due. You loose 10%, one grade, the first day homework is late. Then 10% each week thereafter. Max 50% off. A zero really hurts your average! Paper or EMail to squire@cs.umbc.edu is acceptable. If I can not read or understand your homework, you do not get credit. Type or print if your handwriting is bad. Homework is always due on a scheduled class day within 15 minutes after the start of the class. If class is canceled then homework is due the next time the class meets.

  EMail only plain text! No word processor formats.
       You may use a word processor or other software tools and
       print the results and turn in paper.
       Put CS411 and HW number in subject line.

Email HW 1,2,3, 5, 7,8,9,10,11 BUT submit HW4,6 part1-3

 The "submit" facility only works on the "irix.gl" machines.
 The student commands are:
    submit   cs411 HW4 file   puts your "file" into cs411 HW4
    submitrm cs411 HW4 file   removes your "file" from cs411 HW4
    submitls cs411 HW4        lists your files in cs411 HW4

 Note: For this semester the 'HW4' can be HW4, HW6, part1, part2 or part3.
       a) you must have your userid registered for "submit"
          send mail from a gl machine to squire if your submit fails
       b) you have to be logged onto a gl machine, kermit or telnet are OK
       c) everything is case sensitive, sorry about the uppercase HW.

Do your own homework!

You can discuss homework with other class members but DO NOT COPY!

Contents

  • Homework 1
  • Homework 2
  • Homework 3
  • Homework 4
  • Homework 5
  • Homework 6
  • Midterm Exam
  • Other Links
  • HW1 Terminology 25 points

      Book Page 45, Exercises 1.1 through 1.26.
         The answer is just two columns. The first column is the numbers
         1 through 26, the second column is the answer letter from the set {a-z}
    

    HW2 Evaluating Benchmarks 25 points

      You do not have to copy the questions, but show the
           computation and clearly indicate the answers..
           Be sure to label the answers with the Exercise number.
           Book Page 93,  Exercises 2.18, 2.19, 2.20
           Book Page 101, Exercises 2.41, 2.42
    

    HW3 Analyzing assembly and machine code 25 pts

      Using the program  matmul2.c  from here or  Downloadable source:
    
      On a GL SGI machine, MIPS architecture only:
    
      Part 1. Compare the assembly language printed by two compilers.
      Part 2. Compare the assembly language printed by the compiler vs
              the instructions in memory at execution time.
    
      Note: The answers are not unique. It depends on which
      compiler is used, which specific machine is used and
      which options are used.
    
    
      This assignment must be run on a GL SGI machine using:
        c89 -g3 -O3    SGI compiler
        gcc -g3 -O3    gnu compiler (much different on MIPS architecture) 
                 ^_____ letter upper case oh,  NOT  zero !
    
      --------------------------------------------------------------------
    
      Part 1
            for getting assembly language source code to a file matmul1.s
    
            gcc -g3 -O3 -S matmul2.c
    
            mv matmul2.s  matmul2gcc.s     (save, next clobbers.)         
    
            c89 -g3 -O3 -S matmul2.c       may create matmul2.s
    
            mv matmul2.s  matmul2sgi.s
    
      Now, look in the files  matmul2gcc.s  and  matmul2sgi.s
      Ignore all lines where the first character is a dot "."
    
    a)  How may  mul.d  instructions in matmul2gcc.s ?
    b)  About how many  mul.d  instructions in matmul2sgi.s ?
    c)  Why is there a big difference (e.g. what compiler optimization) ?
    
      ------------------------------------------------------------------
      
      Part 2
    
      When running with redirection, ">", first test without redirection
      to be sure you can type the correct input and it works.  Then
      type carefully or use a script to make the redirected run.
      Extra "enter" keys may be needed at various places.
      Ignore warning messages from debugger.
    
      Remember memory addresses are in bytes, instructions take 4 bytes.
      (Even in the 64 bit machine!)
      In  assy.out  use  main:nn number to relate to hex.out to find the same word.
      In the following sequences of commands, blank lines are typed as "enter"
    
    
      gcc -O3 -S matmul2.c    # strip comments from matmul2.s
      gcc -g3 -O3 matmul2.c   # need debug for "stop main" to work
      dbx -d a.out > hex.out
      stop main
      rerun
      list 1,26
    
      (#1)/100X
    
    
    
    
    
    
    
    
      q
    
    
      dbx -d a.out > assy.out
      stop main
      rerun
      list 1,26
    
      (#1)/100i
    
    
    
    
    
    
    
    
      q
    
    
      Capture to a file with redirection or commands like:
         record output file-name.out
         unrecord
    
      The instruction field format is on page 117 of textbook, also 121, 131 or
      appendix A-73 area.
      mul.d is the MIPS=SGI double precision floating point multiply, "R" format.
      Watch out for where the register values are placed.
      (R2000 instructions differ from UMBC8 or UMBC9 that are R?000.)
    
      Most of the instruction in the loop are "housekeeping", there are various
      instructions for loading and storing data, l.d and s.d are just one pair.
    
    a) Do the instructions have the same names in  matmul2.s  and  assy.out ?
    b) What does  #nop  in  matmul2.s  get converted to in  assy.out ?
       Is it the same every time ?
    c) Find the  mul.d  instruction in assy.out
       Write the assembly language line.
       Look up that instruction in  hex.out
    d) Write the mul.d  as  hexadecimal (from hex.out) and
    e) Write the mul.d  as  six integers for the fields 6,5,5,5,5,6 bits
     
    

    HW4 Use ecomp and esim on a 32 bit fast carry adder 25 pts

    
      "submit" a single file named add32c.e that is a fast carry 32 bit adder.
      (This is not the same adder as previous classes)
    
      You will use this file in HW6 and the three parts of the project.
      It is not important what the signal names are in add32c.e,
      but keep the same size and order.
    
      Build a four bit fast adder component or download  add4c.e 
    
      You need a 32 bit adder, so use eight add4c components in
      an add32 component [NO 'c' on component name] , cin goes into bottom
      stage, the carry out of each stage goes into the bottom of the next stage,
      the carry out from the last stage gets the signal name  cout.
      Use unique signal names or unique subscripts. All connections with
      the same name are tied together and have the same value.
    
    
      Build a main circuit for testing your  add32  component or download  tadd32c.e 
    
      Get the .run file to test your circuit  tadd32c.run 
    
      Use these commands to set up esim and ecomp, then compile and simulate:
      On irix.gl.umbc.edu
    
          ln -s /afs/umbc.edu/users/s/q/squire/pub/ecomp ecomp
          ln -s /afs/umbc.edu/users/s/q/squire/pub/esim  esim
                  (remember to  rm esim  rm ecomp  if typed wrong first time.)
    
      or on linux.gl.umbc.edu  or UMBC PC booting Linux
          ln -s /afs/umbc.edu/users/s/q/squire/pub/linux/redhat52/ecomp ecomp
          ln -s /afs/umbc.edu/users/s/q/squire/pub/linux/redhat52/esim  esim
    
          ecomp  add32c.e tadd32c.e -o tadd32c.net
          esim < tadd32c.run > tadd32c.out
    
          Check to file tadd32c.out to be sure your adder worked.
          The answers are in  tadd32c.chk 
    
          You can check your output with the command  diff tadd32c.out tadd32c.chk.
    
      Submit  ONE file  add32c.e  that has the component  add32  in it.
          submit cs411 HW4 add32c.e
    
      Your circuits must run. Incorrect results loose points.
      Late submittals loose even more points.
      You must include a few comments so anyone reading your circuits can
      understand them.
    
      Follow the links below to Project and Download for more information.
      See the writeups on ecomp, esim, tutorial and sample circuits.
      The building blocks become part of your final project.
    
    

    HW5 Five questions 25 pts

     
      1. Write two esim statements that implement the truth table below
         Just use  and "&"  or "|"  and  not "~"  with parenthesis.
         the answer starts   x <=
                             y <=
    
            a b c | x y
            ------+----
            0 0 0 | 0 0
            0 0 1 | 0 0
            0 1 0 | 1 1
            0 1 1 | 1 0
            1 0 0 | 0 0
            1 0 1 | 1 0
            1 1 0 | 0 0
            1 1 1 | 0 1
    
      2. Write the esim statement that implements the logic diagram
    
              +----+
          a --|OR  |____
          b --|    |   |
              +----+   | +----+
                       --|XOR |
              +----+     |    |
          c --|AND |_____|    |__
          d --|    |     |    |  |
              +----+     |    |  |
                       --|    |  |
              +----+   | |    |  |
          e --|NOT |---| +----+  |  +----+
              +----+             |--|AND |
                                    |    |-- g
          f ------------------------|    |
                                    +----+
    
      3. Draw the logic diagram that represents the esim statement
    
           g <= ((~a|b)^(~c&d&~e))|(~e&f);
    
      4. textbook, Page 330, Problem 4.49 with the additional instructions:
         Use A, B, E and F  all as four ones. e.g. A <= #b1111     etc.
         The answer is a six bit result S.
    
      5. textbook, page 331, Problem 4.50
         Watch out, the problem states 2T, not 1T
         Be sure to count the longest path.
    

    HW6 Serial Multiply Divide Simulation 25 points

     
      Code a circuit using one 32 bit adder that performs a serial multiply
      followed by a serial divide. Use 32 bit numbers with the sign bit set
      to zero. You do not have to correct the remainder after division.
    
      You may use one or more counters, as many multiplexers
      and assorted gates, signals, clocks as you need. But, only one
      32 bit adder.
    
      You may use the sample esim code from the download directory, printed
      copy handed out and discussed in class, for the multiplier
      mul_ser.e  and for the divider  div_ser.e
    
      Set up your circuit to perform the multiplication of 31 times 85 with
      the resulting 64 bit product in the "hi" "lo" registers. This should
      take 32 clocks. Then you circuit divides the "hi" "lo" registers
      by 15 with the quotient in the "lo" register and the remainder in
      the "hi" register. This should take an additional 32 clocks.
    
      DO NOT implement the Booth multiply, do use the non-restoring
      divide algorithm.
    
      Have everything needed for the simulation in one file named
       mul_div_ser.e    (This includes your complete 32 bit adder,
      counter(s) and test driver circuit.
    
      Code up a file  mul_div_ser.run that is similar to div_ser.run
      that was handed out and can be copied to your directory.
      Produce labeled print out, using "puts" statements for at least
      the "hi" "lo" and clock counter, "cntr"
    
      Check that at the end of the multiply, "hi" and "lo" have
      the value 31 times 85. (The counter may read 31 or zero or
      32 if you used a 6 bit counter.)
    
      Check that at the end of divide, "hi" has the remainder of
      (31 * 85) / 15  and "lo" has the quotient of (31 * 85) / 15.
      The counter value is not important, but stop the simulation
      using the control available in the .run file when the result
      is correct in "hi" and "lo."
    
      When the check is OK,  submit cs411 HW6 mul_div_ser.e
                             submit cs411 HW6 mul_div_ser.run
    
    

    Midterm exam. 15% of course grade

      Closed book. Multiple choice questions based on reading assignments
      and esim lectures and homework.
      Exam covers book: 1.1-1.6   common sense questions, not dates or people
                        2.1-2.6
                        page 118, 146 and 148 instruction formats
                        4.1-4.8
      Exam covers homework: HW1-HW5
      Exam covers esim tutorial.
    

    Other Links

    Go to top

     Last updated 10/10/00