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 must define read(), write(), update(v) 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 library, but clearly not for user-defined types.
void mymethod() { .... } SC_METHOD(mymethod) sensitive << myast.pos();
Future topic: TLM: wiring components together with methods instead of shared variables.