Decoder

  • A -bit decoder is a logic block that takes an -bit input and activates one of outputs
    • are the output lines
    • input lines
    • If the value of the input is , then the -th output will be true, and all other outputs will be false

Example: 3-bit decoder

3-bit decoder Only the output corresponding to the binary value of the input is true, as shown in the truth table. The label 3 on the input to the decoder says that the input signal is 3 bits wide.

Encoder

  • There is also a logic element called an encoder that performs the inverse function of a decoder, taking input and producing an -bit output

Example: 4-to-2 encoder

000100
001001
010010
100011
  • Out of 16 possible input values (4 bits), only 4 are valid, so the others are invalid
  • A possible implementation of a 4-to-2 encoder (using two OR gates) is:
    • Note that the input is not wired

4-to-2 encoder

Priority Encoder

todo

  • A priority encoder is an encoder

Enable

  • An enable (E) is sometimes added to some combinational logic components, when its value is 1, the component is working as usual, but when it is 0, the component is disabled and all its outputs are 0

Exercise

Implement a 3-to-8 decoder using two 2-to-4 decoders that have an enable input. (how can we implement an enable over the 2-to-4 decoder?)

Multiplexor

  • A -to- multiplexor (or multiplexer, mux, data selector) is a logic block consisting of:
    • data inputs lines labeled
    • select lines (or control lines) labeled
    • A single output line
  • The multiplexor selects the input line if the binary value formed by concatenating the select lines is , and outputs the value of the selected input line (without modification)
  • An implementation of a multiplexor with data inputs (and select lines) basically consists of three parts:
    • A -bit decoder, where each one (of ) output lines corresponds to one of the data inputs
    • An array of AND gates, each combining one of the data inputs with the corresponding decoder output
    • An OR gate that combines the outputs of the AND gates to produce the final output

Example: 2-to-1 multiplexor

2-to-1 mux

  • (left) A 2-to-1 multiplexor with two data inputs ( and , labeled and ), a select line , and an output .
  • (right) Its implementation using logic gates, which can be represented by

The truth table of the 2-to-1 multiplexor is:

0
1

Exercise: 4-to-1 multiplexor

Draw an implementation using logic gates of 4-to-1 multiplexor with four data inputs (), two select lines (), and an output .

PLA

PLA

  • A programmable logic array (PLA) is a structured-logic elemement that composed of:
    • A set of inputs and corresponding input complements
    • Two stages of logic:
      • (first) an array of AND gates that generate a set of product terms (minterms) of the inputs and their complements
      • (second) an array of OR gates that generate sum terms of the product terms, which are the outputs of the PLA
  • PLAs implement logic functions as a sum of products (SOP)

PLA Example

InOut
ABCDEF
000000
001100
010100
011110
100100
101110
110110
111101
  • Since there are 7 unique product terms (with at least one true output), there will be 7 columns in the AND plane
  • There are 3 rows in the AND plane (one for each input)
  • There are 3 rows in the OR plane (one for each output)

PLA implementation

Rather than drawing all the gates, designers often show just the position of AND gates and OR gates. PLA drawing

  • Rather than use inverters on the gates, usually all the inputs are run the width of the AND plane in both true and complement forms.
  • Dots are used on the intersection of a product term signal line and an input line or an output line when a corresponding AND gate or OR gate is required.
    • A dot in the AND plane indicates that the input, or its inverse, occurs in the product term.
    • A dot in the OR plane indicates that the corresponding product term appears in the corresponding output.

INFO

The contents of a PLA are fixed when the PLA is created, although there are also forms of PLA-like structures, called PALs, that can be programmed electronically when a designer is ready to use them.

ROM

  • A read-only memory (ROM) is a memory device with fixed contents that can only be read, typically set at manufacturing.
    • The shape (or dimensions) of a ROM is defined by:
      • The height which is the number of addressable entries
        • (where is the number of input lines)
      • The width which is the number of bits in each entry, equal to the number of output bits
      • The totel number of bits is
    • In our context, ROMs are used as structured logic to implement logic functions, where inputs represent addresses, and outputs are the data stored at those addresses.

Comparison between PLA and ROM for implementing logic functions

  • ROMs are fully decoded, meaning:
    • they store outputs for all possible input combinations, which results in exponential growth of entries with more inputs.
    • they are more flexible since they can implement any logic function with matching input and output sizes, without changing the ROM size
  • PLAs are partially decoded, meaning:
    • they store outputs for only the active product terms, thus, they are generally more efficient for implementing combinational logic functions

EXAMPLE

Following the previous truth table example, the PLA contains only the 7 active product terms, whereas the ROM contains all 8 possible entries.

Programmable ROM

  • A programmable ROM (PROM) is a type of ROM that can be programmed electronically after manufacturing when the designer determines its contents.
  • A erasable PROM (EPROM) is a programmable ROM that can be erased using ultraviolet light, allowing reprogramming during the design and debugging process.

Don’t Cares

  • A don’t care refers to a condition where the specific value of a variable (input or output) does not impact the operation or behavior of a system. This allows flexibility in logic optimization to minimize complexity.
    • An output don’t care occurs when the output value of a logic function is irrelevant for a particular input combination. This provides freedom to assign any value to the output for such cases to simplify the overall logic.
    • An input don’t care arises when certain inputs have no effect on the output for a specific combination of other inputs. In such cases, the input values can be treated as irrelevant (don’t care), which enables further optimization of the logic.

Example

Consider a logic function, defined as follows:

  • If A or B is 1, the output D is 1 (whatever the value of C)
  • If A or C is 1, the output E is 1 (whatever the value of B)
  • Output F is 1 if exactly one of the inputs is 1, although we do not care about F whenever D and E are both 1.

Here is the full truth table (without don’t cares):

InOut
000000
001101
010011
011110
100111
101110
110110
111110

The truth table written with output don’t cares look like this:

InOut
000000
001101
010011
1111
111
111
111
11

If we also use the input don’t cares, this truth table can be further simplified to:

InOut
000000
001101
010011
1111
111

INFO

Logic minimization is critical to achieving efficient implementations. One tool useful for hand minimization of random logic is the Karnaugh map. Nevertheless, hand optimization of significant logic functions using K-maps can be challenging, both because of the size of the maps and their complexity, for this reason, design tools are used to automate the process.

Bus

  • A bus is a collection of data lines that is treated together as a single logical signal.
    • (The term bus is also used to indicate a shared collection of lines with multiple sources and uses.)
    • Thick lines in diagrams indicate buses. Width of buses (e.g., 32 bits) may be explicitly labeled.
  • An array of logic elements

Example: A 32-bit multiplexor

A multiplexor is arrayed 32 times to perform a selection (using one select line) between two 32-bit inputs. 32-bit mux

Arithmetic logic circuits

Binary adders

Half Adder

Half Adder

  • A half adder addes two single binary digits and , and outputs a sum bit and a carry out bit
    • (sum)
    • (carry out) (represents an overflow into the next digit of a multi-digit addition)
InOut

(XOR)

(AND)
0000
0110
1010
1101

Full Adder

Full Adder

  • A full adder adds two bits and and accounts for values carried in as well as out, and outputs a sum bit and a carry out bit

full adder using two half adders

InOut
00000
00110
01010
01101
10010
10101
11001
11111

Ripple-carry adder

todo

Carry-lookahead adder

todo