C++ Hardware Register Access
summary
Claims a safer replacement for volatile derefs by modelling registers as templates with a mutability policy and a compile-time mask that yields compile errors for illegal ops (read-only vs write-only). Shows actual code and disassembly, reports reads compile to about 2–3 instructions and writes to 4–5 instructions. Demonstrates logging and desktop mocking of MMIO, requires optimization so policy calls inline, and links source and slides on the listed GitHub.
AI-written summary · about
chapters (9)
- 0:00Start
- 1:02Common approach 1: raw volatiles
- 2:12Common approach 2: bitfields
- 2:51Features
- 3:12The proposal
- 3:51read
- 4:13write
- 4:53Usage
- 6:44Moar
related talks
12mModern special function register abstraction
58mLeveraging C++20/23 Features for Low Level Interactions
06mMy least favorite C++ feature
31mGetting Something for Nothing
01h 03mHidden Overhead of a Function API
06mUsing PMR in C++ Embedded Systems for Functional Safety
01h 01mThe two memory models
01h 03mUnlocking the value of C++20
