NEXT (Example (Counter))
SystemC includes (at least):
- A module system with inter-module channels: C++ class instances
are instantiated in a hierarchy, following the circuit component
structure, in the same way that RTL modules instantiate each other.
- An eventing and threading kernel that is non-preemptive and which allows
user code inside components to run either in a trampoline style, returning
the thread without blocking, or to keep the thread and hold state on a stack.
- Compute/commit signals as well as other forms of channel for connecting
components together. The compute/commit signals are needed in a zero-delay
model of hardware to avoid 'shoot-thru': i.e the scenario where one
flip-flop in a clock domain changes its output before another has processed the previous value.
- A library of fixed-precision integers. Hardware typically uses all sorts
of different width busses and counters that wrap accordingly. SystemC provides
classes of signed and unsigned variables of any width that behave in the same way.
For instance the user can define an sc_int of five bits and put
it inside a signal. The provided library includes overloads of all the standard
arithmetic and logic operators to operate on these types.
- Plotting output functions that enable waveforms to be captured to a file
and viewed with a program such as gtkwave.
- A separate transactional modelling library: TLM 1.0 provided separate
blocking and non-blocking interfaces prototypes that a user could follow and in TLM 2.0
these are rolled together into `convenience sockets' that can convert between the
two forms. See LG 4.
Problem: hardware engineers are not C++ experts
but they can be faced with complex or advanced C++ error messages when they misuse
Benefit: General-purpose behavioural
C code, including application code and device drivers, can all be modelled in
a common language.