Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

SystemC basics

$
0
0

Hi,

I am currently migrating from C++ to system C. I have nested functions in C++ and i need to replicate same behaviour in system C. how can i do that. Below is the mimic of the behavior of the model which i want to achieve. 

void check(int a, int b )

{ int x=10;

  int y=20;

  add_m(a,x);

  sub_m(b,y);

}

 

void add_m(int a, int x)

{

 cout<<a+x<<endl;

}

void sub_m(int b,int y)

{

cout<<b-y<<endl;

}

 

till know what i did is :-

 

sc_module(check) {

sc_ctor(check){

    sc_thread(run);

  }

};

void check::run(int a, int b )

{ int x=10;

  int y=20;

  add_m(a,x);

  sub_m(b,y);

}

 

int sc_main(int argc,char*argv[]){

check chk("chk");

}

 

Now how to declare add_m and sub_m. Can anybody help me out???


Viewing all articles
Browse latest Browse all 595

Latest Images

Trending Articles



Latest Images