A suitable coding style for sending calls `along the nets' (prior to the TLM 2.0 standard):
| //Define the interfaces:
class write_if: public sc_interface
{ public:
  virtual void write(char) = 0;
  virtual void reset() = 0;
};
class read_if: public sc_interface
{ public:
  virtual char read() = 0;
};
//Define a component that inherits:
class fifo_dev: sc_module("fifo_dev"), 
public write_if, public read_if, ... 
{
  void write(char) { ... }
  void reset() { ... }
  ...
}
 |   | SC_MODULE("fifo_writer") 
{
  sc_port< write_if > outputport;
  sc_in < bool > clk;
  void writer()
  {
    outputport.write(random());
  }
  SC_CTOR(fifo_writer} {
     SC_METHOD(writer);
     sensitive << clk.pos();
  }
}
//Top level instances:
fifo_dev myfifo("myfifo");
fifo_writer mywriter("mywriter");
// Port binding:
mywriter.outputport(myfifo);
 | 
Here a thread passes between modules, but modules are plumbed in Hardware/EDS netlist structural style.
| 34: (C) 2008-15, DJ Greaves, University of Cambridge, Computer Laboratory. |