HOME       UP       PREV       NEXT (Threads and Methods)  

SystemC Channels and Signals Continued

Can raise modelling abstraction level by passing an abstract datatype along channel.

  sc_signal < bool > mywire; // Rather than a channel conveying just one bit,

  struct capsule 
  { int ts_int1, ts_int2;
    bool operator== (struct ts other)
    { return (ts_int1 == other.ts_int1) && (ts_int2 == other.ts_int2); }
    ...
    ...  // Also some others
  };
 
  sc_signal < struct capsule > myast; // We can send two integers at once.

For many basic types, such as bool, int, sc_int, the required methods are provided in the library, but clearly not for user-defined types.

  void mymethod()  { .... } 
  SC_METHOD(mymethod)
  sensitive << mywire.pos();

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

Future topic: TLM: wiring components together with methods instead of shared variables.


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