top(sc_module_name name, int size) : sc_module(name) , fifo_inst("Fifo1", size) , prod_inst("Producer1") , cons_inst("Consumer1") { prod_inst.out(fifo_inst); cons_inst.in(fifo_inst); }
top(sc_module_name name) : sc_module(name) { fifo_inst = new fifo("Fifo1"); prod_inst = new producer("Producer1"); prod_inst->out(*fifo_inst); cons_inst = new consumer("Consumer1"); cons_inst->in(*fifo_inst); }
// constructor for top, sends name to sc_module constructor top (sc_module_name name, int size) : sc_module (name) , // and executes the actual // instantiation of the fifo, // the producer and consumer // with their respective // parameter values fifo_inst ("fifo", size), prod_inst ("producer"), cons_inst ("consumer") { // Connects the producers writep port to the fifo instance prod_inst.writep (fifo_inst); // and then the consumers readp port to the fifo instance cons_inst.readp (fifo_inst); }