Skip to main content

UVM Testbench Top Module and Adder Example

· loading · loading · ·
Education UVM Verification UVM Verification SystemVerilog Testbench Top Module Adder
Education UVM Verification
Axolot Logic
Author
Axolot Logic
Digital Design Engineer
Table of Contents
UVM Series - This article is part of a series.
Part 20: This Article

🛠️ UVM Testbench Top
#

🎯 Purpose
#

This page explains the top module for the Adder design’s testbench. This module:

✅ Generates clock and reset ✅ Instantiates the Adder DUT ✅ Sets the virtual interface using the UVM config database ✅ Starts the UVM test ✅ Initiates waveform recording


📜 Code Example
#

module top;
  import adder_pkg::*;
  import uvm_pkg::*;

  adder_if vif();
  adder DUT (
    .clk(vif.clk),
    .rst(vif.rst),
    .num1(vif.num1),
    .num2(vif.num2),
    .out(vif.out)
  );

  initial begin
    uvm_config_db #(virtual adder_if)::set(null, "*", "vif", vif);
    uvm_top.enable_print_topology = 1;
    run_test("adder_test");
  end

  // Clock generation
  always #5 vif.clk = ~vif.clk;
  initial vif.clk = 0;

  // Reset generation
  initial begin
    vif.rst = 1;
    #20 vif.rst = 0;
  end
endmodule

🔍 Explanations
#

adder_if: The interface that drives data to the Adder DUT and connects the virtual interface to the UVM testbench. ✅ uvm_config_db: Used to assign the virtual interface to UVM components. ✅ run_test(“adder_test”): Starts the test named adder_test. ✅ $dumpfile() and $dumpvars(): Enable waveform recording during simulation.


💡 Summary
#

  • This top module is the entry point of the UVM testbench.
  • All signals and reset are controlled here.
  • The virtual interface connection allows the driver and monitor components to communicate with the DUT.
  • The default test scenario is adder_test.
  • Waveform recording simplifies simulation analysis. 📈

UVM Series - This article is part of a series.
Part 20: This Article

Related

UVM Agent Usage and Adder Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_agent Testbench Structure
Education UVM Verification
UVM Monitor Usage and Adder Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_monitor Coverage
Education UVM Verification
UVM Scoreboard Usage and Adder Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_scoreboard Test Results
Education UVM Verification
UVM Sequence Usage and Adder Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_sequence Stimulus Generation
Education UVM Verification
UVM Test Usage and base_test Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_test Test Scenario
Education UVM Verification
UVM Base Classes
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Class Hierarchy
Education UVM Verification