Home Tips 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 :

» Inside The Verifiers Cubicle

Have you ever watched ? You know, the show where James Lipton hosts famous actors in front of a small audience of students? Remember? Anyway, this is actually one of my favorite shows on TV (and there aren’t that many really). Towards the end of...

» Verification Consulting, What's Next?

Will the demand for Design and Verification services change? How will Functional Verification look like 3 years from now? Think Verification caught Cristian Amitroaie, AMIQ’s CEO, for a quick chat.

» 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....

» To Do List 2010

Introducing Philip Americus - a new guest blogger here on Think Verification. Phil is an ASIC veteran who's worked with every phase of ASIC design - from initial concept to tapeout, with an emphasis on verification, including management of both HW...

» Verification Documents - Love Them, Hate Them, But You Can't Ignore Them

Verification Plan (or Test Plan) and Coverage Plan are two documents that specify the features to be tested in the verification process. The first document usually lists the DUT features that need to be covered and the latter - the coverage points...

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.