1 of 16

Digital Logic Designs

LECTURE # 10

STATE MACHINES

2 of 16

  • What is a State Machine?
    • A state machine (also called a Finite State Machine or FSM) as a mathematical model of computation that consists of:
      • A finite set of states.
      • A set of inputs.
      • A set of outputs.
      • Transition functions that determine the next state based on the current state and input.
      • Output functions that determine the output based on the current state (Mealy) or the current state and input (Moore).
    • State machines are sequential circuits – their output depends on past inputs as well as the current input.

3 of 16

  • Why are State Machines Important?
    • State machines are designing sequential digital systems. They provide a structured way to design complex control logic.
    • Key applications:
      • Controllers for digital systems (e.g., vending machines, traffic lights, elevator controllers).
      • Protocol implementations (e.g., communication protocols).
      • Pattern recognition.
      • Game logic.
      • Hardware description languages (HDLs) often use state machines as a fundamental building block.

4 of 16

  • Types of State Machines
    • The two main types of state machines:
      • Moore Machines: Output depends only on the current state.
      • Mealy Machines: Output depends on both the current state and the current input.

5 of 16

�Programmable Logic Devices

  • The Need for Programmable Logic:
    • Traditional digital circuit design using discrete logic gates (AND, OR, NOT, etc.).
    • The limitations of discrete logic:
      • Inflexibility: Hardwired logic; changes require rewiring.
      • Complexity: Large designs require many components and complex wiring.
      • Space and Power: Discrete components consume significant space and power.
    • Introduce PLDs as a solution to these limitations: devices that can be configured to implement a wide variety of digital circuits.

6 of 16

I. Programmable Logic Devices (PLDs)

    • PLDs are integrated circuits that contain an array of logic gates that can be configured by the user to implement specific digital functions.
    • Aspects of programmable: The logic function is not fixed at the time of manufacture but can be customized by the designer.
  • Advantages of Using PLDs:
    • Flexibility: Circuits can be easily modified and reconfigured without rewiring.
    • Reduced Complexity: Fewer components, simpler board layout.
    • Faster Design Cycles: Design changes can be implemented quickly in software.
    • Lower Cost (in many cases): Especially for complex designs or when changes are expected.
    • Space and Power Savings: Higher integration leads to smaller, more power-efficient designs.

7 of 16

  • Types of PLDs:
    • The main categories of PLDs:
      • Simple PLDs (SPLDs): PROM, PAL, PLA
      • Complex PLDs (CPLDs)
      • Field-Programmable Gate Arrays (FPGAs)

. Simple Programmable Logic Devices (SPLDs)

  • General Architecture:
    • Basic architecture common to most SPLDs:
      • An array of AND gates.
      • An array of OR gates.
      • Programmable connections between the inputs, AND gates, and OR gates.

8 of 16

  • PROM (Programmable Read-Only Memory):
    • Architecture of a PROM:
      • Fixed AND array (decoder).
      • Programmable OR array.
    • PROM can be used to implement combinational logic functions: the address lines are the inputs, and the data lines are the outputs.
    • PROMs are primarily used for memory applications, but can also implement simple logic functions.
  • PAL (Programmable Array Logic):
      • Programmable AND array.
      • Fixed OR array.
    • PAL provides more flexibility than a PROM for implementing logic functions because the AND array is programmable.
    • PAL can implement multiple sum-of-products (SOP) expressions.

9 of 16

  • PLA (Programmable Logic Array):
      • Programmable AND array.
      • Programmable OR array.
    • PLA provides the most flexibility of the three SPLDs because both the AND and OR arrays are programmable. This allows for more efficient implementation of complex logic functions.
    • PLAs are generally more complex and expensive to manufacture than PALs, so they are less commonly used.

III. Complex Programmable Logic Devices (CPLDs)

  • Limitations of SPLDs:
    • SPLDs are limited in the complexity of the circuits they can implement due to their relatively small size and fixed architecture.

10 of 16

  • Architecture of CPLDs:
      • Multiple SPLD-like blocks (logic blocks or macro_cells).
      • A programmable interconnect matrix (switch matrix) that connects the logic blocks.
      • I/O blocks for connecting to external circuits.
  • Logic Blocks/Macrocells:
      • A programmable AND-OR array (similar to a PAL or PLA).
      • Flip-flops for implementing sequential logic.
      • Multiplexers for selecting different functions or feedback paths.
  • Interconnect Matrix:
    • The interconnect matrix allows any logic block to be connected to any other logic block or to the I/O pins.
    • This provides a high degree of flexibility for implementing complex circuits that span multiple logic blocks.

11 of 16

  • Advantages of CPLDs:
    • Higher Capacity: Can implement larger and more complex circuits than SPLDs.
    • Increased Flexibility: The programmable interconnect matrix allows for complex routing.
    • Good Performance: CPLDs typically offer good performance for a wide range of applications.
    • Non-Volatile: Configuration is typically stored in non-volatile memory (e.g., EEPROM or flash memory), so the device retains its configuration when power is removed.
  • Applications of CPLDs:
    • Glue logic: Interfacing between different components in a system.
    • Address decoding.
    • Simple state machines and controllers.
    • Peripheral control.

12 of 16

IV. Field-Programmable Gate Arrays (FPGAs)

  • Limitations of CPLDs:
    • CPLDs, while more powerful than SPLDs, still have limitations in terms of capacity, flexibility, and performance for very complex designs.
  • Architecture of FPGAs:
      • A large array of configurable logic blocks (CLBs).
      • A programmable interconnect network that connects the CLBs(Configurable logic blocks).
      • I/O blocks for connecting to external circuits.
  • Configurable Logic Blocks (CLBs):
      • Lookup tables (LUTs) for implementing combinational logic functions.
      • Flip-flops for implementing sequential logic.
      • Multiplexers for selecting different functions and routing signals.

13 of 16

  • Interconnect Network:
    • The interconnect network consists of a hierarchy of programmable switches and routing channels that allow any CLB to be connected to any other CLB or to the I/O pins.
    • This provides a very high degree of flexibility for implementing complex routing and signal distribution.
  • Advantages of FPGAs:
    • Very High Capacity: Can implement extremely large and complex circuits.
    • Maximum Flexibility: The fine-grained architecture and highly programmable interconnect network provide unparalleled flexibility.
    • High Performance: FPGAs can achieve very high performance, especially for custom hardware accelerators.
    • Reconfigurable: FPGAs can be reconfigured dynamically, allowing for adaptive hardware and rapid prototyping.

14 of 16

  • Disadvantages of FPGAs:
    • More Complex Design Process: Designing for FPGAs requires specialized tools and expertise.
    • Higher Power Consumption: FPGAs typically consume more power than CPLDs.
    • Volatile Configuration: Most FPGAs use SRAM to store the configuration, so the configuration is lost when power is removed (requires an external configuration memory). Some FPGAs use flash memory for non-volatile configuration.
  • Applications of FPGAs:
    • Digital signal processing (DSP).
    • Image and video processing.
    • Networking and communications.
    • Embedded systems.
    • Hardware acceleration.
    • Rapid prototyping of ASICs (Application-Specific Integrated Circuits).

15 of 16

V. PLD Selection and Design Flow

  • Choosing the Right PLD:
      • Complexity of the design.
      • Performance requirements.
      • Power consumption.
      • Cost.
      • Availability of development tools and support.

General guidelines:

      • SPLDs: For very simple logic functions and glue logic.
      • CPLDs: For medium-complexity designs, address decoding, and control logic.
      • FPGAs: For high-complexity designs, DSP(digital signal processor), hardware acceleration, and applications requiring maximum flexibility.

16 of 16

The End