HOME       UP       PREV       FURTHER NOTES       NEXT (SystemC Plotting and GUI)  

Pre-TLM Software Style Channels

A suitable coding style for sending calls along the nets (prior to the TLM 2.0 standard):

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;
};


class fifodevice: sc_module("fifodevice"), 
public write_if, public read_if, ... 
{
  void write(char) { ... }
  void reset() { ... }

  ...
}
SC_MODULE("fifo_writer") 
{
  sc_port outputport;
  sc_in  clk;
  void writer()
  {
    outputport.write(random());
  }

  SC_CTOR(fifo_writer} {
     SC_METHOD(writer);
     sensitive << clk.pos();
  }
}


   fifodevice myfifo("myfifo");
   fifo_writer mywriter("mywriter");

   mywriter.outputport(myfifo);

Here a thread passes between modules, but modules are plumbed in Hardware/EDS netlist structural style.


(C) 2008-10, DJ Greaves, University of Cambridge, Computer Laboratory.