What is a clock?
The thing the crocodile swallowed. You can still hear it ticking, but you can no longer see the clock display.
HW developers have a way to tell their tools about time. SW developers, need a similar mechanism for their tools to know about and deal with time.
SW issues surrounding time are some of the hardest to find, fix, document, debug and maintain.
Time problems are most likely to be intermittent.
There are few or no debugging technologies
Time based code is typically rewritten for each circumstance. It is often write-once, read none.
For each product that the code is rewritten, it is an opportunity to reintroduce bugs all over again.
Software tools have no concept of “now”.
No standardized way to index into history or future.
Have to relearn/redo how these concepts are expressed within that code base.
“I don’t want to have to build a circular buffer”
“Here is my clock space, here is my 2 line biquad. I’m done.”
The simple case MUST be simple
What is time?
- Like Power, it adds linearly
- You can’t get it back once it’s spent
- Some algorithms are non-causal
- Add buffers and latency to make it causal
What is “absolute time”?
- It’s the time your ears are on (the ‘now’ line).
- The one that goes click when it messes up
Add the concept of “clockspace” to the language
- Like a namespace or #using directive
Make the “x” axis (time) a first class citizen.
Keep simple things simple and uncomplicated.
Allow language and run-time to intelligently implement “plumbing” such as buffer management.
Allow code to rise above the timing details.
Create a new datatype for samples. Instead of using “float X[ ]” for sample data, use a variable of type sample: “sample X[ ]”. The compiler and/or the framework will then know that “sample x” is related to the sample rate and other clockspace concepts.
Multiple clockspaces can be defined along with a way to reference one or more external clockspaces from within an existing clockspace.
Example: For Acoustic Echo Cancellation, grab a sample from another clockspace and know how to correlate it to original clockspace.
Allow code reusability, similar to STL (== C++ Standard Template Library) or C standard libraries.
If clock domain is periodic, then optimizations can be done at compile time.
Able to directly access history and future results using simple z[-1], z, z syntax.
What is a clockspace?
- A description of the time relationships between code and data within a particular hardware clock domain
- Inside a single clockspace everything is synchronous
- A “child” clockspace is always synchronous to its parent clockspace
- Programming uses samples as units in periodic clockspaces
- Time/frequency is easily available from periodic clockspaces
Attributes of the clockspace
- Sample rate
- Point to parent clockspace or child clockspace
- Am I the Master Clock?
- Am I a constant clock or can I change?
- Associated data and coefficients
- 1 to 1 relationship between period and samples (for constant periodic max = min = period)
- Non-constant periodic specifies Max and Min
- Children derive from parent clock attributes
We can see a progression from completely unassisted DSP programming to “informed” DSP programming using these language extensions.
Not everything is discrete time (analog?)
Other times in system:
- Purely relative time between 2 events
- stream time
- core time
- network/web time
- greenwich mean time
- buffer in/out time
- different clock domains
- unreliable clocks
- dynamic clocks
To have a relative time, you must measure in the same place.
Relationships between clocks:
Timers run within clock domain
We quantify biological time against atomic time.
What are attributes of clock spaces/domains?
- 1 to 1 relationship between time + samples for constant (periodic) time domain
- Expected max clock frequency
- Periodic or aperiodic
- For Periodic: sample rate (fixed or ?variable)
- Child clock may inherit from parent clock
- File processing vs real time both support
- Code has clock domain + block size
- Data is associated with clock domain
- Processing Object (PO) processings 1 or more samples
- Max tolerable delay
- Expected max + min block size
We want buffers + buffersizes to disappear.
This assumes we are using a procedural language (or not?)
How can processing order be represented?
Generate RTL or C/C++? LUA?
Pieces that might need to be put in place to support this:
- Test bench execution units
- Test environment
- Processing Code
The Hitchhiker's Guide to the Galaxy