Next we're going to look at how to connect these components together and actually get them to change state in a controlled way. And as a warm up, we're going to look at the Program Counter which is as you see, is kind of a minicomputer. What we're doing is designing a digital sequential circuit in such a way that we have precise control over feedback cycles. And so we've already described our interface, we have the input buses, output buses, and control signals, and what we expect components to do. Then the next step is to figure out the connections that we need between components, one component to another, and then we have to establish the sequence in which the control wires like the right wire become one. Those are the steps, and we're going to as a warm up just look at the toy Program Counter on the PC. It's a little digital sequential circuit. It's a couple of things that we need, the first thing is we need it needs to increment, so we need a circuit to increment the PC. That's relatively easy, and then the second thing is we have to consider what happens when we have multiple buses connecting to the same circuit. And that's also relatively easy but it takes a little bit more thought. So let's look at the incrementer. Well, this is actually just an exercise in designing a combinational circuit. We need to design a circuit to compute X plus one. We could actually use a full adder and just feed in one and X, but it's worthwhile to just start with a slightly circuit built for this purpose just as an exercise in designing a circuit. So, what we'll do is we'll just start with the latter idea but we'll just forget about the Y inputs and then set the carry into one. So it's like you have a number X and you're adding it to zero with the carry in of one. So then these are tables, so over on the left we have the carry bits, we have X and then we have to figure out how to compute the next sample and the next carry bit. So carry bit now is just two bits, the carry and X and then the only time that we have to carry a one out is when those are both one. Well that's nothing more than AND function as shown in the tree table at the left. In the sum bit we have are two bits, so if they're both zero the result is zero, if one is zero on the other one the result is one, if they're both one the result is zero with the carry of one. And now if we look at that tree table as just XOR and so we're going to do the same thing as with an adder except with an AND and XOR rather than the majority and the add parity, and so that's our incrementer just like the adder with bus X at the top and AND and XOR with the carries carry to the same way as we did in the adder, and then the value X plus 1 is always available at the bottom. It's a nice exercise in doing a combinational circuit. So that's our incrementer that's going to be a component in the PC. Now the other problem that we have to consider is what about having multiple bus connections and components? So if we have component outputs that need to go to multiple other components, well there's no problem with that, we just use T connections, just wire comes through, we just connect to that wire. It's got the same value, values on both of the buses are the same and we use those like the register has to connect both to the ALU because sometimes the register is one of the operations of an arithmetic operation, and also asked to connect to the memory for a store operation. But the other way, if the inputs come from multiple other components that's a problem. So for example the ALU has to connect to the register because the output of arithmetic operation might go to the register. Memory has to connect to it for a load, Instruction Register has to connect to it for a load address. But how do we do that connection? The values on those buses are going to be generally going to be different, so how do we connect it? So what we need is a selector switch for buses, the bus mux. And it's actually easy but it's worth taking the time to think about this concept because it really is a key thing in the design of a digital circuit. So we're going to use a one-hot m-way bus mux and all it is is m copies of the 100 bus mux that we did the last time. So our interface is we have a bunch of input buses in this case we have three input buses, and for each input bus we have a selection line and we have one outward bus. And again we're going to have the precondition that at most one of the selection lines is one and the output bus is going to have the same value as the selected input bus lines, and so in this example there's three different values going into the three way bus mux at the top right and they all have different values but in this case select two is one. So that's the bottom one and those values are the ones that are going to appear as the output of the bus mux which we use as input to the next circuit. And again we take output back to input by snaking around like that just to make it clearer what's the output and what's the input making it even more clear than the top bottom relationship, the right left relationship. We're going to stick to that and make it very clear where the buses are coming from and going to. So that's the description of the bus mux, we actually have two of these. Now again, as with all muxes we talked about before, it's not that there's a direct connection from the input to the switch output. It would be misleading to say there's an electrical connection, it's just that the signal is the same, whatever the one zero pattern on the input is the same as the one zero pattern on the output. And again this is very easy to implement, it's just for each bit we just do one hot mux, for each bit extremely simple, just ending the selection line with the corresponding bit line. Only one of those selection lines is one, so then only one in them is vertical OR gates collecting results as always. So when we want to be inputs to your gate as one so it does the job as we've done in several other circuits, and so we're going to need this right away to implement the PC to select among two different inputs to the PC. All right, so what's the interface for the PC? So it holds an address, it got an input bus we might have to load the PC from somewhere else in the case of a branch instruction, branch destruction we load it from the address bits of the Instruction Register and then it's got an output bus that's always available, it's going to be connected to the memory to get the instruction out of the memory. So our control wires are though that there's different things we might want to do, so one thing is we might just want to increment it when it's time to change its value. The other thing is we might want to load from the input bus when it's time to change its value, and then we have a right signal which whichever is up increment our load that the value right control line will cause the value to actually change, and then it's a register of the current value is always available on the input bus. So clearly it's going to have four bit register inside, it's going to have an incrementer inside. Now we have to consider the connections among the two components that we need in order to implement this behavior. So clearly we need to go from the input bus to the register, then it has to be a way to load the register from the input bus. We also have to go from the incrementer to the register once X plus one is known that's got to go into the register at some point. Then from the register to the incrementer that's the number to increment, and then from the register to the output bus that's how we make output available. But the thing is that once we determine these connections that tells us that we are going to need a bus mux, because we have to two connections to the PC register input and those might be different at different times, of course they'll be different. The value of the PC plus one is going to be different than the address bits in the Instruction Register. So that tells us we need not just those components, but we also need a bus mux. So the actual picture is this, so we've got the PC register we know what that is, we've got the incrementer at the top, we know what that is and we've got the bus mux in the middle and we know what that is. And then we can check the connections one at a time, the input bus is one of the connections to the bus mux. The incrementer, so the bottom that's the output of the incrementer goes into the top increment of the bus mux, those two match up with the incrementer and load selection signals for the bus mux, so when increment is high, as the incrementer that goes to the output when load is high, it's the input bus that goes to the output. The output of the bus mux gives the input to the PC register, PC register loops around the incrementer and also goes to the output bus. So that's the complete set of bus connections and control lines for the Program Counter and with these connections and the circuits it's going to have the proper behavior. Really it supports two different control signal sequences, so that is if load comes up and then there's the right pulse, what'll happen is it will set the tape with the value available in the input bus and store it into the PC register. That's what happens when we have a branch instruction and that value is available on the output bus. On the other hand if increment comes up and then right, then it results in adding one to the value the. Output of the incrementer goes through the bus mux into the PC and the right pulse happens then the values in the PC register change. In this case we have a long feedback loop back into the PC and that's a very important note. This is the reason we have the short right pulse. We want to get those values to change but we don't want to if we didn't have the short right pulse blocking the thing we just keep incrementing, it only has the chance to change values during that very short pulse that is just enough to get a flip flop to flip. So those are the two states and that's exactly what we want to support in our Program Counter in order to get it to do what we want it to do, we have to give it those control signal sequences. We do something else really right up for a long time we're going to get some unpredictable behavior. So we have to arrange to do that and the art and science of designing sequences of pulses like this is really the heart of processor design, and now we'll look at the same principles in the context of the whole processor.