Formula sheet
Digital Logic and Embedded Systems Formula Sheet
Digital logic formulas for Boolean laws, timing, I/O margins, buffers, bus bandwidth, sampling, quantization, latency, jitter, watchdogs, power, and reliability.
This formula sheet collects first-pass relationships for digital logic, embedded timing, sampling, buses, power, and validation checks. Use it with clear definitions of voltage levels, clock domains, sample rates, firmware execution paths, protocol overhead, safety state, and measurement method.
Boolean Algebra
AND identity:
OR identity:
Complement:
De Morgan laws:
XOR:
Boolean simplification reduces gates, delay, power, and sometimes fault surface.
Logic Timing
Single-path propagation delay:
Clock-period constraint:
Maximum clock frequency:
Hold-time condition:
Check timing across process, voltage, temperature, loading, and clock-domain crossings.
Digital I/O Margins
High-level noise margin:
Low-level noise margin:
Pull-up current:
RC rise-time estimate:
Debounce window:
Digital I/O checks should include voltage family, input leakage, output drive, cable capacitance, EMC exposure, boot state, and fault tolerance.
Clock Domains and Synchronizers
Clock period:
Frequency ratio between two domains:
Two-flop synchronizer latency, approximate:
Metastability MTBF screening form:
where T_r is available resolution time and \tau and C are device-dependent parameters. Use vendor data and validation evidence for real safety or reliability claims.
Digital Throughput and Data Size
Bits per sample:
Byte count:
Raw data rate:
Required line data rate with overhead:
For a fixed line rate, the effective payload throughput is:
where \alpha_{overhead} represents framing, addressing, checksums, coding, idle time, and metadata.
Bus Bandwidth
Parallel bus raw bandwidth:
where w is bus width in bits.
Serial bus raw transfer time:
Effective throughput:
Bus utilization:
Use worst-case arbitration, retries, and interrupt handling for real-time systems, not only nominal bandwidth.
Buffers and Memory
Buffer fill time:
when R_{in}>R_{out}.
Required buffer size for a service gap:
Memory footprint:
Memory margin:
Use bytes or bits consistently, and include alignment, DMA descriptors, protocol overhead, logging, bootloader, and worst-case stack depth.
Sampling
Sampling period:
Nyquist condition:
Nyquist frequency:
Samples in a time window:
Real systems need anti-alias filtering and margin because signal bandwidth and filter roll-off are finite.
Quantization
Ideal code count for an N-bit ADC:
Least significant bit size:
Maximum ideal quantization error:
Ideal quantization SNR for a full-scale sine:
Effective number of bits:
ADC accuracy also depends on reference, input settling, offset, gain error, noise, temperature, and layout.
Analog Input Filtering
RC low-pass cutoff:
Capacitor impedance magnitude:
Settling of a first-order input:
Input settling error:
Filtering should balance anti-aliasing, noise reduction, sensor bandwidth, and control-loop delay.
Latency Budget
Total embedded latency:
Deadline margin:
Control-loop sample-to-output delay:
A positive average margin is not enough. Use worst-case or high-percentile latency for hard real-time behaviour.
Jitter
Peak-to-peak jitter:
Root-mean-square jitter:
Relative sample-time error:
Jitter can reduce sampling accuracy, communication eye margin, and control stability.
Interrupt and CPU Utilization
CPU utilization from periodic tasks:
where C_i is worst-case execution time and T_i is period.
Interrupt load:
Remaining CPU margin:
Use worst-case execution time, not typical execution time, for deadline checks.
Encoder and Count Rate
Counts per revolution:
where m is decoding multiplier.
Measured speed:
Count frequency:
Check counter width, interrupt rate, debounce, input filtering, quadrature phase, and maximum speed.
Timers, Counters, and PWM
Timer tick period:
Counter rollover time:
PWM frequency:
PWM duty resolution:
Quantized pulse width:
Timer checks should include clock tolerance, interrupt latency, rollover handling, compare-update timing, actuator limits, and safe startup states.
PID Discrete Update
Discrete proportional term:
Discrete integral update:
Discrete derivative estimate:
Control output:
Real controllers need saturation handling, anti-windup, filtering, timing control, and safe output limits.
Power and Switching
Approximate CMOS dynamic power:
where \alpha is switching activity.
Energy per operation:
Regulator power loss, linear approximation:
Battery runtime estimate:
Power estimates should include sleep current, wake time, radio bursts, actuator loads, regulator efficiency, and temperature.
Error Budget
Root-sum-square independent error:
Worst-case bounded error:
Relative error:
Allocate error across sensor, analog conditioning, ADC, reference, calibration, computation, timing, communication, and actuator response.
Reliability and Watchdog Checks
Reliability for constant failure rate:
Watchdog timeout condition:
Diagnostic coverage:
Watchdog recovery should be validated with stuck-loop, interrupt-lockout, brown-out, bus-lockup, and memory-corruption tests.
Validation Metrics
Test pass rate:
Bit error rate:
Packet loss ratio:
Mean measured latency:
Validation should include nominal operation, boundary values, fault injection, power cycling, EMI exposure, timing stress, communication errors, and safe-state verification.