ASIC/FPGA Design and Verification Out Source Services
GTK wave Add Marker PERL script
-
GTK wave is an electronic free waveform viewer. Presently there is no easy way to add multiple cursors which are constant time step apart from the very last marker.
-
I therefor wrote a little PERL script to the job.
The script gets three parameters: saved GTK file, number of cursors to add and the time step.
-
The script modifies one line in the file namely the line of the cursors.
-
The script and an output waveform as example are shown below.
-
In the wave example marker A and B exist and their time interval is:
nevo-pinik:PDH> perl ~/bin/gtk_marker_delta.pl ds2.sav
197730000-197720000=10000
197720000-197730000=-10000
Add markers:
perl ~/bin/gtk_marker_add.pl ds2.sav 10 10000
After re-reading the file all markers are on screen.
#!/bin/perl
#file count step
open(FPR, $ARGV[0]) || die("open fail $ARGV[0]\n");
open(FPW, ">Tmp") || die("open fail $outputFile\n");
$cnt=$ARGV[1];
$add=$ARGV[2];
while(eof(FPR) != 1) {
$line=<FPR>; chomp($line);
if($line =~ /^\*-/) {
@a=split(/ /, $line);
foreach $j ( @a ) {
if($j == -1 && $cnt > 0) {
while($cnt > 0) {
$k += $add;
print FPW ("$k ");
$cnt--;
}#while
$cnt=$ARGV[1];
while($cnt > 0) {print FPW ("-1 "); $cnt--;}
}
print FPW ("$j ");
$k=$j;
}#foreach
print FPW ("\n");
}
else {
print FPW ("$line\n");
}
}
close(FPR);
close(FPW);
$cmd="mv -f Tmp " . $ARGV[0];
system($cmd);
Contact me now at: |