Spring 2020 EE380 Assignment 1

Use this WWW form to submit your assignment. You may submit your assignment as many times as you wish; when the submission deadline is reached, your last recorded submission will be the one counted by the TA for grading. Note that each question is tagged with the course outcome(s) it addresses.


Your account is
Your password is


  1. For this question, check all that apply. Which of the following statements is/are true?
    Allowing a few simultaneous readers from a bus is easy
    SRAM usually takes less power per bit held than DRAM
    A multiplexor can be built using a decoder and tri-state drivers
    The MFC signal indicates that the most recent memory fetch request completed
    Zin only makes sense in a state where the ALU is doing something (e.g., ALUadd)
  2. For this question, check all that apply. Here's something you know from CPE282: Which of the following sets of logic equations implements the cout (carry output) from a one-bit full adder with inputs a, b, and cin, and outputs cout and sum?
    ((a AND b) OR cin)
    ((b AND cin) OR (a AND cin))
    ((a AND b) OR ((a OR b) AND cin))
    (((a OR cin) AND b) OR (a AND cin))
    ((cin AND (a XOR b)) XOR (a AND b))
  3. Given this processor hardware design, add control states to the following to implement an XOR-with-immediate instruction (as decoded by the when below), such that xori $rt,$rs,immed yields rt=(rs^immed). This is actually a MIPS instruction, as we'll discuss later. Hint: it's a lot like the addi given to you, isn't it? You should add initial values and test your design using the simulator before submitting it here.

    You can test your code with:

    MEM[0]={xori}+rs(9)+rt(10)+immed(3)
    MEM[4]=0
    $9=6
    

    Register $10 should end-up holding the value 0x00000005 (5 decimal).

  4. Test-and-set instructions are commonly used for synchronizing multiple processes sharing a processor. Given this processor hardware design, add control states to the following to implement a test-and-set instruction (as decoded by the when below), such that tas $rt,($rs) loads the value from memory, rt=mem[rs], and then stores 1 into that memory location mem[rs]=1. You should add initial values and test your design using the simulator before submitting it here.

    You can test your code with:

    MEM[0]=op(2)+rs(1)+rt(2)
    MEM[4]=0
    MEM[80]=42
    $1=80
    

    Memory MEM[80] should end-up holding the value 0x00000001 (1 decimal) and register $2 should end-up holding 0x0000002a (42 decimal).

  5. Given this processor hardware design and the control sequence below, describe in words (or C-like pseudo code) the function of the instruction xyzzy $rt,$rs.
    when op() op(1) Xyzzy
    
    Start:
     PCout, MARin, MEMread, Yin
     CONST(4), ALUadd, Zin, UNTILmfc
     MDRout, IRin
     Zout, PCin, JUMPonop
     HALT /* Should end here on undecoded op */
    
    Xyzzy:
     SELrs, REGout, Yin
     CONST(-1), ALUxor, Zin
     Zout, Yin
     CONST(1), ALUadd, Zin
     Zout, SELrt, REGin, JUMP(Start)
    

  6. Given the xyzzy $rt,$rs instruction as defined above, and assuming that a memory load request takes 5 clock cycles to complete (after MEMread has been issued), how many clock cycles would it take to execute each xyzzy instruction? You may use the simulator to get or check your answer. In any case, give and briefly explain your answer here:
  7. Given this processor hardware design, suppose that the following control state is the limiting factor in determining the maximum clock speed. Given that the propagation delay associated with CONST(4) is 1ns, Zin is 2ns, REGin is 4ns, SELrd is 8ns, and ALUslt is 16ns, what is the period (in nanoseconds) of the fastest allowable clock? You may use the simulator to get or check your answer. In any case, give and briefly explain your answer here:
    Zin, ALUslt, SELrd, REGin, CONST(4)
    

  8. Given this processor hardware design, add control states to the following to implement a multiply-by-3 instruction (as decoded by the when below), such that mul3 rd makes rd=3*rd;. Note that there is no multiplier per se in the ALU. You should add initial values and test your design using the simulator before submitting it here.

    You can test your code with:

    MEM[0]=op(1)+rd(5)
    MEM[4]=0
    $5=2
    

    Register $5 should end-up holding the value 0x00000006 (6 decimal)

  9. Given this processor hardware design, add control states to the following to implement a swap-registers instruction (as decoded by the when below), such that swap $rt,$rs swaps the value in register rt with the one in register rs. You should add initial values and test your design using the simulator before submitting it here.

    You should be able to make your own test case.... ;-)

  10. What high-level languages call goto is usually called a jump instruction in assembly language. The catch is that you can't have a 6-bit opcode and a 32-bit (immediate) memory address fit in one 32-bit instruction. MIPS handles this a little strangely, so let's make a more normal jump instruction called jump, which takes two words. The first is the instruction with the opcode, the second is just the 32-bit jump target address. Thus, jump 0x12345678 would be encoded as two words: 0x10000000 and 0x12345678. Executing that instruction would make the next instruction be taken from memory address 0x12345678. Add states to the following to implement the jump instruction.

    You can test your code with:

    MEM[0]=op(32) /* Jmp */
    MEM[4]=800   /* to address 800 */
    MEM[800]=0
    

    The simulator should stop after failing to decode the instruction fetched from MEM[800], at which time the PC should hold 804, which is 0x00000324.


Although this is not a secure server, users are bound by the UK code of conduct not to abuse the system. Any abuses will be dealt with as serious offenses.


EE380 Computer Organization and Design.