×
  1. SystemC/C++ Code and UML Diagram Generator
  2. SystemC environment setup with Docker
  3. Hello World
  4. SystemC Module
  5. Constructor: SC_CTOR
  6. SC_HAS_PROCESS
  7. Simulation Process
  8. Simulation Stages
  9. Time Notation
  10. Concurrency
  11. Event
  12. Combined Events
  13. Delta Cycle
  14. Sensitivity
  15. Initialization
  16. Process: Method
  17. Event Queue
  18. Combined Event Queue
  19. Mutex
  20. Semaphore
  21. FIFO
  22. Signal: read and write
  23. Signal: detect event
  24. Signal: many writers
  25. Resolved Signal
  26. sc_signal<bool>
  27. Buffer
  28. Communication: port
  29. Communication: export
  30. Communication: port 2 port
  31. Communication: specialized ports
  32. Communication: port array
  33. Primitive Channel
  34. Hierarchical Channel
  35. Trace File
  36. Error and Message Report
  37. Customized Data Type
  38. Clock
  39. Process: CTHREAD
  40. Handle trigger while busy
  41. Handle trigger while busy, template class
  42. Interrupt a thread while busy
  43. Interrupt a thread while busy, template class

SystemC

  • is a C++ class library.
  • provides a mechanism for managing complex systems involving large numbers of components. It is capable of modeling hardware and software together at multiple levels of abstraction. This capability is not available in traditional hardware description languages.
  • allows a designer to simulate concurrent processes, each described using plain C++ syntax. SystemC processes can communicate in a simulated real-time environment, using signals of all the datatypes offered by C++, some additional ones offered by the SystemC library, as well as user defined.
  • is a system-level modeling language, which mimics the hardware description languages VHDL and Verilog.
  • is applied to system-level modeling, architectural exploration, performance modeling, software development, functional verification, and high-level synthesis.
  • is often associated with electronic system-level (ESL) design, and with transaction-level modeling (TLM).
  • is standardized in IEEE 1666-2011.

General Terminology

Below lists the most common terms used for SystemC.
MethodA C++ method, i.e. a member function of a class.
ModuleA structural entity, which can contain processes, ports, channels, and other modules. Modules allow expressing structural hierarchy. Module is the principle structural building block of SystemC, used to repsent a component in real systems.
ProcessA special kind of member function of a sc_module class, registered to the SystemC simulation kernel and called only by the simulation Kernel.
InterfaceAn interface provides a set of method declarations, but provides no method implementations and no data fields.
ChannelA channel implements one or more interfaces, and serves as a container for communication functionality.
PortA port is an object through which a module can access a channel’s interface. But modules can also access a channel’s interface directly.
EventA process can suspend on, or be sensitive to, one or more events. Events allow for resuming and activating processes.
SensitivityThe sensitivity of a process defines when this process will be resumed or activated. A process can be sensitive to a set of events. Whenever one of the corresponding events is triggered, the process is resumed or activated.

SystemC Components

Below shows an example of a typical SystemC simulation with different types of components. Typically:
  • processes within the same module communicate to each other via events or channels.
  • processes within different modules communicate to each other via ports and channels
systemc_components
In this example:
  • Module A is a top level module (component). It has two sub-modules (module b and module c), a channel (c1), and a simulation process (P). Module A also has one input port (p0) and two output ports (p4, p7).
  • Module A receives input via port p0, and writes output via ports p4 and p7
  • Module b has two simulation processes (X and Y), an event (e), an input port (p1), and two output ports (p2, p3)
  • Within module b, processes X and Y are connected through event e.
  • Module b connected to module A via ports p0 and p1.
  • Module b also connects to process P of module A via port p3.
  • Module c has two simulation processes (M and N), an input port (p5), and an output port (p6)
  • Within module c, processes M and N are connected through channel c.
  • Module b is connected to module c via channel c1 (ports p2 and p5 bound to c1).
  • Module c connected to module A via ports p6 and p7.
  • Overall, there are following signal chaines:
    • ext -> p0 -> p1 -> X -> e -> Y -> p2 -> c1 -> p5 -> N - c2 - M -> p6 -> p7 -> ext
    • ext -> p0 -> p1 -> X -> p3 -> P -> p4 -> ext

SystemC Execution Stages

The execution of a SystemC application consists of elaboration followed by simulation. Refer to simulation stages for details. A diagram is provided below.
systemc_kernel
As shown,
  • sc_main() is the entrying point of an SystemC application. Before and after sc_start() is normal C++ code.
  • Upon reaching sc_start(), SystemC simulation kernel takes over the scheduling of processes. It returns until a specified simulation time has elapsed, no more actions pending, or sc_stop() is called by any of the process.

References

  1. Download SystemC
  2. IEEE 1666-2011
  3. SystemC 2.3 source code
  4. SystemC 2.0 Functional Specification
  5. EDA playground
  6. SystemC: From the Ground Up, Second Edition, 2010, by David C. Black et al.
  7. Youtube Video Course: Learn SystemC with Examples
  8. Github repository: Learn SystemC with Examples