CS/COE 447: Spring 2010 Lab 13 YOUR NAME: YOUR PARTNER'S NAME: =====Question 1 Refer to slide 21 of the lecture notes for Chapter 4, Part 1. Consider the instruction add $s0,$s1,$s2. First, figure out the machine code for the instruction. Find the places on the figure where pieces of the instruction are referred to. Make sure you figure out which bits of the instruction go where in the figure. Pls ask if you have a question. The Control Unit (the oval in the middle of the figure) generates control signals, based on the opcode. The ALU Control Unit (the oval toward the bottom right) also generates control signals (specifically, the ALU control signals), based on the funct field of the instruction and an output from the top Control Unit. HOWEVER, these are not direct mappings, so you won't see a one-to-one correspondence between bits in the opcode & funct fields, and the control signals. Nevertheless, you can figure out what values the control signals should be, by looking at the figure and using your knowledge of the instructions. (At least, for most of them.) Write down the values below for the following control signals. If a control signal turns something on or off, its value is either 1 or 0. E.g., MemRead = 1 if something is read from memory, and 0 if not. For "Output of ALU Control" (the control signal generated by the ALU Control Unit), we haven't yet covered enough for you to know what particlar binary values these are. So, please just indicate one of 'add', 'sub', 'or', 'and'. Also, if a signal's value does not matter for that instruction, please indicate an X. That is, the instruction would execute exactly the same way, whatever value an X signal has. As you do this lab, it will be interesting to recognize the X signals. Please ask if you have any questions. Signal Value ------ ----- RegDst --------------------------------------- Branch --------------------------------------- MemRead --------------------------------------- MemToReg --------------------------------------- (ALUOp - we haven't yet covered enough to answer this) --------------------------------------- MemWrite --------------------------------------- ALUSrc --------------------------------------- RegWrite --------------------------------------- Output of ALU Control --------------------------------------- Output of the And Gate at the top right --------------------------------------- Now, assuming that $s1 contains 0x00000007 and $s2 contains 0x00000004, what values are at the following inputs and outputs of the functional units? If an input or output doesn't matter for the instruction, then put an X next to the value. (Since combinatorial logic determines all of these inputs and outputs, there ARE values at all of them. It's just that some of them may be irrelevant for this instruction. The same is true for the control signals, but we don't have enough information at this point to determine what the values of the X control signals are.) Input Value ----- ----- Read register 1 --------------------------------------- Read register 2 --------------------------------------- Write register --------------------------------------- Write data of register file --------------------------------------- Top input to ALU --------------------------------------- Bottom input to ALU --------------------------------------- Address of memory --------------------------------------- Write data of memory Output Value ------ ----- Read data 1 --------------------------------------- Read data 2 --------------------------------------- Output of ALU --------------------------------------- Zero of ALU (1 if ALU output is 0; 0, otherwise) --------------------------------------- Read Data of memory =====Question 2 Now, do the same thing for the instruction sw $t3,-8($t4) assuming that $t3 contains 0x0000000f and $t4 contains 0x1001002c. Signal Value ------ ----- RegDst --------------------------------------- Branch --------------------------------------- MemRead --------------------------------------- MemToReg --------------------------------------- (ALUOp - we haven't yet covered enough to answer this) --------------------------------------- MemWrite --------------------------------------- ALUSrc --------------------------------------- RegWrite --------------------------------------- Output of ALU Control --------------------------------------- Output of the And Gate at the top right --------------------------------------- Input Value ----- ----- Read register 1 --------------------------------------- Read register 2 --------------------------------------- Write register --------------------------------------- Write data of register file --------------------------------------- Top input to ALU --------------------------------------- Bottom input to ALU --------------------------------------- Address of memory --------------------------------------- Write data of memory Output Value ------ ----- Read data 1 --------------------------------------- Read data 2 --------------------------------------- Output of ALU --------------------------------------- Zero of ALU (1 if ALU output is 0; 0, otherwise) --------------------------------------- Read Data of memory *** A suggested exercise on your own: do this exercise for a BEQ instruction