quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Seed Management

SCV provides support for Global Seed Setting and Unique seed setting for each thread. When no seed setting is done, then default seed 1 is assumed.

   

space.gif

Global Seed Management is done with method

   

space.gif

scv_random::set_global_seed().

   

space.gif

We have already seen in last few examples on how to set the global seed

   

space.gif

  ../images/main/bullet_green_ball.gif Variable And Transaction Recording

In order to effectively debug a simulation run, visualization of events and activities is very important. A test bench must be able to record appropriate data into a database to support visualization. The same database can also be used to perform coverage analysis. This section describes the API from which the user can control what information is recorded in the database.

   

space.gif

Two kinds of recordings have been considered. Because value transitions in variables can be recorded using value-change callbacks, only the callback registration API in the data introspection facility is included in the SystemC Verification Standard. Two kinds of recording are as below.

   

space.gif

  • Variable Recording
  • Variable Recording
   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Variable Recording

The values of a variable across time can be recorded into a database using the VCD facility in SystemC. However, it is more efficient to associate variable recording to value-change callbacks.

   

space.gif

Using the data introspection facility described earlier, value-change callbacks can also be performed on a data object by using scv_smart_ptr. Using value-change callbacks in a data object is different from using value-change callbacks in a signal. Using data introspection, value-change callbacks can be registered in a data object of any type, and the callbacks will be executed whenever an assignment to the data object is performed, regardless of whether the new value is the same as the old value or not.

   

space.gif

If an action should be taken only when a different value is assigned to the data object, the callback function could be written to store the previous value and to ignore invocations when the new value is the same as the previous value.

   

space.gif

  ../images/main/bullet_star_pink.gif Example : Callback
   

space.gif


  1 #include <scv.h>
  2 
  3 void my_callback ( scv_extensions_if& data, 
  4                    scv_extensions_if::callback_reason r) {
  5   if (r == scv_extensions_if::VALUE_CHANGE) {
  6      cout << "The data is assigned value : ";
  7      data.print();
  8      // Do what ever you want to do
  9   }
 10 }
 11 
 12 int sc_main(int argc, char** argv) {
 13   // Set the Seed to 1
 14   scv_random::set_global_seed(1);
 15   scv_smart_ptr<int> data;
 16 
 17   data->register_cb(my_callback);
 18   data->keep_only(0,3); 
 19   data->keep_out(1); 
 20   for (int i = 0; i < 10; i ++) {
 21     data->next();
 22     data->print();
 23   }
 24   return (0);
 25 }
You could download file scv_callback.cpp here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation Output : Callback
   

space.gif

 The data is assigned value : 2
 2
 The data is assigned value : 0
 0
 The data is assigned value : 0
 0
 The data is assigned value : 0
 0
 The data is assigned value : 2
 2
 The data is assigned value : 0
 0
 The data is assigned value : 0
 0
 The data is assigned value : 3
 3
 The data is assigned value : 2
 2
 The data is assigned value : 3
 3
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com