Home SystemVerilog Useful OVM-e Snippets

Search

Useful OVM-e Snippets PDF Print E-mail
User Rating: / 10
PoorBest 
Thursday, 24 December 2009 16:41

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

 

How to activate Specman Profiler?

extend sys {
setup() is also {
specman("set profile");
};
};

 

 

How to get rid of automatic vr_ad coverage?

extend sys {
setup() is also {
set_cover("vr_ad_reg", FALSE);
};
};

 

 

How to continue simulation regardless of DUT errors?

extend sys {
setup() is also {
set_check( "...", ERROR_CONTINUE );
// set_check( "...", IGNORE );  -- use this to disable DUT errors completely
};
};

 

 

How to instantiate a logger?

extend your_unit {
logger: message_logger is instance;
keep soft logger.verbosity == MEDIUM;
keep soft logger.tags == {NORMAL};
short_name(): string is {
result = append("YOUR_UNIT_NAME"); // can also be a dedicated evc_name
};
// Constrain the output coloring for better visibility
short_name_style(): vt_style is {
result = BLUE;
};
};

 

 

How to generate a random list of numbers?

gen_random_list_of_numbers(num_of_items: uint, max_val: uint): list of uint is {
assert num_of_items <= max_val + 1;
var next_item: uint;
for i from 1 to num_of_items {
gen next_item keeping {
it <= max_val;
it not in result;
};
result.add(next_item);
};
result = result.sort(it);
};



How to implement register side affect with vr_ad?

extend MY_REG vr_ad_reg {
post_access(direction : vr_ad_rw_t) is {
if direction == WRITE then { // or READ
// get pointer to the enclosing reg file
var rgf := get_parents()[0].as_a(REG_FILE_TYPE vr_ad_reg_file);
// side affect
if bit0 == 1 then {
rgf.another_register.another_bit = 1;
};
};
};
};

 

 

How to control generation of Boolean variables elegantly?

gen_true_or_false(true_prob: uint): bool is {
assert that true_prob <= 100;
gen result keeping {
soft it == select {
true_prob      : TRUE;
(100-true_prob): FALSE;
};
};
};

 

 

How to declare a sequence?

sequence my_prefix_seq_s using
item = my_prefix_frame_s,
created_kind   = my_prefix_seq_kind_t,
created_driver = my_prefix_driver_u,
sequence_type  = my_prefix_any_sequence_s,  // optional
sequence_driver_type = my_prefix_any_sequence_driver_u; // optional

 

 

How to use method ports?

struct packet {
just_a_number: uint;
};
// define a method type
 method_type packet_method_t (p: packet);
// add an output port
unit tx_u {
broadcast_packet: out method_port of packet_method_t is instance;
send_packet_to_port() is {
broadcast_packet$(pkt);
};
};
// add an input port
unit rx_u {
receive_packet: in method_port of packet_method_t is instance;

 receive_packet(p :packet)  is {
message(LOW,"packet received");
print p using hex;
};
};
//make a one-to-many connection
extend sys {
tx: tx_u is instance;
rx_list[2] : list of rx_u is instance;

 connect_ports() is also {
for each in rx_list {
do_bind(tx.broadcast_packet, it.receive_packet);
};
};
};
 

 

 
More articles :

» Review - Verification Leadership Seminar

How many of you have tried to cut on coffee? or even quit drinking coffee altogether? I guess a lot. Well, personally I’ve given up on trying but you know what? there’s actually something worse than having 8 cups of coffee per day - it’s the...

» Cool Things You Can Do with Verdi

Wow it's been a while, but I'm back with a new series of YouTube videos. Hurray !!This time it's all about Verdi and all the cool things it can do for you.Since most of you guys already know it is the best debugger out there, my goal is to show you...

» Ignorance Is A Bliss

There is a rather confusing feature in Specman’s coverage engine that I would like to share with you today. I’ve met several people (including myself) who had been struggling to understand what was going on there and gave up Recently I was...

» VMM Hackers Guide - Creating Smart Scenarios With Atomic Generators

VMM ships with some pretty useful built-in components and applications. VMM''s Atomic Generator is probably one of the most powerful ones, yet it's pretty basic. It can definitely help you generate a flow of random items but it was not intended for...

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

Comments  

 
0 #1 2011-05-26 17:14
in e 9.2 - it is better to use the connect() pseudo method to connect method ports - thus solve the "star topology" issues
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.