SystemC .. Generate Statement

Status
Not open for further replies.

omara007

Advanced Member level 4
Joined
Jan 6, 2003
Messages
1,237
Helped
50
Reputation
102
Reaction score
16
Trophy points
1,318
Location
Cairo/Egypt
Activity points
9,716
Hi folks ..
Anyone knows how to do something like the ( vhdl generate statement ) in SystemC ? ..
Simply I have a module and I want to instantiate it many times in an upper level module .. how to do that ?
 

You can try somthing like this!
ff_with_pc is module of d flipflop with preset_clear and i am generating
three instances of it here...
Hope this helps!


Code:
 ff_with_pc *lq[3];
  sc_signal<bool> qn[3], q[3];
  int i;
  char *module_name;
  SC_CTOR(upc){
    for (i=0; i<3; i++) {
       sprintf(module_name, "ff_with_pc_lq%d", i);  
       lq[i] = new ff_with_pc(module_name);
       lq[i]->clock(clk);
       lq[i]->din(qn[i]);
       lq[i]->preclr(pc);
       lq[i]->q(q[i]);
       lq[i]->notq(qn[i]);
    }
    //Destructor
  ~upc(){
    for (i=0; i<3; i++)
      delete lq[i];
}
 

However, this example is not synthesizable into hardware.
Works fine for behavioral model, I tried it in catapultC and get into troubles.

Wonder if there is an easy way to create a systolic array as in VHDL.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…