1. Experiences with SystemC
Design Verification Using
SystemC
Greg Tierney
Presented to
DV Club, Boston
March 5, 2007
DV Club, Boston
2. Experiences with SystemC
About Avid
Invented digital video editing
Headquartered in Tewksbury
– http://www.avid.com/company/
Products
– Film/Video Editing and
Finishing
– Audio
– Broadcast
– Animation
– Storage & Workgroups
– Digital Asset and Production
Management
Services
– Support
– Training
– Consulting
DV Club, Boston
3. Experiences with SystemC
Agenda
What is SystemC?
Why did Avid choose to use SystemC?
DV problems solved by SystemC.
Summary
DV Club, Boston
4. Experiences with SystemC
What is SystemC?
Provides hardware constructs and a simulation kernel
for C++
It is a class library
– And it is a language standard (IEEE 1666TM 2005)
It has utilities and constructs
– Data types, ports, channels, processes
Adopted by different disciplines
– Architectural Modeling (SoC, performance)
– DV (RTL simulation, HW/SW co-verification)
– Synthesis
It is open source (OSCI)
– http://www.systemc.org
DV Club, Boston
5. Experiences with SystemC
Why Avid Chose SystemC
Enhanced existing C++ DV code
– Replaced an unreliable in-house framework
• Signal encapsulation
• Thread management
• Random seed management
– Smooth transition from C++ to SystemC
Tool availability
– Single kernel multi-language simulator
Industry acceptance
Low cost
Came with built-in verification capabilities
DV Club, Boston
6. Experiences with SystemC
Agenda
What is SystemC?
Why did Avid choose to use SystemC?
DV problems solved by SystemC.
Summary
DV Club, Boston
7. Experiences with SystemC
Crossing Language Boundaries
Connect an entire HDL module to the
testbench.
– Wrap the module with a SystemC class
(sc_foreign_module).
– Provide a string mapping for each port.
Connect a foreign signal anywhere in the
hierarchy.
– Bind a sc_signal (observe_foreign_signal).
– Provide a string of hierarchical path to wire or reg.
DV Club, Boston
9. Experiences with SystemC
Issues with Binding
No clear standard for language boundary
resolution.
– Each vendor has its own implementation.
– Implementation we use doesn’t map arrays or
records (yet).
Supporting foreign interface requires two
pass compilation.
– First pass creates object files.
– Second pass builds a symbol library used in
design elaboration.
DV Club, Boston
10. Experiences with SystemC
SystemC Connections
p
start() p start()
Call a public method Connect sc_port to a
via pointer to object sc_export
outp write() read() inp
Connect sc_port to a
channel
DV Club, Boston
12. Experiences with SystemC
Issues with Connections
Construction and binding are separate steps.
– Ports must be public.
– Ports bound after modules and channels are constructed.
Binding uses “strict type checking”.
– Compilation will fail if type mismatch in the connection.
– Splitting a vector across multiple ports is complicated.
Binding errors detected at elaboration.
– Simulation should abort at runtime if a port is not bound.
– Need to assign attributes to port (e.g. # of connections).
DV Club, Boston
13. Experiences with SystemC
Randomization
Separate library dedicated to verification
constructs (SCV).
Robust, rich feature set for
randomization.
– Simple constraints (ranges and lists).
– Complex constraint solver.
– Thread-safe seeding.
– Extendible to custom object types.
DV Club, Boston
14. Experiences with SystemC
Randomization at Avid
SCV more than we needed.
– So, we use a subset of the features.
Provide a Tcl interface to apply constraints.
– Wrap scv_smart_ptr.
– Define string representations for simple
constraints.
– Recompilation not required to change constraints.
– Reapply constraints over course of simulation.
DV Club, Boston
15. Experiences with SystemC
Processes
Hardware is inherently parallel.
DV must be multi-threaded.
SystemC solves this with processes.
– Macros: SC_THREAD and SC_METHOD.
– Events, mutexes, semaphores.
– Dynamic processes (sc_spawn).
DV Club, Boston
16. Experiences with SystemC
Hierarchy
SystemC defines an object hierarchy.
– Relates objects (parent/child).
– Familiar to HDL design.
Avid DV defines a layer hierarchy.
– Relates connections.
– Familiar to communication stacks.
Issue: SystemC is not a methodology.
DV Club, Boston
17. Experiences with SystemC
Example Hierarchy
VTOP
VTEST
Test
Translator Reference Model Scoreboard
VTB
TLM Agent
STIMGEN Analysis Agent Analysis Agent
Commander_BFM TX_BFM Snooper_BFM RX_BFM
Driver Monitor Driver Monitor Monitor Monitor
DUT
DV Club, Boston
18. Experiences with SystemC
Agenda
What is SystemC?
Why did Avid choose to use SystemC?
DV problems solved by SystemC.
Summary
DV Club, Boston
19. Experiences with SystemC
Additional Issues
Compile and link performance is disappointing.
– Overuse of C++ templates in library.
– Partially attributed to vendor implementation.
Libraries are huge.
Being a language standard has tool implications.
C++ learning curve.
– C++ code debug very different than HDL.
• Segmentation faults, stack traces, code stepping
Think like a HW engineer, code like a SW engineer.
DV Club, Boston
20. Experiences with SystemC
Avid’s Experience
Used reliably for nearly 3 years.
Runtime performance very satisfactory.
Provides opportunity to assist product
development beyond DV.
– Evaluate architectures and predict
performance.
– Create programmer’s view models for
emulation and HW/SW co-verification.
DV Club, Boston