//Introductory "Hello World" //Concurrent Modeling Program #include "systemc.h" //Definition of 1st Concurrent Module SC_MODULE (My1stModule) { //In the constructor block, spawn a new //thread called "hello_prc". SC_CTOR (My1stModule) { SC_THREAD (hello_prc); } //This thread will run as long as their //is SystemC simulation. void hello_prc() { //This while loop allows the thread //to run for "virtually forever" while(1) { //Print "Hello World" to the console. cout << "Hello World.\n"; //Suspend this thread for 20 nanoseconds. //This allows the simulator to give control //to any other threads running concurrently wait(20,SC_NS); } } }; //Definition of 1st Concurrent Module SC_MODULE (My2ndModule) { SC_CTOR (My2ndModule) { SC_THREAD (hi_prc); } void hi_prc() { while(1) { cout << "Hi There.\n"; wait(10,SC_NS); } } }; int sc_main(int argc, char* argv[]) { //Instantiate both modules My1stModule hello("1stConcurrentModule"); My2ndModule hi("2ndConcurrentModule"); //Run Simulation for 50 nanoseconds sc_start(50,SC_NS); return(0); }