Project 2 Un-Pinpointable Errors The auto-grader is pretty good at detecting an illegal transition and telling you where it is. However, under certain circumstances, it can detect that there was an illegal transition somewhere, but it can't pinpoint where. In such cases, fixing an inefficiency may reveal an un-pinpointable error. Here are some of the common errors that fall in this category: 1. First and foremost, RE-READ the Project 2 handout! If you follow the guidelines in the handout, you will have no illegal transitions. 2. if-goto problems If-statements represent the control unit making decisions based on some value. Remember that the control unit can only read the current opcode bits of instrReg, the memory ready signal, and the aluResult register (i.e. test if aluResult is 0) to make decisions on what next state to go to. Since instrReg and aluResult are registers, they must be written in the cycle BEFORE the control unit tests their value. Hence the following is ILLEGAL: test1: printState(state, "test1"); state.aluResult = state.aluOperand + bus; if (state.aluResult == 0) { /* this is illegal because aluResult doesn't actually get the new value until the next cycle */ goto ... } On the other hand, the memory read signal is not a register. Hence it can be read in the same cycle that it is written in. Hence the following is LEGAL. test3: printState(state, "test3"); if (memoryAccess(...)) { goto ... } 3. Body of if-goto The body of your if-else-statements should ONLY have a goto. No other work should be done inside an if-statement. E.g. the following is ILLEGAL: test: printState(state, "test"); if ((state.instrReg>>22) == ADD) { bus = programCounter; memoryAddress = bus; } 4. Condition of if statement The control unit can read instrReg, memory's ready signal, and the aluResult register. Be careful that your if statements only test these values. 5. memoryAccess problems Make sure your memoryAccess function is EXACTLY the same as in the handout. memoryAccess should NOT be called in the same cycle that loads memoryAddress or memoryData. E.g. the following is ILLEGAL: test4: printState(state, test4"); bus = state.aluResult; state.memoryData = bus; ready = memoryAccess(...); 6. beginning the FSM Remember to call printState at the beginning of each state.