UVM_ROOT:
Thursday, October 10, 2019
How class based uvm test top connected in module
UVM_ROOT:
Friday, April 3, 2015
A better theory for System Verilog threads
Follow this article and gives a good explanation that I ever saw
http://www.arrowdevices.com/blog/oops-3-issues-that-show-system-verilog-threads-are-not-oop-safe/
Sunday, March 1, 2015
The "wildcard bins" in SV useful for covering addresses/register coverage with specific
This is useful in finding register bit specific coverage
If reg1 is a 32 bits wide and we were interested in LSB [3:0] in combine with msb [31]=1
REG1_BITS_CP : coverpoint reg1 {
wildcard bins ={32'b1000_0000_0000_0000_0000_0000_0000_????};
}
So with this cover point you will get 16 bins ,32'b1000_0000_0000_0000_0000_0000_0000_0000,32'b1000_0000_0000_0000_0000_0000_0000_0001 to 32'b1000_0000_0000_0000_0000_0000_0000_1111.
Wednesday, May 1, 2013
shallow copy vs deep copy
Packet p1;
Packet p2;
p1 = new;
p2 = new p1;//shallow copy
The last statement has new executing a second time, thus creating a new object p2, whose class properties
are copied from p1. This is known as a shallow copy. All of the variables are copied across integers, strings,
instance handles, etc. Objects, however, are not copied, only their handles; as before, two names for the
same object have been created. This is true even if the class declaration includes the instantiation operator
new.
It shall be illegal to use a typed constructor call for a shallow copy (see 8.8).
A shallow copy executes in the following manner:
1) An object of the class type being copied is allocated. This allocation shall not call the object’s constructor
or execute any variable declaration initialization assignments.
2) All class properties, including the internal states used for randomization and coverage, are copied to
the new object. Object handles are copied; this includes the object handles for covergroup objects
(see Clause 19). An exception is made for embedded covergroups (see 19.4). The object handle of
an embedded covergroup shall be set to null in the new object. The internal states for randomization
include the random number generator (RNG) state, the constraint_mode status of constraints, the
rand_mode status of random variables, and the cyclic state of randc variables (see Clause 18).
3) A handle to the newly created object is assigned to the variable on the left-hand side.
NOTE—A shallow copy does not create new coverage objects (covergroup instances). As a result, the properties of the new object are not covered.
Several things are noteworthy. First, class properties and instantiated objects can be initialized directly in a
class declaration. Second, the shallow copy does not copy objects. Third, instance qualifications can be
chained as needed to reach into objects or to reach through objects:
b1.a.j // reaches into a, which is a property of b1
p.next.next.next.val // chain through a sequence of handles to get to val
To do a full (deep) copy, where everything (including nested objects) is copied, custom code is typically
needed. For example:
Packet p1 = new;
Packet p2 = new;
p2.copy(p1);
where copy(Packet p) is a custom method written to copy the object specified as its argument into its
instance.
Tuesday, April 23, 2013
Command line arguments to configure DUT parameters
$value$plusargs (string, variable)
%d - decimal conversion
%e - real exponential conversion
%f - real decimal conversion
%g - real decimal or exponential conversion
%h - hexadecimal conversion
%o - octal conversion
%s - string (no conversion)
%x - (undergound equivalent for %h)
if ($value$plusargs("FINISH=%d", stop_clock))
begin repeat (stop_clock) @(posedge
clk); $finish;
end
if ($value$plusargs("TESTNAME=%s", testname))
begin$display("Running test %0s.",
testname);
startTest();
end
if (!$value$plusargs("FREQ=%0F", frequency))
frequency = 8.33333; // 166MHz;
forever begin
#frequency clk = 0;
#frequency clk = 1;
end
2. The variable 'testname' obtains the value 'this_test'.
3. The variable 'frequency' obtains the value '5.6666'; note the final plusarg +FREQUENCY does not affect the value of the variable 'frequency'.
Need for abstract class
- A partially implemented class - Abstract classes act as expressions of general concepts from which more specific classes can be extended. An abstract class defines some default functionality with virtual methods, and requires you to add additional functionality with pure virtual methods (method prototypes with no implementation). Although the language does not require having a pure virtual method in your abstract class, there is usually no point in using the abstract class without extending it and providing some virtual method overrides. You cannot create an object of an abstract class type; however, you can reference extended objects from an abstract class typed variable. You are using polymorphism to access the virtual method in the extended class, and those virtual methods will access members of the extended class.
- An interface class containing only pure virtual methods - a completely unimplemented class. This is a way for one class to communicate with another class through a published API that is made up of the pure virtual method prototypes. That one class just needs to contain an abstract class variable to reference the other implemented object. Since SystemVerilog only allows for single inheritance, this also serves to keep the inheritance hierarchies of the two classes separate.
The difference between these two contrivances is a matter of degree in implementation inside the base class. However, SystemVerilog 2012 has formalized the concept of interface classes in a way that allows for multiple inheritance of interface classes. These are all concepts borrowed from Java, so you can search for more information in that domain.
why we making an interface as virtual
Where as a class object is dynamic which can be allocated memory and can be freed during the course of simulation. So, we cannot instantiate any static objects (let it be interfaces or modules) inside the class.
For that reason, a physical interface is assigned to a virtual interface defined (which is just a handle) inside a monitor/driver class through which you can access the real interface signals.
Sunday, April 21, 2013
Advanced SystemVerilog Process Control – Beyond fork-join_X
http://learn-systemverilog.blogspot.in/2010/07/advanced-systemverilog-process-control.html
Sunday, March 17, 2013
fork join_none inside a for loop
for (int i = 0;i < 5;i++) begin
fork
thread(i)
join_none
end
since 'i' is a common variable for all threads, all threads are spawned with index 4.
I don't want to use join_all as i want all threads to be spawned simultaneously.
To work as expected try the below
This is explained in the LRM. See the last example in section 9.3.2 Parallel blocks that explains fork/join_none.
for(int i = 0; i < 5; i++) begin
automatic int j;
j = i;
fork
thread(j);
join_none
end
What makes it work is that for each iteration of the for loop, a local automatic variable is created with a lifetime that is extended by the lifetime of the fork/join_none block that references it. The statements inside the fork/join_none block begin execution after finishing the for loop. It doesn't mater if the function/task call passes its arguments by value or by reference; each call has an independent copy of the automatic variable that was set to a value as the for loop went through its iterations.
Saturday, December 15, 2012
Scoreboard Vs Checker
A checker is used to check whether a given transaction has taken place correctly .
This may include data correctness and correct signalling order.
A Scoreboard is used to keep track of how many transactions were initiated, how many finished and how many are pending and whether a
given transaction passed or failed.
To find the differences between scoreboard and checker we have to understand the meaning of transaction:
"The transaction is quantum of activity that occurs in design bounded by time"
"A transaction is a single transfer of control or data between 2 entities"
"A transaction is a function call"
More on checker:
checker,endchecker are sv constructs refer sv 1800-2009 LRM section-17 .
checker is a place holder for assertions. LRM says
“The checker construct in SystemVerilog was specifically created to represent such verification blocks encapsulating assertions along with the modeling
code. The intended use of checkers is to serve as verification library units, or as building blocks for creating
abstract auxiliary models used in formal verification.”
Thursday, November 8, 2012
UVM RAL
The UVM register layer classes are used to create a high-level, object-oriented model for memory-mapped registers and memories in a design under verification.
Sunday, August 5, 2012
Using event based modeling in verilog to avoid Racing between always blocks.
begin
if (condition1)
mode1 = 1′b1;
else if (condition2)
mode2 = 1′b1;
else
mode3 = 1′b0;
end
begin
if( mode1 && conditions3)
output <= input1;
else if (mode2 && condition4)
output <= input2
else
output <= 2′b0;
end
event ev_mode
begin
if (condition1)
mode1 = 1′b1;
else if (condition2)
mode2 = 1′b1;
else
mode3 = 1′b0;
-> ev_mode
end
begin
if( mode1 && conditions3)
output <= input1;
else if (mode2 && condition4)
output <= input2
else
output <= 2′b0;
end
Design synthesis and relevant verilog code for DFF
q <= d;
if (reset)
q <= 1′b0;
else
q <= d;
if (reset)
q <= 1′b0;
else
q <= d;
wire gtd_clk = enable && clk;
q <= d;
if (enable)
q <= d;
q <= d;
What is Timescale in verilog codes
What are sequential and parallel blocks, what is fork and join statements? How it is deffer than begin and end?
initial
begin
a = 1′b1;
b = 1′b0;
c = 1′b1;
end
The Example -1 is showing the sequential block without delays, All the statements written inside the begin-end will execute sequentially and after the execution of initial block, final values are a=1, b=0 and c=1
initial
begin
#5 a = 1′b1;
#10 b = 1′b0;
#15 c = 1′b1;
end
initial
fork
#5 a = 1′b1;
#10 b = 1′b0;
#15 c = 1′b1;
join
initial
begin
fork
#5 a = 1′b1;
#10 b = 1′b0;
#15 c = 1′b1;
join
- 30 d = 1′b0;
What is sensitivity list in verilog?
Example of normal always block
always
begin
// statements
end
begin
// statements
end
A. always @ ( x or y or z)
B. always @ ( posedge x )
C. always @ ( posedge x or A )
D. always @ ( posedge x or negedge y )
E. always @ ( x, y, z)
F. always @(*)
G. always @*
The E, F and G are the new constructs added in the verilog 2001.
Begin
Sum = x + y + z
End
begin
if (!reset)
q<= 0;
else
q<= data
end
Begin
Sum = x + y + z
End
What is the difference between a function and a task? in verilog
- behavior –
- No of outputs :
- Nesting :
- Synthesis :
- Limitations :
- Usage :
What is the difference between blocking and nonblocking statements in verilog
- Synthesis –
- Usage -
