Index by title

System-Perl examples

See also the test files and manuals that are part of the kit.

SystemPerl AUTO expansion example

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
    };
}

Netlist Example

   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."  ");
       }
   }

Installing SystemPerl

Installation with CPAN

If you're using a recent version of Perl, just:

cpan install SystemPerl

Download

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.

Repository

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

Prerequisites

SystemPerl should run on any operating system with Perl and a C++ complier.


Introduction to System-Perl

Written by Wilson Snyder <wsnyder@wsnyder.org>.

Summary

This perl library, SystemC-Perl, or SystemPerl for short, provides four major sub-packages:

See also

See the buttons at the top of this page, which include:

SystemPerl examples

SystemPerl installation