A Practical SystemC Source-Reading Workflow
How to move from public API behavior to the implementation without getting lost in templates.
Reading SystemC source is not like reading a small application. It is a mature C++ library with compatibility concerns, macros, templates, platform code, and multiple abstraction layers. You need a workflow.
Start From a Tiny Example
Pick one behavior:
SC_METHOD(comb);
sensitive << a << b;Ask one question: how does this method become runnable when a changes?
Now follow only the code needed for that question. Ignore unrelated template specializations until they become necessary.
Trace Public API to Internal Object
For any feature, identify:
- The public type or macro the user writes.
- The object created by that API.
- The simulation context it registers with.
- The callback or virtual function invoked later.
- The event or update that causes progress.
This turns source reading into a graph walk rather than a file-reading marathon.
Use Search Terms That Match Concepts
Useful searches:
rg "request_update" src
rg "notify" src/sysc
rg "sc_simcontext" src
rg "SC_METHOD" src
rg "b_transport" srcWhen a term is too broad, search for a public method name plus a class name.
Read Header First, Implementation Second
Headers show the API and object relationships. Implementation files show scheduling and policy.
For example, with signals:
- Read the signal class declaration.
- Find
write(). - Find where it requests an update.
- Find
update(). - Find where value-change events are notified.
That sequence explains user-visible behavior.
Keep a Source Notebook
For each source reading session, write down:
- public API
- internal type
- key member fields
- important callbacks
- scheduler interaction
- surprising edge cases
This site can grow those notes into new lessons. The best technical tutorials are not just explanations; they are maps of what the reader should inspect next.
Comments and Corrections