OSSS

Warning: Attempt to modify property of non-object in /home/ssynth/dokuwiki/lib/plugins/pageredirect/action.php on line 97

Empty Module

Online Synthesis Demo

Want to see this code in VHDL? Try our free online synthesiser!

Description

This example can be used as a starting point for the submission of your own examples. It only contains an empty SystemC module, with comments where to add actual logic, etc..

Source

#include <systemc.h>
 
SC_MODULE( my_module )
{
  /* ----- input ports ----- */
  sc_in<bool> clock;
  sc_in<bool> reset;
  // add your input ports here
  // sc_in< sc_uint<32> > in_data;
 
  /* ----- output ports ----- */
  // add your output ports here
  // sc_out< sc_uint<32> > out_data;
 
  /* ----- constructor ----- */
  SC_CTOR( my_module )
  {
     /* ----- process definitions ----- */
     SC_CTHREAD( processing, clock.pos() );
     reset_signal_is( reset, true );
  }
 
private:
  /* ----- process(es) ----- */
  void processing();
 
  /* ----- sub-module(s), and other members ----- */
  // ...
 
}; // my_module
 
/* ----- process body ----- */
void
my_module::processing()
{
  /* ----- reset block ----- */
 
  wait();
  while( true )
  {
    /* ----- main loop ----- */
    wait();
  }
} // my_module::processing()
 
/* ----- sc_main() -----
 *
 * This is optional and only required, if you have more than one
 * module in your design.  In that case, you should instantiate
 * your top-level module here.
 */
int sc_main( int, char*[] )
{
  my_module top( "top" );
  return 0;
}
examples/000-systemc/000-empty.txt · Last modified: 2009/04/30 08:50 by Philipp A. Hartmann
  • © 2008 OFFIS Institute for Information Technology
  • Escherweg 2
  • 26121 Oldenburg
  • Germany
  • Imprint
  • Top of page