FPGA Lab 11: Behavioral Modeling

This laboratory introduces the behavioral modeling style in Verilog. Students will learn how to describe digital logic by using always blocks and common procedural statements such as if, case, and for. The lab also emphasizes the distinction between combinational and sequential logic, which is essential for later topics such as finite state machines and memory design.

Learning Objectives

  • Understand the concept of behavioral modeling in Verilog.
  • Distinguish among structural, dataflow, and behavioral modeling styles.
  • Use always blocks for combinational and sequential logic.
  • Use if, case, and for statements in synthesizable Verilog.
  • Apply correct coding rules for FPGA-oriented RTL design.
  • Verify behavioral designs using simulation.

Background

1. What is Behavioral Modeling?

Behavioral modeling describes what a circuit does rather than explicitly showing how it is built from gates. This style is especially useful for writing register-transfer level (RTL) designs in FPGA development.

2. Common Verilog Modeling Styles

Modeling StyleDescriptionTypical Example
Structural Describes circuits using gates or lower-level modules. AND, OR, NOT gate instantiation
Dataflow Describes logic using continuous assignments. assign y = a & b;
Behavioral Describes circuit behavior using procedural blocks. always @(*), always @(posedge clk)

3. Two Important Types of always Blocks

Combinational logic:

always @(*) begin
    // combinational logic
end

Sequential logic:

always @(posedge clk) begin
    // sequential logic
end

Important Design Rules

  • Rule 1: Assign all outputs in combinational logic
  • Rule 2: Use clock edges for sequential logic
  • Rule 3: Use '=' for combinational and '<=' for sequential
  • Rule 4: Use reset to initialize sequential logic
  • Rule 5: Avoid unintended latch inference

Lab Experiments

Simulation Requirement

All designs must be verified by simulation before hardware implementation. Students should write a corresponding testbench for each task, apply test vectors, and confirm the expected results using waveform observation.

  • Create a Verilog testbench for each design.
  • Apply representative input patterns.
  • Observe output changes in the waveform viewer.
  • Confirm that the circuit behavior matches the design specification.

Required Deliverables

  • Verilog source code for each task
  • Testbench file for each task
  • Simulation waveform screenshots
  • A short explanation of the design and verification results

Common Mistakes

  • Not assigning all outputs in a combinational always @(*) block
  • Inferring unwanted latches
  • Using blocking assignment in sequential logic
  • Forgetting the default branch in a case statement
  • Writing simulation-only code that is not synthesizable
  • Mixing combinational and sequential logic incorrectly in the same design block

Discussion Questions

  1. What is the difference between structural, dataflow, and behavioral modeling?
  2. Why must all outputs be assigned in a combinational always block?
  3. Why is non-blocking assignment recommended for sequential logic?
  4. What is the purpose of the default branch in a case statement?
  5. Why is simulation necessary before downloading the design to the FPGA board?

Conclusion

In this lab, students practice behavioral modeling as a major step from basic logic design toward RTL-based digital system design. The concepts in this experiment will be used directly in later topics such as finite state machines, memory blocks, and larger FPGA systems.

© 2026 Air Supply Information Center (Air Supply BBS)