Interactive controls require JavaScript. The worked examples and downloads below remain available.
1. Setup improves. Does hold?
Explore a simplified single-clock register path. Skew is capture arrival minus launch arrival.
See the fixed path assumptions
All values are in ns: tCQ max/min 0.6/0.2; data delay max/min 7.5/0.1; setup/hold 0.5/0.15; uncertainty setup/hold 0.3/0.05. No OCV, common-path correction, multicycle behavior or latch borrowing is modeled.
Worked result: period 10 ns and skew +0.2 ns give setup slack +1.3 ns and hold slack −0.1 ns. Changing only the period to 12 ns gives +3.3 ns setup and the same −0.1 ns hold.
Read the timing derivation →2. From oscillator to timer reload
Calculate a 16-bit up-counter preload. The divider is oscillator clocks per timer increment; verify it for your device and mode.
Worked result: at 12 MHz, divide-by-12 and 1 ms, use 1,000 ticks and preload 0xFC18. At 11.0592 MHz the nearest count is 922, preload 0xFC66, giving approximately 1.000434 ms before software overhead.
This ideal tick calculation excludes oscillator tolerance, reload overhead and interrupt latency. Nearest-count rounding is used; it is not a minimum-delay guarantee.
Understand the timer modes →3. Check the whole UART frame
With classic Timer 1 mode 2, divide-by-12 and SMOD=0, 11.0592 MHz with TH1=0xFD gives 9,600 baud. An 8N1 frame takes ten bit times: about 1.041667 ms per byte.
What changes at 12 MHz?
The same reload produces about 10,416.67 baud, +8.5069% relative to 9,600. Reusing the constant does not preserve the baud rate.
Practice with the source
The exercises include a four-bit counter and scan-register simulation, a portable C bit-mask exercise, and numeric checks for the worked examples.
Save these files in one local folder:
- Arithmetic models
- Arithmetic tests
- Portable C exercise and tests
- Counter and scan RTL
- RTL testbench
- Instructions and test scope
Run the checks on your computer
node test_checks.mjs
clang -std=c11 -Wall -Wextra -Werror -O2 -fsanitize=undefined merge_bits.c -o merge_bits
./merge_bits
iverilog -g2012 -s tb -o counter_scan.vvp counter_scan.sv tb_counter_scan.sv
vvp counter_scan.vvpUse a compatible Node.js runtime, C compiler and Icarus Verilog installation. The README explains scope and expected results.
These are educational software and RTL checks. They do not prove physical timing closure, device programming, board behavior or safety certification.