HOME       UP       PREV       NEXT (Threads and Methods)  

SystemC Abstracted Data Modelling

Here we raise the modelling abstraction level by passing an abstract datatype along a 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); }

    int next_ts_int1, next_ts_int2; // Pending updates 
    void update()
    { ts_int1 = next_ts_int1; ts_int2 = next_ts_int2;
    ...  // Also must define read(), write() and value_changed()

  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 SystemC library, but clearly not for user-defined types.

  void mymethod()  { .... } 
  sensitive << myast.pos(); // User must define concept of posedge for his own abstract type. 

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

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