|
|
|
|
|
|
|
|
|
|
|
|
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. |
|
|
|
|
|
Global Seed Management is done with method |
|
|
|
|
|
scv_random::set_global_seed(). |
|
|
|
|
|
We have already seen in last few examples on how to set the global seed |
|
|
|
|
|
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. |
|
|
|
|
|
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. |
|
|
|
|
|
- Variable Recording
- Variable Recording
|
|
|
|
|
|
|
|
|
|
|
|
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. |
|
|
|
|
|
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. |
|
|
|
|
|
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. |
|
|
|
|
|
Example : Callback
|
|
|
|
|
|
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
|
|
|
|
|
|
Simulation Output : Callback
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|