sn_compare compares two Specman runs. It is useful when you think two runs should run alike (at least to some point) and you want to find the first difference.
Examples of typical comparisons:
Compiled mode and interpreted mode
Two runs from different Specman versions
Two runs of slightly changed code
sn_compare checks for differences between:
Loaded e user code
Everything under sys at configured sampling points
Everything printed
Because sn_compare can check everything that is printed, its configuration is flexible. It can compare only user trace or user trace plus emission of events, outcome of sim_read or sim_write, and outcome of trace call or any other trace command.
For more information about trace commands, see the online help.
The sn_compare process has two stages:
Information collection
Information comparison
To collect information:
Run sn_collect.sh twice - once for each run:
sn_collect.sh <dir>
<config> <specman execution command>
<dir> The directory where the information of the run is gathered. (<dir> should be different for two runs.)
<config> The config file that determines the sampling points of sys comparison and what is to be dumped into the output file for comparison. (<config> should be the same for both sn_collect.sh runs.)
For a sample configuration file, see cfg.e, which you can also use as your default configuration.
To compare the collected information:
Run sn_compare.sh in version 4.x.
sn_compare.sh <dir1> <dir2>
<config> <specman with user_files>
<dir1> The directory where the information of the first run was gathered.
<dir2> The directory where the information of the second run was gathered.
<config> The same config file that determined the sampling points of sys comparison and what was dumped into the output file for comparison.
Comparing two runs
(one interpreted and one compiled):
// Collect information required by cfg.e from the run of compiled top.e with xl
// and put it into /tmp/top_comp. xl_top is the specman executable that is the
// outcome of compiling top.e.
sn_collect.sh /tmp/top_comp
cfg.e specsim xl_top -s top.v specman.v -i run_xl.i
// Collect information required by cfg.e from the run of top.e loaded above xl_specman
// and put it into /tmp/top_load.
sn_collect.sh /tmp/top_load cfg.e specsim xl_specman -s top.v specman.v -i load_n_run_xl.i
// Compare the information collected from the two runs.
// "top" is the specman executable that is the outcome of compiling top.e.
sn_compare.sh /tmp/top_comp /tmp/top_load
cfg.e top
Note: You could also omit specsim and run in interactive mode with sn_collect.sh.
Comparing two runs (one in version 3.3.3 and one in version 3.3.4):
// Use version 3.3.3. Collect information required by cfg.e from the run of compiled
// top.e with xl and put it into /tmp/top_3.3.3. xl_top is the specman executable
// that is the outcome of compiling top.e.
sn_collect.sh /tmp/top_3.3.3 cfg.e specsim xl_top -s top.v specman.v -i run_xl.i
// Use version 3.3.4. Collect information required by cfg.e from the run of compiled
// top.e with xl and put it into /tmp/top_3.3.4. xl_top is the specman executable
// that is the outcome of compiling top.e.
sn_collect.sh /tmp/top_3.3.4
cfg.e specsim xl_top -s top.v specman.v -i run_xl.i
// Compare the information collected from the two runs.
// "top" is the specman executable that is the outcome of compiling top.e.
sn_compare.sh /tmp/top_3.3.3 /tmp/top_3.3.4
cfg.e top
Note: sn_compare.sh should be run in 4.x
Comparing sys between different versions of Specman might fail. (If it fails, an error message will be issued.)
<'
import
$SPECMAN_HOME/ce_tools/run_compare/sn_compare;
extend
sn_compare {
init() is also {
// The following values are in sys.time units.
dump_sys_start_time
= 0; // Start
dumping sys
dump_sys_frequency
= 1; // Time between two
sys dumps
};
start() is also {
// Adjust the following according to need.
specman("echo event full"); // Echo all events
specman("trace call extension *.*"); // Print out all calls to
// method extensions.
// If you want only method starts,
// remove the word "extension".
specman("trace sim_read;trace sim_write"); // Comment out when comparing
// interpreted to
compiled
// You can add more trace commands
here.
};
};
'>