Other Counters

Almost any type of counter can be created using a combination of SIMPLIS digital devices. This topic describes three common examples.

Basic digital counters are composed of a register and the logic to decode the current state and to apply the next state to the input of the register. The counters described below use a SIMPLIS register and a variety of ways to implement the decoding logic, ranging from gates to a lookup table.

By using a SIMPLIS register and a SIMPLIS lookup table, any kind of counter can be generated. Since counters are actually cleverly disguised state machines, the same circuit can implement a state machine with an arbitrary number of states using the same techniques as shown in the Gray Code Counters section.

All of the examples in this section use 3-bit counters, an arbitrary choice that makes the graph waveforms easier to read. All SIMPLIS logic supports up to 32 bits; therefore, scaling the counter to a different size is not difficult.

In this topic:

Implementing roll-over and roll-under protection

A conceptually simple way to implement roll-over and roll-under protection uses a digital comparator to compare the current output to the desired minimum or maximum count value and to disable the counter via the EN pin. This example uses an up/down counter with the maximum count value limited to 6 and the minimum count value limited to 1. The count value is initialized to 3 using the Initial Condition parameter on the up/down counter.

This example can be downloaded here: simplis_070_updowncounter_anti-rollover_example.

Sample waveforms for this example are shown below:

Up/Down Counter with Load Input

This example uses a SIMPLIS digital register and logic to implement a counter with a load input. In this case, the next count value is calculated with a SIMPLIS adder and subtractor. The input to the register is determined by the load control which is connected to the select pin of the MUX.

This example can be downloaded here: simplis_071_updown_counter_load_example.

Sample waveforms for this example are shown below:

Gray Code Counters

This example uses a SIMPLIS lookup table to implement a Gray code counter. A Gray code counter is a basic state machine in which only one of the output bits changes on the clock edge. This behavior is useful in designing glitch-free logic because the output of the counter can easily be decoded without any race conditions.

The SIMPLIS lookup table is one of the most powerful and, at the same time, one of the most overlooked of the SIMPLIS digital devices. Using the lookup table, extremely complex logic can be implemented, tested, and revised without changing the schematic view of the design. In this example, only two SIMPLIS digital devices are used to implement the Gray code counter: a SIMPLIS register and a SIMPLIS lookup table.

This example can be downloaded here: simplis_072_gray_code_counter_example.

Sample waveforms for the Gray code counter example are shown below. Note the D0, D1, and D2 signals - only one signal changes state at any clock edge.