image/svg+xml
  • Contents
      • Back
      • Digital Basics
      • Verilog
      • Verification
      • SystemVerilog
      • UVM
Most Popular
Verification
  Testbench Evolution
  Constraint Random Verification
  Verification Techniques
  Verification Plan
  Code Coverage

Verilog
  Data Types
  Basic Constructs
  Behavioral Modeling
  Gate Modeling
  Simulation Basics
  Design Examples

SystemVerilog
  Data Types
  Class
  Interface
  Constraints and more!
  Testbench Examples

UVM
  Sequences
  Testbench Components
  TLM Tutorial
  Register Model Tutorial
  Testbench Examples

Digital Fundamentals
  Binary Arithmetic
  Boolean Logic
  Karnaugh Maps
  Combinational Logic
  Sequential Logic




Testbench Evolution

A verification testbench is a hardware verification language (HVL) code written in Verilog or SystemVerilog that is used to verify the functionality of a digital design. The testbench is a simulation environment that generates stimulus for the design under test (DUT) and checks the response of the DUT against expected results. The testbench may also include functional coverage and assertions to ensure that all functional scenarios have been exercised and the DUT behaves as expected. The testbench typically consists of three main parts: the testbench framework, the stimulus generator, and the response checker.

Evolution

Since the advent of Verilog in the 1980s, testbenches have undergone significant evolution to become more powerful, automated, and efficient.

Constrained-random testbenches: In the 1990s, constraint-random testbenches were introduced as a way to generate input stimuli and testcases automatically. This allowed designers to test their designs more thoroughly and to explore a wider range of input scenarios than was possible with linear testbenches.

Read more: Testbench Evolution

Introduction to Verification

The ASIC Design Flow consists of several steps, including design specification, design entry, design synthesis, design verification, physical design, and design sign-off.

Design verification (DV) typically refers to the pre-silicon effort of functional validation of the design using simulation tools.

Read more: Introduction to Verification

Verilog File IO Operations

Verilog has system tasks and functions that can open files, output values into files, read values from files and load into other variables and close files.

Opening and closing files


module tb;
	// Declare a variable to store the file handler
	integer fd;
	
	initial begin
		// Open a new file by the name "my_file.txt" 
		// with "write" permissions, and store the file
		// handler pointer in variable "fd"
		fd = $fopen("my_file.txt", "w");
		
		// Close the file handle pointed to by "fd"
		$fclose(fd);
	end
endmodule

Read more: Verilog File IO Operations

Verilog Hierarchical Reference Scope

Most programming languages have a characteristic feature called scope which defines the visibility of certain sections of code to variables and methods. The scope defines a namespace to avoid collision between different object names within the same namespace.

Verilog defines a new scope for modules, functions, tasks, named blocks and generate blocks.


module tb;
	reg signal;
	
	// Another variable cannot be declared with
	// an already existing name in the same scope
	reg signal;
	
	// However, the name 'signal' can be reused inside
	// a task because it belongs to a different scope.
	task display();
		reg signal = 1;
		$display("signal = %0b", signal);
	endtask
	
endmodule

An identifier, like a signal name, can be used to declare only one type of item in a given scope. This means that two variables of different or same data types cannot have the same name, or a task and a variable of the same name, or even a net and gate instance with the same name in the same scope.

Read more: Verilog Hierarchical Reference Scope

Verilog Math Functions

Verilog math functions can be used in place of constant expressions and supports both integer and real maths.

Integer Math Functions

The function $clog2 returns the ceiling of log2 of the given argument. This is typically used to calculate the minimum width required to address a memory of given size.

For example, if the design has 7 parallel adders, then the minimum number of bits required to represent all 7 adders is $clog2 of 7 that yields 3.


module des 
  #(parameter NUM_UNITS = 7) 
  
  // Use of this system function helps to reduce the 
  // number of input wires to this module
  (input [$clog2(NUM_UNITS)-1:0] active_unit);
  
  initial 
    $monitor("active_unit = %d", active_unit);
endmodule

`define NUM_UNITS 5

module tb;
  integer i;
  reg [`NUM_UNITS-1:0] 	active_unit;
  
  des #(.NUM_UNITS(`NUM_UNITS)) u0(active_unit);
  
  initial begin
    active_unit     = 1;     
	#10 active_unit = 7;
    #10 active_unit = 8;    
  end
endmodule

Note that the signal active_unit has 3-bits to store total 5 units.

Read more: Verilog Math Functions

  1. Verilog Clock Generator
  2. Verilog Concatenation
  3. Verilog User Defined Primitives
  4. Verilog Timeformat
  5. Verilog Timescale Scope

Page 16 of 63

  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
Interview Questions
  Verilog Interview Set 1
  Verilog Interview Set 2
  Verilog Interview Set 3
  Verilog Interview Set 4
  Verilog Interview Set 5

  SystemVerilog Interview Set 1
  SystemVerilog Interview Set 2
  SystemVerilog Interview Set 3
  SystemVerilog Interview Set 4
  SystemVerilog Interview Set 5

  UVM Interview Set 1
  UVM Interview Set 2
  UVM Interview Set 3
  UVM Interview Set 4
Related Topics
  Digital Fundamentals
  Verilog Tutorial

  Verification
  SystemVerilog Tutorial
  UVM Tutorial
  • Verilog Testbench
  • Verilog Coding Style Effect
  • Verilog Conditional Statements
  • Verilog Interview Set 10
  • Synchronous FIFO
  • SystemVerilog Interview Set 10
  • SystemVerilog Interview Set 9
  • SystemVerilog Interview Set 8
  • SystemVerilog Interview Set 7
  • SystemVerilog Interview Set 6
  • UVM Singleton Object
  • UVM Component [uvm_component]
  • UVM Object [uvm_object]
  • UVM Root [uvm_root]
  • UVM Interview Set 4
© 2015 - 2023 ChipVerify
Terms and Conditions | DMCA.com Protection Status