The Ultimate Hitchhiker's Guide to Verification

Dumping ground of useful links/articles/tips/tricks on System Verilog/VMM/OVM as and when I stumble upon them and some of my views on it :)

Answers to SystemVerilog Interview Questions - 8

13. What is the difference between mailbox and queue?
Mailbox are FIFO queue, which allows only atomic operations. They can be bounded/unbounded. A bounded mailbox can suspend the thread (while writing if full, while reading if empty) via get/put task. Thats why mailbox is well suited for communication between threads.

24. What is the use of $cast?
Typecasting in SV can be done either via static casting (', ', ') or dynamic casting via $cast task/function. $cast is very similar to dynamic_cast of C++. It checks whether the casting is possible or not in run-time and errors-out if casting is not possible.

27. What is $unit?
Refer these 2 doc form more details

  2. SV LRM 3.1a :: Section 18.3

28 .What are bi-directional constraints?
Constraints by-default in SystemVerilog are bi-directional. That implies that the constraint solver doesn't follow the sequence in which the constraints are specified. All the variables are looked simultaneously. Even the procedural looking constrains like if ... else ... and -> constrains, both if and else part are tried to solve concurrently. For example (a==0) -> (b==1) shall be solved as all the possible solution of (!(a==0) || (b==1)).

29. What is solve...before constraint ?
In the case where the user want to specify the order in which the constraints solver shall solve the constraints, the user can specify the order via solve before construct. i.e.

constraint XYZ  {
    a inside {[0:100]|;
    b < 20;
    a + b > 30;
    solve a before b;

The solution of the constraint doesn't change with solve before construct. But the probability of choosing a particular solution change by it.

40. What is circular dependency and how to avoid this problem ?
Over specifying the solving order might result in circular dependency, for which there is no solution, and the constraint solver might give error/warning or no constraining. Example

int x, y, z;
constraint XYZ  {
    solve x before y;
    solve y before z;
    solve z before x;


Post a Comment

About Me

My photo
I am from Sambalpur, Orissa, India. Have done Btech and Mtech in ECE from IIT Kharagpur. Currently working as Lead Member Technical Staff at Mentor Graphics Noida

My Feedburner


Search This Blog

My Shelfari Bookshelf

Shelfari: Book reviews on your book blog


Traffic Summary