AN2094 Freescale Semiconductor / Motorola, AN2094 Datasheet - Page 45

no-image

AN2094

Manufacturer Part Number
AN2094
Description
ITU-T G.729 Implementation on StarCore SC140
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Appendix C
Script Sources
C.1 Perl Script for Generating Cycle Statistics
Freescale Semiconductor
#!c:/Perl/bin/perl
# DSP Center Romania, 2000
=head1
The script parses the log file generated by coder_worst_case.sc or
decoder_worst_case.sc simulator scripts.
The output of this script is a table with worst-case and average execution time
on each test vector described in the .ini file (g729coder.ini or g729decoder.ini).
The script assumes a fixed directory structure. There are two parameters:
- The first parameter is mandatory and represents the name of the module to be analyzed
- the second parameter establishes if the script also runs the simulation.
The log files for coder and decoder are similar in structure.
=cut
# analyzed module is received from command line
$module=<$ARGV[0]>;
# check if the module tester is available; end script if not found
$exec_file="../../../code/bin/".$module.".eld";
if (! -e $exec_file) {die "Binary file doesn’t exist!!!";}
print "\nStatistics made for $module :\n\n";
# run the module tester without ini files to extract the build number and
# build date
system("runsc100 $exec_file > tmp.txt");
open (tmpfile,"tmp.txt") || die "Cannot create temporary files!!!";
# extract the build number and date
while (<tmpfile>)
{
}
# close and remove the temporary file
close(tmpfile);
system("rm -f tmp.txt");
# change the current working directory to log files directory
$path="worst_case/".$module."/";
chdir $path;
# Check if the .ini file is available.
# This file is needed for both running the simulation and for extracting
# the names of the test vectors and the corresponding number of frames.
$ini_file_name="g729".$module.".ini";
open ( inifile, $ini_file_name) || die "Cannot open ini file : $!\n";
# check the second parameter; if the value is "exec", run the simulation
$execute = <$ARGV[1]>;
if ($execute eq "exec")
{
(coder or decoder)
if(/.*build *(\d{4}).*/)
{
}
if(/.*time: *(.*)/)
{
}
# check the presence of the worst-case log generating script
$cmd_file=$module."_worst_case.sc";
if (! -e $cmd_file) {die "Inexistent worst-case command file for simulator!!!";}
# run the simulation
print "Build number : $1\n";
print "$1\n\n";
ITU-T G.729 Implementation on the StarCore™ SC140/SC1400 Cores, Rev. 1
Example 15. cycles_analyzer.pl
References
45

Related parts for AN2094