HOME       UP       PREV       NEXT (SystemC: Abstracted Signals)  

SystemC Channels and Signals

SystemC channels connect modules together: serve as wiring (and more).

RTL-style compute/commit is provided by the SystemC signal channel.

 // A signal is an abstract (templated) data type that has a current and next value. 
 // Signal reads are of the current value.  Writes are to the next value.
 // This example illustrates:
  int nv;                       // nv is a simple c variable (POD)
  sc_out    < int > data;       // data and mysig are signals (non-POD) 
  sc_signal < int > mysig;      //
        nv += 1;
        data = nv;
        mysig = nv;
        printf("Before nv=%i, %i %i\n'', nv, data.read(), mysig.read());
        wait(10, SC_NS);
        printf("After  nv=%i, %i %i\n'', nv, data.read(), mysig.read());
Before nv=96, 95 95
After  nv=96, 96 96

When the scheduler blocks with no more events in the current time step, the pending new values are committed to the visible current values.

22: (C) 2012-17, DJ Greaves, University of Cambridge, Computer Laboratory.   TAPE MISSING ICON