Due to the large number of control signals that the state machine will generate, we have not included what all of them will be at every state in the state machine. If a control signal state is not specified, it either a) is a don't care (as in the case in_con_0, the control for the input demux when the state machine is in the middle of counting the rounds of encryption); or b) it is tied to a disabling voltage (as would be IRWE0' when we are in the state that latches the output registers).
Finally, as will become immediately obvious when one takes a look at the state diagram, we have shown a Moore Machine implementation for our control. Since the meg tool in Magic implements Mealy Machines, we will need to convert our FSM into a Mealy FSM. We stayed with the Moore representation here because we felt that it was easier to conceptualize. The conversion between the two should result in fewer states in the machine; for example, presently we have thirty-two states that perform the eight rounds of encryption. These 32 states are essentially 4 states repeated eight times. The only difference is the round of encryption that the machine is on (as represented by a three-bit counter). In a Mealy Machine implementation, it might be possible to reduce these 32 states down to 4. This is something that we will consider when we actually write the meg file implementing the control FSM.
For the rounds of encryption, however, things are a little more difficult. The data path is thus: Latch X -> Logic -> TempLatch -> Latch X. The input to Latch X must be at least Va, meaning that the output will be VaSb. This means that all input to the xor logic which does not come from Latch X must be at least Vb; fortunately, the only inputs to the logic that wouldn't come from the latch would come from the FSM, meaning that it would be Vb. The output of the logic would thus also be Vb, meaning that the output of the TempLatch would be VbSa, which is what we want for the input to Latch X. This is good.
In addition to these externally-seen outputs, the FSM will generate a number of control signal; these are detailed on the attached diagram. Essentially, every mux or demux has a control signal, every latch has an active-low write enable signal, and the logic that determines what key to use in the rounds of encryption receives signals telling it whether the chip is in encrypt or decrypt mode and what round of encryption the chip is on. Strictly speeking, it probably would have been possible to have done this with fewer states or with fewer control signals -- if we had really wanted to, we might have been able to get away with no control at all; however, this would make the project somewhat uninteresting. Since this is, after all, an academic exercise, we don't feel too guilty about our unnecessary complexity.
RST': Resets the FSM to the first state. It is active low enable, and (despite the fact that this is not stated on the FSM diagram), having RST' go low at any time will result in the FSM to be put into state IR0.
IRWE0', IRWE1': These are the write enable signals for the input registers. They are active low.
DRWE0', DRWE1': These are the write enable signals for the data registers. They are active low.
KRWE0', KRWE1': These are the write enable signals for the key registers. They are active low.
ORWE0',ORWE1': These are the write enable signals for the output registers. They are active low.
TRWE0': This is the write enable signal for the temporary register. It is active low.
in_con_0: This is the control signal for the demux at the input. When this is low, the input data is routed to Input Register 0. When it is high, input data is routed to Input Register 1.
in_con_1: This is the control signal for the second demux in the data path. If this is low, then the data from the Input Registers is routed to the Key Registers; otherwise, it is routed from the Input Registers to the Data Registers.
out_con: This is the control signal that controls the output mux. If it is low, then the data from Output Register 0 is routed to the output pins. Otherwise, the data from Output Register 1 is routed to the output pins.
cnt_0, cnt_1, cnt_2: These are the signals that tell the encryption rounds how many rounds of encryption have been done so far.
en_or_de: This signal is identical to the E/D' input signal.
October 3, 1995