Repository navigation
Clocklevel refuses a net at full rate - #7
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7 +/- ##
=======================================
Coverage 88.41% 88.42%
=======================================
Files 41 41
Lines 6519 6524 +5
=======================================
+ Hits 5764 5769 +5
Misses 755 755 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add forwarded-clock simulation coverage and update remaining contradictory black-box and generated documentation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
This PR rejects ambiguous clocklevel reads on full-rate clocks while preserving internal clock-tree behavior and edge counting.
Changes:
- Adds full-rate detection and refusal logic.
- Preserves internal forwarded-clock and mux level reads.
- Updates tests and documentation.
| File | Summary |
|---|---|
test/runtests.jl |
Updates full-rate clock and mux behavior tests. |
src/core/ports.jl |
Uses internal level reads for forwarded clocks. |
src/core/blackbox.jl |
Implements full-rate detection and errors. |
qdocs/wires.qmd |
Documents the new restriction. |
docs/wires.html |
Updates rendered wires documentation. |
docs/sitemap.xml |
Updates documentation metadata. |
docs/search.json |
Updates searchable documentation content. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A block that samples a clock at that clock's own edge has no settled level in the hardware, and the two models disagreed on one such read: a falling-edge block reading a divide-by-one PLL output saw it high in the Verilog, where the stand-in drops it a step after the pin, and low in Julia. Rather than pick a value for a race, the read is refused, as the manual already said it was only meaningful for a much slower clock. A mux of full-rate sources is refused with them. The package's own reads of a net's level, a part's clock output as a port and a mux's source at a switch, keep treating a full-rate clock as low, as it is at every sample point.
2929cd6 to
a53e42c
Compare

A block that samples a clock at that clock's own edge has no settled level in the hardware, and the two models disagreed on one such read: a falling-edge block reading a divide-by-one PLL output saw it high in the Verilog, where the stand-in drops it a step after the pin, and low in Julia.
Rather than pick a value for a race,
clocklevelon a net at the rate of the design's own clock pins is now an error. The manual already said the read was only meaningful for a much slower clock. A mux of full-rate sources is refused with its sources; its edges are still counted.The package's own reads of a net's level, a part's clock output forwarded as a port and a mux's source at a switch, keep treating a full-rate clock as low, as it is at every sample point.
Not breaking: while a design that read a full-rate net with
clocklevelgotfalsebefore and errors now, the old behavior was not a contract but an accidental behavior. In hardware, such an operation is undefined.Suite green with iverilog. Manual rendered.