Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1Learning Outcomes

Combination logic circuits produce outputs based purely on their input signals. They are used for a wide variety of functions. State elements, on the other hand, have a small number of very specific uses. These are circuits that remember their input signal values.

2Accumulator Example

Consider the design of a circuit whose job is to form the sum of a list of integers, X0,X1,X2,,Xn1X_0, X_1, X_2, \dots, X_{n-1}. Assume that some other circuit applies the numbers from the list one at a time—one per clock cycle. Below is a graphical depiction of an abstraction of our circuit used to form the sum–we’ll call the block “sum”. The XX values are applied, one per cycle, and after nn cycles the sum is present at the output, S.

"TODO"

Figure 1:Block diagram for accumulator.

What should we put inside the sum block to achieve the desired function? Obviously the circuit involves an adder. Also, on each step we need to take the current sum and pass it back to the adder so that it can add another X value to it.

2.1Strawman: Unstable Circuit

Figure 2 is our first try:

"TODO"

Figure 2:Circuit diagram for accumulator.

Let’s examine the operation of this circuit in detail to see if it does the job. Assume that SS begins at 0. We then apply X0X_0. After a short delay (the adder propagation delay, τadd\tau_{add}) SS will change to X0X_0. Then after another τadd\tau_{add} of delay, S will change to X0+X0X_0 + X_0, then after another τadd\tau_{add} of delay, S will change to X0+X0+X0X_0 + X_0 + X_0, etc. Because τadd\tau_{add} is typically less than the clock period, all of these adds of X0X_0 will happen before X1X_1 is applied.

This is clearly not the correct operation of “sum”. The circuit is out of control! We need some way to control the computation, one step at a time.

2.2Use a Register

The way to control the computation is to put a register in the feedback path (the connection from the output of the adder to its input), as shown in Figure 3.

"TODO"

Figure 3:Circuit diagram for accumulator with reset.

The register holds the current value of SS while the next one is being formed. After we are happy with the next SS, we load it into the register and apply the new XX value, then wait for a new SS to appear at the output of the adder. The process is repeated for all nn XX values.

Reset signals are a common feature of register circuits. In the circuit diagram, this is the “reset” input signal to the register. This is a signal that can be used to clear the register value, and thus gives us a way to initialize the circuit.

2.3Waveform diagram

Figure 4 shows the waveforms demonstrating the rough operation of the accumulator circuit, for a few iterations. Results are generated nicely one at time. In this example, the register is used to hold up the transfer of data from one place to another in the circuit.

The output of the circuit is labeled SiS_i, and the output of the register is labeled Si1S_{i-1} to remind us that the register delays the signal for 1 cycle. So if the output of the circuit is holding the result of the ith iteration, then the register holds the result of the (i − 1)th iteration.

"TODO"

Figure 4:Rough timing diagram for accumulator, now with the waveform for the register output Si1S_{i-1}.

2.4Different signal arrival times

In practice XiX_i may not necessarily arrive at the same time as the feedback value, Si1S_{i−1}. The waveforms below in Figure 5 show XX arriving a little bit later than Si1S_{i−1}.

Even though X_i and S_{i-1} arrive at different times to the accumulator, the clock period is long enough that S_i is stable before the next rising edge of the clock.

Figure 5:Even though XiX_i and Si1S_{i-1} arrive at different times to the accumulator, the clock period is long enough that SiS_i is stable before the next rising edge of the clock.

As seen above, on each cycle there is a small time period where the adder has inconsistent inputs. This sort of arrival mismatch and subsequent output instability is common in many circuits. In properly designed circuits, this instability never happens around the rising-edge of the clock and therefore gets ignored by the registers and downstream circuitry.

3Computing Maximum Clock Frequency

Notice that the maximum clock frequency (minimum clock period) is limited by the propagation delay of the add/shift operation. If we try to make the clock period too short, then the add/shift logic would not have sufficient time to generate its output and the output register would capture an incorrect value.

At thge same time, we seek to create high-bandwidth circuits, which produce many outputs per second. We’d like to find an ideal balance between a high-frequency clock and stable outputs.

Figure 6 shows a typical circuit.

"TODO"

Figure 6:To determine the minimum clock period, compute the delay on the critical path.

In this circuit, the critical path is:

critical path=clk-to-q delay+CL delay+setup time\text{critical path} = \text{clk-to-q delay} + \text{CL delay} + \text{setup time}

where clk-to-q delay and setup time are properties of the register (e.g., internal flip flops), and CL delay is the delay through the combinational logic block.

4Hold Time Violations

Above, the critical path determins the maximum clock frequency we can use to ensure a stable input to our register elements. We next present a different problem: hold time violations.

Recall from earlier that the hold time is the duration during which a register’s input d must be stable after the rising edge of the clock. There are some cases where data propagates through the circuit is so fast that the input to registers become unstable during the hold time.

While rare[1], this may occur if the best-case delay between clocked elements is shorter than the hold time. To mitigate this, we could add arbitrary delay to combinational logic the circuit to increase the best-case delay.

Footnotes
  1. See the relevant footnote in a previous section.