7 Feb 2013

Digital Systems Part 3 - Combinational Logic

In the first two parts of this installment, we learned about the different logic gates and how some of these are implemented with transistors. It is now the time to go a bit further i.e. working with these gates to form complex circuits. Electronics circuits made with logic gates are called digital circuits. There are two main type of digital circuits : combinational and sequential.

Combinational circuits

These circuits are easier to understand than sequential circuits. Combinational logic means that the outputs of the circuit are going to be the same for a given set of input values. The sequence of how the inputs have been setted has no effect on the circuit outputs. There are multiple different type of combinational circuits :

  • encoder/decoders
  • multiplexer/demultiplexer
  • comparator
  • adder/substracter/multiplier/divider
...and I do probably miss some types. 

A decoder is a type of circuit that will take a given number of input bits (a code) and will produce a set of signal for each code. The output will have a larger number of bits than the input. The encoder is the inverse, it will take a set of signals and generate fewer code bits. 

The multiplexer can be seen like a train rail that encounter an Y path. The train will take a selected path. The same thing happens with the multiplexer, the input bit (either one or zero) will propagate to one of the outputs, depending of the control signals (that set the path). The demultiplexer will take one bit from multiple input bits and propagate it to the single output depending of the control signals.

The comparator is used to determine which of two binary number is the highest. The mathematical operations (+ - x /) will also work on binary numbers.

A special type of encoder is the one-hot encoder. It will take a certain number of input bits, and generate a single high bit among the output bits (all other are zeroed). In the example animated GIF below, you can see how this encoder works. When the wire turns green, it means that the input is high. There is only one high output (lit LED) at a time. The gates used are 3-pins AND gates; observe that there are little bubbles at various inputs, this is a shortcut to indicate that the corresponding input is inverted. (ps. I used Logisim circuit simulator on Linux and took screenshots of the possible combinations to finally animate the cropped screenshots with GIMP)

The one-hot encoder circuit is used to create a decade counter. A popular decade counter chip is the CD4017 in the CD4000 series of IC. This integrated circuit is really old and we can see the chip layout (transistors) in the datasheet. In the picture below, you can see the mask of the real chip.

Sequential circuits

I won't go in the details of sequential circuits, I will keep that subject for later. A sequential circuits is a combination (no pun intended) of registers and combinational circuits. What's special with them is that their outputs will depend on when the inputs change (time factor). These circuits need a clock signal as a time base. Also, sequential circuits have internal states (memory effect) that are kept in different registers. The most complex digital structure like processors and state-machines use sequential circuits to work. An example circuit is a pass code locked door. The door will unlock only if a certain pattern of button is pressed sequentially. That would not be possible with combinational circuits.

No comments:

Post a Comment