 In this example we're going to be implementing a set on equals instruction. This is an instruction you may not be familiar with. In this case, it takes two registers as inputs, compares them to see if their results are equal, and if they are, then it sets the writeback data to be one for some provided register. If they're not equal, then the results are zero. So this is kind of similar to a branch instruction that we're going to be comparing two registers and making a decision based on that, but it's also like an ALU instruction because we're going to be writing something back to the registers. So for the basic hardware that this instruction uses, we will need the program counter, instruction memory, the registers, the ALU. We'll also need to be able to update the program counter, and as always, we'll also need the control unit. We'll be able to determine if the two registers have the same data by doing a subtraction operation and checking the results of the zero line, just the same way we would for a branch instruction. But this time we need to be able to set our writeback data based on that zero line instead of the branch hardware. So one thing to notice is that in this case, we don't actually need a multiplexer. We could build a multiplexer and index it based on the results of the zero line, could take zero out, pass it, and use it as the control for some multiplexer that might otherwise just take the memtoredge multiplexer result. But really, the results of that zero line already tell me what I want to write back to my registers if I'm doing a set equals instruction. So this time I'm going to add a new multiplexer and on the one hand it will take the memtoredge result in as one of the inputs. Other input will come from the zero line. This is pretty much all I'll need for hardware. I'll need to add one control signal to control this multiplexer and that can be my set equals line. Now if I'm doing a set equals instruction, then I can pass the results of the zero line right back to my registers to be stored. The rest of the operation is rather like doing a subtract instruction. I take my program counter, I pass it to the instruction memory, separate that out so that I get my opcode which will say I'm doing an ALU instruction. I'd say that I'm interested in doing a subtract instruction to the ALU. Then I'd get my first source register, my second source register, and my destination register. That would tell me which two pieces of data I'm comparing and then I'll get the result out and since I'm doing a set equals instruction, the set equals line would also be set so that the results of the subtraction operation from the zero line are passed to this multiplexer and then sent back as the right data. So implementing a set equals operation is actually not too difficult either. Most of our hardware worked exactly the way we're used to. We added one multiplexer and a line to its second input as well as a control for that multiplexer, but that was all we really needed in this case.