Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

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