# Digital Component Types¶

Read time: 30 minutes (7665 words)

There is one other important aspect of basic digital components we need to discuss before actually designing the parts we need for our simulator.

Digital components fall into one of two major categories, depending on how they operate.

## Combinational Parts¶

Some parts act as a simple function, mapping a set of inputs directly into a set of outputs. These components react immediately to any change on an input and after a short period of time, a new set of outputs will appear.

These components are called `combinational`, and they obey George Boole’s algebraic rules. In fact, we can use Boolean Algebra to derive the internal structure of these components.

We still need to activate the simulated combinational components in order to calculate the current set of outputs leaving that component. But this activation is not really driven by the master system clock. It is driven by the signal changes that arrive from other components. We will need to consider this when we set up the real simulator control system.

### ALU¶

A good example of a combinational component is the ALU. This device does not need a clock. Instead, it simply reacts to the incoming signals, and produces the desired outputs. There is no memory of the action that occurred. In our simulator, we need to activate this part, but that activation is not really dependent on the system clock.

Any given system may actually have several ALU units. Besides the obvious number crunching ALU, we might provide a simple one that is used to adjust some signal value by adding (or subtracting) a constant. An obvious place to use such a simple ALU is in the program counter circuit, where we normally need to advance the PC to point to the next instruction in the instruction sequence. (Remember, we still might adjust this again if

### Multiplexors¶

Another example is a `multiplexor` device, which is used to chose on of several signals to pass along to the next component. This device takes a number of input signals, and a selector signal, then chooses which input to route to the single output. We might have many such devices scattered through our system to deal with each instruction and the routing of the data involved in that instruction.

## Sequential Components¶

The second class of digital components are activated by a clock signal, and what they do depends on their internal structure and the set of input signals available. We call these components `sequential` and these components maintain internal data somehow. That internal data, plus the available inputs, can be used to alter the outputs when the component is activated by a clock signal.

These sequential components may deliver different outputs, even when no changes are seen on any input signal. A simple counter is an example of this. Counters need a way to “reset” their internal store to a known (zero) value. At all other times, when a clock signal arrives, the output increments to the next value. Devices of this sort do not need to count sequentially, they could be designed using a look-up table, and return any value desired. In that case, we probably should not call the resulting component a “counter”, but rather, some kind of simple “state machine”.

### Registers¶

The simplest sequential component is called a `register`. This component has a single data input signal, and a single data output signal. When the clock arrives, the output is updated with the current input value. No change will occur on that output until the next clock signal arrives. The register “holds” a value for the period of one clock. Such devices can be used to delay a signal so it arrives at another point in the system when we need it there, not before!

### Memory Components¶

We can collect a group of registers in an array and store more than one value in the resulting component. We will need to add additional input signals to decide which register is to receive the new input data when the clock arrives, We can decide whether to update the internal store based on one input signal, .

Some memory elements cannot be altered while the system is running. The instruction memory should act like this, so the program cannot be altered.

Note

In the “old days” it was fairly common for programs to alter themselves. This kind of tricky programming is not used these days. YMMV!

Obviously, in a modern machine, we need to provide a way to “load” the program, usually from a file. However, once loaded, that memory will not provide a way to modify the contents.

Other memory elements can be updated. Here an incoming data signal, combined with an address signal will specify the single memory cell to be updated. The clock will cause that data item to be stored. We need to provide a special signal that tells the memory component to either deliver the memory stored at a specified address, or to write the provided data item at the specified address.

## Component Activation¶

The master system clock is driving the system. However, between clock ticks, things happen all by them selves. The sequential components deliver new signals on their output data ports, and those signals travel over wires to other components. If those components are combinational, they are processed immediately, and any outputs travel along until they reach another sequential component. Then things screech to a halt until the next clock comes along.

Note

It is the total time it takes for all signals to reach the next sequential component that determines how fast our processor can go. Too fast, and all the signals will not be ready when the next clock tick comes along. Obviously, tracking this timing is an important part of system design!

### Tick-Tock¶

We proposed using a “tick” signal to activate all components, and a “tock” signal to deliver those signals to other components. In fact, the “tick” signal should only trigger sequential components so the flow of new data can start. We need something a bit more involved to handle the flow of signals from there.

If we step back and look at the four steps, we see something that looks like this:

The registers at the boundaries between each step are where signals halt until the next “tick” clock signal comes along. Dealing with the action in the middle is a bit more complex, since that area may involve several combinational components. We need to work through the stages individually to see what needs to happen.

For now, consider this simple arrangement of combinational components to see the problem:

When the input signals arrive at the left boundary of this circuit, both components begin their processing immediately. After some short period of time, each will produce a new output. he problem occurs when the left component delivers a new output to the input of the right component. If that component is in the middle of processing the original signals it saw, it should be obvious that we need to ditch that processing and start over. How are we to do that?

One answer is to introduce an inner loop that activates the combinational components multiple times. (Remember the dance game we played? This is sort of like that!)

The inner loop must track changes on each wire, and stop when things become “stable”. Unfortunately, in digital circuits involving only combinational components, we might “feed back” the output of one stage to the input of an earlier component, and the resulting system might never become stable.

Try this circuit, made up of one simple inverter (The Boolean “NOT” component):

This circuit will “oscillate”” from one state to the next, alternating from zero to one over and over. Variations of this circuit actually make up the foundation of that system clock we keep talking about.

With careful design, we can avoid problems like this, and focus on how many combinational components must be traversed to get to the next register “gate” that ends that stage.