-
Notifications
You must be signed in to change notification settings - Fork 2
Cfx file
Cfx files are a method of avoiding the need for a plethora of .cfg files by allowing the specification of many workloads in a single file. Cfx files are actually scripts written in Perl. Awb’s standard workload setup tools (awb-shell and awb) detect files with the .cfx extension and automatically invoke Perl in order to retrieve the list of workloads defined by that .cfx file. Both awb-shell and awb treat these scripts something like a directory. The .cfx file appears as a node in a path, followed by the name of the virtual cfg file defined in the script. E.g.
config/bm/smips/6_375.cfx/benchmarks/towers.cfg
Command line parsing and generation of the .cfg files is handled by a Perl module in the core library. Cfg scripts tend to be quite simple.
The basic structure of most .cfx files is:
- Include the Asim core libraries.
- Allocate a new instance of an Asim::GenCFG().
- Define one or more workloads with calls to GenCFG’s add() method.
- Call GenCFG’s action() method, passing @ARGV.
Here is an example:
: # -*-Perl-*-
eval 'exec perl -w "$0" ${1+"$@"}'
if 0;
use Asim;
use strict;
##
## Generate cfg files for 6.375 benchmarks.
##
my $gcfg = Asim::GenCFG->new();
my @bmarks = ("median",
"multiply",
"towers",
"qsort",
"vvadd");
foreach my $bmark (@bmarks) {
$gcfg->add(name => $bmark,
tree => [ "benchmarks" ],
setup => "tools/scripts/bmark/setup-bmark --isa smips $bmark",
feeder => "vcs",
feedflags => "program/${bmark}.smips.vmh",
);
}
$gcfg->action(@ARGV);
Anyone familiar with writing .cfg files will find the arguments to the add() method familiar. With a few exceptions, they translate almost directly into lines of the .cfg file. The “tree” parameter is an array of names representing the directory hierarchy in which a .cfg file will appear to be stored.
Although .cfx files are usually invoked automatically through awb-shell and awb, it is executable, but you must use asimstarter to run it. E.g.:
asimstarter -- ./6_375.cfx --emit config/bm/smips/6_375.cfx/benchmarks/towers.cfg
Without arguments a .cfx file will print a help message with legal arguments.
Usage: GenCFG [--emit <CFG>] [--list <path>] [--dir <path>]
Must specify one of --emit, --list or --dir
--emit <CFG>
Emit CFG file.
--list <path>
List all available CFG files under path.
--listflags <path>
List all available CFG files under path along with the genflags field.
This is used by awb as a quick method of finding whether a workload
has multiple regions.
--dir <path>
Treat path like a directory and list the level below it.