Interview Question Bank

Questions asked in RTL design, verification, timing, physical design and post-silicon interviews.

  • 337 Questions
  • 149 Verilog
  • 100 SystemVerilog
  • 15 SoC Verification
  • 14 Formal Verification
  • 15 Static Timing Analysis
  • 15 Bus Protocols
  • 15 Physical Design
  • 14 Post-Silicon Validation
Results 1 - 20 of 100 Click a question to show its answer.
How will you test the functionality of interrupts using functional coverage? SystemVerilog ▲ 0

Testing the functionality of interrupts using functional coverage involves the following steps:

  1. Define functional coverage goals: First, you need to define your functional coverage goals. These goals should be specific to the interrupts you want to test. For example, you might define goals for interrupt latency, interrupt frequency, or interrupt priority handling.
  2. Create a testbench for interrupts: Next, you need to create a testbench that generates interrupts with different characteristics. This testbench should also monitor the behavior of the design under test (DUT) in response to the interrupts.
  3. Implement functional coverage: You can then implement functional coverage in your testbench to track how often each of the defined functional goals is achieved. You can use standard SystemVerilog constructs like covergroups, coverpoints, and bins to define and track the functional coverage.
  4. Analyze the functional coverage results: Finally, you can analyze the functional coverage results to determine how well your testbench tests the desired interrupt functionality. Based on the results, you can make adjustments to your testbench to improve the tests.
What is the use of scope resolution operator? SystemVerilog ▲ 0

The scope resolution operator in SystemVerilog is denoted by the double colon '::' symbol. The basic purpose of this operator is to specify the scope in which an identifier is defined or should be searched for.

Here are some common uses of the scope resolution operator:

  1. Accessing a base class's members from a derived class: The :: operator can reach a superclass's public or protected members directly from a subclass, or reach anything declared static from outside the class hierarchy entirely. This is a genuinely different mechanism from the dot operator's hierarchical name referencing (e.g. top.sub.clk), which navigates module/instance hierarchy rather than class or package scope — :: only ever resolves against a class type, package, covergroup, or typedef name, never an instance path.
  2. Resolving naming conflicts: When a design has two or more variables or modules with the same name, the scope resolution operator can be used to differentiate the variables or modules by specifying their scope.
  3. 
      	package ahb_pkg;
      		typedef enum {READ, WRITE} e_access;
      	endpackage
      
      	package wishbone_pkg;
      		typedef enum {WRITE, READ} e_access;
      	endpackage
      
      	ahb_pkg::e_access 	m_access; 		// m_access = 1 indicates WRITE
      
  4. Accessing static variables and functions: The scope resolution operator is also used to access static properties and methods in a class.
  5. Accessing items in package: Elements in a package can be imported using import with scope resolution operator.
  6. 
    	import ahb_pkg::*; 	 		// Imports everything in the package called "ahb_pkg"
    	import enum_pkg::global; 	// Imports everything under "global" from enum_pkg
    

Read more on SystemVerilog Scope Resolution Operator.

How do you implement randc in SystemVerilog? SystemVerilog ▲ 0

The randc keyword in SystemVerilog will first exhaust all combinations possible before repeating a value. This is different from rand keyword where the same value may repeat even before all combinations are exercised.

Here's an example :


class ABC;
	rand 	bit [1:0] 	x; 		// randomization can give x = 3, 1, 1, 0, 3, 0, 2, 2
	randc 	bit [1:0] 	y; 		// randomization can give y = 1, 3, 0, 2, 3, 1, 2, 0 
endclass

Read more on SystemVerilog rand Variables.

What is inheritance? SystemVerilog ▲ 0

Inheritance is a concept in object-oriented programming that allows creating a new class by inheriting or extending the properties and behavior of an existing class. The existing class is called the parent or base class, and the new class is called the child or derived class. The child class inherits all the members of the parent class, such as variables, methods, and constructors, and can also add new members or override the inherited members.

Read more on SystemVerilog Inheritance.

What is DPI? Explain DPI export and import. SystemVerilog ▲ 0

DPI stands for Direct Programming Interface, which is a mechanism in SystemVerilog for integrating SystemVerilog design and verification code with external C/C++ code. It enables interoperability between SystemVerilog and other high-level programming languages, which is not possible with traditional Verilog.

DPI import is used to import C/C++ functions into SystemVerilog. This means that a C/C++ function can be used as a task or function in SystemVerilog by creating an import task or import function.


extern "C" void my_function(int arg1, int arg2) {
	// Do something here
}

And here's an example of how to import this function in SystemVerilog using DPI import:


import "DPI-C" context function void my_function(int arg1, int arg2);

DPI export works in the other direction: it makes a SystemVerilog function or task callable from that same C code. Declaring a function as exported doesn't change how it behaves on the SystemVerilog side at all — it just makes it reachable from the foreign-language side of a DPI call chain:


// SystemVerilog side: an ordinary function, nothing special about its body
function void sv_callback(int status);
  $display("Got status %0d from C", status);
endfunction

// Export it so C code can call it directly
export "DPI-C" function sv_callback;

C code elsewhere in the same simulation can now call sv_callback(...) directly, the same way SystemVerilog called into my_function above — the DPI boundary works in both directions.

Read more on SystemVerilog DPI.

What is semaphore and in what scenario is it used? SystemVerilog ▲ 0

Semaphore is a synchronization mechanism used to control access to shared resources. It is a variable or an abstract data type that is used to indicate the status of a shared resource, whether it is free, in use, or unavailable.

In a multi-tasking or multi-threaded environment where multiple processes or threads access shared resources concurrently, semaphores can ensure that only one process or thread can access the shared resource at a time. This helps to avoid conflicts and data inconsistency caused by simultaneous access, which could result in unexpected behavior.

Read more on SystemVerilog Semaphore.

Difference between fork-join, fork-join_any, and fork-join_none SystemVerilog ▲ 0

They are all used to spawn processes in parallel.

  • fork-join will exit only after all child processes finish.
  • fork-join_any will exit after any of the child processes finish.
  • fork-join_none will exit immediately without waiting for any child process to finish.

See examples of fork join, fork join_any and fork join_none.

Difference between static and automatic variables SystemVerilog ▲ 0

The main difference is that a static variable gets initialized once before time 0 at some memory location and future accesses to this variable from different threads or processes access the same memory location. However, an automatic variable gets initialized every time the scope where it is declared gets executed and stored in a different location every time.

Read more on SystemVerilog Static Variables & Functions.

Difference between module and program block? SystemVerilog ▲ 0

A module is the primary container for all RTL design code and allows hierarchical structuring of design intent. A program block, on the other hand, is a verification container introduced in SystemVerilog to avoid race conditions with the testbench: its contents execute in the Reactive region, after all of that time step's Active/Inactive/NBA design activity has already settled.

Read more on Verilog module and SystemVerilog Program Blocks.

Difference between dynamic and associative arrays SystemVerilog ▲ 0

A dynamic array is an array whose size can be changed during runtime. Elements of the array are stored in a contiguous block of memory, and the size is determined when the array is created. An associative array, on the other hand, is also known as a dictionary or a map. It is a collection of key-value pairs where each key has a corresponding value.

In a dynamic array, the elements are accessed using an index, which refers to the position of the element in the array. In an associative array, elements are accessed using the key.

Read more on SystemVerilog Dynamic Array and Associative Array.

What is the difference between a deep copy and a shallow copy ? SystemVerilog ▲ 0

A deep copy is one where nested class object contents are also entirely copied over into the new class object. A shallow copy is one where nested class objects are not copied but instead handles are simply assigned. So, if the original class object changes its contents, then the copied class also see the same contents.

Read more on SystemVerilog Copying Objects.

How to disable constraints? SystemVerilog ▲ 0

All constraints are by default enabled and will be considered by the SystemVerilog constraint solver during randomization. A disabled constraint is not considered during randomization. Constraints can be enabled or disabled by constraint_mode().


class ABC;
	rand bit [3:0] 	data;

	constraint c_data { data == 10; }
endclass

ABC m_abc = new;
m_abc.c_data.constraint_mode(0); 	// Disable constraint

Read more on SystemVerilog Disable Constraints.

Difference between code and functional coverage? SystemVerilog ▲ 0

In Verilog/SystemVerilog, code coverage and functional coverage are two types of verification metrics used to measure the completeness of a testbench.

Code coverage measures the extent to which the testbench has exercised the RTL code being verified. It tracks which lines of the code were executed during simulation, which branches of conditional statements were taken, and which blocks of code were repeated in loops. Code coverage is often measured in terms of statement coverage, branch coverage, and condition coverage.

Functional coverage, on the other hand, measures the completeness of the functional requirements being verified. It tracks how many and which functional scenarios were exercised during simulation. Functional coverage is defined based on functional coverage points, which are specific items or aspects of the functional specification that need to be tested. For example, a functional coverage point could be the number of packets transmitted and received correctly by a network interface block.

The key differences between code coverage and functional coverage are:

  1. Purpose: Code coverage is used to ensure that every line of code in the design has been tested while functional coverage is used to ensure that all functional requirements of the design have been tested.
  2. Measurement: Code coverage is measured based on the number of lines of code executed, branches explored, and conditions evaluated during simulation, while functional coverage is measured based on the number of functional coverage points exercised during simulation.
  3. Scope: Code coverage provides insight into the completeness of the implementation of the design, while functional coverage provides insight into the completeness of the specifications of the design.

Read more on Code Coverage and SystemVerilog Functional Coverage.

What is ignore_bins? SystemVerilog ▲ 0

In SystemVerilog, ignore_bins is a keyword used in functional coverage to exclude certain bins from being counted towards the coverage goal.

Ignoring bins can be useful when there are some bins that are not meaningful for the verification objectives, or if it is not feasible to cover some of the bins. By ignoring some bins, the coverage report can focus on the meaningful and feasible coverage points.

To ignore bins in a functional coverage point, the ignore_bins attribute can be used. Here's an example:


covergroup my_covergroup;
   // Coverage points definitions
   
	coverpoint my_var {
		bins  		zero 	= {0};
   		ignore_bins unused 	= {10};
	}
   
endgroup
What are 2 state and 4 state variables? Provide some examples. SystemVerilog ▲ 0

Two-state variables have only two possible values: 0 and 1. In two-state variables, there is no distinction between "unknown" and "floating" values. Two-state variables are commonly used in simple designs, or where the value of a variable is either known or unknown, but not floating.

Four-state variables, on the other hand, have four possible values: 0, 1, X, and Z. Four-state variables are used to model the behavior of digital circuits, where the signal can either be a known logic value, or a floating or unknown value.


reg [7:0] 	data_bus; 		// Can hold 0, 1, X, Z
bit  		true; 			// Can hold 0, 1

Read more on SystemVerilog logic and bit.

How to ensure address range 0x2000 to 0x9000 is covered in simulations ? SystemVerilog ▲ 0

To make sure that address ranges from 0x2000 to 0x9000 are covered in Verilog/SystemVerilog, we can use a covergroup to define coverage points for each address value within the range. Here's an example:


covergroup memory_access_coverage @(posedge clk);
   // Declare coverage points for each address within the range

   addr_coverage: coverpoint addr {
      bins addr_0x2000  		= {[16'h2000]};
      bins addr_0x2001_0x8FFF 	= {[16'h2001:16'h8FFF]};
      bins addr_0x9000  		= {[16'h9000]};
   }

   // Declare coverage points for other signals of interest
endgroup

Within the "addr_coverage" point, we declare three bins to cover the address range. The bin "addr_0x2000" covers the value 0x2000, while the bin "addr_0x2001_0x8FFF" covers the range from 0x2001 to 0x8FFF. Finally, the bin "addr_0x9000" covers the value 0x9000.

What is layered architecture in Verification? SystemVerilog ▲ 0

In verification, a layered architecture is a methodology in which the verification environment is structured into multiple layers of abstraction, each building on the lower layers. This approach separates functionality and responsibilities of different layers, making verification more manageable and scalable.

Layered architecture typically consists of three main layers:

  1. Testbench layer: This is the top layer of the verification architecture, which contains test scenarios that stimulate the design under test (DUT) and verify its functionality. The testbench layer is responsible for test management, collecting and analyzing results, and reporting errors and warnings.
  2. Verification IP (VIP) layer: The VIP layer provides hardware and software components that are reusable and pre-verified, such as memory models, bus functional models (BFMs), and protocol checkers. The VIP layer abstracts the DUT interface and behavior, allowing the testbench layer to focus on DUT functionality.
  3. Functional block layer: This is the lowest layer of the verification architecture, which contains individual blocks of the design. The functional block layer specifies the behavior and function of the DUT at the RTL level. The functional block layer includes RTL code, gate-level models, and timing models.

The layered architecture approach promotes reusability and scalability of the verification environment. Each layer can be independently designed and tested, facilitating incremental verification of the DUT. It allows efficient and thorough testing for complex designs with multiple blocks, interfaces, and protocols. By separating concerns and providing abstraction, layered architecture makes verification more manageable and improves the quality of the design.

Explain the cycle of verification and its closure. SystemVerilog ▲ 0

In the context of digital design verification, the verification cycle refers to the iterative process of designing, developing, running tests, and debugging to ensure the design meets the functional and performance requirements. The verification cycle generally consists of design verification plan, testbench development, test execution and verification closure.

Read more on Verification Stages.

Difference between dynamic array and queue SystemVerilog ▲ 0

A dynamic array is a collection of similar data elements whose sizes and memory locations are allocated dynamically during the runtime of the program. The size of the array can be changed at runtime, making it more flexible than a static array.

  • It can grow or shrink dynamically.
  • It can be used for random access of data elements.
  • It does not have a fixed size.
  • It has an index to locate an element.

A queue is also a collection of similar data elements, but its primary function is to store and retrieve data elements in a specific order, FIFO (First In First Out), or LIFO (Last In First Out) — a queue supports both, since elements can be pushed and popped from either end.

  • It is a sequential data structure that stores and retrieves elements in a specific order.
  • It follows the FIFO (First In First Out) or LIFO (Last In First Out) rule to maintain the order of elements, depending on which end it's pushed and popped from.
  • It has two main functions of adding elements to the rear and removing elements from the front.

Read more on SystemVerilog Dynamic Array and Queue.

Difference between structure and class SystemVerilog ▲ 0

In object-oriented programming, both structures and classes can be used to define custom data types with properties and functions, but there are some differences in their behavior and usage.

  • Access Modifiers: Classes have private, public, and protected access modifiers for data members and member functions. Structures only support public access modifiers.
  • Inheritance: Classes support inheritance, where a new class can be derived from a base class. Structures do not support inheritance.
  • Constructors and Destructors: Classes have constructors and destructors that get called when objects are created and destroyed, respectively. On the other hand, structures do not have constructors or destructors.
  • Methods: Classes can have functions and tasks that operate on its members, but structures do not have them.

Read more on SystemVerilog Structure and Class.

Cron Job Starts