So we will need to create another state and label it S2. This is certainly another state that is different from either S0 or S1. In this case, the output F is 0 and a carry will be generated. Starting from initial state, we have one case left that we have not yet considered both A and B are asserted. The new state diagram is shown below in Fig. Thus, we label F = 1 F=1 F = 1 and C o u t = 0 Cout=0 C o u t = 0 beside state S1. When the circuit arrives at state S1, output F should be driven high and Cout remains low. We can draw an arrow from S0 to S1 and label it A and B, respectively.
The condition that the circuit will go from S0 to S1 is that one of A and B is 1. So we will create another state by drawing another circle and labeling it S1. Circuits will certainly be in a different state than the initial state S0. The result of the current bit should be 1 with no carry out generated. Let’s consider the case when one of the inputs A and B is asserted. So we just need to draw an arrow from S0 to S0 (self loop) and label it A ‾ ⋅ B ‾ \overline A \cdot \overline B A ⋅ B, as shown in Fig. If A is 0, and B is 0, the result of the current bit will be 0 with no carry generated. Let’s consider the case when neither A or B are asserted. Now, we will try to see where to go from the initial state when inputs come. When rst is asserted, the circuit should reset to this initial state S0, and we define that both outputs will be initialized to be 0, as shown in Fig. So we will draw a circle to represent the initial state and we will name it S0. Design State DiagramĮvery state diagram starts from an initial state. We also need a clock signal (named clk here) to provide the timing reference for both the inputs and the outputs and a reset signal (named rst) to bring the circuit into initial state. As with the adder we described in the arithmetic circuit, we have a data output F and another output called Cout (Carry Out). In this case, we have two data inputs named A and B.
Step 1: Describe the Serial Adder Using the State Diagram Define Inputs and Outputsīefore designing the state diagram, we always need to define the inputs and outputs first. To design such a circuit, you are going to use the state diagram as the mode of describing the behavior of the circuit, and then translate the state diagram into Verilog code. A serial adder is a circuit that performs binary addition bit by bit (i.e., instead of presenting both operands at the inputs of an adder at the same time, the operands are fed into the serial adder bit by bit and it generates the answer on the fly). In this tutorial, you are going to design a serial adder.