Skip to content

Clocklevel refuses a net at full rate - #7

Merged
mchitre merged 2 commits into
masterfrom
fix/full-rate-level
Sep 22, 2026
Merged

mchitre merged 2 commits into
masterfrom
fix/full-rate-level

Conversation

@mchitre

@mchitre mchitre commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

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, clocklevel on 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 clocklevel got false before 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.

@mchitre mchitre changed the title feat(core): clocklevel refuses a net at full rate Clocklevel refuses a net at full rate Sep 22, 2026
@mchitre mchitre self-assigned this Sep 22, 2026
@mchitre
mchitre requested a lite review from Copilot September 22, 2026 14:09
@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.42%. Comparing base (b2ab77c) to head (a53e42c).
⚠️ Report is 5 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Low severity

Open (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.

Comment thread src/core/blackbox.jl
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.
@mchitre
mchitre force-pushed the fix/full-rate-level branch from 2929cd6 to a53e42c Compare September 22, 2026 14:27
@mchitre
mchitre merged commit 1553ee8 into master Sep 22, 2026
6 checks passed
@mchitre
mchitre deleted the fix/full-rate-level branch September 22, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants