Home Articles SystemVerilog Method Manipulation In SV and e

Search

Method Manipulation In SV and e PDF Print E-mail
User Rating: / 5
PoorBest 
Thursday, 24 December 2009 16:46

If you're familiar with SystemVerilog and taking your first steps in e (or vice versa) you might find this useful. Here are some of the most common method manipulations that you''ll need to master and how you should go about implementing them in e and SV:

 

Before we dive in - here's the reference code for the examples we're going to show you.

// ** e **
struct my_struct {
 my_function() is {};
 my_task1()@sys.any is {};
 my_task2()@sys.any is {};
 };
// ** SystemVerilog **
class parent;
 // must be virtual
 virtual function my_function();
 endfunction
 virtual task my_task1();
 endtask
 virtual task my_task2();
 endtask
 endclass

OK, now let''s see how to implement the most common method manipulations in each language:


Extending methods - adding more functionality at the end:

// ** e **
 extend parent {
 my_function() is also {
 j++;
 };
 };
 
 // ** SV **
 class child extends parent;
 virtual function my_function();
 super.my_function();
 j++;
 endfunction;
 endclass


Extending methods - adding stuff to the beginning of a method:

// ** e **
 extend parent {
 my_function() is first {
 j++;
 };
 };
 
 // ** SV **
 class child extends parent;
 virtual function my_function();
 j++;
 super.my_function();
 endfunction;
 endclass


Overriding a method:

// ** e **
 extend parent {
 my_function() is only {
 j++;
 };
 };
 
 // ** SV **
 class child extends parent;
 virtual function my_function();
 j++;
 endfunction;
 endclass


Launching parallel threads - parent process not blocked:

// ** e ** 
 foo()@sys.any is {
 start my_task1();
 start my_task2();
 };
 
 // ** SV **
 task foo();
 fork begin 
 my_task1();
 my_task2();
 join_none; 
 endfunction


Launching parallel threads - parent process blocked until shortest thread completes:

// ** e ** 
 foo()@sys.any is {
 first of {
 { my_task1(); };
 { my_task2(); };
 };
 };
 
 // ** SV **
 function foo();
 fork begin 
 my_task1();
 my_task2();
 join_any;
 disable fork;    // remove if you don''t want to kill the longer task prematurely
 endfunction


Launching parallel threads - parent process blocked until all threads are finished:

// ** e ** 
 foo()@sys.any is {
 all of {
 { my_task1(); };
 { my_task2(); };
 };
 };
 
 // ** SV **
 function foo();
 fork begin 
 my_task1();
 my_task2();
 join;
 endfunction

 

 
More articles :

» Let The New Game Begin

Things are changing. The EDA industry is changing, and the verification world is changing (check out Janick Bergeron's inspiring at SNUG San Jose for a glimpse of the future of verification). One of the major challenges we’re already facing today...

» The Easy Way To Start Using OVM-e Sequences

Industry-standard methodologies are great, really. It would be so nice if our entire verification environment (VE) were OVM-e (eRM) compliant, wouldn’t it? But what if there are legacy components in our env that don’t follow any specific...

» We Hear Ya!

 During the last months we conducted a poll about what you guys would you like to read more about on ThinkVerification and here are the results: Verification Methodology - 41%SystemVerilog Tutorials - 31%e Tutorials - 13%Interviews - 12%...

» Get Hooked

Changing an existing eVC for new project requirements is a grueling task. It’s really painful for any eVC developer to witness his creation being torn apart by an end user, but a little prudence from the developer can result into longevity of eVC....

» Useful OVM-e Snippets

How to activate Specman Profiler? How to get rid of automatic vr_ad coverage? Let's find out.

Comments  

 
0 #1 2010-04-17 16:43
Very simple and very informative article.
Quote
 

Add comment


Security code
Refresh

Copyright © 2017 Think Verification - Tips & Insights on ASIC Verification. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.