The purpose of the control state machine is to generate the signals necessary to execute instructions through the data path. The overall block diagram of the control state machine is shown in figure 2.
Figure 2: Triscuit's Control State Machine
This figure shows the inputs to the state machine that come from the data path, and the outputs of the machine that control the data path. The inputs on the top of the block are RESET, used to set the machine into an initial state (note that this is the same signal that clears the values of the IR and PC to 0 in the datapath), and CLOCK which is the system clock.
The inputs on the left of Figure 2 come from the data path. The GO signal is actually a switch that will determine whether the processor should execute instructions or not. The very first state of the control state machine should check this value and state in the initial state until GO is asserted.
The next five inputs are generated from the value in the instruction register. Each of these signals should be asserted if the processor is currently executing that type of instruction. These signals are simply logic that looks at the value in the instruction register and decided which type of instruction is held there according to the four bit opcode. The instruction encoding is particularly simple for Triscuit to minimize this decoding. The encoding is shown in Figure 3.
Figure 3: Opcode Values for Triscuit Instructions
Finally, the last input to the state machine is a value that comes from the data path to tell if the current accumulator value is 0. This is used to decide whether to take a branch or not.
The outputs from the control state machine are connected to circuits in the data path. They are as follows:
The operation of the state machine should cause these control signals to be asserted in the proper order to execute Triscuit's instruction set.