Behavioral Modeling in HW/SW Co-design Using C++ Coroutines
Talkat CppCon 2023 · on Friday, 2023-10-06· at 14:45· Cottonwood 8/9, 6700 North Gaylord Rockies Boulevard·
summary
Two methodologies drive the work: Register Hooking (preprocessor-backed hook registers that overload assign and cast to trigger side effects) and using C++20 coroutines with the concurrent_cpp library to express parallel hardware behavior as time-sliced awaitables. The team implements lockless coroutine queues, shows how tests co_await done bits, validates functional correctness against specs, and demonstrates hardware-in-the-loop substitution. Code and examples live on the linked GitHub and the approach reduces synchronization complexity while proving practical for pre‑silicon software development.
AI-written summary · about
chapters (21)
- 0:00Introduction
- 1:12Problem statement and shift left
- 3:17Behavioral modeling requirements
- 5:28Complexity with C++ coroutines
- 7:15Coroutines implementation
- 11:30Coroutines vs threads
- 18:34Waiting for multiple conditions
- 21:43State machines for hardware
- 22:47Generators for hardware simulation
- 25:55Coroutines for queues
- 30:11Register hooking
- 34:52Integrating C code
- 38:25Starting models and reset
- 40:29Testing models with assertions
- 43:01Hardware-in-the-loop testing
- 44:50Benefits and takeaways
- 48:41Q&A
- 50:26Q&A: Queue sync and mutexes
- 51:33Q&A: Thread pool for coroutines
- 53:05Q&A: Timing accuracy
- 54:10Q&A: Machine-generated hardware
related talks
01h 04mDeciphering Coroutines - a visual approach
01h 02mC++ Coroutines from scratch
55mC++ Concurrency TS 2 Use Cases and Future Direction
41m(Don't) use coroutines for this
01h 04mA Pattern Language for Expressing Concurrency in Cpp
54mawait 2.0: Stackless Resumable Functions
42mHistory of Concurrency
01h 00mDesign Idioms from an Alternate Universe
