See also the test files and manuals that are part of the kit.
SC_MODULE (mod) {
sc_in<clk> clk;
sc_in<bool> in;
sc_out<bool> out;
/*AUTOSUBCELLS*/
/*AUTOSIGNAL*/
SC_CTOR(__MODULE__) {
//====
SP_CELL (sub0, mod_sub);
SP_PIN (sub0, out, cross);
/*AUTOINST*/
//====
SP_CELL (sub1, mod_sub);
SP_PIN (sub1, in, cross);
/*AUTOINST*/
};
Expands automatically into:
SC_MODULE (mod) {
sc_in<clk> clk;
sc_in<bool> in;
sc_out<bool> out;
/*AUTOSUBCELLS*/
// Beginning of SystemPerl automatic subcells
mod_sub *sub0;
mod_sub *sub1;
// End of SystemPerl automatic subcells
/*AUTOSIGNAL*/
// Beginning of SystemPerl automatic signals
sc_signal<bool> cross; // For mod_sub
// End of SystemPerl automatic signals
SC_CTOR(__MODULE__) {
//====
SP_CELL (sub0, mod_sub);
SP_PIN (sub0, out, cross);
/*AUTOINST*/
// Beginning of SystemPerl automatic instantiation pins
SP_PIN(sub0, clk, clk);
SP_PIN(sub0, in, in);
// End of SystemPerl automatic instantiation pins
//====
SP_CELL (sub1, mod_sub);
SP_PIN (sub1, in, cross);
/*AUTOINST*/
// Beginning of SystemPerl automatic instantiation pins
SP_PIN(sub1, clk, clk);
SP_PIN(sub1, out, out);
// End of SystemPerl automatic instantiation pins
};
}
use SystemC::Netlist;
my $nl = new SystemC::Netlist ();
foreach my $file ('testnetlist.sp') {
$nl->read_file (filename=>$file,
strip_autos=>1);
}
$nl->link();
$nl->autos();
$nl->lint();
$nl->exit_if_error();
foreach my $mod ($nl->modules_sorted) {
show_hier ($mod, " ");
}
sub show_hier {
my $mod = shift;
my $indent = shift;
print $indent,"Module ",$mod->name,"\n";
foreach my $cell ($mod->cells_sorted) {
show_hier ($cell->submod, $indent." ".$cell->name." ");
}
}
If you're using a recent version of Perl, just:
cpan install SystemPerl
Alternatively, download from CPAN/wsnyder. Then
tar xvzf SystemPerl*.t*gz cd SystemPerl-* perl Makefile.PL make make test make install
And see the kit's README.
Alternatively, you can get the entire development repository with:
git clone http://git.veripool.org/git/SystemPerl
cd SystemPerl
git tag # See what versions exist (recent GITs only)
# Skip next line if wish to use HEAD development version
#git checkout SystemPerl_{version} # Switch to specified version
perl Makefile.PL
make
make test
make install
SystemPerl should run on any operating system with Perl and a C++ complier.
Written by Wilson Snyder <wsnyder@wsnyder.org>.
This perl library, SystemC-Perl, or SystemPerl for short, provides four major sub-packages:
See the buttons at the top of this page, which include: